3D modeling & numerical simulation

### How to triangularize the shape, not surface.

How to triangularize the shape, not surface.
 Jun WANG 2008/11/13 20:10 Maybe you can say that a shape(also shell) consists of surface and hence the shape(shell) can be triangularized surface by surface by using of "BRep_Tool::Triangulation". However, if so,there are something wrong with the generated triangle meshes at the boundary edge of adjacent surfaces. So I want to generate a whole triangle meshes for the shape(shell). How can I carry out that??????
 Rob Bachrach 2008/11/13 20:17 You would still use the BRepMesh_FastDiscrete to mesh your entire shell (not face-by-face). Just make sure you set the withShare parameter in the constructor to true. This causes the mesher to share the meshes of coincident edges and, therefore, matches the meshes of adjacent faces.
 Jun WANG 2008/11/13 20:32 Thanks a lot. Can you give me more details? //---------------------- TopoDS_Shape tpShape = ...;// Suppose "tpShape" is the shell which needs to be triangulized. ... // Can you give some details //----------------------
 Rob Bachrach 2008/11/13 20:56 Of course you will have to come up with a deflection and angle for your geometry. My code looks something like this: BRepMesh_Discrete *myMesh = new BRepMesh_Discrete(deflection, tpShape, angle, Standard_True, Standard_True); if (myMesh != NULL) delete myMesh; The first Standard_True keeps the mesh continuous at the edges. The second tells it to store the final mesh in the shape, allowing it to be accessed through the Poly_Triangulation. Since the mesh is stored in the shape, I do not keep the BRepMesh_Discrete object around.
 Jun WANG 2008/11/13 21:02 Thanks for your reply. After that, how can I explore the triangles, nodes??? So I am wondering if you can give me a small episode, Thank you VERY much!!!
 Rob Bachrach 2008/11/14 14:36 Assuming you store the triangulation in the shape, as described above... TopExp_Explorer exFace; for (exFace.Init(tpShape, TopAbs_FACE); exFace.More(); exFace.Next()) { TopoDS_Face face = TopoDS::Face(exFace.Current()); // get the triangulation TopLoc_Location loc; Handle(Poly_Triangulation) tri = BRep_Tool::Triangulation(face, loc); if (tri.IsNull()) continue; // create a transformation from the location gp_Trsf xloc = loc; // get the nodes const TColgp_Array1OfPnt &nodes = tri->Nodes(); for (iCount = nodes.Lower(); iCount <= nodes.Upper(); iCount++) { Standard_Real x,y,z; nodes(iCount).Coord(x,y,z); xloc.Transforms(x,y,z); // do something with the point } // copy the polygons Standard_Integer i1, i2, i3; const Poly_Array1OfTriangle &tris = tri->Triangles(); for (iCount = tris.Lower(); iCount <= tris.Upper(); iCount++) { // get the node indexes for this triangle tris(iCount).Get(i1, i2, i3); // reverse the triangle orientation if the face is reversed if (face.Orientation() != TopAbs_FORWARD) { // do something with the node indexes } else { // do something with the node indexes } } }
 davenkin 2010/03/05 09:44 Hi,Rob Bachrach. The example you gave can get nodes from a face, but how can I get the inner nodes of a solid.
 LeeYin 2010/03/24 09:14 Hi,Rob Bachrach. The example you gave can get nodes from a face, but how can I get the inner nodes of a solid£¿£¿
 Ling 2013/01/30 07:40 if (face.Orientation() != TopAbs_FORWARD) when read Iges file , we want to iges to STL ,,the face.Orientation() is always = TopAbs_FORWARD for every face... what's wrong with this .? how to process this problem? can you give me some advices Thank you very much You have to be logged in to download the attached file
 Ling 2013/01/30 07:40 if (face.Orientation() != TopAbs_FORWARD) when read Iges file , we want to iges to STL ,,the face.Orientation() is always = TopAbs_FORWARD for every face... what's wrong with this .? how to process this problem? can you give me some advices Thank you very much You have to be logged in to download the attached file
 Jun WANG 2009/01/23 22:12 Thank you very much. However, I can NOT find the BRepMesh_FastDiscrete ??? Is your OCC 6.3 version ??? Does anyone know that ??? Thanks in advance.
 Rob Bachrach 2009/01/26 12:57 Sorry, this was a typo on my part. It is actually BRepMesh_FastDiscret (without the trailing "e"). I guess the French spell it differently. And yes, you should find the header file in the inc directory. Rob