pymel.core.context.snapTogetherCtx

static context.snapTogetherCtx(*args, **kwargs)

The snapTogetherCtx command creates a tool for snapping surfaces together.

Flags:
Long name (short name) Argument Types Properties
clearSelection (cs) bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 
Sets whether the tool should clear the selection on entry to the tool. Default true.
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
   
image2 (i2) unicode ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
   
image3 (i3) unicode ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 
Contexts support up to three icons that represent the tool associated with the context.
name (n) unicode ../../../_images/create.gif
 
If this is a tool command, name the tool appropriately.
setOrientation (so) bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 
Sets whether the tool should orient as well as moving an item. Default true.
snapPolygonFace (spf) bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

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')

Previous topic

pymel.core.context.skinBindCtx

Next topic

pymel.core.context.snapshotBeadContext

Core

Core Modules

Other Modules

This Page