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: 

get human readable name of railing type

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
wouter.hilhorst
456 Views, 2 Replies

get human readable name of railing type

Hi,

I`m trying to get the names of all railings used in a revit model but the filter keeps giving me nonetypes. Can anyone see what I`m doning wrong?

I`m using the following code:

railing_symb_list = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_StairsRailing).WhereElementIsElementType().ToElements()

railingtypes=[]    
for railing in railing_symb_list:
    T=doc.GetElement(railing.GetTypeId())
    railingtypes.append([T,T.Name])

 

Wouter Hilhorst

2 REPLIES 2
Message 2 of 3

Hi @wouter.hilhorst ,

I think there is no need to use the GetTypeId().

try using the below code

FilteredElementCollector railingTypes = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_StairsRailing).WhereElementIsElementType();
            foreach(Element railingType in railingTypes)
            {
               string s =railingType.Name;
            }

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 3

The sollution was indeed to leave auto the elementId. Also I needed to call WhereElementIsNotELementType() instead of WhereElementIsELementType() .

Which gives me the type that I needed. 

I`m not sure I completely understand the logic behind this but it works...

thanks for your help!

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

Post to forums  

Autodesk Design & Make Report