# Trace Back Linked Model Path from List Elements

**URL:** <https://forum.dynamobim.com/t/trace-back-linked-model-path-from-list-elements/27913>\
**Category:** Revit\
**Tags:** revit, python\
**Created:** [November 1, 2018, 8:03am UTC](https://forum.dynamobim.com/t/trace-back-linked-model-path-from-list-elements/27913 "2018-11-01T08:03:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![s.bosch](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/s.bosch/32/55195_2.png) [@s.bosch](https://forum.dynamobim.com/u/s.bosch)\
**Post date:** [November 1, 2018, 8:03am UTC](https://forum.dynamobim.com/t/trace-back-linked-model-path-from-list-elements/27913/1 "2018-11-01T08:03:46Z")

</div>

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

 ![afbeelding](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/4/94e4c814177d35d45b6fb3d1cd65ffa9bf3ce710.png)

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))

---

<div class="post-metadata">

**Author:** ![lucamanzoni](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/lucamanzoni/32/56718_2.png) [@lucamanzoni](https://forum.dynamobim.com/u/lucamanzoni)\
**Post date:** [November 5, 2018, 4:50pm UTC](https://forum.dynamobim.com/t/trace-back-linked-model-path-from-list-elements/27913/2 "2018-11-05T16:50:14Z")

</div>

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

 ![LinkedFilesPath](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/2/b271f6ce73e5d3048419da39075375bc9d6184b3.png)

---

<div class="post-metadata">

**Author:** ![s.bosch](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/s.bosch/32/55195_2.png) [@s.bosch](https://forum.dynamobim.com/u/s.bosch)\
**Post date:** [November 7, 2018, 1:29pm UTC](https://forum.dynamobim.com/t/trace-back-linked-model-path-from-list-elements/27913/3 "2018-11-07T13:29:53Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Thomas\_Mahon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/thomas_mahon/32/64209_2.png) [@Thomas\_Mahon](https://forum.dynamobim.com/u/Thomas_Mahon)\
**Post date:** [November 7, 2018, 1:40pm UTC](https://forum.dynamobim.com/t/trace-back-linked-model-path-from-list-elements/27913/4 "2018-11-07T13:40:10Z")

</div>

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:

> [@Selected element by id returns null value](https://forum.dynamobim.com/t/selected-element-by-id-returns-null-value/16664/3):
>
> Hi @pmora1990 Try internal selection method.
