c# - How to find start/end of ramp in revit, perhaps with sketches? -
i have bunch of ramps know begin , end points of (and in case of multiple begin/end points know how connect). these
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 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 stairs use icollection stairs = collector.ofcategory(builtincategory.ost_stairs).ofclass(typeof(stairs)).toelements();
, can cast objects stairs there not appear class simmulair stairs allow me adres stairs.getstairsruns().
anybody know how either ramprun or otherwise find start , end of ramp?
i have tried following sollution 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 never activated } } } }
this finds plenty of objects none ramp host.
here example of ramp , location i'm trying find marked 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 can use locationcurve, way that?
edit: there appear sketches based on might able find ramps, question if have sketch
var rampcategoryfilter = new elementcategoryfilter(builtincategory.ost_stairssketchrunlines); var rampsruns = new filteredelementcollector(doc).wherepasses(rampcategoryfilter);
then can indeed locations not have ramp belongs too, idea how find that?
assuming ramp
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 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 location
, can cast location
locationcurve
. curve, can end points via autodesk.revit.db
namespace.
Comments
Post a Comment