get human readable name of railing type

get human readable name of railing type

wouter.hilhorst
Explorer Explorer
527 Views
2 Replies
Message 1 of 3

get human readable name of railing type

wouter.hilhorst
Explorer
Explorer

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

0 Likes
Accepted solutions (1)
528 Views
2 Replies
Replies (2)
Message 2 of 3

naveen.kumar.t
Autodesk Support
Autodesk Support
Accepted solution

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

0 Likes
Message 3 of 3

wouter.hilhorst
Explorer
Explorer

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!

0 Likes