pymel.core.general.currentUnit

currentUnit(*args, **kwargs)

This command allows you to change the units in which you will work in Maya. There are three types of units: linear, angular and time. The current unit affects how all commands in Maya interpret their numeric values. For example, if the current linear unit is cm, then the command: move 5 -2 3; sphere -radius 4; will be interpreted as moving 5cm in X, -2cm in Y, 3cm in Z, and as creating a sphere with radius 4cm. Similarly, if the current time unit is Film (24 frames per second), then the command: currentTime 6; will be interpreted as setting the current time to frame 6 in the Film unit, which is 6/24 or 0.25 seconds. You can always override the unit of a particular numeric value to a command be specifying it one the command. For example, using the above examples: move 5m -2mm 3cm; sphere -radius 4inch; currentTime 6ntsc; would move the object 5 meters in X, -2 millimeters in Y, 3 centimeters in Z, create a sphere of radius 4 inches, and change the current time to 6 frames in the NTSC unit, which would be 0.2 seconds, or 4.8 frames in the current (Film) unit.

Flags:
Long name (short name) Argument Types Properties
angle (a) unicode ../../../_images/create.gif ../../../_images/query.gif
 
Set the current angular unit. Valid strings are:[deg | degree | rad | radian]When queried, returns a string which is the current angular unit
fullName (f) bool ../../../_images/query.gif
 

A query only flag. When specified in conjunction with any of the -linear/-angle/-time flags, will return the long form of the unit. For example, mmand millimeterare the same unit, but the former is the short form of the unit name, and the latter is the long form of the unit name.

linear (l) unicode ../../../_images/create.gif ../../../_images/query.gif
 

Set the current linear unit. Valid strings are:[mm | millimeter | cm | centimeter | m | meter | km | kilometer | in | inch | ft | foot | yd | yard | mi | mile]When queried, returns a string which is the current linear unit

time (t) unicode ../../../_images/create.gif ../../../_images/query.gif
 

Set the current time unit. Valid strings are:[hour | min | sec | millisec | game | film | pal | ntsc | show | palf | ntscf]When queried, returns a string which is the current time unit Note that there is no long form for any of the time units. The non-seconds based time units are interpreted as the following frames per second: game: 15 fpsfilm: 24 fpspal: 25 fpsntsc: 30 fpsshow: 48 fpspalf: 50 fpsntscf: 60 fps

updateAnimation (ua) bool ../../../_images/create.gif
 

An edit only flag. When specified in conjunction with the -time flag indicates that times for keys are not updated. By default when the current time unit is changed, the times for keys are modified so that playback timing is preserved. For example a key set a frame 12film is changed to frame 15ntsc when the current time unit is changed to ntsc, since they both represent a key at a time of 0.5 seconds. Specifying -updateAnimation false would leave the key at frame 12ntsc. Default is -updateAnimation true.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.currentUnit

Example:

import pymel.core as pm

import maya.cmds as cmds

# What is the current linear unit?
pm.currentUnit( query=True, linear=True )
# Result: u'cm' #

# What is the current angular unit in its long name form?
pm.currentUnit( fullName=True, query=True, angle=True )
# Result: u'degree' #

# Change the current time unit to ntsc
pm.currentUnit( time='ntsc' )
# Result: u'ntsc' #

# Change the current linear unit to inches
pm.currentUnit( linear='in' )
# Result: u'inch' #

Previous topic

pymel.core.general.createNode

Next topic

pymel.core.general.curveRGBColor

Core

Core Modules

Other Modules

This Page