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

Synopsis

xform( [objects...] , [absolute=boolean], [boundingBox=boolean], [boundingBoxInvisible=boolean], [centerPivots=boolean], [centerPivotsOnComponents=boolean], [deletePriorHistory=boolean], [euler=boolean], [matrix=[float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float]], [objectSpace=boolean], [pivots=[linear, linear, linear]], [preserve=boolean], [preserveUV=boolean], [reflection=boolean], [reflectionAboutBBox=boolean], [reflectionAboutOrigin=boolean], [reflectionAboutX=boolean], [reflectionAboutY=boolean], [reflectionAboutZ=boolean], [reflectionTolerance=float], [relative=boolean], [rotateAxis=[angle, angle, angle]], [rotateOrder=string], [rotatePivot=[linear, linear, linear]], [rotateTranslation=[linear, linear, linear]], [rotation=[angle, angle, angle]], [scale=[float, float, float]], [scalePivot=[linear, linear, linear]], [scaleTranslation=[linear, linear, linear]], [shear=[float, float, float]], [translation=[linear, linear, linear]], [worldSpace=boolean], [worldSpaceDistance=boolean], [zeroTransformPivots=boolean])

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

xform is undoable, queryable, and NOT editable.

This command can be used query/set any element in a transformation node. It can also be used to query some values that cannot be set directly such as the transformation matrix or the bounding box. It can also set both pivot points to convenient values.

All values are specified in transformation coordinates. (attribute-space)

In addition, the attributes are applied/returned in the order in which they appear in the flags section. (which corresponds to the order they appear in the transformation matrix as given below)

See also: move, rotate, scale

Notes

The transformation matrix for a node is built by post-multiplying the following matrices in the given order (Note: rotations are applied according to the rotation order parameter and the 6 different rotation possibilities are not shown below)
-1                       -1
[M]  = [sp]x[s]x[sh]x[sp]x[st]x[rp]x[ar]x[ro]x[rp]x[rt]x[t]

where:

[sp] = | 1 0 0 0 | = scale pivot matrix | 0 1 0 0 | | 0 0 1 0 | | -spx -spy -spz 1 |

[s] = | sx 0 0 0 | = scale matrix | 0 sy 0 0 | | 0 0 sz 0 | | 0 0 0 1 |

[sh] = | 1 0 0 0 | = shear matrix | xy 1 0 0 | | xz yz 1 0 | | 0 0 0 1 |

-1 [sp] = | 1 0 0 0 | = scale pivot inverse matrix | 0 1 0 0 | | 0 0 1 0 | | spx spy spz 1 |

[st] = | 1 0 0 0 | = scale translate matrix | 0 1 0 0 | | 0 0 1 0 | | stx sty stz 1 |

[rp] = | 1 0 0 0 | = rotate pivot matrix | 0 1 0 0 | | 0 0 1 0 | | -rpx -rpy -rpz 1 |

[ar] = | * * * 0 | = axis rotation matrix | * * * 0 | (composite rotation, | * * * 0 | see [rx], [ry], [rz] | 0 0 0 1 | below for details)

[rx] = | 1 0 0 0 | = rotate X matrix | 0 cos(x) sin(x) 0 | | 0 -sin(x) cos(x) 0 | | 0 0 0 1 |

[ry] = | cos(y) 0 -sin(y) 0 | = rotate Y matrix | 0 1 0 0 | | sin(y) 0 cos(y) 0 | | 0 0 0 1 |

[rz] = | cos(z) sin(z) 0 0 | = rotate Z matrix | -sin(z) cos(z) 0 0 | | 0 0 1 0 | | 0 0 0 1 |

-1 [rp] = | 1 0 0 0 | = rotate pivot matrix | 0 1 0 0 | | 0 0 1 0 | | rpx rpy rpz 1 |

[rt] = | 1 0 0 0 | = rotate translate matrix | 0 1 0 0 | | 0 0 1 0 | | rtx rty rtz 1 |

[t] = | 1 0 0 0 | = translation matrix | 0 1 0 0 | | 0 0 1 0 | | tx ty tz 1 |

Return value

None

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

Related

move, rotate, scale

Flags

