I have a Python script which worked rather well for two years. It exports the scene mesh & transformations to a XML format for use in an external tool.
Recently I came across an error in the exported mesh normals, happening on one polysurface object in a complex scene. Some vertex normals seem random, the error is reproducible and can be isolated to a single object.
I create the mesh with :
object.CreateMeshes (Rhino.Geometry.MeshType.Render, object.GetRenderMeshParameters(), False) meshes = object.GetMeshes(Rhino.Geometry.MeshType.Render)
Then I access the mesh properties with:
for v in mesh.Vertices: for n in mesh.Normals: for f in mesh.Faces:
As mesh faces contain only vertex indices, I assumed that normal indices are the same, and that there is exactly one normal per vertex (which is not true in any 3D software)
By debugging the erroneous polysurface, I noticed that the render mesh has not the same number of vertices and normals : 128963 and 128949
However, If I manually convert the polysurface to mesh in Rhino before exporting, this problem disappears.
Is this a bug or can there be different vertex and normal count in Rhino meshes? In this case, what are the normal indices?