This command groups the specified objects under a new group and returns the name of the new group. If the -em flag is specified, then an empty group (with no objects) is created. If the -w flag is specified then the new group is placed under the world, otherwise if -p is specified it is placed under the specified node. If neither -w or -p is specified the new group is placed under the lowest common group they have in common. (or the world if no such group exists) If an object is grouped with another object that has the same name then one of the objects will be renamed by this command.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
absolute (a) | bool | ||
|
|||
empty (em) | bool | ||
|
|||
name (n) | unicode | ||
|
|||
parent (p) | unicode | ||
|
|||
relative (r) | bool | ||
|
|||
useAsGroup (uag) | unicode | ||
Use the specified node as the group node. The specified node must be derived from the transform node and must not have any existing parents or children.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list. |
|||
world (w) | bool | ||
|
Derived from mel command maya.cmds.group
Example:
import pymel.core as pm
import maya.cmds as cmds
# create an empty group node with no children
pm.group( em=True, name='null1' )
# Result: nt.Transform(u'null1') #
# create some objects and group them
pm.sphere( n='sphere1' )
# Result: [nt.Transform(u'sphere1'), nt.MakeNurbSphere(u'makeNurbSphere1')] #
pm.circle( n='circle1' )
# Result: [nt.Transform(u'circle1'), nt.MakeNurbCircle(u'makeNurbCircle1')] #
pm.group( 'circle1', 'sphere1', n='group1' )
# Result: nt.Transform(u'group1') #
# create a group node under another node and move
# the sphere under the new group node.
pm.group( 'sphere1', parent='null1' )
# Result: nt.Transform(u'group2') #