Getting link instance of list of elements

hi All, I am trying to retrieve revit link instance of a list of elements…I know how to retrieve document from elements…Is there any similiar way to get link instance from elements…
image

Hi @j.sunnyT6MVA,

It’s possible with the Element To LinkInstance node in the Genius Loci package.

2 Likes

or

for Wall in Walls: 
    link_instance = doc.GetElement(Wall)
    instances.append(link_instance)

Hello
a suggestion :wink:

import clr
import sys
import System

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

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

elements = UnwrapElement(IN[0]) if isinstance(IN[0],list) else [UnwrapElement(IN[0])]

dicDocLink = {link.GetLinkDocument().GetHashCode() : link for link in  FilteredElementCollector(doc).OfClass(RevitLinkInstance) }

OUT = [dicDocLink.get(elem.Document.GetHashCode()) for elem in elements]
3 Likes