Go to: Synopsis. Return value. Flags. Python examples.

Synopsis

snapTogetherCtx( [contextName] , [clearSelection=boolean], [exists=boolean], [history=boolean], [image1=string], [image2=string], [image3=string], [name=string], [setOrientation=boolean], [snapPolygonFace=boolean])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

snapTogetherCtx is undoable, queryable, and editable.

The snapTogetherCtx command creates a tool for snapping surfaces together.

Return value

string(name of the new context)

In query mode, return type is based on queried flag.

Flags

clearSelection, exists, history, image1, image2, image3, name, setOrientation, snapPolygonFace
Long name (short name) Argument types Properties
clearSelection(cs) boolean createqueryedit
Sets whether the tool should clear the selection on entry to the tool. Default true.
exists(ex) boolean create
Returns true or false depending upon whether the specified object exists. Other flags are ignored.
history(ch) boolean create
If this is a tool command, turn the construction history on for the tool in question.
image1(i1) string createqueryedit
First of three possible icons representing the tool associated with the context.
image2(i2) string createqueryedit
Second of three possible icons representing the tool associated with the context.
image3(i3) string createqueryedit
Third of three possible icons representing the tool associated with the context.
name(n) string create
If this is a tool command, name the tool appropriately.
setOrientation(so) boolean createqueryedit
Sets whether the tool should orient as well as moving an item. Default true.
snapPolygonFace(spf) boolean createqueryedit
Sets whether the tool should snap the cursor to polygon face centers. Default false.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

# Create two nurbs spheres, then move them apart
cmds.sphere(r=3, n='nurbsSphere1')
cmds.move(5, 0, 0)
cmds.sphere(r=3, n='nurbsSphere2')
cmds.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
cmds.snapTogetherCtx('snapTogetherCtx1', so=False)
cmds.setToolTo('snapTogetherCtx1')