Offseting an STL surface with BRepOffsetAPI_MakeOffsetShape result in empty shape

I tried to load an STL surface and offseting it but the TopoShape seems to lose all points and face after offset. I guess there might be something happening when I triagulate the mesh with BRepMesh_incrementalMesh function.

I tried two case:

  • In the first I load a custom triangulated cylinder mesh (exported from VTK) with no success.
  • The second time I created a cube in OCCT with MakePrism on a square and offset it, which successfully gave an offsetted cube, but when I triangulate save the pre-offset cube in STL, load the same STL then offseting, the resulting TopoShape is empty.

Here is my code:


int main() {

    TopoDS_Shape cube;
    StlAPI_Reader reader;
    reader.Read(hand, "cube.stl");

    TopoDS_Compound compound;
    BRep_Builder aBuilder;
    //aBuilder.Add(compound, cube);

    TopoDS_Shape outer;
    try {
        outer = BRepOffsetAPI_MakeOffsetShape(compound, 1, 1.e-3);
        numOfFace = 0;
        for (TopExp_Explorer aFaceExp(outer, TopAbs_FACE); aFaceExp.More(); aFaceExp.Next()) {
            numOfFace += 1;
        cout << "Number of Face: " << numOfFace << endl;
        //aBuilder.Add(compound, outer);
        BRepMesh_IncrementalMesh(outer, 0.1);
    catch (...) {
        cerr << "Thickening operation failed";

    StlAPI_Writer writer;
    writer.Write(outer, "cube_thickend.stl");

return 0;



Matthew Wong's picture

Changed tittle

ATTIA's picture

I have the same probem and I haven't a solution.