Koochy
10-23-2011, 03:10 AM
I've been trying to print ouf the world position of each vertex on a selected piece of geo. This is what I've written:
import pymel.core as pm
sel = pm.ls(sl=1)
vertCount = pm.polyEvaluate(sel, v=1)
for vert in range(vertCount):
print pointPosition("%s.vtx[%s]" % (sel, vert))
Which brings up the error:
# Error: Maya Attribute does not exist: u"[nt.Transform(u'pCube1')].vtx[0]"
I don't understand these little PyMEL nodes. How do I access the string name of the selected object? I could manually type in the loop "pCube1.vtx[]" but that's not very dynamic. Accessing the shape of object selected doesn't work either. The node [nt.Transform(u'')] contains all the information I need (shape, transform, etc) right? I just have trouble accessing verts and other shape related information. What am I doing wrong here?
Thanks for any help!
import pymel.core as pm
sel = pm.ls(sl=1)
vertCount = pm.polyEvaluate(sel, v=1)
for vert in range(vertCount):
print pointPosition("%s.vtx[%s]" % (sel, vert))
Which brings up the error:
# Error: Maya Attribute does not exist: u"[nt.Transform(u'pCube1')].vtx[0]"
I don't understand these little PyMEL nodes. How do I access the string name of the selected object? I could manually type in the loop "pCube1.vtx[]" but that's not very dynamic. Accessing the shape of object selected doesn't work either. The node [nt.Transform(u'')] contains all the information I need (shape, transform, etc) right? I just have trouble accessing verts and other shape related information. What am I doing wrong here?
Thanks for any help!
