Monday, March 14, 2016

How to get the begin and end point of a ramp

Leave a Comment

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. ramps 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?

sorry this is false edit it turns out that adding a ramp also adds in an object of the type strairun gotten by var rampCategoryfilter = new ElementCategoryFilter(BuiltInCategory.OST_StairsRuns); var rampsRuns = new FilteredElementCollector(doc).WherePasses(rampCategoryfilter);
however if we add in the line var rampsRuns = new FilteredElementCollector(doc).WherePasses(rampCategoryfilter).OfCategory(StairsRun);
Without this line var run = rampsRuns[0] as StairsRun will return null. then this returns null instead. Anybody know how to cast this into a StairsRun object so that I may access the data contained within (by asking for the Curve object it contains)? var Path = run.GetStairsPath(); edit: many it turns out that the type of rampsruns in this case is StairsRunType rather then StairsRun and that this does not contain an get curve method, any idea how to ask for that?

it turns out that there just so happend to be a matching number of actual ramps and stair families in my test objects.

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment