pymel.core.general.xform

xform(*args, **kwargs)

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 In query mode, return type is based on queried flag.

Flags:
Long name (short name) Argument Types Properties
absolute (a) bool ../../../_images/create.gif
 
perform absolute transformation (default)
boundingBox (bb) bool ../../../_images/query.gif
 
Returns the bounding box of an object. The values returned are in the following order: xmin ymin zmin xmax ymax zmax.
boundingBoxInvisible (bbi) bool ../../../_images/query.gif
 

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) bool ../../../_images/create.gif
 
Set pivot points to the center of the object’s bounding box. (see -p flag)
deletePriorHistory (dph) bool  
   
euler (eu) bool ../../../_images/create.gif
 
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 ../../../_images/create.gif ../../../_images/query.gif
 
Sets/returns the composite transformation matrix. *Note* the matrix is represented by 16 double arguments that are specified in row order.
objectSpace (os) bool ../../../_images/create.gif ../../../_images/query.gif
 
treat values as object-space transformation values (only works for pivots, translations, rotation, rotation axis, matrix, and bounding box flags)
pivots (piv) float, float, float ../../../_images/create.gif ../../../_images/query.gif
 
convenience method that changes both the rotate and scale pivots simultaneously. (see -rp -sp flags for more info)
preserve (p) bool ../../../_images/create.gif
 

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) bool  
   
reflection (rfl) bool  
   
reflectionAboutBBox (rab) bool  
   
reflectionAboutOrigin (rao) bool  
   
reflectionAboutX (rax) bool  
   
reflectionAboutY (ray) bool  
   
reflectionAboutZ (raz) bool  
   
reflectionTolerance (rft) float  
   
relative (r) bool ../../../_images/create.gif
 
perform relative transformation
rotateAxis (ra) float, float, float ../../../_images/create.gif ../../../_images/query.gif
 
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) unicode ../../../_images/create.gif ../../../_images/query.gif
 

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) float, float, float ../../../_images/create.gif ../../../_images/query.gif
 
rotate pivot point transformation (when used with the -p flag the overall transformation is preserved by modifying the rotation translation)
rotateTranslation (rt) float, float, float ../../../_images/create.gif ../../../_images/query.gif
 
rotation translation
rotation (ro) float, float, float ../../../_images/create.gif ../../../_images/query.gif
 
rotation transformation
scale (s) float, float, float ../../../_images/create.gif ../../../_images/query.gif
 
scale transformation
scalePivot (sp) float, float, float ../../../_images/create.gif ../../../_images/query.gif
 
scale pivot point transformation (when used with the -p flag the overall transformation is preserved by modifying the scale translation)
scaleTranslation (st) float, float, float ../../../_images/create.gif ../../../_images/query.gif
 
scale translation
shear (sh) float, float, float ../../../_images/create.gif ../../../_images/query.gif
 
shear transformation. The values represent the shear xy,xz,yz
translation (t) float, float, float ../../../_images/create.gif ../../../_images/query.gif
 
translation
worldSpace (ws) bool ../../../_images/create.gif ../../../_images/query.gif
 
treat values as world-space transformation values (only works for pivots, translations, rotation, rotation axis, matrix, and bounding box flags)
worldSpaceDistance (wd) bool ../../../_images/create.gif ../../../_images/query.gif
 

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) bool ../../../_images/create.gif
 

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 commandFlag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.xform

Example:

import pymel.core as pm

import maya.cmds as cmds

# create object to manipulate
pm.sphere( n='sphere1' )
# Result: [nt.Transform(u'sphere1'), nt.MakeNurbSphere(u'makeNurbSphere1')] #

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

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

Previous topic

pymel.core.general.validComponentIndexType

Next topic

pymel.core.general.Attribute

Core

Core Modules

Other Modules

This Page