Plane - Shape Intersection

want I want to cut a shape(face) with a simple plane (face). I found many topics about that problem but no of these one could really help me.

What I´m trying to do: Using the BRepAlgo_Section to found the intersection but as the documentation says I only get a TopoDS_Compound - but I need a curve. I tried to make use of ShapeHealing algorithm (like ) to ShapeFix_Wire to create a correct curve but this didn´t work for me (maybe the configuration was wrong).

As an alternative i thought making a big circle (curve) in the cutting plane and project this one on the shape. But I quess this wouldn´t work.

If someone has solved the problem... can U please give me some hints or pseudocode.

Thx in Advance - Stefan Kunze

Svetlozar Kostadinov's picture
StefanKunze's picture

This is one of topics i´ve already checked. But it didn´t work for me in all cases.

StefanKunze's picture

I quess you have used the ShapeFix_Wire - class. Could you please send me same pseudocode so that I can see which functionality you used (maybe it´s just a problem of the order of applying).
Thx in advance - Stefan

Svetlozar Kostadinov's picture

You may look in the Salome project... the "Geom" module specifically. Maybe the "Archimede" operation.

Davide Sammaritani's picture

This is the code that I use:

Standard_Real tol = 0.01;
BRepBuilderAPI_MakeWire brepMake;
ShapeFix_ShapeTolerance FTol;
TopExp_Explorer ExpEdges;

TopoDS_Shape planeShape = BRepBuilderAPI_MakeFace(pln).Face();
BRepAlgo_Section sectionalg(aShape, planeShape);
TopoDS_Shape section = sectionalg.Shape();

Handle(ShapeExtend_WireData) sbwd1 = new ShapeExtend_WireData();
for (ExpEdges.Init(section, TopAbs_EDGE); ExpEdges.More(); ExpEdges.Next())
const TopoDS_Edge& Edge = TopoDS::Edge(ExpEdges.Current());

Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire;
//Reorder edges is very important

for (int i = 1; i <= sfw->NbEdges(); i ++)
TopoDS_Edge Edge = sfw->WireData()->Edge(i);
FTol.SetTolerance(Edge, tol, TopAbs_VERTEX);

TopoDS_Wire wire = brepMake.Wire();
BRepAdaptor_CompCurve curve(wire);

I hope that will be useful, good luck