How do I get ViewFamilyType Name?

(First time poster)

I’m very new to the Revit API so this could have a very simple answer, but how do I get the name of a ViewFamilyType?

If I create a collector to get all ViewFamilyTypes:

# Collecting all view family types from the model
view_collector = DB.FilteredElementCollector(doc)\
                   .OfClass(DB.ViewFamilyType)\
                   .ToElement()

I cannot access the Name parameter:

for view_family_type in view_collector:
  name = view_family_type.Name
  print(name)

I get:

**Script Executor Traceback:**
System.MissingMemberException: Name

But I can access the FamilyName parameter:

for view_family_type in view_collector:
  name = view_family_type.FamilyName
  print(name)

Returns “Floor Plan”, etc. as expected.

You cannot get the Name member of any subclasses of ElementType in IronPython this way unfortunately. Try this:
name = DB.Element.Name.__get__(view_family_type)

4 Likes

Thanks. That did the trick.

It seems awkward to iterate over an array just to query for the name attribute, but good enough for now

1 Like