0

I am using python to write a Maya script and I would like to be able to get a single coordinate value from a Maya object or object component.

In this case, I would like to retrieve only the y-coordinate value from a control vertex called "curve1.cv[1]"

I know how to get the full group of coordinates with:

cmds.pointPosition("curve1.cv[1]")
or

cmds.getAttr("curve1.cv[1]")

but both of these return a group of float values for x,y, and z. I would like to be able to return just a single float value for the y coordinate.

How can I do this?

-ps. this is my first post here and I am a beginner programmer. I apologize if this is the wrong place to ask questions about MEL/Python scripting.

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
Space9
  • 1
  • 2

1 Answers1

0
# You can also use pointPosition or getAttr
xyz = cmds.xform ( "curve1.cv[1]", query = True, translation = True )

# Use array index: xyz[0]=x, xyz[1]=y, xyz[1]=z
print xyz[1]
SAF
  • 309
  • 2
  • 13