Revit link elements

If you’d like to do this in Python without any 3rd party nodes, you can use the following:

import clr
clr.AddReference("RevitAPI")
clr.AddReference("RevitServices")

from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager

current_doc = DocumentManager.Instance.CurrentDBDocument
links = FilteredElementCollector(current_doc).OfClass(RevitLinkInstance)

docs = [link.GetLinkDocument() for link in links]

OUT = docs

This will get all Revit link instances in from the current document and return all documents associated with the link instances. You can also append current_doc to the docs list if you want to evaluate elements from both the host document and the linked documents.

You can then pass all of these documents to the FilteredElementCollector() as you would with any other document. So, if you’ve already written a script that uses the FilteredElementCollector you won’t have to change much.

1 Like