How to read all Texture Coordinates of a Mesh in RhinoCommon? – Rhino Developer


hi there,

I’m trying to read UVs (/texture coordinates) of a mesh, including discontinuous values, meaning those, that are different per face.
Here is a file with a simple mesh and discontinuous UVs:
disco_UVs.3dm (142.6 KB)
Mesh with UVEditor open:
image

Of course there is Mesh.TextureCoordinates, but that returns just one value per vertex.
For the sample file the following returns 9 for each of them.

import Rhino
doc = Rhino.RhinoDoc.ActiveDoc
for obj in doc.Objects:
    if isinstance(obj.Geometry, Rhino.Geometry.Mesh):
        mesh = obj.Geometry
        print(len(mesh.Vertices))
        print(len(mesh.TopologyVertices))
        print(len(mesh.TextureCoordinates))

I’m probably missing something, or don’t understand how Rhino stores these values.

I appreciate any help!
Thanks,
Bernd



Source link

Leave a Comment