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 Dimension Tolerances
Working with Dimension Tolerances

A tolerance is an optional element of a linear or angular dimension text box that does not affect the measured value of the dimension entity.

Tolerances are measured using the same units as the units used to measure the value to which each tolerance belongs. If the measurement of alternate units is enabled (Dimalt value is true), tolerances are calculated in primary and alternate units simultaneously. A tolerance value is recalculated automatically from primary units to alternate units using the same alternate scale factor that is used for a measured value.

Tolerance values can be limited to a specified number of decimal places, can be purged from using leading and trailing zeros, similar to a measured value, but independent from it.

Methods described in this topic are available for all dimension entities and are declared by the standard dimension interface to work with tolerances.

Dimtol, Dimlim, Dimtm, Dimtp

These values are used to define the method of graphical representation of the tolerance.

The Dimtol value enables or disables the use of tolerances. The initial value is false (tolerances are disabled).

The Dimlim value controls whether the limits are generated as the dimension text.

The Dimtm and Dimtp values are used for storing the lower and upper tolerance limits respectively. If the Dimtm value is positive, the value is drawn with a minus sign, and a plus sign is added if the value is negative. The Dimtp value is drawn with a plus sign if it is positive and with a minus sign if it is negative.

To get the Dimtol and Dimlim values, use the dimtol() and dimlim() methods, which return Dimtol and Dimlim as bool values.

For example:


odPrintConsoleString(L"\nTolerances are %s", ((pDimension->dimtol()) ? L"enabled" : L"disabled"));
odPrintConsoleString(L"\nThe limits %s generated as the dimension text", ((pDimension->dimse2()) ? L"are" : L"are not"));

To get the Dimtm and Dimtp values, use the dimtm() and dimtp() methods, which return Dimtm and Dimtp as double values.

For example:


odPrintConsoleString(L"\nDimtm value is %f", pDimension->dimtm());
odPrintConsoleString(L"\nDimtp value is %f", pDimension->dimtp());

To set new Dimtol and Dimlim values, use the setDimtol() and setDimlim() methods, which require one bool parameter to specify the new Dimtol or Dimlim value.

For example:


pDimension->setDimtol(true);
pDimension->setDimlim(true);

To set new Dimtm and Dimtp values, use the setDimtm() and setDimtp() methods, which require one double parameter to specify the new Dimtm or Dimtp value.

For example:


pDimension->setDimtm(0.1);
pDimension->setDimtp(0.2);

Combining these values, you can form different graphical representations of a tolerance:

  • If Dimtol is true and Dimtm and Dimtp are equal, the tolerance is drawn in symmetrical format.

    For example:

    
    pDimension->setDimtol(true);
    pDimension->setDimtm(0.02);
    pDimension->setDimtp(0.02);
    
  • If Dimtol is true and Dimtm and Dimtp are unequal, the tolerance is drawn in deviant format. The Dimtp value is drawn above Dimtm.

    For example:

    
    pDimension->setDimtol(true);
    pDimension->setDimtm(0.02);
    pDimension->setDimtp(0.01);
    
  • If Dimlim is true, the tolerance isn't drawn, and the measured value limits that are calculated using Dimtm and Dimtp are drawn.

    For example:

    
    pDimension->setDimlim(true);
    pDimension->setDimtm(0.02);
    pDimension->setDimtp(0.01);
    
  • If Dimtol is false and Dimlim is false, the measured value will be drawn as the dimension text. This is the initial case.

  • If Dimtol and Dimlim are false and the Dimgap has a negative value, the measured value will be drawn in the Basic format, with a border around the dimension text.

    For example:

    
    pDimension->setDimtol(false);
    pDimension->setDimlim(false);
    pDimension->setDimgap(-0.3);
    

Dimtfac

The Dimtfac value stores the scale factor for the tolerance text box relative to the dimension text box. If the tolerance scale factor is greater than 1.0, the tolerance text box is larger than the dimension text box. If the tolerance scale factor is less than 1.0, the tolerance text box is smaller than the dimension text box.

The initial value is 1.0.

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

For example:


odPrintConsoleString(L"\nDimtfac value is %f", pDimension->dimtfac());

To set a new Dimtfac value, use the setDimtfac() method, which requires one double parameter as a new Dimtfac value.

For example:


pDimension->setDimtfact(1.2);

Dimtolj

The Dimtolj controls the vertical justification of the tolerance text box relative to the dimension text box. This is an OdUInt8 value and can be one of the following:

  • 0 — Bottom.
  • 1 — Middle.
  • 2 — Top.

The initial value is 1.

Note: The Dimtolj value is not applicable if Dimtol is false (i.e., for no tolerance and basic modes).

To get the Dimtolj value, use the dimtolj() method, which returns the Dimtolj value as an OdUInt8 value.

For example:


odPrintConsoleString(L"\nDimtolj value is %d", pDimension->dimtolj());

To set a new Dimtolj value, use the setDimtolj() method, which requires one OdUInt8 parameter as a new Dimtolj value.

For example:


pDimension->setDimtolj(0);

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 Values

Working with Primary Unit Measurements

Working with Alternate Unit Measurements

Marking the Center of Dimensions

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