Oops... I just realized that my variable
pars was not defined in the example above. Here is the corrected version:
doc = __revit__.ActiveUIDocument.Document
fm = uidoc.Document.FamilyManager
pars = fm.GetParameters()
wid = pars[2]
def ChangeParameter(p,w):
with Transaction(doc) as t:
t.Start("Change Parameter")
fm.Set(p, w)
t.Commit()
with Transaction(doc) as t:
t.Start("Refresh View")
doc.Regenerate() # doesn't actually do anything -- I was hoping this would refresh the view
t.Commit()
for i in range(4,10):
ChangeParameter(wid, i)
Unfortunately, putting doc.Regenerate() anywhere doesn't change the result. It has to be wrapped in a Transaction, but not even that fixes it. The interface freezes until then end of the whole script, then updates to show the final result. I want it to step through each change. This would make it so I can be sure my constraints do not break for different parameter values when building a family.