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.
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
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
absolute (a) | bool | ||
|
|||
centerPivot (cp) | bool | ||
|
|||
deletePriorHistory (dph) | bool | ||
euler (eu) | bool | ||
|
|||
objectCenterPivot (ocp) | bool | ||
|
|||
objectSpace (os) | bool | ||
|
|||
pivot (p) | float, float, float | ||
|
|||
preserveChildPosition (pcp) | bool | ||
preserveUV (puv) | bool | ||
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 | ||
|
|||
reflectionAboutBBox (rab) | bool | ||
|
|||
reflectionAboutOrigin (rao) | bool | ||
|
|||
reflectionAboutX (rax) | bool | ||
|
|||
reflectionAboutY (ray) | bool | ||
|
|||
reflectionAboutZ (raz) | bool | ||
|
|||
reflectionTolerance (rft) | float | ||
|
|||
relative (r) | bool | ||
|
|||
rotateX (x) | bool | ||
|
|||
rotateXY (xy) | bool | ||
|
|||
rotateXYZ (xyz) | bool | ||
|
|||
rotateXZ (xz) | bool | ||
|
|||
rotateY (y) | bool | ||
|
|||
rotateYZ (yz) | bool | ||
|
|||
rotateZ (z) | bool | ||
|
|||
worldSpace (ws) | bool | ||
|
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) )