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 Primary Unit Measurements
Working with Primary Unit Measurements

All dimension entities use a measurement in primary units to represent the measured value. Linear dimensions also have alternate units, but angular dimensions use only primary units. This topics describes usage of angular units and linear primary units.

Measurement

Measurement is a read-only value that stores the measured value in the specified units as a double value. For linear dimensions, it is a length; for angular dimensions, it is an angle.

Note: You can not change this value. Dimension entities automatically calculate this value.

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

For example:


odPrintConsoleString(L"\nMeasurement value is %f", pDimension->measurement());

Dimlfac

The Dimlfac value stores the linear scale factor, a positive non-zero double value, which influences the measured value. The linear scale factor does not affect the measured angles, original coordinates, text sizes, text gap, arrowheads size, extension or dimension line extensions, extension line offset, or other visual elements of a dimension entity. The dimension entity multiplies a measured value in drawing units on the linear scale factor to calculate the measurement.

The initial value is 1.0.

Note: The linear scale factor does not influence the tolerance value. The Dimlfac value is not available for angular dimension entities.

To get the Dimlfac value, use the dimlfac() method, which returns the Dimlfac value as a double value.

For example:


odPrintConsoleString(L"\nDimlfac value is %f", pDimension->dimlfac());

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

For example:


pDimension->setDimlfac(2.1);

Dimlunit

The Dimlunit value stores the format for primary measured values and primary tolerance values. It is an OdInt16 value and can be one of the following:

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

The initial value is 2.

Note: The Dimlunit is not available for angular dimension entities. If the Dimlunit value is 2, the Dimdsep value specifies the character that is used as the decimal separator. If the Dimlunit value is 4 or 5, the Dimfrac value specifies the units format.

To get the Dimlunit value, use the dimlunit() method, which returns the Dimlunit value as an OdInt16 value.

For example:


odPrintConsoleString(L"\nDimlunit value is %d", pDimension->dimlunit());

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

For example:


pDimension->setDimlunit(1);

Dimfrac

The Dimfrac value stores the fractional format as an OdInt16 value and can be one of the following:

  • 0 - Horizontal Stacked.
  • 1 - Diagonal Stacked.
  • 2 - Not Stacked.

The initial value is 0.

Note: The Dimfrac value is applicable if the Dimlunit value is set to 5 (Fractions format) or 4 (Architectural format). The Dimfrac value is not available for angular dimension entities.

To get the Dimfrac value, use the dimfrac() method, which returns the Dimfrac value as an OdInt16 value.

For example:


odPrintConsoleString(L"\nDimfrac value is %d", pDimension->dimfrac());

To set a new Dimlunit value, use the setDimfrac() method, which requires one OdInt16 parameter as a new fraction format.

For example:


pDimension->setDimfrac(2);

Dimdsep

The Dimdsep value stores the character to use as a decimal separator. The initial value is a dot.

Note: If the Dimlunit value is set to 6 (Windows operating system default), custom regional options define the decimal separator (depending on the user's version of Windows, in some Windows versions specified using Control Panel > Regional and Language Options > Customize button > Numbers tab).

To get the Dimdsep value, use the dimdsep() method, which returns the Dimdsep value as an OdInt16 value.

For example:


odPrintConsoleString(L"\nDimdsep value is %d", pDimension->dimdsep());

To set a new Dimdsep value, use the setDimdsep() method, which requires one OdInt16 parameter as a new decimal separator.

For example:


pDimension->setDimdsep(',');

Dimaunit

The Dimaunit value stores the format for the angular measured value and angular tolerance value. It is an integer value and can be one of the following:

  • 0 — Decimal degrees.
  • 1 — Degrees, minutes, and seconds.
  • 2 — Gradians.
  • 3 — Radians.

The initial value is 0.

Note: The Dimaunit is applicable only for angular dimension entities and is not available for any other dimensions.

To get the Dimaunit value, use the dimaunit() method, which returns the Dimaunit value as an OdInt16 value.

For example:


odPrintConsoleString(L"\nDimaunit value is %d", pDimension->dimaunit());

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

For example:


pDimension->setDimaunit(1);

Dimpost

The Dimpost value stores a text suffix or prefix or both for the primary dimension measurement. Text suffix and prefix are text strings that combine with the angular or primary 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 Dimpost text, the dimension entity uses this text as the suffix.

The initial value is an empty string.

To get the Dimpost value, use the dimpost() method, which returns the Dimpost value as an OdString value.

For example:


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

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

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


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

To set "mm" as the prefix:


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

To set "mm" as the prefix and suffix:


pDimension->setDimpost(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 Alternate Unit Measurements

Marking the Center of Dimensions

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