Hello list,
I'm trying to use calculate the index of the nearest face of a plane
to a point, I've seen that there's a node called "closestPointOnMesh"
that can do this job but I don't know how to use it in python...
actually I don't know how to set the mesh attribute...
This is what I have so far:
import maya.cmds as cmds
myNode = cmds.createNode("closestPointOnMesh")
cmds.setAttr( "%s.ip"%myNode,-10.887166, 0.977407,
14.022607,type="double3")
cmds.setAttr( "%s.im"%myNode, "pPlane1", type="mesh")
cmds.getAttr("%s.result.closestFaceIndex"%myNode)
I'm getting this error when trying to set the input mesh attribute
# Error: Error reading data element number 1: pPlane1
# Traceback (most recent call last):
# File "<maya console>", line 2, in ?
# RuntimeError: Error reading data element number 1: pPlane1
Does anybody know how to do this right??
thanks!
/lui
--~--~---------~--~----~------------~-------~--~----~
Yours,
Maya-Python Club Team.
-~----------~----~----~----~------~----~------~--~---