Drawings SDK Developer Guide > Working with .dwg Files > Working with Entities > Working with Specific Entitites > Working with Dimensions > Working with Common Dimension Entities > Working with Alternate Unit Measurements
Working with Alternate Unit Measurements

Alternate units of measurement can be used optionally for some dimension entities, presenting additional features to represent the measured value. Alternate units of measurement are available for aligned linear, rotated linear, arc-length, ordinate, diametric, radial, and radial large dimension entities. (Angular dimension entities do not have alternate units.)

The methods described in this topic are available only for those dimension entities that can use alternate units.

Dimalt

The Dimalt value enables or disables measurement in alternate units. This property is true if enabled or false if disabled. If enabled, the alternate dimension text box in brackets is combined with the primary dimension text box.

The initial value is false.

To get the Dimalt value, use the dimalt() method, which returns the Dimalt value as a bool value.

For example:


odPrintConsoleString(L"\nAlternate units are %s", ((pDimension->dimalt()) ? L"enabled" : L"disabled"));

To enable or disable alternate units, use the setDimalt() method, which requires one bool value.

For example:


pDimension->setDimalt(true);

Dimaltf

The Dimaltf value stores the scale factor for alternate units. It is a positive non-zero double value. A dimension entity multiplies the primary units value by the alternate scale factor to calculate the value in alternate units. For example, if the alternate scale factor is 25.4, 2 inches in primary units becomes 50.8 mm in alternate units.

The initial value is 25.4 (the number of millimeters in an inch).

Note: The Dimaltf value is applicable when Dimalt is set to true.

To get the Dimaltf value, use the dimaltf() method, which returns the Dimaltf value as a double value.

For example:


odPrintConsoleString(L"\nDimaltf value is %f", pDimension->dimaltf());

To set a new Dimaltf value, use the setDimaltf() method, which requires one double parameter as a new scale factor.

For example:


pDimension->setDimaltf(30.3);

Dimaltu

The Dimaltu value stores the format of alternate units as an OdInt16 value and can be one of the following:

  • 1 — Scientific format.
  • 2 — Decimal format.
  • 3 — Engineering format.
  • 4 — Architectural (stacked) format.
  • 5 — Fractions (stacked) format.
  • 6 — Architectural format.
  • 7 — Fractions format.
  • 8 — Microsoft® Windows® operating system default format.

The initial value is 2.

Note: The Dimaltu value is applicable when Dimalt is set to true.

To get the Dimaltu value, use the dimaltu() method, which returns the Dimaltu value as an OdInt16 value.

For example:


odPrintConsoleString(L"\nDimaltu value is %d", pDimension->dimaltu());

To set a new Dimaltu value, use the setDimaltu() method, which requires one OdInt16 parameter as a new format.

For example:


pDimension->setDimaltu(3);

Dimapost

The Dimapost value stores the text suffix or prefix or both for the dimension alternate measurement. Text suffix and prefix are text strings that combine with the alternate dimension text box at the beginning and end of the text, respectively. To set the prefix or suffix, use the brackets to indicate placement of the measured value text. If you don't use the brackets, while setting the Dimapost text, the dimension entity uses this text as the suffix.

The initial value is an empty string.

Note: The Dimapost value is applicable when Dimalt is set to true.

To get the Dimapost value, use the dimapost() method, which returns the Dimapost value as an OdString value.

For example:


odPrintConsoleString(L"\nDimapost value is %s", pDimension->dimapost().c_str());

To set a new Dimapost value, use the setDimapost() method, which requires one OdString parameter as a new prefix, suffix or both.

For example, to set "mm" as the suffix for an alternate measurement:


pDimension->setDimapost(L"<>mm");

To set "mm" as the prefix for an alternate measurement:


pDimension->setDimapost(L"mm<>");

To set "mm" as the alternate prefix and suffix:


pDimension->setDimapost(L"mm<>mm");

See Also

Working with Dimensions

Working with Common Dimension Entity

Working with General Dimension Methods

Positioning Dimension Text

Formatting Dimension Text

Working with Dimension Lines

Working with Extension Lines

Working with Dimension Fit and Movement

Working with Dimension Tolerances

Working with Dimension Values

Working with Primary Unit Measurements

Marking the Center of Dimensions

Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.