Element.SetParameterByName fails for parameters with unit type Force

Hi All,

I’m having a problem setting the value of a parameter through Element.SetParameterByName, when the parameter is of unit type Force. In this case the node reports a warning that “the unitType is an invalid unit type”.
If I apply the node to set the value of a parameter of another type, e.g. ‘volume’, it works as expected.

What can be the issue? I’m using Revit 2020.0 and Dynamo Revit 2.5.0

An example can be found here: https://sofistik-my.sharepoint.com/:u:/g/personal/andreas_niggl_nbg_sofistik_de/EeEgoQwOzXhGkbyLAHi1nBoBk9ZAFRv_VhftbKirKqx5ng?e=2bUbyn


Hi Mohamed,

Thank you for your immediate answer. I created an instance parameter, and as mentioned set the type of the parameter to “Force”. See in the screenshot below.



Hi Andreas,

I am honestly not sure where the problem is and I cannot open the file since I do not have Revit 2021 on my pc. However, a similar error happened to me once when I used a parameter with a name similar to another parameter that existed before. I know it is not possible to have two project parameters with the same name but it is possible when one is a project and the other is a shared parameter. So maybe your model already has an existing shared parameter with the same name but a different unit type. Just a suggestion!

Good luck!


Use the Element.Parameters node to see if the parameter is available.

Hi thank you, I checked it. It is available. I really don’t understand what is missed. I would regard it now as a bug in Dynamo or caused by some version mismatch…

I need to clarify: the error occurs on Revit 2021 (, but not in Revit 2020.

Hi @andreas.niggl,
the same issue happened to me yesterday with a custom parameter linked to a shared parameter.
SetParameter returned error when I specified the data type to number.
I solved the issue by deleting both the project parameter and the shared parameter and by recreating the shared parameter with data type length and then recreating the project parameter.
Don’t know the cause though.
Ah one last info: I grouped my project parameter in identity data.

My advice is to try to change the data type from force to something else as in my case solved the issue.