Trace Back Linked Model Path from List Elements

Hi, trying to get the path of linked element. Any idea how to get the linked file path of linked element?

import clr

clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference(“System”)
from System.Collections.Generic import List

clr.AddReference(‘RevitNodes’)
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference(‘RevitServices’)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
import itertools

elementlist =

doc = DocumentManager.Instance.CurrentDBDocument
linkdocs = DocumentManager.Instance.CurrentUIApplication.Application.Documents

#looks for links in the active project, add instances to a list
for linkdoc in linkdocs:
if linkdoc.IsLinked:
collector = FilteredElementCollector(linkdoc)
filter = ElementCategoryFilter(BuiltInCategory.OST_StructuralFraming)
elementlist.append(collector.WherePasses(filter).WhereElementIsNotElementType().ToElements())

#for elem in elementlist:

options = Options()

elem.get_Geometry(options)

OUT = list(itertools.chain(*elementlist))

You can use this node from MEPover package, it gives you all the link paths in the current document:

1 Like

I don’t think that’s the issue.

I have a list of Elements and I wanne know in whitch Linked Model the Elements came from.

Any idea how to trace back the source path?

Use BimorphNodes LinkElement.OfCategory node, then you can use the LinkElement.LinkInstanceId which is the ID of the link from where the linked element derived.

To get the link instance element from the ID, you can use this technique by @Kulkul:

1 Like