Help me with Set parameter by name node please ! (python maybe?)

Hi,

I am using the SetParameter.by.name node to set type-parameter values, but notice that it gives an error when the parameter can not be changed, like if there is a formula attached or because of the parameter links .This is understandable.
image

Is there a way to ignore the error and return the file unchanged where the parameter cant be changed ?
If this is possible I can change different families with the same parameterName, eventhough 1 parameter is changeable and the other isnt.
Maybe this can be done in Python by modifying the node or a dynamo work around ?

Please help me Dynamo-community

Main goal:

  • use an excel file to change multiple family-parameters without getting error if the parameters in 1 or the other or not changeable. (red circle is unchangeable)

image

what is the category or categories and what is the parameter name ?

Category = Windows

Parameter name = self named (shared)parameter as you can see in the excel image above.
=> InbouwBreedte
=> InbouwHoogte

The issue is within Revit.
Look up the parameter in Revit, modify it, and uncheck “read only”.

Thats just it,

If i have to modify the family i will have to modify 60+ families. So my question is, can the node ignore errors and output the file unchanged instead of no file ?

I think that might be going against the “nature” of Revit. For a lot of read only parameters it’s often not even possible to change it even if isn’t a read-only parameter by the simply nature of how that parameter is put into the file.

Depending on your graph, this can be achieved by:

  1. Just Dynamo, by selecting the parameters using Parameter.ByName node, and filtering out both the parameters and values from the excel using the node Parameter.IsReadOnly.

  2. Using python would be much compact and straight forward, I would do something like (pseudo-code):


...

parametersToChange = [] # these comming from the excel

for fam in families:
    parameters = fam.GetOrderedParameters();
    for param in parameters:
        #if parameter is not ReadOnly and it is on the excel spreadsheet, change the value
        if not param.IsReadOnly and param.Definition.Name in parametersToChange:
            param.Set( value ) #value associated with that parameter and family from excel.

...
2 Likes

Thank you! This is exactly what I was looking for!

I will try the first option. I do not have experience with python and can not open the SetParameter node as a code.

Thanx again @alvpickmans

@alvpickmans
Ive tried the isreadonly node and now have another “problem”.

I have 4 different types that i use as input in the ParameterByName node.
image

and 1 Parameter name that is in all 4 types.
image

The outcome is 1 answer and not 4 answers. This is weird to me because the Parameter differs between readonly and not"readonly" in the 4 types.

Try to flatten the output of Family.Types and play with the list levels or lacing on the Parameter.ParameterByName node.

1 Like

You, sir, are a genius !

Thank you for the help! The dynamo script is not finished yet but i think I can get a long way with your help.

:+1::+1:

Glad it helped! If you can it would be good to share the final outcome for reference :slight_smile:

@alvpickmans

Finally finished and your advice worked perfectly. This is what the final part of the script looks like. I flattened one of the list so i didnt have to use the levels. Dont know why but i never seem to find the right level.

Thnx