pythonironpythonrevit-apirevitpythonshellpyrevit

Getting name of element type doesn't work in Iron python for Revit


I am working in Iron python in pyRevit environment and my code is as follows:

element_types = \
        DB.FilteredElementCollector(doc)\
          .OfCategory(DB.BuiltInCategory.OST_Walls)\
          .WhereElementIsElementType()\ # getting family types not elements
          .ToElements()

for ele in element_types:
    print(ele.Name)

As per Revit API documentation this should work and probably works in C#. There ele.Name works both as setter and getter. But in Ironpython above code fails, returning an AttributeError: Name. But when i try ele.Name = "new_family_type_name" it works fine.

So my question is how to make ele.Name work to get the family type name.


Solution

  • This is normally one of the earliest quirks that you come across with RPS - but not to worry, its an easy fix. Try:

    for ele in element_Types:
         print Element.Name.__get__(ele)