Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getting group name in Python

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
1813 Views, 2 Replies

Getting group name in Python

Hey guys

 

So, I have two questions:

 

1) See the group in the yellow? How do I get it so it says "Left Elbow Joint_Offset Group" instead of "u_Left_Elbow_Joint__Offset_Group"?

 

2) I want to set the attributes of the group using the setAttr command, but how do I get the name of the group for the command i.e cmds.setAttr("Left Elbow Joint_Offset Group")?

 

ThanksControl_Code_Problem.jpg

2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

1: I usually call the objects in the list by it's index that takes care of the "u_",  like this

 

selectionindex = selection[0]
offsetGroup = base.group(em=True, n=str(selectionindex)+"_offset_group")

 

Or if you need it to happen to all of the objects in the list 

 

for index in selection:
      offsetGroup = base.group(em=True, n=str(index)+"_offset_group")

 

 

2: You can select it by using 

 

cmds.select( '*_group' )
groupselection = cmds.ls(sl=True)
print groupselection[0]

 

for example 🙂

 

I hope this help.

Message 3 of 3
Anonymous
in reply to: Anonymous

Awesome 🙂 that seems to have done the trick, thanks!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report