筛选出和该元素相交的元素之BoundingBoxIntersectsFilter

时间:2021-11-21 17:27:44

//假设元素为ee

BoundingBoxXYZ box = ee.get_BoundingBox(doc.ActiveView);
//创建outline,通过boundingboxintersect过滤器
Outline myOutLn = new Outline(box.Min, box.Max);
BoundingBoxIntersectsFilter boxee = new BoundingBoxIntersectsFilter(myOutLn);
FilteredElementCollector collector = new FilteredElementCollector(doc);

//过滤出相交元素,假设用到的是板类型

IList<Element> elements = collector.OfClass(typeof(Floor)).WherePasses(boxee).ToElements();