Help collecting linked elements inside a bounding box



I am trying to collect elements in linked files that pass through a bounding box. I am new to dynamo and not very familiar with code writing. See image for the nonworking code that I have managed to cobble together. I would appreciate any help anyone could offer. Thank you in advance.


There have been some recent posts on this. Try searching the forum. Three example threads I found:


You could also get linked elements with Get Documents from Archi-Lab Grimshaw along with Element.GetFromLinkedFile from SteamNodes, and then filter by bounding box like so:


Thank you Tom_Kunsman and Yna_Db. You both pointed me to great resources. Unfortunately after playing around with the examples given in other posts I can not get the results I am after. Please see attached .dyn file for a working example of what I am trying to achieve. The attached graph works perfectly for collecting the elements in the active project, but does not pick up any of the linked elements. I am trying to modify the graph to perfume the same function, but picking up all the elements both within the active model and the linked models. Again any help would be appreciated and I thank you for the help given thus far.

ElementsInSpace.dyn (47.4 KB)


I can’t help yet with Python but here is one way to get elements from linked file:

Hope this helps…


You could also try to use this and have all the elements inside all the BB

import clr
import Revit
import RevitServices
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

#Preparing input from dynamo to revit
bbs = IN[0]
output = []

for bb in bbs:
	bbx = bb.ToRevitType()
	outline = Outline(bbx.Min, bbx.Max)
	#filter = BoundingBoxIntersectsFilter(outline)
	filter = BoundingBoxIsInsideFilter(outline)
	collector = FilteredElementCollector(doc, doc.ActiveView.Id).WherePasses(filter)
	for i in collector:
OUT = output