pymel.core.context.alignCtx

alignCtx(*args, **kwargs)

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

Flags:

Long Name / Short Name Argument Types Properties
align / a bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Align objects
anchorFirstObject / afo bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Anchor first or last selected object. Default false. Only applicable when aligning objects.
distribute / d bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Distribute objects
exists / ex bool ../../../_images/create.gif
  Returns true or false depending upon whether the specified object exists. Other flags are ignored.
history / ch bool ../../../_images/create.gif
  If this is a tool command, turn the construction history on for the tool in question.
image1 / i1 unicode ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  First of three possible icons representing the tool associated with the context.
image2 / i2 unicode ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Second of three possible icons representing the tool associated with the context.
image3 / i3 unicode ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Third of three possible icons representing the tool associated with the context.
name / n unicode ../../../_images/create.gif
  If this is a tool command, name the tool appropriately.
showAlignTouch / sat bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Show or hide align touching handles. Default true. Only applicable when aligning objects. Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.alignCtx

Example:

import pymel.core as pm

# Create a poly sphere and a poly cube, then move them apart
pm.polySphere(r=3, n='pSphere1')
# Result: [nt.Transform(u'pSphere1'), nt.PolySphere(u'polySphere1')] #
pm.move(5, 0, 0)
pm.polyCube(w=3, h=3, d=3, n='pCube1')
# Result: [nt.Transform(u'pCube1'), nt.PolyCube(u'polyCube1')] #
pm.move(-5, 3, 0)
pm.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
pm.alignCtx('alignCtx1',a=True)
# Result: u'alignCtx1' #
pm.setToolTo('alignCtx1')