I have a bunch of ramps that I would like to know the begin and end points of (and in case of multiple begin/end points I would like to know how they connect). I currently get these as
List<TransitionPoint> ret = new List<TransitionPoint>();
FilteredElementCollector collector = new FilteredElementCollector(doc);
ICollection<Element> ramps = collector.OfCategory(BuiltInCategory.OST_Ramps).ToElements();
foreach (var ramp in ramps)
{
//what goes here?
}
These ramps contain the following properties:
Type Comments
Ramp Max Slope (1/x)
Category
URL
Design Option
Type Name
Ramp Material
Function
Manufacturer
Family Name
Model
Keynote
Type Image
Text Size
Shape
Text Font
Maximum Incline Length
Assembly Description
Assembly Code
Type Mark
Category
Thickness
Cost
Description
Now if these where stairs I would use ICollection stairs = collector.OfCategory(BuiltInCategory.OST_Stairs).OfClass(typeof(Stairs)).ToElements();
and then I can cast the objects into Stairs however there does not appear to be a class simmulair to Stairs which would allow me to adres Stairs.GetStairsRuns().
Anybody know how to either get something like a RampRun or otherwise find the start and end of a ramp?
I have also tried the following sollution but that didn't work either
public static void MapRunsToRamps(Document doc)
{
var rule = ParameterFilterRuleFactory.CreateNotEqualsRule(new ElementId(BuiltInParameter.HOST_ID_PARAM), "null", true);
ElementParameterFilter filter = new ElementParameterFilter(rule);
FilteredElementCollector collector = new FilteredElementCollector(doc);
List<Element> rampsRuns = collector.WherePasses(filter).ToElements().ToList<Element>();
foreach (Element e in rampsRuns)
{
var hostpara = e.get_Parameter(BuiltInParameter.HOST_ID_PARAM);
if (hostpara != null)
{
var host = doc.GetElement(new ElementId(hostpara.AsInteger()));
if (host.Category.Equals(BuiltInCategory.OST_Ramps))
{
//breakpoint that is never activated
}
}
}
}
This finds plenty of objects just none with a ramp as a host.
Here is an example of a ramp and the location I'm trying to find marked with red arrows.
this https://forums.autodesk.com/t5/revit-api/how-do-we-get-the-x-y-z-cordinates-for-stairs-ramps/td-p/2575349 suggests that we can use a locationcurve, any way to do that?
edit: There do appear to be sketches based on which we might be able to find the ramps, question is if I have a sketch say with
var rampCategoryfilter = new ElementCategoryFilter(BuiltInCategory.OST_StairsSketchRunLines);
var rampsRuns = new FilteredElementCollector(doc).WherePasses(rampCategoryfilter);
then I can indeed get the locations but what I do not have is the ramp that this belongs too, any idea how to find that?