Mesh Point different from Mesh.Vertices

Hi everyone,

I am really confused. I have a mesh whose vertices are different from the point I can see in the UI.

I got the orange points by doing the following. But the points do not align with the actual shape?

for vt in mesh.Vertices:
sc.doc.Objects.AddPoint(vt)


Am I missing something? How can I get the actual vertices (meaning the points used to display the mesh)?

Much appreciate!

Seems to be a problem of the file itself. When I copy the mesh to another empty file. It works out fine. Just curious, what would cause the shift of mesh vertices?

Hi Vincent,

Could it be this object has been positioned far from the world origin?
If so you could be seeing errors due to floating point limitations for representing large numbers.

-Willem

The MeshVertexList is, unfortunately, an enumerable of Point3f (3 floats) due to historic reasons. Rhino did not have double precision for meshes in version 4.

If you use the Point3dAt() method, it will match double precision.

for i in range(mesh.Vertices.Count):
   vt = mesh.Vertices.Point3dAt(i)
   sc.doc.Objects.AddPoint(vt)

We could do something about this, but it might break a few older plugins. @stevebaer
Thanks,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Hi Willem,

Indeed, that’s the problem. When you move it near the origin, all gets fine.

-Vincent

Thank you! Good to know there is a workaround.

This won’t change as there are still many cases where floats are preferable and it would definitely break existing plugins.

CIL has method overload resolution support based on return type. This means that maybe one day we could find a way to make this work… so it would not definitely break plug-ins. But it would take serious work to set it up… so it’s probably future tripping.