
Tue, 12/26/2023 - 16:36
Forums:
As shown in the figure, imagine the four rectangular faces as four walls. I want to get the enclosed area formed by the four walls.
TopoDS_Face f1 = BRepBuilderAPI_MakeFace(w1);
TopoDS_Face f2 = BRepBuilderAPI_MakeFace(w2);
TopoDS_Face f3 = BRepBuilderAPI_MakeFace(w3);
TopoDS_Face f4 = BRepBuilderAPI_MakeFace(w4);
gp_Pln plane(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1));
TopoDS_Face plane_face = BRepLib_MakeFace(plane);
TopoDS_Shape fused = BRepAlgoAPI_Fuse(f1, f2);
fused = BRepAlgoAPI_Fuse(fused, f3);
fused = BRepAlgoAPI_Fuse(fused, f4);
TopoDS_Shape spaces = BRepAlgoAPI_Cut(plane_face, fused);
TopExp_Explorer face_explorer(spaces, TopAbs_FACE);
I perform a fuse operation on the four faces, and then do a cut operation with a plane face. I traverse the spaces and obtain two faces. One is the middle area, and the other is the face formed by the fuse. Is there a good way to distinguish them?
Or is there another method to obtain the area enclosed by multiple intersecting faces?
Attachments: