For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Segmentation fault while using BRepMesh_IncrementalMesh

Daniel Kosinski's picture

Hey guys,

i'm using StlTransfer::BuildIncrementalMesh to generate a Mesh from a STEP file. With the attached file i'm getting a segmentation fault.

Here is the backtrace:

#0  0x00007fff85e82bd0 in BRepMesh_EdgeTessellator::splitSegment(Handle_Geom_Surface const&, Handle_Geom2d_Curve const&, double, double, int) ()
   from /home/kosinski/devel/oce-dist-org/lib/
#1  0x00007fff85e835b6 in BRepMesh_EdgeTessellator::BRepMesh_EdgeTessellator(TopoDS_Edge const&, Handle_BRepMesh_FaceAttribute const&, TopTools_IndexedDataMapOfShapeListOfShape const&, double, double) () from /home/kosinski/devel/oce-dist-org/lib/
#2  0x00007fff85e75071 in BRepMesh_FastDiscret::update(TopoDS_Edge const&, Handle_Geom2d_Curve const&, double, BRepMesh_FastDiscret::EdgeAttributes&) ()
   from /home/kosinski/devel/oce-dist-org/lib/
#3  0x00007fff85e75ecb in BRepMesh_FastDiscret::add(TopoDS_Edge const&, BRepMesh_FastDiscret::EdgePCurve const&, double) () from /home/kosinski/devel/oce-dist-org/lib/
#4  0x00007fff85e775f6 in BRepMesh_FastDiscret::Add(TopoDS_Face const&) () from /home/kosinski/devel/oce-dist-org/lib/
#5  0x00007fff85e707a8 in BRepMesh_IncrementalMesh::update(TopoDS_Face const&) () from /home/kosinski/devel/oce-dist-org/lib/
#6  0x00007fff85e70fa4 in BRepMesh_IncrementalMesh::update() () from /home/kosinski/devel/oce-dist-org/lib/
#7  0x00007fff85e71304 in BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh(TopoDS_Shape const&, double, bool, double, bool) () from /home/kosinski/devel/oce-dist-org/lib/
#8  0x00007fff8cceb873 in StlTransfer::BuildIncrementalMesh(TopoDS_Shape const&, double, bool, Handle_StlMesh_Mesh const&, double, Message_ProgressIndicator*) ()
   from /home/kosinski/devel/local/lib/

The angular deflection is fixed with value 0.5. The following function computes the deflection:

double OCEMeshCreator::optimalDeflection(TopoDS_Shape& shape)
        //max. deflection
        double deflection = 10;
        double aXmin;
        double aYmin;
        double aZmin;
        double aXmax;
        double aYmax;
        double aZmax;
        Bnd_Box bndBox;

        BRepBndLib::Add(shape, bndBox);
                bndBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
                deflection = MAX3(aXmax-aXmin , aYmax-aYmin , aZmax-aZmin) * 0.001;

        return deflection;

For the attached file it is 2e97. I tried other values but without success.

Does anybody know how to fix this? The code works fine with other STEP files.

Best regards,