So, I'm seeing some very odd behavior in Maya 2017
(Not sure if this affects other versions, but this is the version I'm 
testing with)

import maya.api.OpenMaya as om
import maya.cmds as cmds
sphere = cmds.polySphere(name="sphere")
compare = cmds.polySphere(name="compare")
cmds.xform("{}.vtx[10]".format(sphere[0]), translation=(1,1,1))

selectionList = om.MSelectionList()
selectionList.add(sphere[0])
selectionList.add(compare[0])
sphereDagPath = selectionList.getDagPath(0)
compareDagPath = selectionList.getDagPath(1)
sphereMeshFn = om.MFnMesh(sphereDagPath)
compareMeshFn = om.MFnMesh(compareDagPath)
sphereMeshFn.getFloatPoints()[10].distanceTo(compareMeshFn.getFloatPoints()[10])

So, if you enter all the above in the Script Editor, and execute the last 
line, you'll sometimes get the correct answer: 2.485206365585327, and other 
times 0.0
So, you can test this by selecting the last line in the Script Editor, and 
press-and-hold CTRL-ENTER and watching the results go by in the Script 
Editor.

If you select just the  sphereMeshFn.getFloatPoints()[10]part, and 
press-and-hold CTRL-ENTER, the vertex position will not change.  Similarly, 
with the compareMeshFn.getFloatPoints()[10])part 

If we enter these lines
x = sphereMeshFn.getFloatPoints()[10]
y = compareMeshFn.getFloatPoints()[10]

Sometimes, the value of x will change when y is assigned.

I really can't comprehend this particular behavior, and it seems like a bug 
to me.

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/292f92da-6f30-4a2b-9206-20eaa106a494%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to