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

Synopsis

select( [objects...] , [add=boolean], [addFirst=boolean], [all=boolean], [allDagObjects=boolean], [allDependencyNodes=boolean], [clear=boolean], [containerCentric=boolean], [deselect=boolean], [hierarchy=boolean], [noExpand=boolean], [replace=boolean], [symmetry=boolean], [toggle=boolean], [visible=boolean])

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

select is undoable, NOT queryable, and NOT editable.

This command is used to put objects onto or off of the active list. If none of the five flags [-add, -af, -r, -d, -tgl] are specified, the default is to replace the objects on the active list with the given list of objects.

When selecting a set as in "select set1", the behaviour is for all the members of the set to become selected instead of the set itself. If you want to select a set, the "-ne/noExpand" flag must be used.

With the advent of namespaces, selection by name may be confusing. To clarify, without a qualified namespace, name lookup is limited to objects in the root namespace ":". There are really two parts of a name: the namespace and the name itself which is unique within the namespace. If you want to select objects in a specific namespace, you need to include the namespace separator ":".

For example, 'select -r "foo*"' is trying to look for an object with the "foo" prefix in the root namespace. It is not trying to look for all objects in the namespace with the "foo" prefix. If you want to select all objects in a namespace (foo), use 'select "foo:*"'.

Note: When the application starts up, there are several dependency nodes created by the system which must exist. These objects are not deletable but are selectable. All objects (dag and dependency nodes) in the scene can be obtained using the "ls" command without any arguments. When using the "-all", "adn/allDependencyNodes" or "-ado/allDagObjects" flags, only the deletable objects are selected. The non deletable object can still be selected by explicitly specifying their name as in "select time1;".

Return value

None

Related

selectKey, selectMode, selectPref, selectPriority, selectType, selectedNodes

Flags

add, addFirst, all, allDagObjects, allDependencyNodes, clear, containerCentric, deselect, hierarchy, noExpand, replace, symmetry, toggle, visible
Long name (short name) Argument types Properties
all(all) boolean create
Indicates that all deletable root level dag objects and all deletable non-dag dependency nodes should be selected.
allDependencyNodes(adn) boolean create
Indicates that all deletable dependency nodes including all deletable dag objects should be selected.
allDagObjects(ado) boolean create
Indicates that all deletable root level dag objects should be selected.
visible(vis) boolean create
Indicates that of the specified items only those that are visible should be affected.
hierarchy(hi) boolean create
Indicates that all children, grandchildren, ... of the specified dag objects should also be selected.
add(add) boolean create
Indicates that the specified items should be added to the active list without removing existing items from the active list.
addFirst(af) boolean create
Indicates that the specified items should be added to the front of the active list without removing existing items from the active list.
replace(r) boolean create
Indicates that the specified items should replace the existing items on the active list.
deselect(d) boolean create
Indicates that the specified items should be removed from the active list if they are on the active list.
toggle(tgl) boolean create
Indicates that those items on the given list which are on the active list should be removed from the active list and those items on the given list which are not on the active list should be added to the active list.
clear(cl) boolean create
Clears the active list. This is more efficient than "select -d;". Also "select -d;" will not remove sets from the active list unless the "-ne" flag is also specified.
noExpand(ne) boolean create
Indicates that any set which is among the specified items should not be expanded to its list of members. This allows sets to be selected as opposed to the members of sets which is the default behaviour.
containerCentric(cc) boolean create
Specifies that the same selection rules as apply to selection in the main viewport will also be applied to the select command. In particular, if the specified objects are members of a black-boxed container and are not published as nodes, Maya will not select them. Instead, their first parent valid for selection will be selected.
symmetry(sym) boolean create
Specifies that components should be selected symmetrically using the currenct symmetricModelling command settings. If symmetric modeling is not enabled then this flag has no effect.

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 some objects and add them to a set
cmds.sphere( n='sphere1' )
cmds.sphere( n='sphere2' )
cmds.sets( 'sphere1', 'sphere2', n='set1' )

# select all dag objects and all dependency nodes
cmds.select( all=True )

# clear the active list
cmds.select( clear=True )

# select sphere2 only if it is visible
cmds.select( 'sphere2', visible=True )

# select a couple of objects regardless of visibilty
cmds.select( 'sphere1', r=True )
cmds.select( 'sphere2', add=True )

# remove one of the spheres from the active list (using toggle)
cmds.select( 'sphere1', tgl=True )

# remove the other sphere from the active list
cmds.select( 'sphere2', d=True )

# the following selects all the members of set1
cmds.select( 'set1' )

# this selects set1 itself
cmds.select( 'set1', ne=True )


# Some examples selecting with namespaces:

# create a namespace and an object in the namespace
cmds.namespace( add='foo' )
cmds.namespace( set='foo' )
cmds.sphere( n='bar' )

# 'select bar' will not select "bar" unless bar is in the
# root namespace. You need to qualify the name with the
# namespace (shown below).
cmds.select( 'foo:bar' )

# select all the objects in a namespace
cmds.select( 'foo:*' )