In my script, I get an Id of a BuiltInParameter (e.g. ‘-1002300’ )
How can I get the BuiltInParameter from this Id?
doc.GetElement() returns none.
What is the correct way to do this?
I’m writing in Python btw
In my script, I get an Id of a BuiltInParameter (e.g. ‘-1002300’ )
How can I get the BuiltInParameter from this Id?
doc.GetElement() returns none.
What is the correct way to do this?
I’m writing in Python btw
Try passing it into an ElementId first:
Ok tried this , a bit with help of chatGPT
walls = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsNotElementType().ToElements()
wall = walls[0]
param = wall.get_Parameter(BuiltInParameter.WALL_BASE_CONSTRAINT)
print("\n parameterId {}".format(param))
param_id = param.Id
print(param_id)
# Get the parameter from its ID
param_from_id = None
for p in wall.Parameters:
if p.Id == param_id:
param_from_id = p
break
if param_from_id:
print("\n parameter {}".format(param_from_id.Definition.Name))
else:
print("\n Parameter not found")
I asked someone personally, this ended up doing the trick:
from System import Enum
param = Enum.ToObject(BuiltInParameter, param_id.Value)
Where param_id is the id of the BuiltInParameter.
Maybe there are easier solutions, but this was the first to work for me