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: 

Set attribute of offset group

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Anonymous
1046 Views, 4 Replies

Set attribute of offset group

Anonymous
Not applicable

Hi, guys

 

Okay, here is my code:

 

def groupAndSelect():
    selection = base.ls(sl=True)
    selectionindex = selection[0]
    offsetGroup = base.group(em=True, n=str(selectionindex)+"_Offset_Group")
    base.parent(offsetGroup, selection)


    base.setAttr("*_Offset_Group.translateX", 0)

The red code is the issue, here is the lowdown: I'm trying to make a function that will select a joint and then assign a an offset group to it and the add a nurbs ctrl.

 

The key problem I'm having now is that I've managed to assign the group to the joint but I can't zero out its translate/rotate values.

 

The question I'm asking is how do I select the offset group and then zero out the translate/rotate attributes? I've been trying to use the setAttr command with no luck, is there another way or is there something I'm doing wrong?

 

Thanks

0 Likes

Set attribute of offset group

Hi, guys

 

Okay, here is my code:

 

def groupAndSelect():
    selection = base.ls(sl=True)
    selectionindex = selection[0]
    offsetGroup = base.group(em=True, n=str(selectionindex)+"_Offset_Group")
    base.parent(offsetGroup, selection)


    base.setAttr("*_Offset_Group.translateX", 0)

The red code is the issue, here is the lowdown: I'm trying to make a function that will select a joint and then assign a an offset group to it and the add a nurbs ctrl.

 

The key problem I'm having now is that I've managed to assign the group to the joint but I can't zero out its translate/rotate values.

 

The question I'm asking is how do I select the offset group and then zero out the translate/rotate attributes? I've been trying to use the setAttr command with no luck, is there another way or is there something I'm doing wrong?

 

Thanks

Labels (3)
4 REPLIES 4
Message 2 of 5
mcw0
in reply to: Anonymous

mcw0
Advisor
Advisor

Your code worked fine for me.  Another command to zero out values is the "makeIdentity" command.  Give that a try.  But your code is working for me.

0 Likes

Your code worked fine for me.  Another command to zero out values is the "makeIdentity" command.  Give that a try.  But your code is working for me.

Message 3 of 5
Anonymous
in reply to: mcw0

Anonymous
Not applicable

Ah, I should've mentioned this in the original: if I create more than one offset_group the code fails, I presume because it's trying to deal with multiple "offset_groups" in the scene. The idea behind this code is that it can be used multiple times.

0 Likes

Ah, I should've mentioned this in the original: if I create more than one offset_group the code fails, I presume because it's trying to deal with multiple "offset_groups" in the scene. The idea behind this code is that it can be used multiple times.

Message 4 of 5
mcw0
in reply to: Anonymous

mcw0
Advisor
Advisor
Accepted solution

Ah...of course.  "setAttr" only does one node at a time.  So you would have to loop through your offsetGrps.  Whereas "makeIdentity" works on any number of selections.

0 Likes

Ah...of course.  "setAttr" only does one node at a time.  So you would have to loop through your offsetGrps.  Whereas "makeIdentity" works on any number of selections.

Message 5 of 5
Anonymous
in reply to: mcw0

Anonymous
Not applicable

That seems to have done it! Thanks 🙂

0 Likes

That seems to have done it! Thanks 🙂

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

Post to forums  

Autodesk Design & Make Report