Deleting Poly_Triangulation

Hi,

I'm using TopExp_Explorer to traverse through the faces of a shape, create a mesh for every single face (I was having some crashes when attaching meshes to entire shapes, some copy using BRepBuilderAPI_Copy, I've heard that it doesn't work too well) and then make a triangulation using Brep_Tool::Triangulation. After I process all the triangles, I try deleting the created handle to Poly_Triangulation, but in the next iteration of the explorer, I get an exception when creating a mesh of a face.

So how can I safely delete the mesh and the triangulation once I'm done with them, to save some memory? I'm dealing with geometries that yield millions of triangles, so memory management is key.

Thanks,
Janko Jerinic

Stephane Routelous's picture

BRepTools::Clean should do the job

Stephane

wei guo's picture

Hi, Stephane,

I do not understand why BRepTools::Clean(const TopoDS_Shape &) can clean triangulation data? It seems that it only destroys TopoDS_Shape.

Another question is that how to clear data from BRepMesh::Mesh()

Best regards,

Wei

wei guo's picture

Sry that BRepTools::Clean(const TopoDS_Shape &) is for remove the triangulation data. I just read the comments and at first I thought that it is for removing the information of TopoDS_Shape.

Another question then is that TopoDS_Shape::Nullify() will destroy all information in current TopoDS_Shape, is that ture?