So I'm convinced this is a Maya bug. I was able to partially create it. I 
figured out you have to get the path to the shape node instead of the 
transform. Maya is usually able to handle this but it doesn't for 
MMeshIntersector for some reason. What still doesn't work is the second 
parameter for the MMeshIntersector.create(). For some reason, it doesn't 
want to accept the MMatrix. Its not in the documentation but I found out 
you don't have to feed in the matrix to create the MMeshIntersector object.

import maya.api.OpenMaya as om
import pymel.core as pm

obj = pm.polyCube(ch=0)[0].getShape()
path = om.MGlobal.getSelectionListByName(obj.name()).getDependNode(0)

intersector = om.MMeshIntersector()
intersector.create(node)

This bit of code should work. The obj's matrix isn't taken into account, 
again because I think its bugged.

On Friday, November 10, 2017 at 11:07:42 AM UTC-6, mnhan wrote:
>
> I had the same problem, I also tried mesh.extendToShape().node() but got 
> the same RuntimeError.
> could not figure out why, I end up using MFnMesh.getClosestPoint()
>

-- 
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/4894dd0b-6c07-4c53-914d-d04317d1cc2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to