Storing custom triangulation into TopoDS_Shape

Hello forum,

I used Netgen for meshing a TopoDS_Shape. The resulting mesh is good enough for a FEM calculation.

Now I would like to store the surface mesh into the shape, fully replacing the stl mesh

generated by the BRepMesh_IncrementalMesh for visualization purposes (shaded view).

These are the steps::

1) clean the "automatic" triangulation using BRepTools::clean.

then, foreach face:

2) convert the mesh of the j-th face into Poly_triangulation Tj

3) BRepMesh_ShapeTool::AddInFace(<j-th face>, T), where j-th is a TopoDS_Face

 

As a test I retrieve for each face of the TopoDS_Shape the triangulation, using BRep_Tool::Triangulation,

and I plot all the triangles, which obviously overlap the original view of the surface mesh. So, the shape

triangulation is updated.

Unfortunately when Display is called on the AIS_Shape(TopoDS_Shape) the shaded view does not

reflect the change: a triangulation from BRepMesh_IncrementalMesh is used again, instead of the new one.

I'm sure I'm missing something.

Any idea?

Thanks a lot

Giovanni

 

 

 

Kirill Gavrilov's picture

Auto-triangulation is enabled by default in AIS_InteractiveContext (for compatibility with old applications).
Check Prs3d_Drawer::SetAutoTriangulation() documentation ("vdefaults -autoTriang 0" in Draw Harness).

Giovanni Bettega's picture

Thank you very much Kirill for your help

Giovanni