You may need to remove duplicates, when there are more than one shape under
a transform.

from maya import cmds

transform = cmds.createNode("transform")
shape1 = cmds.createNode("nurbsCurve", parent=transform)
shape2 = cmds.createNode("nurbsCurve", parent=transform)

shapes = cmds.ls(type="nurbsCurve")
transforms = cmds.listRelatives(shapes, parent=True)assert
len(transforms) == 2  # Should be 1

​

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

Reply via email to