Family Symbol Name Error

Hi - I am trying to extract all the family names from the project, but I keep getting the AttributeError: Name.
Here’s the code:

from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *
from Autodesk.Revit.DB import BuiltInParameter

doc = __revit__.ActiveUIDocument.Document
family_symbols = FilteredElementCollector(doc).OfClass(FamilySymbol).OfCategory(BuiltInCategory.OST_StructuralFraming).ToElements()

for family_symbol in family_symbols:
    print( family_symbol.Name)

This give me the AttributeError: Name. However, when I run the dir(family_symbol), name property shows up in the list.
At the same time, running this exact code inside RPS works and gives the correct result.
Thank you in advace!

Probably the infamous IronPython name error where some elements cannot provide the Name property. Try this workaround.

from pyrevit import DB

Thank you! I did see that thread but didn’t understand it at first, but now it makes sense (kinda) :smiley:

1 Like