Element.GetParameterValueByName fails with Linked Revit element in Revit 2021 but not 2020

I have a graph that worked well in Revit 2020 and I’m trying to bring it into Revit 2021 and it fails at Element.GetParameterValueByName. I’m accessing the levels from a Linked Revit file and while I can see the information in the output of the node and it looks the same as in Dynamo under Revit 2020, it fails in Revit 2021. Clearly something changed between the two but I’m at a loss as to how to solve it. Revit 2021 is running Dynamo 2.6.1.8786 while Revit 2020 is running Dynamo 2.3.0.5885. Any help would be greatly appreciated.

Try LinkElement.GetParameterValueByName from Bimorph Package

I am not sure what has happened. Maybe one of the developers could chime in? Reading this I too am going to need to update my graphs as I am doing the same thing you are. I do know Bimorph’s node will solve the problem but it is a shame when things go backwards.

One easy thing to try: add a code block with “[y]” in it. This will index your level in a list and may solve the problem (this is a long shot though and I am doubtful).

Most likely has to do with the version of Dynamo and the nodes. In 2021 they changed to SpecType.

2 Likes

yep - @ziyun.shang can probably explain better than I can - but the underlying revit API changed - one way to improve it in the future is to not expose revit api types directly to the public signatures in DynamoRevit’s nodes so DynamoRevit can be better isolated from Revit API changes, but that is sometimes not possible.
Update obsolete function for RevitAPI updated by ZiyunShang · Pull Request #2509 · DynamoDS/DynamoRevit (github.com)

I am curious if that node though is a builtin node or from a package?

1 Like

Just verified that LinkElement.GetParameterValueByName fails in the same manner.

Thanks for the suggestion, but it failed as well.

That is the OOTB node but LinkedElement.GetParameterValueByName is also failing. Weird that it works in 2.3 but that it fails in an unusual way in 2.6.

Hi @stephengabriel your first node List.GetItemAtIndex have null output, for a valid output maybe try get parameter value as string or unit nodes from Mepover package or Rhythm package
Cheers

Not quite correct. All are assigned values. Below is the complete graph including the user inputs. I tried upgrading all of the Data-Shapes to the latest versions to no effect. Still generates the errors as shown below.

Hi @stephengabriel , I just take a look and debug on your issue.
This issue is due to the RevitAPI changed, some methods and properties have been removed. You can see the changes we made in this PR - Update obsolete function for RevitAPI updated by ZiyunShang · Pull Request #2509 · DynamoDS/DynamoRevit · GitHub

However, it is possible that in some third-party packages, outdated properties and methods are not upgraded to cause this problem.
In BimorphNodes, it retrieve elements from linked Revit models using the LinkElement class nodes, and overrides the element’s GetParameterValueByName method. you’re using “Element.GetParameterValueByName”, is equivalent to in the use of Bimorphnodes “LinkElement.GetParameterValueByName”.
I think this bimorphNode should use the obsolete property - “Autodesk.Revit.DB.UnitType”, and then you receive this warning.
I think you can ask bimorphNodes owner for help on this.