The alignCtx command creates a tool for aligning and distributing objects.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
align (a) | bool | ||
|
|||
anchorFirstObject (afo) | bool | ||
|
|||
distribute (d) | bool | ||
|
|||
exists (ex) | bool | ||
|
|||
history (ch) | bool | ||
|
|||
image1 (i1) | unicode | ||
image2 (i2) | unicode | ||
image3 (i3) | unicode | ||
|
|||
name (n) | unicode | ||
|
|||
showAlignTouch (sat) | bool | ||
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')