More than one object matches name!! -problem

More than one object matches name!! -problem

danielblaze
Contributor Contributor
7,534 Views
2 Replies
Message 1 of 3

More than one object matches name!! -problem

danielblaze
Contributor
Contributor

I have a heirarchy of groups with a lot of objects. Instead of selecting them manually want to do so via python, by selecting the main Group and when I run the script it selects all the mesh objects inside it. My problem so far is that I have objects with the same name and its giving me this error: ""More than one object matches name:""

How do I solve this please?

sample screenshot attached

 

Thanks in advance.

0 Likes
Accepted solutions (2)
7,535 Views
2 Replies
Replies (2)
Message 2 of 3

RFlannery1
Collaborator
Collaborator
Accepted solution

This is a common problem in Maya scripts.  Generally what you want to do is get the full path to your object.  Different commands have different flags for this.  For the "ls" command, you want to use the "long" flag.  For "listRelatives", you want to use the "fullPath" flag.

For example:

objSel = cmds.ls(sl=True, long=True)
objGRP = cmds.listRelatives(objSel, allDescendents=True, fullPath=True, type='mesh')
Message 3 of 3

mcw0
Advisor
Advisor
Accepted solution

No need for "fullPath" with listRelatives.  Just "path" is sufficient.