Cannot set a "Number" data type to a family parameter value in dynamo - Element.SetParameterByName

I am trying to set a “Number” (i.e. a double or integer) data type to a family parameter value in dynamo, but I keep getting an error message. The parameter in the family is a number not text.
Any ideas? please see the attached image:

It seems thagt parameter is expecting a string (“1x3”) and not a number (52.2).
“52.2” should work so you need to convert the data type (String from object for example)

Thank you, the parameter in the family is a number not text so it is not a string. Although I did try your suggestion, it still didn?t work :frowning:

I believe the graph was made with an older version of Dynamo and by the looks of it I assume your in Revit 2022? The Unit engine in Revit changed so older nodes aren’t going to work right.

The top node is using a string and not returning an error so the data type is string… unless i’m missing something.
@SeanP there’s no unit to deal with if it’s a string no?

Yes, the top node is working, the bottom isn’t and they clearly stated they are trying to set a Number value. Based on that, and what the error message is saying, it most likely the UnitType issue inside of Revit.

Some additional information on it.

My bad, i thought both nodes we’re using the same parameters ahahahah
Must be time to stop and have a drink :wink:

Thank you, I am using Revit 2021, the parameter in revit is a simple number, a double, it has no unit of measurement designated. The Dynamo functions I used just refuse to set double data types (a number) into a parameter in revit. I have no idea what the error is saying it doesn’t make any sense to me.

Could it be that this parameter is an integer? What if you try 52?

Any chance you could share a small simple model with that family in it?

@ziyun.shang do you think this is a Revit API issue with the Unit changes? Or something else?

Looks like there are others out there with similar issues. Are you in the project environment or conceptual mass?

Element Set parameter by name failed - Invalid Unit Type? - Bug? - Revit - Dynamo (dynamobim.com)

Sorry didn’t have a chance to send you the files yet, I am in a project. It is an issue I am having in general. I made a simple generic family to test it. It has a number parameter and a text parameter. I load the family into a project and run a Dynamo script to set these to parameter values. The ‘Number’ parameter is not allowing Dynamo to set a value there, any kind of value, not a double or integer, I even tried a string just for the experiment, nothing works.

Uri Natanel

Can you tell me what version of Dynamo your using?

Are you using Revit 2021 with Dynamo 2.6.1?
Unit Changes should start with Revit 2022.
The warning seems from RevitAPI. May be your input is invalid.
Could you share a working environment (Revit files and Dynamo files) that can reproduce this problem?

Revit 2021 Dynamo 2.5.07460
Thank you for all the replies I appreciate it. I won’t be on Revit for the next couple of days, I’ll get back and send the sample files.
Thanks again

Uri Natanel

I have tested this in Revit 2021 and with Dynamo 2.6.1.8 and I am unable to recreate it with a generic model.

Have you found a solution? I had the same problem (I think it’s a bug in the function) and wrote myself a Python script that I could provide you.

This is a Family type parameter, try using family instance parameter.

Could you please, share with us.