Hi Jeremy,

Almost all nodes in Maya is inherited from some other node; e.g.
shape<http://download.autodesk.com/global/docs/maya2013/en_us/Nodes/shape.html>inherits
dagNode<http://download.autodesk.com/global/docs/maya2013/en_us/Nodes/dagNode.html>
.

You can query this inheritance using the
cmds.nodeType<http://download.autodesk.com/global/docs/maya2013/en_us/CommandsPython/nodeType.html>command:

from maya import cmds
if 'dagNode' in cmds.nodeType('pCubeShape1', inherited=True):
    print "This is a dag node"

​


On 23 May 2014 05:38, Jeremy YeoKhoo <[email protected]> wrote:

> (Sorry I posted this up before but tried to edit it.)
>
>
> Hi guys,
>
> This is a bit silly. But...
> I am trying to determine if a queried object is a dag node or a shape node
> because my current example code has the following....
>
> import maya.cmds as cmds
>
> obj= cmds.polySphere(r= 1, sx= 20, sy= 20, ax=[0, 1, 0], cuv= 2, ch= 0)
> cmds.select(obj, r=1)
> sels= cmds.ls(sl=1)
> result= cmds.listRelatives(sels[0],c=1, s=0)
>
> within result, I still get a shape object in the list....
> So the way I check if it is a DAG node, I would then
>
> for r in result:
>     if cmds.objExists(r+"tx"):
>        print "This is daggy"
>
>
> Is there a better way of coding this?
>
> -Jeremy
>
> --
> 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/1751a6c9-4611-45ae-b92f-dbcb41e14a56%40googlegroups.com<https://groups.google.com/d/msgid/python_inside_maya/1751a6c9-4611-45ae-b92f-dbcb41e14a56%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Marcus Ottosson*
[email protected]

-- 
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/CAFRtmOAnT9J13NZ3kkg_qvPU9MxfRrEzAMA%2BUNEwKarxDACizw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to