Go to: Synopsis. Return value. Related. Flags. Python examples.
currentUnit([angle=string], [fullName=boolean], [linear=string], [time=string], [updateAnimation=boolean])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
currentUnit is undoable, queryable, and NOT editable.
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.
| string | The new current unit that has been set |
In query mode, return type is based on queried flag.
| Long name (short name) | Argument types | Properties | ||
|---|---|---|---|---|
angle(a)
|
string
|
|
||
|
||||
fullName(f)
|
boolean
|
|
||
|
||||
linear(l)
|
string
|
|
||
|
||||
time(t)
|
string
|
|
||
|
||||
updateAnimation(ua)
|
boolean
|
|
||
|
||||
import maya.cmds as cmds # What is the current linear unit? cmds.currentUnit( query=True, linear=True ) # What is the current angular unit in its long name form? cmds.currentUnit( fullName=True, query=True, angle=True ) # Change the current time unit to ntsc cmds.currentUnit( time='ntsc' ) # Change the current linear unit to inches cmds.currentUnit( linear='in' )