Surface plane section area with OCC

Dear All,

My problem is to cut irregular object made of surfaces (imported as IGES file) at different sections and to calculate the section area at different position (say x1, x2, x3, and so on)! ofcourse using OCC!

Does anybody worked same, i need your help,



Ashish's picture

Hi Game,

Sometime in past I had used following code to do the same thing. Hope this will help. You could achieve same result using BRepAlgoAPI_Section.


BRepAlgoAPI_Common l_brepCom(l_tdShape,l_tdCutPln);//l_tdShape is object from IGES file, l_tdCutPln is topological object of cut plane
if (!l_brepCom.IsDone())
if (l_brepCom.Shape().IsNull())
if (!BRepAlgo::IsValid(l_brepCom.Shape()))

TopoDS_Shape l_tdCommon = l_brepCom.Shape();

GProp_GProps l_gprop;
Standard_Real l_rArea = l_gprop.Mass();
Standard_Real l_rPeri = l_gprop.Mass();
Standard_Real l_rDia = 4*l_rArea/l_rPeri;

Game Milky's picture

Hello Ashish,

Thank you very much for helpfull infomations. It helps a lot! But in my case, i have a surface and plane! I used BRepAlgoAPI_Section based on your suggestions. obviously the intersection is something like a curve or edge/wire. I need to mirrow this mirror this wire and finally should make a face. The face from mirroredwire and wire. Then to calculate the area, and other properties.

I succeeded sectioning, and mirror! and couldn't make the two wires together! So that to construct face and shape to calculate properties.

In addition: BRepGProp::SurfaceProperties(myFaceProfile,l_gprop); // myFaceProfile should be TOPO_DOS-SHape how to make shape from face!

I tried as follow!

The code part
Standard_Boolean PerformNow=Standard_False;
BRepAlgo_Section l_brepinter(shape, aSurface, PerformNow=Standard_True); // shape is imported and the aSurface (geomtric surface)
TopoDS_Shape l_tdCommon = l_brepinter.Shape(); // l_tdCommon the intersection between shape and aSurface

// TopoDS_Wire WaterLineWire = TopoDS::Wire(l_brepinter.Shape());

// Now to create the face to calculate the waterline area
TopExp_Explorer aExpEdge;
TopoDS_Edge WaterLineEdge = TopoDS::Edge(aExpEdge.Current());
TopLoc_Location aLocation;
TopoDS_Wire WaterLineWire = BRepBuilderAPI_MakeWire(WaterLineEdge);
TopoDS_Face WaterLineFace = BRepBuilderAPI_MakeFace(WaterLineWire, false);
Handle(Geom_Surface) WaterLineSurface = BRep_Tool::Surface(WaterLineFace);

//Reflect or mirror the wire

gp_Pnt aOrigin(xmin , ymin , z);
gp_Dir xDir(xmax , ymin , z);
gp_Ax1 xAxis(aOrigin , xDir);

//gp_Ax1 xAxis = gp::OX();
gp_Trsf aTrsf;

BRepBuilderAPI_Transform aBRepTrsf(WaterLineWire , aTrsf);

TopoDS_Shape aMirroredShape = aBRepTrsf.Shape();

TopoDS_Wire aMirroredWire = TopoDS::Wire(aBRepTrsf.Shape());

BRepBuilderAPI_MakeWire mkWire;


TopoDS_Wire myWireProfile = mkWire.Wire();

TopoDS_Face myFaceProfile = BRepBuilderAPI_MakeFace(myWireProfile);

//Global properties of the geometric components
GProp_GProps l_gprop;
Standard_Real l_rArea = l_gprop.Mass();
Standard_Real l_rPeri = l_gprop.Mass();
Standard_Real l_rDia = 4*l_rArea/l_rPeri;
// qDebug ()<