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


alignCtx( [contextName] , [align=boolean], [anchorFirstObject=boolean], [distribute=boolean], [exists=boolean], [history=boolean], [image1=string], [image2=string], [image3=string], [name=string], [showAlignTouch=boolean])

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

alignCtx is undoable, queryable, and editable.

The alignCtx command creates a tool for aligning and distributing objects.

Return value

string(name of the new context)

In query mode, return type is based on queried flag.


align, anchorFirstObject, distribute, exists, history, image1, image2, image3, name, showAlignTouch
Long name (short name) Argument types Properties
exists(ex) boolean create
Returns true or false depending upon whether the specified object exists. Other flags are ignored.
image1(i1) string createqueryedit
image2(i2) string createqueryedit
image3(i3) string createqueryedit
Contexts support up to three icons that represent the tool associated with the context.
history(ch) boolean create
If this is a tool command, turn the construction history on for the tool in question.
name(n) string create
If this is a tool command, name the tool appropriately.
align(a) boolean createqueryedit
Align objects
distribute(d) boolean createqueryedit
Distribute objects
anchorFirstObject(afo) boolean createqueryedit
Anchor first or last selected object. Default false. Only applicable when aligning objects.
showAlignTouch(sat) boolean createqueryedit
Show or hide align touching handles. Default true. Only applicable when aligning objects.

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 a poly sphere and a poly cube, then move them apart
cmds.polySphere(r=3, n='pSphere1')
cmds.move(5, 0, 0)
cmds.polyCube(w=3, h=3, d=3, n='pCube1')
cmds.move(-5, 3, 0)
cmds.select('pSphere1', 'pCube1', r=True)

# Create a new align context which is used to align objects, then switch to it
# Now you can use this tool to align objects