Go to: Synopsis. Return value. Related. Flags. Python examples.

Synopsis

group( [objects...] , [absolute=boolean], [empty=boolean], [name=string], [parent=string], [relative=boolean], [useAsGroup=string], [world=boolean])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

group is undoable, NOT queryable, and NOT editable.

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.

Return value

string - name of the group node

Related

duplicate, instance, parent, ungroup

Flags

absolute, empty, name, parent, relative, useAsGroup, world
Long name (short name) Argument types Properties
name(n) string create
Assign given name to new group node.
world(w) boolean create
put the new group under the world
parent(p) string create
put the new group under the given parent
empty(em) boolean create
create an empty group (with no objects in it)
relative(r) boolean create
preserve existing local object transformations (relative to the new group node)
absolute(a) boolean create
preserve existing world object transformations (overall object transformation is preserved by modifying the objects local transformation) [default]
useAsGroup(uag) string create
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 command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

# create an empty group node with no children
cmds.group( em=True, name='null1' )
# create some objects and group them
cmds.sphere( n='sphere1' )
cmds.circle( n='circle1' )
cmds.group( 'circle1', 'sphere1', n='group1' )
# create a group node under another node and move
# the sphere under the new group node.
cmds.group( 'sphere1', parent='null1' )