1.通过solid信息构建相交过滤器过滤图元
public List<Element> GetIntersectsElements(Solid solid, Document doc)
{
//solid的boundingbox是局部坐标矩阵转换为世界坐标系
Transform transform = solid.GetBoundingBox().Transform;
XYZ minSolid = solid.GetBoundingBox().Min;
XYZ maxSolid = solid.GetBoundingBox().Max;
XYZ acturalMin = transform.OfPoint(minSolid);
XYZ acturalMax = transform.OfPoint(maxSolid);
Outline outline = new Outline(acturalMin, acturalMax);
BoundingBoxIntersectsFilter boxFilter = new BoundingBoxIntersectsFilter(outline);
FilteredElementCollector collector = new FilteredElementCollector(doc);
List<Element> intersectElements = collector.WherePasses(boxFilter).Where(s => s.GetCategory().Equals(BuiltInCategory.OST_StructuralFraming)).ToList();
return intersectElements;
}