This section documents the API structures and functions related to units of measurement.
These functions use the following unit types:
UNITS_INCHES
UNITS_FEET
UNITS_MILES
UNITS_MILLIMETERS
UNITS_CENTIMETERS
UNITS_METERS
UNITS_KILOMETERS
GetMasterScale()
- Retrieves the master scale in
terms of the specified unit type. For example:.
GetMasterScale(UNITS_INCHES)
returns the number of
inches per unit. Returns -1.0 if an invalid unit type is
supplied.GetMasterUnitInfo()
- Retrieves the master unit
settings in effect. These are the unit type (Inches, Feet, Meters,
etc.) and the master scale setting. This is the value the user
entered in the "1 Unit = XXX field" of the General Page in the
Preference Settings dialog box.SetMasterUnitInfo()
- Sets the master unit
settings. These are the unit type (Inches, Feet, Meters, etc.) and
the master scale setting.GetUnitDisplayInfo()
- Retrieves the current unit
display information.SetUnitDisplayInfo()
- Sets the unit display
information used by 3ds Max.GetUnitDisplayType()
- Returns the current unit
display type to one of the following values:UNITDISP_GENERIC
UNITDISP_METRIC
UNITDISP_US
UNITDISP_CUSTOM
SetUnitDisplayType()
- Sets the current unit
display type to one of the following values:UNITDISP_GENERIC
UNITDISP_METRIC
UNITDISP_US
UNITDISP_CUSTOM
FormatUniverseValue()
- Converts the specified
value to an ASCII representation according to the current unit
scale. Note that this can cause a string overflow, especially when
the units are set to miles or kilometers. If an overflow occurs the
function returns a null string (i.e. _T("")
). Thus
developers can check for this condition using something like
if (buf[0] == '\0')
to see if an overflow
occurred.DecodeUniverseValue()
- Parses the
specified string using the current unit settings and converts it to
a floating point value. If an error occurs in the parsing then
valid is set to FALSE.
The following functions store and retrieve default distances in the defaults .INI file using a section and key.
RegisterDistanceDefault()
- Registers a default
value for a distance value. The default has separate values for
both Imperial and Metric systems. The Imperial default is given in
inches and the Metric default is given in Meters.RestoreDistanceDefault()
- Restores the original
default value for a distance value.GetDistanceDefault()
- Get the default for the
given section and key in the defaults file. The system returns the
default relative to the current system units. If the units are
Imperial (inches, feet, etc.) it returns the Imperial version of
the default, otherwise it returns the Metric version. In either
case the default value is returned in the current system
units.SetDistanceDefault()
- Sets the
defaults for the given section and key in the defaults file. The
system sets the default relative to the current system units. If
the units are Imperial (inches, feet, etc.) it sets the Imperial
version of the default, otherwise it sets the Metric version.
Units of Measurement