Get Parameter from Element issue

Hello Forum,

I am having issues when I try to GetParameterByName for some elements modeled. As you can see in the following screenshot, in the “Watch” node I have the element instances and I have tried three different ways of getting the parameters (Parameter.Value, Element.GetParameterValueByName and Python). You can notice that in the Element.Parameters node I got the value for Key_ID parameter (G-2-5) but for Parameter.Value I get empty. Same for the rest of the approaches.

Some of the inputs are structural framing category and some of them are generic model (adaptive) category. The parameter that I am trying to retrieve is a Family parameter (shared parameter loaded within the family).

image

The weird business here is that if I try to get the parameter with a new and empty script, I am getting the outcome that I expect:

Thoughts?

Thank- you in advance,

Are you writing that value in the same script? If you try to write then read the same data it may be out of sync. You would have to add a wait or transaction node to force the timing to be correct.

I am writing those parameters within the same script, yes, but all those wires come out from the Element.SetParameterValueByName so I assume those steps are carried out after the parameter assignment, right?

That’s a logical conclusion, and true for data within the Dynamo environment, but not for how Dynamo interacts with Revit.

Dynamo defaults to a singular transaction in Revit. It executes the entire graph before doing anything with the model. You can use a Transaction node to force your graph to commit multiple transactions which will allow you to ensure that you’re committing a change to the model before trying to read those values back.

1 Like

That was the issue @Nick_Boyts . I only had to insert a Transaction.End after the SetParameter node and after that, add a Transaction.Start so now I can get the parameters from the elements.

Thanks.