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 Align objects anchorFirstObject / afo bool Anchor first or last selected object. Default false. Only applicable when aligning objects. distribute / d bool Distribute objects exists / ex bool Returns true or false depending upon whether the specified object exists. Other flags are ignored. history / ch bool If this is a tool command, turn the construction history on for the tool in question. image1 / i1 unicode First of three possible icons representing the tool associated with the context. image2 / i2 unicode Second of three possible icons representing the tool associated with the context. image3 / i3 unicode Third of three possible icons representing the tool associated with the context. name / n unicode If this is a tool command, name the tool appropriately. 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')