Access violation on BRepMesh_IncrementalMesh


Working on a STEP reader, I ran into a *potentially* bad STEP file. (unfortunately it is an internal file) I am getting an error pointing to TKMesh.dll -the code breaks with an access violation error at BRepMesh_IncrementalMesh.

Access violation reading location 0x0000000000000000.

IMeshTools_Parameters params;
//set the parameters here
TopoDS_Shape shape = mShape_tool->GetShape(label);
BRepMesh_IncrementalMesh m(shape, params);

The snippet above works for most files. I ran a debug version to print the names and when I looked to find the shape in CAD Assistant, I realized that this part is discarded. (the name is there but when I do a Show only selected and hit F nothing is displayed.)

  •  TopLoc_Location is NULL for the shape that fails. However, this is not a problem for other shapes.
  • shape is not NULL and params works with other parts.

I am not sure where the problem is:

  1. Is there another method that CAD Assistant might be using to validate shapes?
  2. The model has many very tiny parts in mm. could that be part of the problem?

Thank you :) 

Kirill Gavrilov's picture

NULL-dereference indicates either a bug in application code or in some of OCCT algorithms (STEP translator, BRepMesh, etc.). Building OCCT and application in Debug mode might help to reveal exact places where problem happen (or shoots) - at least you will be able to share your stacktrace.

If application code looks fine to you, than consider reporting an issues to OCCT with reproducing steps.