family.Document.SetParameterValueByName

Hello everyone,
I am working on Revit 2024 with Dynamo. In the family editor, I want to assign values to various parameters of a family. To do this, I use the node family.Document.SetParameterValueByName. This node works perfectly for length, angle, text, and number parameters… but it doesn’t work at all for Yes/No parameters or integer parameters. In both cases, it says, “The input value for this parameter must be of type Integer”, even when I set an Integer slider as the value.

I cannot find any way to assign a value to these parameters (the goal is to be able to assign different values per type within the family).
Everything else in my script works without any issues.

Thank you in advance for your responses.

@t.birge Try using 0 to represent falsy value (NO/unticked) and 1 to represent truthy value(YES/ticked). Though I don’t see any errors on parameters of integer type, at least in Revit 2025.

1 Like

This is exactly what I tried, and it returns this error : see image. (I’m French, so my script in Dynamo is in French).

@t.birge hm… I wish this works:

doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)

for param_n_val in IN[0]:
    param = doc.FamilyManager.get_Parameter(param_n_val[0])
    doc.FamilyManager.Set(param, param_n_val[1])
    
TransactionManager.Instance.TransactionTaskDone()

Thank you very much! With your help, a bit of ChatGPT, and some testing, I managed to create a Python script that replaces FamilyDocument.SetParameterValueByName and works for Revit 2024 with Yes/No parameters and integer parameters.

1 Like