Set Parameter Name

Hi all,
I am hoping someone can help me with this. I was playing around with a Pattern Based Curtain Panel which i wanted to be able to open and close using a parameter. I all works well updating manually. I thought I would try using Dynamo to see what we could do with it.
The family has a parameter in called NCP which is linked to normalized curve parameter values, which drives the geometry, creating and open and closed appearance.
I first tried to randomize the amount of opening values which threw the error, so I tried making them all open the same value using a number slider, but I still get the same error.
Because I am using normalized curve parameters, the value ranges from 0.1 to 1.0 which the slider controls. The NCP parameter in the family is a number parameter, but for some reason the Element.SetParammeterByName keeps giving this error:
*Warning: Element.SetParameterByName operation failed. *
unitType is an invalid unit type. See UnitUtils.IsValidUnitType() and UnitUtils.GetValidUnitTypes().
Parameter name: unitType

Not sure why the unit type would be invalid, its a number trying to be pushed into a number category parameter.
Any help would be appreciated.

1 Like

There is one thing missing in your analysis. Check your assumption that the Curve parameter is indeed a number.

Select the same elements and read the NPC parameter and Object.type the answer. Now you have the confirmation that you are feeding the right data type.

That can inform your next step, either your input type is wrong or the parameter itself needs to be adressed in a different way.

Can you provide a Revit project with two instances the family in question?

HI Jacob,
Please see attached files. Thanks for your help.
Im curious to see what the issue is here.

Triangle Panel.rfa (396 KB)
Panel Wall.rfa (796 KB)
Panel Open & Close.dyn (13.2 KB)

Hi Bjorn,
Yep, pretty sure it is a number parameter.

Just wondering if the problem’s been solved. I’ve encountered the same situation when input a number which is a normalized curve parameter into String Box. I tried to play with other parameters with a unit, like thickness or length, they both worked. Somehow a number makes an invalid unit type. Anyone help? Thanks!

I am having the same issue with a graph that has worked fine in the past. I’m trying to write coordinate values to a parameter set to “Number”.


2022-01-19_11-57-32

You better create the string parameters and fill with string…

Convert number to string before filling the data

The original problem wasn’t addressed but their cause was they were in the project trying to set values to a nested component, which isn’t possible for conceptual masses with nested components. I went and viewed their model and all, only to realise it’s more than a year old haha…

Like before it’s hard to say why without a script and excerpt of the model.

@_Vijay I’m not sure changing the storage type of a parameter to text is usually a suitable solution, it would remove such aspects as the ability to represent in tags with a fixed decimal place, and process that data elsewhere as a number.

As of last night, it is now working for me. I can’t explain why. I removed the project parameters I was trying to write to and added them (the same ones) back in and it started working.