# MDistance

## Constants

Name | Type | Description
--- | --- | ---
Unit Types
kInvalid | Int |
kInches | Int |
kFeet | Int |
kYards | Int |
kMiles | Int |
kMillimeters | Int |
kCentimeters | Int |
kKilometers | Int |
kMeters | Int |
kLast | Int |

## Static Methods

Name | Parameters | Returns | Description
--- | --- | --- | ---
uiUnit() |  | Unit type constant. | Returns the type of units currently being used to enter and display distances in Maya's UI.
setUIUnit(newUnit) | newUnit - unit type constant | None | Sets the type of units to be used to enter and display distances in Maya's UI
internalUnit() |  | Unit type constant. | Returns the type of units in which Maya stores distance values internally (e.g. in plugs and binary file formats).
internalToUI(internalValue) | internalValue - Float | Float | Interprets internalValue as a distance in Maya's internal units and returns it converted to UI units.
uiToInternal(uiValue) | uiValue - Float | Float | Interprets uiValue as a distance in Maya's UI units and returns it converted to internal units.

## Static Attributes

None.

## Constructors

Signature | Parameters | Description
--- | --- | ---
MDistance() |  | Default constructor. Returns a new MDistance with a value of 0.0 centimeters.
MDistance(src) | src - MDistance | Copy constructor. Returns a new MDistance with the same value and unit type as src.
MDistance(value, unit=kCentimeters) | value - Float unit - Unit type constant | Returns a new MDistance using the given value and unit.

## Object Methods

Signature | Parameters | Returns | Description
--- | --- | --- | ---
asInches() |  | Float | Returns the distance value, converted to inches.
asFeet() |  | Float | Returns the distance value, converted to feet.
asYards() |  | Float | Returns the distance value, converted to yards.
asMiles() |  | Float | Returns the distance value, converted to miles.
asMillimeters() |  | Float | Returns the distance value, converted to millimeters.
asCentimeters() |  | Float | Returns the distance value, converted to centimeters.
asKilometers() |  | Float | Returns the distance value, converted to kilometers.
asMeters() |  | Float | Returns the distance value, converted to meters.
asUnits(unit) | unit - Unit type constant | Float | Returns the distance value, converted to the specified unit.

## Object Attributes

Name | Type | Access | Description
--- | --- | --- | ---
value | Float | RW | Raw distance value.
unit | Unit type constant | RW | Units in which to interpret value.

## Sequence Support

None.

## Number Support

None.

## Comparison Support

None.

© 2011 Autodesk, Inc. All rights reserved.