I am trying to create a list of all type parameters using ironpython hosted by pyrevit. I tried following code
from pyrevit import revit, DB
doc =__revit__.ActiveUIDocument.Document
curview = doc.ActiveView
target_category = DB.BuiltInCategory.OST_StructuralColumns
elements = DB.FilteredElementCollector(doc, curview.Id)\
.OfCategory(target_category)\
.WhereElementIsNotElementType()\
.ToElements()
for ele in elements:
parameters = [i.Definition.Name for i in ele.Parameters]
orderedParas = [i.Definition.Name for i in ele.GetOrderedParameters()]
print(sorted(parameters))
print(sorted(orderedParas))
Both ele.Parameters
and ele.GetOrderedParameters()
could only produce instance parameters.
I have read that instance parameters are type parameters for elements. So i tried to catch family types and applied same code as above.
families = DB.FilteredElementCollector(revit.doc)\
.OfClass(DB.FamilyInstance)
for family in families:
x = family.GetOrderedParameters()
if family.Name == "C2 300x600":
for i in x:
print(i.Definition.Name)
Unfortunately above code also could produce only instance parametets
Any help in solving this is deeply appreciated
After some more searching i stumbled upon this post How to access all the family types through revit API? which thankfully had keys to my question
from pyrevit import revit, DB
doc =__revit__.ActiveUIDocument.Document
target_category = DB.BuiltInCategory.OST_StructuralColumns
elements = DB.FilteredElementCollector(doc)\
.OfCategory(target_category)\
.WhereElementIsElementType()\
.ToElements()
for ele in elements:
for i in ele.GetOrderedParameters():
print(i.Definition.Name)
It appears i had to use .WhereElementIsElementType()
instead of .WhereElementIsNotElementType()
to tap into type properties of Revit family