The Shape S should be the result obtained after cut operation.
But S is displaying either S1 or res2. The two wires are intersecting so the resultant obtained should be the combination of two wires with the common part(the purple wire inside the red wire) removed. Can anyone help me please. How can I get the resultant wire S as a combination of S and res2?
Thanks a lot,
Author
Discussion
6 archived replies
Posts are displayed in their archived order.
01Commenter-1
It seems to me that you are working on a plane.
If this is tha case I suggest a different approach.
Build 2 faces with S1 and res2 using BRepBuilderAPI_MakeFace(wire, true)
Intersect the two faces with BRepAlgoAPI_Common
Extract the external wire of the resulting shape with ShapeAnalysis_FreeBounds
02Commenter-2
Hi Author,
As far as I remember BOP are not supposed to work on two wires (edges). And this is obvious as this operation does not make (much) sense. If you really want to cut W2 from S1 then a possible approach could be to create a solid of extrusion (i.e. prism) using a profile of W2.
I have implemented your code and got struck at a point. you have mentioned that
"Extract the external wire of the resulting shape with ShapeAnalysis_FreeBounds"
Can you please give me a sample code on how to extract the external wire of the resulting shape with ShapeAnalysis_FreeBounds?
Thanks a lot for the help,
Author
04Commenter-1
The resulting shape of the common operation is RESULT
I had the process of extrusion and then performing Boolean operation in mind as a last choice to implement.As, it is a complex process. But, I was trying if I can do it in any other way instead of extrusion. I wanted exactly what you said. The remaining part of the outer wire. I was trying if it works using the method Marco has suggested. The output obtained after COMMON operation is to be removed and the rest of the outer wire is to be extracted. I didn't understand how to use ShapeAnalysis_FreeBounds to extract it. Can you please help me by giving a sample code if possible?
Thanks a lot
Author
06Author
Thank you Marco and Roman for your great help.
I was able to perform the Boolean operation Cut on wires by converting them into faces.
My code goes like this:
TopoDS_Face F1=BRepBuilderAPI_MakeFace (W1,true);
TopoDS_Face F2=BRepBuilderAPI_MakeFace (W2,true);
TopoDS_Shape S1=BRepAlgoAPI_Cut (F1,F2);
ShapeAnalysis_FreeBounds Final(S1,Standard_True,Standard_False);
TopoDS_Compound T=Final.GetClosedWires();