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?
CALCULATE RAMP SLOPE Let's imagine a ramp where we have a length of 4 meters and the ramp has a height of 1.20 meters. We then have the value of 1.20 multiplied by 100 (which results in 120) and by dividing the result by 4 we get the value of 30.
You can create ramps in a plan view or a 3D view. Create a ramp in a plan or 3D view by sketching the run of the ramp or by sketching boundary lines. While sketching a new ramp, you can specify the railing type to use. After creating a ramp, you can edit its boundaries.
YOu are absolutely right, there is a way to change (flip) the direction of the ramp, but it is very subtle. No double or even single flip arrows at one end or the other to pick, just what might appear as a tiny little arrow at the starting up the ramp end.
No double or even single flip arrows at one end or the other to pick, just what might appear as a tiny little arrow at the starting up the ramp end. It may even appear as a grip dot at the starting end, but its there so place your cursor on the starting end of the ramp, right down the middle and the "Flip Stairs Up Direction" tip should display.
Assuming that your Ramp
is a FamilyInstance
:
var fecRamps = new FilteredElementCollector(doc) .OfClass(typeof(FamilyInstance)) .Where(pElt => { int lCatId = pElt.Category.Id.IntegerValue; return lCatId == (int)BuiltInCategory.OST_Ramps; }) .OfType<FamilyInstance>() .ToList(); List<XYZ> lRampLocs = new List<XYZ>(); foreach (var pFam in fecRamps) { var fLoc = pFam.Location as LocationCurve; var fRampSide1 = new XYZ(fLoc.Curve.GetEndPoint(0); var fRampSide2 = new XYZ(fLoc.Curve.GetEndPoint(1); lRampLocs.Add(fRampSide1); lRampLocs.Add(fRampSide2); }
Every FamilyInstance
has a Location
and you can cast the Location
as a LocationCurve
. From the curve, you can get the end points via the Autodesk.Revit.DB
namespace.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With