The snapTogetherCtx command creates a tool for snapping surfaces together.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
clearSelection (cs) | bool | ||
|
|||
exists (ex) | bool | ||
|
|||
history (ch) | bool | ||
|
|||
image1 (i1) | unicode | ||
image2 (i2) | unicode | ||
image3 (i3) | unicode | ||
|
|||
name (n) | unicode | ||
|
|||
setOrientation (so) | bool | ||
|
|||
snapPolygonFace (spf) | bool | ||
Sets whether the tool should snap the cursor to polygon face centers. Default false. Flag can have multiple arguments, passed either as a tuple or a list. |
Derived from mel command maya.cmds.snapTogetherCtx
Example:
import pymel.core as pm
# Create two nurbs spheres, then move them apart
pm.sphere(r=3, n='nurbsSphere1')
# Result: [nt.Transform(u'nurbsSphere1'), nt.MakeNurbSphere(u'makeNurbSphere1')] #
pm.move(5, 0, 0)
pm.sphere(r=3, n='nurbsSphere2')
# Result: [nt.Transform(u'nurbsSphere2'), nt.MakeNurbSphere(u'makeNurbSphere2')] #
pm.move(-5, 0, 0)
# Create a new snap together tool context, set it to move objects only, then switch to it
# You can use this tool to snap two spheres together
pm.snapTogetherCtx('snapTogetherCtx1', so=False)
# Result: u'snapTogetherCtx1' #
pm.setToolTo('snapTogetherCtx1')