Create parameter value of storagetype ElementID

I’m trying to modify an element parameter of Storagetype ‘ElementID’. In Revit, the value of this parameter is set using a drop-down with the options ‘Circular’, ‘Rectangular’ or ‘Square’.

If I try to assign a value to this parameter in Dynamo using the ‘Parameter.SetValue’ node using a string (e.g. “Circular”) for the value I get the error “The parameter’s storage type is not a string”. However, I don’t know how to create a value of type ‘ElementID’ - can someone point me in the right direction please?

Thanks
Alex

Use GetParameterValueByName to see what format comes out, then use the same format to put values in.

1 Like

How to apply an elementID format to a string value?

Hello,
Was there any progress on that? I encountered the issue now while trying to change value of a parameter which its storage type is “ElementId”. I have filtered out pipes that I would like to change their “System Type” parameter value from “Other” to some other item on the suggested drop-down list. I didn’t manage to get all those drop-down list elements.

issue was resolved in this post:

For anyone comming acros this thread with this issue:

The storage type ElementId is a storagetype that can be constructed via the Revit API.
id = ElementId(<int>)

It requires a integer value to cast into the ElementId Storagetype (it can be obtained by using the .Id property on any element.

If you get this storage type in your Dynamo script, it means that you are at that point handeling the ElementID of the element you got the parameter from. This is the same ID as is shown in green behind the elementname in the dropdown menus. you can also use this ID to find the element in your Revit project.
An important thing to realize is that Revit handles almost everything as an element. Both the instances you place, as the familyTypes and the family to which the types belong (found as a familySymbole) are considered elements.

In this particular case the ElementID refers to a familyType. This ElementID can be set to the corresponding familyType ID of a different type of the same family. This way it should change the familyType of the family you’re handling.

1 Like