ElementTransformUtils.CopyElements issue revit 2025

i have graph that uses the rhythm copy elements from view to view node it has an exception error that crashes r2025

i pulled this node out to the main graph and found the error with this python node. unfortunately, i don’t have the python know how to determine the issue.

The error happens at line 26. Any ideas how I can correct this code? Below is the python code from the node.

“line 26 ~~~~ newId = ElementTransformUtils.CopyElements(sourceView, ele, destView, None, CopyPasteOptions() )”

error message before crash


> ```
> #Based on a node originally from Dimitar Venkov
> import clr
> 
> clr.AddReference("RevitServices")
> import RevitServices
> from RevitServices.Persistence import DocumentManager
> from RevitServices.Transactions import TransactionManager
> doc = DocumentManager.Instance.CurrentDBDocument
> doc1 = DocumentManager.Instance.CurrentDBDocument
> 
> clr.AddReference("RevitNodes")
> import Revit
> clr.ImportExtensions(Revit.Elements)
> clr.ImportExtensions(Revit.GeometryConversion)
> 
> clr.AddReference("RevitAPI")
> from Autodesk.Revit.DB import *
> 
> from System.Collections.Generic import*
> 
> 
> ele = List[ElementId](IN[0])
> sourceView = UnwrapElement(IN[1])
> destView = UnwrapElement(IN[2])
> 
> newId = ElementTransformUtils.CopyElements(sourceView, ele, destView, None, CopyPasteOptions() )
> 
> res1 = [doc.GetElement(newId[i]).ToDSType(False) for i in range(len(newId) )]
> 
> OUT = res1
> ```

Try installing the latest version of Rhythm, as I don’t recall there being a .DYF for this in the package. Can you provide a screenshot of the graph so we can understand the structure?

1 Like

Sorry I got busy and took a bit of a break, but back too it and still lost.

After digging around a bit, It looks like this is a custom node based off a rhythm node. Unfortunately, the colleague that develop this is no longer with us. This is a massive graph, but the gist is: it gets a list of typical details and compares against a user modified spread sheet. sorts the list to retrieve specific details.
ele = is all the elements from the typical details > flattens the list > gets the element IDs
sourceView = List of drafting view names to be copied
destView = coppied elements from list of drafting view names to be copied

1 Like

Why not replace it with the new version?

I couldn’t find any matching nodes in the Rythm package, suggesting it must be a custom node. It’s also saved in a Company package. This led me to point Dynamo to a test folder on my local system, where I have the latest versions of all packages. There was an issue with the IronPython 2.7 v2.1.0 package: it runs now but with a different error, but doesn’t crash, unlike the old package location.

new error is :
image

For Revit 2025 you need the newer version of DynamoIronPython2 - version 3.2.1 if memory serves.

You cannot use the same version across multiple builds.

doesn’t matter what I do I’m still getting that same error. Can anyone point me in the right direction?

image

You’re not loading any winforms in that code so we don’t have a full picture. Post your graph and any custom nodes, configured to run on a sample model (indicating which one) so people can try to reproduce.

Hi,

The ContextMenu class is not available in .NET Core. Use ContextMenuStrip instead

this all stemmed from a bug between dynamo and an add-in. updated the add-in and problem resolved

2 Likes

Renamed this thread as it is not a Rhythm issue, but a python issue from old code taken from a previous version of Rhythm.

2 Likes