DiscussionsIssue archiveOther usage issues

Archived discussion

Boolean Operation of 2d Faces in the same plane

Other usage issuesTue, 10/06/2015 - 14:301 reply

Browse this forum
QuestionAuthor

Hi,

I am trying to do a simple boolean operation in 2d. Essentially, all I need is the common area between a circle and another face. Unfortunately, I could not find any algorithm that would do this directly in 2d. Does anyone know an algorithm here?

Then, I tried to produce 3d TopoDS_Faces from it and use BRepAlgoAPI_Common to get the common part. In 99% of the time, this works, but for a small percentage of seemingly innocent faces, the algorithm fails. Is there a better way to do this? 

I've posted the code below. I am using OCC6.7.1 with the C#-wrappers.

Thanks for the help.

Cheers,

Author

            Geom2d_Curve Circle_tragend = new Geom2d_Circle(new gp_Circ2d(new gp_Ax2d(Schwerpunkt_gesamt, new gp_Dir2d(1, 0)), Durchmesser_tragend / 2.0, true));
            BRepBuilderAPI_MakeWire circleWireTemp = new BRepBuilderAPI_MakeWire();
            circleWireTemp.Add(new BRepBuilderAPI_MakeEdge(GeomAPI.GeomAPI.To3d(Circle_tragend, xyPlane)).Edge());
            TopoDS_Wire circleWire = circleWireTemp.Wire();
            TopoDS_Face circleFace = new BRepBuilderAPI_MakeFace(circleWire).Face();

            BRepAlgoAPI.BRepAlgoAPI_Common schneiden = new BRepAlgoAPI_Common(circleFace, Face);
            TopoDS_Shape tragendeFlaecheShape = schneiden.Shape();

Discussion

1 archived reply

Posts are displayed in their archived order.

01Author

Here are the shapes in igs format, in case someone wants to reproduce the problem. The third shape is simply missing...

IGESControl_Controller.Init();

IGESControl_Writer ICW = new IGESControl_Writer();

ICW.AddShape(circleFace);

ICW.AddShape(Face);

ICW.AddShape(tragendeFlaecheShape);

ICW.ComputeModel();

Boolean OK = ICW.Write(@"c:\temp\ausgabe.igs");

Thanks for the support!

Author