Hi
I share this.
if you have better ideas I’m interested, thank you in advance
Recover elements (here walls) only inside a non-rectangular poaching area
the solid is in m here
the 2nd output of the python script is the result of the elements included and cut with the geometry
Python script
import sys
import clr
import System
from System.Collections.Generic import List
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import XYZ,GeometryCreationUtilities,BooleanOperationsUtils,BooleanOperationsType,FilteredElementCollector,BuiltInCategory,ElementIntersectsSolidFilter
fr=UnwrapElement(IN[0])
doc=fr.Document
cl=fr.GetBoundaries()
vecZplus=XYZ(0,0,1)
bh=GeometryCreationUtilities.CreateExtrusionGeometry(cl,vecZplus,30/0.3048)
bb=GeometryCreationUtilities.CreateExtrusionGeometry(cl,vecZplus.Negate(),10/0.3048)
bigboite=BooleanOperationsUtils.ExecuteBooleanOperation(bh,bb,BooleanOperationsType.Union)
allwalls=FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsNotElementType().ToElements()
pts=[w.Location.Curve.Evaluate(0.5,True).ToPoint() for w in allwalls]
filtre_solid = ElementIntersectsSolidFilter(bigboite)
wallsfilter = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsNotElementType().WherePasses(filtre_solid).ToElements()
OUT = allwalls,wallsfilter,pts,bigboite.ToProtoType()
Sincerely
christian.stan