absolute, boundingBox, boundingBoxInvisible, centerPivots, centerPivotsOnComponents, deletePriorHistory, euler, matrix, objectSpace, pivots, preserve, preserveUV, reflection, reflectionAboutBBox, reflectionAboutOrigin, reflectionAboutX, reflectionAboutY, reflectionAboutZ, reflectionTolerance, relative, rotateAxis, rotateOrder, rotatePivot, rotateTranslation, rotation, scale, scalePivot, scaleTranslation, shear, translation, worldSpace, worldSpaceDistance, zeroTransformPivots
Long name (short name) Argument types Properties
absolute(a) boolean create
perform absolute transformation (default)
boundingBox(bb) boolean query
Returns the bounding box of an object. The values returned are in the following order: xmin ymin zmin xmax ymax zmax.
boundingBoxInvisible(bbi) boolean query
Returns the bounding box of an object. This includes the bounding boxes of all invisible children which are not included using the boundingBox flag. The values returned are in following order: xmin ymin zmin xmax ymax zmax.
centerPivots(cp) boolean create
Set pivot points to the center of the object's bounding box. (see -p flag)
centerPivotsOnComponents(cpc) boolean create
Set pivot points to the center of the component's bounding box. (see -p flag)
deletePriorHistory(dph) boolean create
If true then delete the construction history before the operation is performed.
euler(eu) boolean create
modifer for -relative flag that specifies rotation values should be added to current XYZ rotation values.
matrix(m) [float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float] createquery
Sets/returns the composite transformation matrix. *Note* the matrix is represented by 16 double arguments that are specified in row order.
objectSpace(os) boolean createquery
treat values as object-space transformation values (only works for pivots, translations, rotation, rotation axis, matrix, and bounding box flags)
pivots(piv) [linear, linear, linear] createquery
convenience method that changes both the rotate and scale pivots simultaneously. (see -rp -sp flags for more info)
preserve(p) boolean create
preserve overall transformation. used to prevent object from "jumping" when changing pivots or rotation order. the default value is true. (used with -sp, -rp, -roo, -cp, -ra)
preserveUV(puv) boolean create
When true, UV values on rotated components are projected across the rotation in 3d space. For small edits, this will freeze the world space texture mapping on the object. When false, the UV values will not change for a selected vertices. Default is false.
reflection(rfl) boolean create
To move the corresponding symmetric components also.
reflectionAboutBBox(rab) boolean create
Sets the position of the reflection axis at the geometry bounding box
reflectionAboutOrigin(rao) boolean create
Sets the position of the reflection axis at the origin
reflectionAboutX(rax) boolean create
Specifies the X=0 as reflection plane
reflectionAboutY(ray) boolean create
Specifies the Y=0 as reflection plane
reflectionAboutZ(raz) boolean create
Specifies the Z=0 as reflection plane
reflectionTolerance(rft) float create
Specifies the tolerance to findout the corresponding reflected components
relative(r) boolean create
perform relative transformation
rotateAxis(ra) [angle, angle, angle] createquery
rotation axis orientation (when used with the -p flag the overall rotation is preserved by modifying the rotation to compensate for the axis rotation)
rotateOrder(roo) string createquery
rotation order (when used with the -p flag the overall rotation is preserved by modifying the local rotation to be quivalent to the old one) Valid values for this flag are <xyz | yzx | zxy | xzy | yxz | zyx>
rotatePivot(rp) [linear, linear, linear] createquery
rotate pivot point transformation (when used with the -p flag the overall transformation is preserved by modifying the rotation translation)
rotateTranslation(rt) [linear, linear, linear] createquery
rotation translation
rotation(ro) [angle, angle, angle] createquery
rotation transformation
scale(s) [float, float, float] createquery
scale transformation
scalePivot(sp) [linear, linear, linear] createquery
scale pivot point transformation (when used with the -p flag the overall transformation is preserved by modifying the scale translation)
scaleTranslation(st) [linear, linear, linear] createquery
scale translation
shear(sh) [float, float, float] createquery
shear transformation. The values represent the shear <xy,xz,yz>
translation(t) [linear, linear, linear] createquery
translation
worldSpace(ws) boolean createquery
(works for pivots, translations, rotation, rotation axis, matrix, and bounding box flags). Note that, when querying the scale, that this calculation is cumulative and is only valid if there are all uniform scales and no rotation. In a hierarchy with non-uniform scale and rotation, this value may not correspond entirely with the perceived global scale.
worldSpaceDistance(wd) boolean createquery
Values for -sp, -rp, -st, -rt, -t, -piv flags are treated as world space distances to move along the local axis. (where the local axis depends on whether the command is operating in local-space or object-space. This flag has no effect for world space.
zeroTransformPivots(ztp) boolean create
reset pivot points and pivot translations without changing the overall matrix by applying these values into the translation channel.

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 object to manipulate
cmds.sphere( n='sphere1' )

# set rotation of sphere
cmds.xform( r=True, ro=(0, 90, 0) )

# change the rotate order but preserve the overall transformation
cmds.xform( p=True, roo='yzx' )