Reputation: 11
I'm trying to build a script that changes the family and the type of an element from a selected element in the model in Revit. I've tried what I've been doing for the rest of the paramaters of the element:
from Autodesk.Revit.DB import Transaction
uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document
transaction = Transaction(doc, "Modify element")
transaction.Start()
gdict = globals()
max_elements = 100
if uidoc:
selection = [doc.GetElement(x) for x in uidoc.Selection.GetElementIds()]
for idx, el in enumerate(selection):
if idx < max_elements:
gdict['e{}'.format(idx+1)] = el
print(el.LookupParameter('Type').AsValueString())
update = el.LookupParameter('Type').SetValueString('ANG')
transaction.Commit()
This way I can access to the type parameter, but it's not changing at all (it's the same for the family parameter, but again, nothing changes after running the code).
I'm assuming this must be because of the relation between Type and Family. Do you have any idea how to change this?
Thank you in advance!
Upvotes: 1
Views: 2595