pymel.core.context.snapTogetherCtx¶
- snapTogetherCtx(*args, **kwargs)¶
The snapTogetherCtx command creates a tool for snapping surfaces together.
Flags:
Long Name / Short Name Argument Types Properties clearSelection / cs bool Sets whether the tool should clear the selection on entry to the tool. Default true. 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. setOrientation / so bool Sets whether the tool should orient as well as moving an item. Default true. 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')