If you’ve ever inherited someone else’s model or found that you didn’t have the time to build it yourself you have probably run into this problem. When objects in your scene have their tranlations frozen off-axis, bad things tend to happen. As a TA it can mess with your scripts, and make it hard for Maya to find the objects true world space position. So, finally, I decided to write this little script to take a group of objects you have selected, could be geometry or groups, and gives them back their real world space translations. Have fun with it and be careful freezing transformations.

import maya.cmds as mc

objs = mc.ls(sl=True)

if objs:
    origin = mc.spaceLocator()[0]

    for obj in objs:
        pntConstraint = mc.pointConstraint(origin,obj,maintainOffset=False)
        getOffset = mc.xform(obj,q=True,worldSpace=True,translation=True)
        mc.delete(pntConstraint)
        mc.makeIdentity(obj,apply=True,translate=True)
        mc.xform(obj,worldSpace=True,translation=(-(getOffset[0]),-(getOffset[1]),-(getOffset[2])))

    mc.delete(origin)
    
if not objs:
    mc.error ("// Error, You Need To Have An Object Selected //")