So Autodesk documentation on this is sparse and a bit inaccurate.
In order to get this function to work you need to separate out the parameters at the ‘.’ (something I am finding is a common thread among many of maya’s library functions)
This is the way to do it:
- selectedObject = cmds.ls(selection = True)
- #Note that the .cv[0] is separated out from the variable, also note that the .cv index starts at 0, not at 1 as the maya documentation would lead you to believe
- pointA = cmds.pointPosition('%s.cv[0]' % selectedObject[0])
- pointB = cmds.pointPosition('%s.cv[1]' % selectedObject[0])
- print('pointA is: ' + str(pointA))
- print('pointB is: ' + str(pointB))
Note that this won’t work:
pointA = cmds.pointPosition(str(selectedCurve.cv[1]), world = True)
Because the .cv[1] is not separated out.
This however will work:
pointA = cmds.pointPosition(str(selectedCurve) + ‘.cv[0]’, world = True)#this is just another way of converting a variable to a string.
Because the .cv[1] is separated out.
Also as mentioned in the code, the index for the cv points starts as [0]. Autodesk documentation indicates that it starts a [1].
ShareJAN
2018
About the Author:
I RUN this joint! And I am a digital artist. BFA from the University of Colorado with an emphasis in 3D Animation. I worked in medical animation for some time. I then narrowly escaped with an only partially crushed spirit. Since then I have been expanding my skill set, reaching out into custom coding, game and app development.