pymel.core.general.rotate

rotate(obj, *args, **kwargs)

The rotate command is used to change the rotation of geometric objects. The rotation values are specified as Euler angles (rx, ry, rz). The values are interpreted based on the current working unit for Angular measurements. Most often this is degrees. The default behaviour, when no objects or flags are passed, is to do a absolute rotate on each currently selected object in the world space.

Modifications:
  • allows any iterable object to be passed as first argument:

    rotate("pSphere1", [0,1,2])
    

NOTE: this command also reorders the argument order to be more intuitive, with the object first

Flags:
Long name (short name) Argument Types Properties
absolute (a) bool ../../../_images/create.gif
 
Perform an absolute operation.
centerPivot (cp) bool ../../../_images/create.gif
 
Let the pivot be the center of the bounding box of all objects
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.
objectCenterPivot (ocp) bool ../../../_images/create.gif
 
Let the pivot be the center of the bounding box of each object
objectSpace (os) bool ../../../_images/create.gif
 
Perform rotation about object-space axis.
pivot (p) float, float, float ../../../_images/create.gif
 
Define the pivot point for the transformation
preserveChildPosition (pcp) bool  
   
preserveUV (puv) bool ../../../_images/create.gif
 

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.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list.

reflection (rfl) bool ../../../_images/create.gif
 
To move the corresponding symmetric components also.
reflectionAboutBBox (rab) bool ../../../_images/create.gif
 
Sets the position of the reflection axis at the geometry bounding box
reflectionAboutOrigin (rao) bool ../../../_images/create.gif
 
Sets the position of the reflection axis at the origin
reflectionAboutX (rax) bool ../../../_images/create.gif
 
Specifies the X=0 as reflection plane
reflectionAboutY (ray) bool ../../../_images/create.gif
 
Specifies the Y=0 as reflection plane
reflectionAboutZ (raz) bool ../../../_images/create.gif
 
Specifies the Z=0 as reflection plane
reflectionTolerance (rft) float ../../../_images/create.gif
 
Specifies the tolerance to findout the corresponding reflected components
relative (r) bool ../../../_images/create.gif
 
Perform a operation relative to the object’s current position
rotateX (x) bool ../../../_images/create.gif
 
Rotate in X direction
rotateXY (xy) bool ../../../_images/create.gif
 
Rotate in X and Y direction
rotateXYZ (xyz) bool ../../../_images/create.gif
 
Rotate in all directions (default)
rotateXZ (xz) bool ../../../_images/create.gif
 
Rotate in X and Z direction
rotateY (y) bool ../../../_images/create.gif
 
Rotate in Y direction
rotateYZ (yz) bool ../../../_images/create.gif
 
Rotate in Y and Z direction
rotateZ (z) bool ../../../_images/create.gif
 
Rotate in Z direction
worldSpace (ws) bool ../../../_images/create.gif
 
Perform rotation about global world-space axis.

Derived from mel command maya.cmds.rotate

Example:

import pymel.core as pm

# create a circle and grouped cone to rotate;
pm.circle( n='circle1' )
# Result: [nt.Transform(u'circle1'), nt.MakeNurbCircle(u'makeNurbCircle1')] #
pm.cone( ax=(0, 1, 0), n='cone1' )
# Result: [nt.Transform(u'cone1'), nt.MakeNurbCone(u'makeNurbCone1')] #
pm.group( 'cone1', n='group1' )
# Result: nt.Transform(u'group1') #

# rotate the active objects 45 degrees about the world space X axis
# centered at each object's rotate pivot point.
pm.select( 'cone1' )
pm.rotate( '45deg', 0, 0, r=True )

# Set the rotation values for group1 to (90, 0, 0). This is
# equivalent to:
#   pm.setAttr('group1.rx',90)
#   pm.setAttr('group1.ry',0)
#   pm.setAttr('group1.rz',0)
pm.rotate( '90deg', 0, 0, 'group1' )

# rotate the circle 180 degrees about its local space Y axis
# centered at the rotate pivot point 1 0 0.
pm.rotate( 0, '180deg', 0, 'circle1', pivot=(1, 0, 0) )

Previous topic

pymel.core.general.resetTool

Next topic

pymel.core.general.saveToolSettings

Core

Core Modules

Other Modules

This Page