Hi guys,
I have a face. Now I want to have the meshes from the face.
Solved! Go to Solution.
Solved by MichaelT_123. Go to Solution.
Hi Mr John4TMYX,
...Yes and No.
Meshes can come in different forms, ... triangular, quad or even polygonal.
polygonCount | Returns the number of polygons (more than 4 sides) in the mesh. |
polygonNodeIndices | Returns the index values that index into the NodeCoordinates and NormalVectors arrays to define the coordinates of each polygon and the corresponding normal. |
quadCount | Returns the number of quads in the mesh. |
quadNodeIndices | Returns the index values that index into the NodeCoordinates and NormalVectors arrays to define the four coordinates of each quad and the corresponding normal. |
triangleCount | Returns the number of triangles in the mesh. |
triangleNodeIndices | Returns the index values that index into the NodeCoordinates and NormalVectors arrays to define the three coordinates of each triangle and the corresponding normal. |
... thus you have to address such diversity first ... unless you are sure that your mesh is of triangular type.
If the latter is the case ... the rest is easy.
myTriangleCoordsLst = []
for tC in triangleCount:
myTriangleCoord = [nodeCoordinates[triangleNodeIndices[3*tC+0]],
nodeCoordinates[triangleNodeIndices[3*tC+1]],
nodeCoordinates[triangleNodeIndices[3*tC+2]]]
myTriangleCoordsLst.append(myTriangleCoord )
The code is similar or even the same as the one you presented ... as per my 5 sec glimpse.
Regards
MichaelT
but I use the following way to get the mesh from a face:
Ptr<MeshManager> meshMgr = face_ptr->meshManager();
Ptr<TriangleMeshList> meshList = meshMgr->displayMeshes();
so I assume that the mesh should be triangle mesh, right?
I have printed all the mesh, it is not right at all.
Here is the code snippet:
Ptr<TriangleMesh> pmesh = meshList->bestMesh();
Hi Mr John4TMYX,
int face_count = triangle_count / 3 ????
what about:
int face_count = triangle_count
... and by the way ... consider using F360 API to keep consistency of the code.
Regards
MichaelT
Can't find what you're looking for? Ask the community or share your knowledge.