Get Elements from Nested Linked Models (Linked Models within Linked Models)


I have a situation where I have linked models inside of linked models and am trying to access the elements within that deepest level of linked model. I can get the first level of linked elements using the SteamNodes or Archilab nodes but can’t seem to get down to the next nested level of elements.

The Get Linked RVT Documents node returns items for each link and sub-link but then when I use Elements.GetFromLinkedFile, I only get elements that are in the highest/first level of linked model.


I hope I explained this clearly. Any help would be appreciated! Thanks,


Apply the concept of crossed lacing to your models for more control

Been down this road before and the behavior is not what is expected.

1 Like

Thanks for the reply. I think in this case, it might be easier to organize my files differently and avoid the issue all together.


a solution to search Elements only on nested Linked Models

import clr
#import Revit API
import Autodesk
from Autodesk.Revit.DB import *

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

#Get Important vars
doc = DocumentManager.Instance.CurrentDBDocument

lstRvtlinkName = IN[0]

out = []

fecLnkInstace = FilteredElementCollector(doc).OfClass(RevitLinkInstance).ToElements()
for rvtLkinst in fecLnkInstace:
	lnkType = doc.GetElement(rvtLkinst.GetTypeId())
	if lnkType.IsNestedLink:	
		if 	Element.Name.GetValue(lnkType) in lstRvtlinkName:
			linkDoc = rvtLkinst.GetLinkDocument()
			fecWallNest = FilteredElementCollector(linkDoc).OfClass(Wall).WhereElementIsNotElementType().ToElements()
			out.append([lnkType, rvtLkinst, linkDoc, fecWallNest])

OUT = out