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: 

Group Pivot Point Problem

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

Group Pivot Point Problem

Anonymous
Not applicable

Hey guys, so here is my problem:

I'm trying to create a code that creates an offset group with a NURBS control for joint structures. The offsetgroup needs to have the same pivot point and XYZ transformations as the selected joint.

 

Problem is, however, the group doesn't seem to want to centre it's pivot point to the joint and instead sets itself to the corner of the NURBS control (see the photo). What I need to know is how to set the offset group so that it's pivot is centered then the same as the joint? Any ideas guys?

Here is the code I'm currently using:

 

import maya.cmds as base


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

base.parent(offsetGroup, selection)
groupselection = base.ls(sl=True)
base.makeIdentity(r=True, t=True)
newCtrl = base.curve( d=1, p=[(0, 0, 0), (0, 0, 2), (2, 0, 2), (2, 0, 0), (0, 0, 0), (0, 2, 0), (0, 2, 2), (2, 2, 2), (2, 2, 0), (0, 2, 0), (2, 2, 0), (2, 0, 0), (2, 0, 2), (2, 2, 2), (0, 2, 2), (0, 0, 2)] )
base.xform(cp=True)
base.parent(newCtrl, offsetGroup)
base.makeIdentity(t=True, r=True)
base.xform(newCtrl, cp=True)

base.parent(groupselection, world=True)

 

Control_Code_Problem_3.jpg

0 Likes

Group Pivot Point Problem

Hey guys, so here is my problem:

I'm trying to create a code that creates an offset group with a NURBS control for joint structures. The offsetgroup needs to have the same pivot point and XYZ transformations as the selected joint.

 

Problem is, however, the group doesn't seem to want to centre it's pivot point to the joint and instead sets itself to the corner of the NURBS control (see the photo). What I need to know is how to set the offset group so that it's pivot is centered then the same as the joint? Any ideas guys?

Here is the code I'm currently using:

 

import maya.cmds as base


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

base.parent(offsetGroup, selection)
groupselection = base.ls(sl=True)
base.makeIdentity(r=True, t=True)
newCtrl = base.curve( d=1, p=[(0, 0, 0), (0, 0, 2), (2, 0, 2), (2, 0, 0), (0, 0, 0), (0, 2, 0), (0, 2, 2), (2, 2, 2), (2, 2, 0), (0, 2, 0), (2, 2, 0), (2, 0, 0), (2, 0, 2), (2, 2, 2), (0, 2, 2), (0, 0, 2)] )
base.xform(cp=True)
base.parent(newCtrl, offsetGroup)
base.makeIdentity(t=True, r=True)
base.xform(newCtrl, cp=True)

base.parent(groupselection, world=True)

 

Control_Code_Problem_3.jpg

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

mcw0
Advisor
Advisor
Accepted solution

Might I suggest the following:

 

1.  Create your control curve.

2.  Group the control curve to itself and name it your offset group

3.  Delete a parent constraint of your offset group to your joint.

0 Likes

Might I suggest the following:

 

1.  Create your control curve.

2.  Group the control curve to itself and name it your offset group

3.  Delete a parent constraint of your offset group to your joint.

Message 3 of 3
Anonymous
in reply to: mcw0

Anonymous
Not applicable

A bit of tweaking but that seems to have done the trick. Added a matchTransform instruction and it's worked 🙂 thanks!

0 Likes

A bit of tweaking but that seems to have done the trick. Added a matchTransform instruction and it's worked 🙂 thanks!

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

Post to forums  

Autodesk Design & Make Report