Modifying the formula (text) of a parameter (type) in families

Hello,
I would like to modify the value of a parameter in the formula box for several families in a Revit project.
Each family has a different value (loaded from Excel).
I’m using Python code found on the forum, but it seems it doesn’t consider a list as the input for the new parameter value.

It modifies the value, but always uses the first value in the list.

The result is:

found,
CVC BOU S Type 1_1 WALL Rect Plenum,
CVC BOU S Type 2_1 CEILING Rect Plenum

reload,
Family: CVC BOU S Type 1_1 WALL Rect Plenum,

Family: CVC BOU S Type 2_1 CEILING Rect Plenum

failed

locked

canAssign,
Object Type,
Object Type

cannotAssign

validFormula

notValidFormula

Thank you for your help.
Google Translate

Hello,
I would like to modify the value of a parameter in the formula box for several families in a Revit project.
Each family has a different value (loaded from Excel).
I’m using Python code found on the forum, but it seems it doesn’t consider a list as the input for the new parameter value.

It modifies the value, but always uses the first value in the list.

The result is:

found,
CVC BOU S Type 1_1 WALL Rect Plenum,
CVC BOU S Type 2_1 CEILING Rect Plenum

reload,
Family: CVC BOU S Type 1_1 WALL Rect Plenum,

Family: CVC BOU S Type 2_1 CEILING Rect Plenum

failed

locked

canAssign,
Object Type,
Object Type

cannotAssign

validFormula

notValidFormula

Thank you for your help.
Google Translate

Modifier parametre v2.dyn (83.2 KB)

image

What is your intended use for this? Can you describe what it is that you want to do?
To me it looks like you are trying to change the type of a family, or perhaps the type of a nested family (like a door handle family in a door family)

Hello,
In a project, I have a family set with a parameter (of type) that I would like to modify.

The parameter value needs to be changed in the Formula field.

The value given to the parameter varies depending on the family name.
That’s why I’m using Excel.

In the script shown, the part before the Python code is there to test only two values.

The Python script works, but it only modifies the parameter with the first element of the list (New type).

The FamilyManager class can only change the current type, so if you want to change the formula in a different type you need to set FamilyManager.CurrentType and then update the FamilyParameter

Thank you for your reply.

I modified the Python code, and it’s OK.

Modifier parametre Famille.dyn (108.4 KB)