Element Set parameter by name failed - Invalid Unit Type? - Bug?

Hi everyone,
I am trying to learn Dynamo to do a parametric pattern.
However, when I type the parameter name and connect to the name box, it says
“Warning: Element.SetParameterByName operation failed.
unitType is an invalid unit type. See UnitUtils.IsValidUnitType() and UnitUtils.GetValidUnitTypes().
Parameter name: unitType”

I was following a tutorial online.
The only difference is the video uses metric, and I’m using Imperial.

Dose anybody know what it is going on?
I would appreciate with your help.

Revit 2021
Dynamo 2.5


Hi @junxian.poon,

I think it’s because you are trying to write values of an “instance” parameter to a list of family “types”.
So try to place a “FamilyInstance.ByFamilyType” node between your “All Elements of Family Type” and “Element.SetParameterByName” nodes.

Hi MJB-online,
Thank you for your reply.
It seems to have some other issues. Would you have any other suggestions?
I would appreciate it! Thank you.

Can you check what kind of input the “opening” parameter needs (number or text/string).

It says string in the dialog box, but it still doesn’t work when I change it to string.
Did I do anything wrong?

Sorry i mean the value

For value, it’s var.

Sorry again for the misunderstanding, this is what i mean.

I apologize for the misunderstanding.
It is number.

I think you can forget my first comment. Other than that, I’m afraid I can’t help you because I don’t quite understand the error on your first picture. Maybe someone else can help. Good luck.

Thanks, I appreciate your effort.

Are you in the project environment or the family environment?

Hi JacobSmall,
I’m in conceptual mass environment. Do you know what I did wrong?
Would you like me to share the project files?

it’s seem a bug, in Revit 2021 API the enumerations DisplayUnitType, UnitSymbolType, and UnitType have been deprecated

Hi, thanks for letting me know. How should I report it?

I can’t reproduce - can you please upload the family and graph as they currently stand?

Hi JacobSmall,
Thank you.
Please follow the link for the family and graph files.