-
Notifications
You must be signed in to change notification settings - Fork 3
/
MeshTextureCoordinates.py
22 lines (19 loc) · 1.07 KB
/
MeshTextureCoordinates.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#***********************************************************************************************************#
#********* Get normalized 2-D texture coordinates of a mesh object *****************************************#
#********* by Djordje Spasic *******************************************************************************#
#********* [email protected] 17-Feb-2015 **************************************************************#
"""
Rhino 5 SR11 (and all older releases) still does not have RhinoScript "MeshTextureCoordinates" function implemented for PythonScript.
MeshTextureCoordinates returns normalized (between 0 and 1) 2-D texture coordinates of a mesh object.
Small function bellow replicates this functionality.
"""
import rhinoscriptsyntax as rs
def MeshTextureCoordinates(object_id):
meshObj = rs.coercemesh(object_id)
mCoordL = []
for i in range(meshObj.TextureCoordinates.Count):
mCoordL.append(meshObj.TextureCoordinates[i])
return mCoordL
meshId = rs.GetObject("pick up your mesh", 32)
coord = MeshTextureCoordinates(meshId)
print coord