Hi

import maya.cmds as cmds

myDimNode=cmds.createNode("nearestPointOnMesh")

cmds.connectAttr('pPlane1.outMesh',myDimNode+'.inMesh')

myReult=cmds.getAttr(myDimNode+".nearestFaceIndex")

print myReult

i can get the result like this i am using maya 2009 ..closestPointOnMesh
changed to nearestPointOnMesh

check it

On Sat, Nov 15, 2008 at 8:07 PM, luigi <[EMAIL PROTECTED]> wrote:

>
> 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.
-~----------~----~----~----~------~----~------~--~---

  • ... luigi
    • ... kurian os ™ ®കോപ്പിയടിച്ചാല്©ഗോതമ്പുണ്ട!

Reply via email to