Get the name of the file containing linked element

Is there a way to get the name of the file containing the linked element?

Can you show what your input would be? How would you select an element from a linked instance?

From Springs.Collector.LinkedInstanceElements

I have several linked files and I filter these elements by different conditions, however finally I want to know the file name of which the element is contained in

You could try API, using .Document. Not sure if it will work, it might just return the current doc since the RevitLinkedInstance is considered inside the current doc.

You can try this python for it:

# Enable Python support and load DesignScript library
import clr
from Autodesk.Revit.DB import *
import RevitServices
from RevitServices.Persistence import DocumentManager

# The inputs to this node will be stored as a list in the IN variables.
if isinstance(IN[0], list):
    elements = UnwrapElement(IN[0])
    elements = [UnwrapElement(IN[0])]

docs = []
for elem in elements:
    doc = elem.Document

# Assign your output to the OUT variable.
OUT = docs

Edit: Actually you might need to use the LinkElementId class if you can get the elementid. From there you can find the linked element + its name (the file name).

Edit #2: Nevermind, the above python works. Just be careful of the levels, as the Springs node will give you a nested list even if it is just one category, so you may need to flatten it first or add in for loops:


Thank you, I did flatten the the list.
Works Perfectly.

1 Like