BRepMesh_IncrementalMesh and STL write problems

Hi all,

I am converting files from IGES/STEP to STL. With 6.6.0 all works well. With 7.2.0 I have added the BRepMesh_IncrementalMesh() method to triangulate the shapes before writing them.

  const Standard_Real aLinearDeflection = 0.1;
  if (BRepTools::Triangulation(aShape, aLinearDeflection) == false) {
   BRepMesh_IncrementalMesh aMesh(aShape, 0.1);
   Standard_Boolean bDone= aMesh.IsDone();
   if (aMesh.IsModified()) {
    aShape = aMesh.Shape();
   bool bCheck= BRepTools::Triangulation(aShape, aLinearDeflection);
I get always a bDone flag "ok" but the bCheck is "false". BRepMesh_IncrementalMesh do nothing on many Iges files.

I have added ShapeFix_Shape methods on the shapes before "meshing" them but nothing changes.

Using some other iges files it works.

What can I check ?



Forum supervisor's picture

Hello Marco,

Can you attach any IGES file that shows this problem?

Thanks in advance!

Forum supervisor

Marco Balen's picture


I have tried to check the problem with a new OCC7.2 installation on a new PC (I am working on a VM) using the MFC sample Import/Export.

I have tried to convert some files and I attach the sample that doesn't work in OCC ImportExport application.

ASSE_2.igs,ASSE_6.igs, Esempio2.igs files do not work.

ASSE_3-OK.igs and ASSE_4-OK.igs files work fine and we provide them for you to compare.

ASSE_#.igs file was exported from CREO.

Esempio2.igs file was exported from EdgeCAM. 

Could you check, please ?

Thank you and kind regards

Forum supervisor's picture

Hello Marco,

Using Draw Test Harness of OCCT 7.2 and the following sequence of commands:

# Load all commands

pload ALL

# Read an IGES file

igesbrep ASSE_2.igs a *

# Display the model

axo; fit

# Check the tolerance

tolerance a

# Check the shape validity

checkshape a

# Build mesh

incmesh a 0.1

# Check the triangulation

trinfo a

you can see that, in all cases, the translated models show quite high maximal tolerance on edges and vertexes – around 0.97, that may indicate there are some inaccuracies in the models definition.

The models from ASSE_2.igs, ASSE_3-OK.igs and ASSE_4-OK.igs are reported to be ok by ‘checkshape’, while the models from ASSE_6.igs and Esempio2.igs contain errors.

If a model contains errors, the OCCT algorithms, including meshing, are not guaranteed to work on it.

The models from ASSE_3-OK.igs and ASSE_4-OK.igs are meshed without problems, while other models report problems during the meshing, mostly ‘OpenWire’.

As ‘trinfo’ shows in all cases, the mesh on most faces is created, however some faces are not meshed due to errors.

We shall be glad to offer you further detailed analysis and fixes in the frames of our support programs.

Best regards,

Forum supervisor

Marco Balen's picture


To propose a better solution to our customer we may evaluate a better management of the import-export handling.

Could you send us a cost estimate to improve the check of problems in iges/step files and how to solve them.

Please send it to the email matched to my profile.

Forum supervisor's picture

Hello Marco,

We sent a personal message to your email, as you asked.

Best regards,

Forum supervisor