2016-02-29 4 views
34

Ho un sacco di rampe che mi piacerebbe conoscere i punti di inizio e fine (e in caso di più punti inizio/fine vorrei sapere come si collegano). Attualmente ottenere questi comeCome trovare inizio/fine della rampa in revisione, magari con gli schizzi?

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? 
} 

Queste rampe contengono le seguenti proprietà:

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 

Ora, se questi in cui le scale userei ICollection stairs = collector.OfCategory(BuiltInCategory.OST_Stairs).OfClass(typeof(Stairs)).ToElements(); e poi posso lanciare gli oggetti in Scale tuttavia ci fa non sembra essere una classe simmulair alle scale che mi permetterebbe di scrivere Stairs.GetStairsRuns().

Qualcuno sa come ottenere qualcosa come un RampRun o altrimenti trovi l'inizio e la fine di una rampa?

Ho anche provato il seguente sollution, ma che non ha funzionato neanche

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 
     } 
     } 
    } 
} 

Questo trova un sacco di oggetti solo nessuno con una rampa come host.

Ecco un esempio di una rampa e la posizione che sto cercando di trovare contrassegnata con frecce rosse. ramps marked with red arrows

questo https://forums.autodesk.com/t5/revit-api/how-do-we-get-the-x-y-z-cordinates-for-stairs-ramps/td-p/2575349 suggerisce che possiamo usare una localcurve, un modo per farlo?

edit: Ci sembrano essere schizzi in base alle quali potremmo essere in grado di trovare le rampe, la domanda è se ho uno schizzo dire con

var rampCategoryfilter = new ElementCategoryFilter(BuiltInCategory.OST_StairsSketchRunLines); 
    var rampsRuns = new FilteredElementCollector(doc).WherePasses(rampCategoryfilter); 

poi mi può infatti ottenere le posizioni, ma ciò Non ce l'ho è la rampa a cui appartiene anche questa, qualche idea su come trovarla?

+0

E quale versione di Revit stai usando? –

+0

Sto sviluppando per 2015-2016 e 2017 – Thijser

+0

Dai uno sguardo a questo: https://knowledge.autodesk.com/de/support/revit-products/learn-explore/caas/CloudHelp/cloudhelp/2014/DEU/ Revit/files/GUID-D5F9820D-B548-4600-8739-8029AD3B3B8B-htm.html (controllare il metodo GetStairLandings) –

risposta

1

Supponendo che il vostro è un RampFamilyInstance:

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); 
} 

Ogni FamilyInstance ha un Location e si può lanciare la Location come LocationCurve. Dalla curva, è possibile ottenere i punti finali tramite lo spazio dei nomi Autodesk.Revit.DB.

Problemi correlati