Sorry I am very new in python, I used the script below to find the elements inside a boundingbox, it works fine, but it only applies on one boundingbox. But I dont know how to edit the script to input a list of boundingbox
Tyr this, I think your bounding box needs a little bit of offset to always include elements, in some cases, not all elements/ sub elements are filtered:
import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitNodes')
clr.AddReference('RevitServices')
import Revit
import RevitServices
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
doc = DocumentManager.Instance.CurrentDBDocument
#Preparing input from dynamo to revit
bb = IN[0]
l = []
for w in bb:
wall = w.ToRevitType()
outline = Outline(wall.Min, wall.Max)
#filter = BoundingBoxIntersectsFilter(outline)
filter = BoundingBoxIsInsideFilter(outline)
collector = FilteredElementCollector(doc, doc.ActiveView.Id).WherePasses(filter)
l.append(collector)
OUT = [[i.ToDSType(True) for i in e] for e in l]
import clr
import sys
import System
from System.Collections.Generic import List
clr.AddReference('RevitAPI')
clr.AddReference('RevitNodes')
clr.AddReference('RevitServices')
import Revit
import RevitServices
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
doc = DocumentManager.Instance.CurrentDBDocument
#Preparing input from dynamo to revit
lstBbx = [ds_bbx.ToRevitType() for ds_bbx in IN[0]]
listFilter = List[ElementFilter]([BoundingBoxIsInsideFilter(Outline(bb.Min, bb.Max)) for bb in lstBbx])
filter = LogicalOrFilter(listFilter)
collector = FilteredElementCollector(doc, doc.ActiveView.Id).WherePasses(filter).ToElements()
OUT = collector