class MDistance

Jump to documentation

Manipulate Linear Data. (OpenMaya) (OpenMaya.py)

public members:

enum Unit
Available Unit Systems
kInvalid
kInches
Inches
kFeet
Feet
kYards
Yards
kMiles
Miles
kMillimeters
Millimeters
kCentimeters
Centimeters
kKilometers
Kilometers
kMeters
Meters
kLast
MDistance ()
MDistance ( double value , Unit unitSystem = kCentimeters )
MDistance ( const MDistance & src )
~MDistance ()
MDistance & operator= ( const MDistance & src )
Unit unit () const
double value () const
MStatus setUnit ( Unit newUnit )
MStatus setValue ( double newValue )
double as ( Unit newUnit, MStatus *ReturnStatus = NULL ) const
double asInches () const
double asFeet () const
double asYards () const
double asMiles () const
double asMillimeters () const
double asCentimeters () const
double asKilometers () const
double asMeters () const
static Unit uiUnit ()
static MStatus setUIUnit ( Unit newUnit )
static Unit internalUnit ()
static double internalToUI ( double internalValue )
static double uiToInternal ( double uiValue )
static MStatus setInternalUnit ( Unit internalUnit )
OBSOLETE Changing the internal units is generally not a good idea and using this method may often produce unexpected results.

Documentation

Methods for setting and retreiving linear data in various unit systems
Description

The MDistance class provides a fundamental type for the Maya API to hold and manipulate linear data. All API methods that require or return distance information do so through variables of this type.

Functions

MDistance:: MDistance ()

Description

The default class constructor. Initialize the MDistance instance to 0 in the current internal units. (See setInternalUnit and internalUnit below).

MDistance:: MDistance ( double newValue, MDistance::Unit newUnit )

Description

Class constructor. Initialize the MDistance instance to the given value in the given unit system

Arguments

  • value the initial value of the instance
  • unitSystem the unit system for the initial value

MDistance:: MDistance ( const MDistance & src )

Description

Copy constructor.

MDistance:: ~MDistance ()

Description

The class destructor.

MDistance & MDistance:: operator = (const MDistance & src)

Description

The assignment operator.

MDistance::Unit MDistance:: unit () const

Description

Return the units currently in effect for this instance.

Return Value

  • an element of the MDistance::Unit enum

double MDistance:: value () const

Description

Return the value of the current instance in the currently set units.

Return Value

  • the current value of the instance

MStatus MDistance:: setUnit ( MDistance::Unit newUnit )

Description

Set the units used by this instance.

Arguments

  • newUnit an element of the MDistance::Unit enum

Return Value

  • MS::kSuccess if a valid unit was provided, MS::kFailure otherwise

MStatus MDistance:: setValue (double newValue )

Description

Set the value of this instance

Arguments

  • newValue the new value in the units currently in effect

Return Value

  • always returns MS::kSuccess

double MDistance:: as ( MDistance::Unit otherUnit, MStatus *ReturnStatus ) const

Description

Return the current value of this instance in the provided units.

Arguments

  • otherUnit an element of the MDistance::Unit enum specifying the desired units
  • ReturnStatus return status

Return Value

  • the current value in the given units

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

double MDistance:: asInches () const

Description

Return the current value of this instance in inches.

Return Value

  • the current value in the inches

double MDistance:: asFeet () const

Description

Return the current value of this instance in feet.

Return Value

  • the current value in the feet

double MDistance:: asYards () const

Description

Return the current value of this instance in yards.

Return Value

  • the current value in the yards

double MDistance:: asMiles () const

Description

Return the current value of this instance in miles.

Return Value

  • the current value in the miles

double MDistance:: asMillimeters () const

Description

Return the current value of this instance in millimeters.

Return Value

  • the current value in the millimeters

double MDistance:: asCentimeters () const

Description

Return the current value of this instance in centimeters.

Return Value

  • the current value in the centimeters

double MDistance:: asKilometers () const

Description

Return the current value of this instance in kilometers.

Return Value

  • the current value in the kilometers

double MDistance:: asMeters () const

Description

Return the current value of this instance in meters.

Return Value

  • the current value in the meters

MDistance::Unit MDistance:: uiUnit ()

Description

Returns the Working Units (or UI units) chosen in the settings of the prefs window.

Return Value

  • an element of the MDistance::Unit enum

MStatus MDistance:: setUIUnit ( MDistance::Unit newUnit)

Description

Set the unit system to be used by the user in the UI.

Arguments

  • newUnit and element of the MDistance::Unit enum.

Return Value

  • MS::kSuccess if a valid unit was provided, MS::kFailure otherwise

MDistance::Unit MDistance:: internalUnit ()

Description

Returns the internal unit system.

Return Value

  • the internal unit for distance

double MDistance:: internalToUI (double internalValue)

Description

Converts a value from internal units to UI units.

Arguments

  • internalValue a value in internal units

Return Value

  • the value in UI units

double MDistance:: uiToInternal (double uiValue)

Description

Converts a value from UI units to internal units.

Arguments

  • uiValue a value in UI units

Return Value

  • the value in internal units.

MStatus MDistance:: setInternalUnit ( MDistance::Unit internalUnit )

Description

THIS IS AN OBSOLETE METHOD

This method will be removed in a future Maya release. Changing the internal units is generally not a good idea and using the method may often produce unexpected results. It is recommended to just read the values and convert them to the units desired.

Set the internal unit system.

Arguments

  • internalUnit the internal unit to be used by distance

Return Value

  • MS::kSuccess a valid unit was provided
  • MS::kFailure a valid unit was not provided

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright