Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Categories that can create legend components

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
jjesusdelpino
1433 Views, 7 Replies

Categories that can create legend components

Hi there forum. Is there a way to know if a legend component can be created from a determined category? E.G. I can create legend components from cable trays, but I cant do that with railings. I havent seen any specific rule o parameter that specifies this property. Any ideas? Thanks

7 REPLIES 7
Message 2 of 8

You might have better luck discussing this in the general architectural forum, not the API one.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 8
RPTHOMAS108
in reply to: jjesusdelpino

I've found no obvious solution to this via the API i.e. a Boolean property on the category class. I believe also that Legend views don't have a specific class. So there is no static methods available on such for checking category suitability of placed elements that way either.

 

You'll find sketch based system families (floors/Railings/Stairs...) are not applicable since Legend views don't have a sketch plane. If you think about it apart from annotation objects Legend views contain types not instances (since you usually drag the types onto the Legend from the project browser). However there is also no property for this indicated on ElementType class.

 

Message 4 of 8
jjesusdelpino
in reply to: RPTHOMAS108

Thanks to both for your anwsers, as @RPTHOMAS108 , I also havent found any solution for this through API so I have ended up checking and making the list manually. I put it here in case someone looking for the same thing comes.

 

FamilyInstances = [“OST_DuctAccessory”, “OST_PipeAccessory”, “OST_PlumbingFixtures”, “OST_StructuralFraming”, “OST_StructuralFoundation”, “OST_ElectricalEquipment”, “OST_SpecialityEquipment”, “OST_MechanicalEquipment”, “OST_LightingFixtures”, “OST_Furniture”, “OST_Casework”, “OST_Columns”, “OST_StructuralColumns”, ”OST_Doors”, ”OST_Sprinklers”, “OST_DuctTerminal”, “OST_DuctFitting”, “OST_PipeFitting”, “OST_Planting”, “OST_Windows”];

 

SystemFamilies = [“OST_CableTray”, ”OST_RoofSoffit”, “OST_Ceilings”, “OST_DuctCurves”, “OST_Roofs”, “OST_Walls”, “OST_StackedWalls”, ”OST_CurtainWallPanels”, “OST_Floors”, ”OST_PipeCurves”, ”OST_FlexPipeCurves”,” OST_Conduit”];

 

Regards.

Message 5 of 8

Thank you very much, both of you, for solving and sharing this result.

 

I cleaned it up by converting the strings to built-in categories and sorting them alphabetically:

 

 

    BuiltInCategory [] _bics_for_FamilyInstance = new BuiltInCategory[]
    {
      BuiltInCategory.OST_Casework,
      BuiltInCategory.OST_Columns,
      BuiltInCategory.OST_Doors,
      BuiltInCategory.OST_DuctAccessory,
      BuiltInCategory.OST_DuctFitting,
      BuiltInCategory.OST_DuctTerminal,
      BuiltInCategory.OST_ElectricalEquipment,
      BuiltInCategory.OST_Furniture,
      BuiltInCategory.OST_LightingFixtures,
      BuiltInCategory.OST_MechanicalEquipment,
      BuiltInCategory.OST_PipeAccessory,
      BuiltInCategory.OST_PipeFitting,
      BuiltInCategory.OST_Planting,
      BuiltInCategory.OST_PlumbingFixtures,
      BuiltInCategory.OST_SpecialityEquipment,
      BuiltInCategory.OST_Sprinklers,
      BuiltInCategory.OST_StructuralColumns,
      BuiltInCategory.OST_StructuralFoundation,
      BuiltInCategory.OST_StructuralFraming,
      BuiltInCategory.OST_Windows };

    BuiltInCategory[] _bics_for_SystemFamily = new BuiltInCategory[]
    {
      BuiltInCategory.OST_CableTray,
      BuiltInCategory.OST_Ceilings,
      BuiltInCategory.OST_Conduit,
      BuiltInCategory.OST_CurtainWallPanels,
      BuiltInCategory.OST_DuctCurves,
      BuiltInCategory.OST_FlexPipeCurves,
      BuiltInCategory.OST_Floors,
      BuiltInCategory.OST_PipeCurves,
      BuiltInCategory.OST_RoofSoffit,
      BuiltInCategory.OST_Roofs,
      BuiltInCategory.OST_StackedWalls,
      BuiltInCategory.OST_Walls };

 

 

Sorry for being so ****. 🙂

 

Wow, a perfectly normal Freudian psychological expression has been automatically censored and replaced by asterisks:

 

https://en.wikipedia.org/wiki/Anal_retentiveness

 

Surprise, surprise. What a world we live in...

 

The two lists above now reside in The Building Coder samples for posterity:

 

https://github.com/jeremytammik/the_building_coder_samples

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 6 of 8

Message 7 of 8

In the end I have had to use that list with BuildingCategories in my code so your **** retentivenes has already been proven necesary haha.

 

Regards.

Message 8 of 8

Glad to hear it was useful for you!

 

I am in discussion with friends on the topic of perfection versus the Pareto 80-20 principle:

 

https://en.wikipedia.org/wiki/Pareto_principle

 

I try to favour both.

 

I see this as an  effective demonstration that both can be achieved simultaneously.

 

In simple cases only, of course.

 

Luckily, all programming issues are simple, always.

 

Unless someone seriously messed them up.

 

Unfortunately, the most common case...

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community