I'm trying to move the selected object pivot to the center of a selection of vertices.
I have gotten to the point where I have the xform
defined, but can't seem to move the object (defined as obj
) pivot to this point
import maya.cmds as cmds
sel = cmds.ls(sl=True)
print sel
obj = cmds.ls(*sel, o=True)
print obj
selVerts = cmds.ls(sl=True)
tempClstr = cmds.cluster()
pos = cmds.xform(tempClstr[1], q=True, ws=True, rp=True)
loc = cmds.spaceLocator()
cmds.move(pos[0], pos[1], pos[2])
cmds.delete(tempClstr)
piv = cmds.xform (loc[1], piv=True, q=True, ws=True)
print piv
cmds.xform( obj, ws=True, piv=(piv[0], piv[1], piv[2]) )
Here's what I've got, any extra eyes that can spot what im missing would be greatly appreciated.