How to get the elements inside a boundingbox?

Thanks for the fast reply.
Ok, so i have no experience with python or programming… i tried to read trough and understand witch part i should implement and i got this.
I did not work. Maybe you could point me in the right direction?

import clr
clr.AddReference('RevitAPI')
clr.AddReference('System')
clr.AddReference('RevitNodes')
clr.AddReference('RevitServices')
import Revit
import RevitServices
from Autodesk.Revit.DB import *
from System.Collections.Generic import List
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
doc = DocumentManager.Instance.CurrentDBDocument

#Functions for list handling
def ProcessList(_func, _list):
   return map( lambda x: ProcessList(_func, x) if type(x)==list else _func(x), _list )

def ProcessParallelLists(_func, *lists):
return map( lambda *xs: ProcessParallelLists(_func, *xs) if all(type(x) is list for x in xs) else _func(*xs), *lists )

#Preparing input from dynamo to revit
def Unwrap(item):
return UnwrapElement(item)

def ToRevit(item):
return item.ToRevitType(True)

if isinstance(IN[0], list):
bb = ProcessList(Unwrap, IN[0])
else:
bb = list(Unwrap(IN[0]))

bb = IN[0].ToRevitType()
outline = Outline(bb.Min, bb.Max)
filter = BoundingBoxIntersectsFilter(outline)
#filter = BoundingBoxIsInsideFilter(outline)

collector = FilteredElementCollector(doc, doc.ActiveView.Id).WherePasses(filter)

OUT = [e.ToDSType(True) for e in collector]
1 Like