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 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' % selectedObject)
- pointB = cmds.pointPosition('%s.cv' % selectedObject)
- print('pointA is: ' + str(pointA))
- print('pointB is: ' + str(pointB))
Note that this won’t work:
pointA = cmds.pointPosition(str(selectedCurve.cv), world = True)
Because the .cv is not separated out.
This however will work:
pointA = cmds.pointPosition(str(selectedCurve) + ‘.cv’, world = True)#this is just another way of converting a variable to a string.
Because the .cv is separated out.
Also as mentioned in the code, the index for the cv points starts as . Autodesk documentation indicates that it starts a .Share