Cannot set mesh parameters in order to get only triangles faces

Hello,
I’m trying to get a only triangles’ mesh from a ON_BrepFace.
I read in the documentation that the following function (from ON_MeshParameters class) could help me to reach my purpose:

  // 0 = mixed triangle and quads
  // 1 = all triangles
  // 2 = all quads
  const unsigned int FaceType() const;
  void SetFaceType(
    unsigned int face_type
  );

Unfortunately it seems that I’m doing something wrong because after the mesh generation, if I check how many quads the mesh has I reported a number major then 0.
Then if I call the ConvertQuadsToTriangles() function i obtain what I want.

The following is my code:

ON_MeshParameters parameters = ON_MeshParameters::DefaultMesh;
parameters.SetTolerance(0.1);
parameters.SetFaceType(1);

ON_Mesh* mesh = p_bf->CreateMesh(parameters);

int quadNumber = mesh->QuadCount(); // quadNumber = 3744
if (mesh->QuadCount() > 0)
{
   mesh->ConvertQuadsToTriangles();
}
quadNumber = mesh->QuadCount(); // quadNumber = 0

Can you help me?
Many thanks.

Hi @margari,

I’ve logged the issue - https://mcneel.myjetbrains.com/youtrack/issue/RH-58029

Thanks,

– Dale

RH-58029 is fixed in the latest WIP