opencascade display a BRepMesh_IncrementalMesh object on the screen

283 Views Asked by At

I am reading a step file. I want to triangulate the object in it and draw the mesh. I am trying to do these things in opencascade as follows:

STEPControl_Reader reader;
reader.ReadFile("file_path");

if (reader.TransferRoots() != IFSelect_RetDone) {
    std::cerr << "Error: Unable to read file." << std::endl;
    return 1;
}

int numShapes = reader.NbShapes(); // there is 1 shape actually

for (int i = 1; i <= numShapes; i++) {
    TopoDS_Shape shape = reader.Shape(i);
    
    IMeshTools_Parameters aMeshParams;
    aMeshParams.Deflection               = 0.01;
    aMeshParams.Angle                    = 0.5;
    aMeshParams.Relative                 = Standard_False;
    aMeshParams.InParallel               = Standard_True;
    aMeshParams.MinSize                  = Precision::Confusion();
    aMeshParams.InternalVerticesMode     = Standard_True;
    aMeshParams.ControlSurfaceDeflection = Standard_True;
 
    BRepMesh_IncrementalMesh aMesher (shape, aMeshParams);
    aMesher.Perform();

    // now display aMesher on the screen
}

How can I display a BRepMesh_IncrementalMesh object on the screen?

0

There are 0 best solutions below