om.MGlobal.clearSelectionList()
om.MGlobal.selectByName('pCube1')
sList = om.MSelectionList()
om.MGlobal.getActiveSelectionList(sList)
item = om.MDagPath()
sList.getDagPath(0, item)
item.extendToShape()
fnMesh = om.MFnMesh(item)
inPoint = om.MPoint(0, 2, 3)
outPoint = om.MPoint(0.0, 0.0, 0.0)
worldSpace = om.MSpace.kWorld
fnMesh.getClosestPoint(inPoint, outPoint, worldSpace)
print outPoint[2]
Or you can use simpler pymel function getClosestPoint(), from Mesh class, it's depend of what you want.
Cya!
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe