StlAPI.write() returns StlAPI_MeshIsEmpty

We are upgrading an older version of OCC and are having problems exporting STL files. In the older code, when writing an STL file, a mesh was automatically created. In the current release, however, the StlAPI_MeshIsEmpty error code is returned.

I've traced the problem to the following OCC code change: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff;h=b9c1e44...

It appears the auto-mesh generation for STL files has been removed. Is there a newer example of how to generate an STL file with a mesh? I've looked at the various examples, e.g. ImportExport.cpp, but I think this code is based on the old version of OCC too. It does not generate a mesh and produces the same StlAPI_MeshIsEmpty error.

Forum supervisor's picture

Hello Scott,

We confirm that the behavior of the OCCT STL writing interface is changed as you described. One reason to do that was to allow use of triangulations produced by other meshing algorithms.

We can’t reproduce the problem in our standard samples – STL files are created well. We assume it is because the shapes get triangulated as soon as they are displayed in these samples.

If you want to create mesh in your application, use BRepMesh_IncrementalMesh class to repeat the behavior of the STL writing interface before the modification.

Best regards,

Forum supervisor