Can't copy and paste elements from Linked to host file by ID

I’m trying to copy a list of elements from a linked file to the host file using Element IDs that I got from Navisworks Clash reports. Dynamo has identified the elements from the links but when I send it through the Rhythm Copy elements node it returns an error saying cannot copy element.

Any idea what I’m doing wrong? Or if there is a better way of achieving this?

@tushar.aj

did you also check list depth ?

Start by using the element’s UniqueId as ElementIds are not persistent.

I think the issue here is the top nodes is expecting a linkElement but is getting elements, the other nodes are also trying to save elements at the same time so you may be getting conflicting transactions. Try one node at a time. There may be issues with hosted elements as well if their isn’t a host in the current document.

Unfortunately the UniqueId nodes only work with the current document and I couldn’t get the Clockwork node to work so a little python is in order. Once you have your elements and as you only have one document I think the middle rhythm node should work (I was able to get it working)

import clr

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

def get_element(doc, ids):
    if isinstance(ids, str):
        try:
            return doc.GetElement(ids)
        except:
            return
    elements = []
    for id in ids:
        try:
            elements.append(doc.GetElement(id))
        except:
            elements.append(None)
    return elements

doc = IN[0]  # Link document
ids = IN[1]  # Element UniqueId strings

OUT = get_element(doc, ids)

You could do this or just use an equals node and filter by bool mask

Thank you for this!
But it doesn’t seem to be working on my end… I’m getting null outputs when I use the script and feed it the UniqueID information

This worked! Thanks a ton!
Should have tried that before hand but it never crossed my mind…
Was able to get the Rythm node working when I used the right list depth… The Biimorph node is still unresponsive though…

Flatten the list of UniqueIds and the python should work. @Draxl_Andreas is on the money here

1 Like

@Mike.Buttery

i would say Karma points:wink: