Get Parameter Value by Id - 2022 edition

Greetings all - I have an issue where I can’t use Element.GetParameterValueByName because there are 2 parameters with the same name AND Revit likes to switch the order depending on the element. I have seen this for several built in elements. Does anyone have a method to Get Parameter Value By Id??

1 Like

@AdamHamilton ,

there is a node called ParameterId

yes as you can see i used it at the end of my script. It gives me the Id but there isnt a node to ‘Get by id’ You can only get values by name…but there are parameters with the same Built-In name.

1 Like

@AdamHamilton ,

hmmm, you want to get elements by there parameter(id) containt ?

correct but cant use that filter method because there is too much content to get the parameter values of all parameters just to filter. Thats how i have gotten this far but i have 25000 elements i need to filter through

Honestly, your best option is to rename the custom parameter. Best practice is to not have duplicate names for exactly this reason.

If you have to work around that, then I’d recommend using Python so you can get both parameters and check to see which one is a built in parameter and which isn’t.

EDIT: What kind of elements are these? Both parameters have a negative Id, which typically denotes a BuiltIn parameter.

2 Likes

they aren’t custom. these are OOB. Trying to use the Design Option parameters. not sure why revit was built this way.

I have never noticed that Design Option splits into two parameters when assigned. That’s very interesting. I think you need to use Python in this case. Or just get both parameters and check for the one you want, whether string name or element Id.

Thanks all - Nick you gave me a nugget that i took in a new direction. I pulled the BIP names and got the specific BIP name to pull the value from.

1 Like

If you get stuck again I believe that Element.Parameters will return the parameter elements. This list of parameter elements can then be filtered by the ID in question.

the issue with that workflow is the parameters pulls up i believe 26 items per element. I had a couple thousand elements and it became too much data. also the issue above is there are parameters with the same name and you can’t say ‘the second one’