Close

Relief for ODA Team in Ukraine

Learn more
ODA Drawings SDK
Working with Dimension Lines

The methods described in this topic are available for dimension entities that have either two dimension lines (aligned linear, rotated linear, two-line angular, three-point angular, arc-length, and diametric) or a single dimension line (radial and radial large). These methods are not available for ordinate dimension entities — ordinate dimensions do not have dimension lines.

Dimsd1 and Dimsd2

For dimensions that have two dimension lines, the Dimsd1 and Dimsd2 values hide or show the first and second dimension line respectively. For dimensions that have one dimension line, the logical product of Dimsd1 and Dimsd2 specifies the suppression of the single dimension line. If these values are true, the dimension line is not drawn (suppressed); if false, the dimension line is drawn (not suppressed). The initial value is false.

The behavior depends on the Dimatfit value of the dimension entity and the orientation of the definition entity (see Working with Dimension Fit and Movement).

For linear dimension entities:

Dimsd1 false true false true
Dimsd2 false false true true
Dimatfit Not used
0
1
2

For angular and arc-length dimension entities:

Dimsd1 false true false true
Dimsd2 false false true true
Dimatfit Not used
0
1
2

For radial, radial large, and diametric dimension entities:

Dimension type (Dimsd1)&&(Dimsd2)
Dimension line outside Dimension line inside
false true false true
Radial and diametric dimensions
Radial Large dimension

To get the value of Dimsd1 and Dimsd2, use the dimsd1() and dimsd2() methods, which return the dimension line suppression values as bool values.

For example:


odPrintConsoleString(L"\nFirst dimension line is %s", ((pDimension->dimsd1()) ? L"suppressed" : L"is not suppressed"));
odPrintConsoleString(L"\nSecond dimension line is %s", ((pDimension->dimsd2()) ? L"suppressed" : L"is not suppressed"));

To show or hide dimension lines, use the setDimsd1() and setDimsd2() methods, which require one bool value as a suppression flag.

For example:


pDimension->setDimsd1(true);
pDimension->setDimsd2(true);

Dimsoxd

The Dimsoxd value controls the suppression of dimension lines drawn beyond the extension lines, which occurs when the space between extension lines is not enough to place the arrowheads and the dimension text box either between extension lines or along extension lines. This value is true if dimension lines are not drawn beyond extension lines (suppressed) or false if dimension lines are drawn beyond extension lines (not suppressed).

The initial value is false.

The Dimsoxd value does not influence dimension lines when they are placed inside of extension lines.

If there is not sufficient space to place the dimension text box inside the extension lines, and Dimtix is set to false, Dimsoxd also has no effect.

To get the Dimsoxd value, use the dimsoxd() method, which returns the dimension lines suppression as a bool value.

For example:


odPrintConsoleString(L"\nFirst dimension lines are %s beyond the extension lines", ((pDimension->dimsoxd()) ? L"suppressed" : L"is not suppressed"));

To show or hide dimension lines beyond the extension lines, use the setDimsoxd() method, which requires one bool value as a suppression flag.

For example:


pDimension->setDimsoxd(true);

Dimblk1, Dimblk2, Dimblk

Dimblk1, Dimblk2, and Dimblk are used to manage arrowhead shapes of dimension lines.

For dimensions that have two dimension lines, Dimblk1 and Dimblk2 are used to specify the object ID of the entities that are used as arrowheads for the first and second dimension lines respectively. For dimensions that have one dimension line, or for dimensions that have identical arrowheads, Dimblk is used instead.

If these values aren't set manually, the default arrowheads defined in the dimension style are used.

Note: The Dimsah value should be set to true to use arrowhead blocks set by Dimblk1 and Dimblk2, and it should be set to false if a block set by Dimblk is used.

To get the object ID of the arrowhead block, use the dimblk1(), dimblk2() and dimblk() methods, which return the object ID as an OdDbObjectId object.

For example:


odPrintConsoleString(L"\nObjectId of the arrowhead block is %d", pDimension->dimblk());

To set a new arrowhead, use the setDimblk1(), setDimblk2() and setDimblk() methods, which require one OdDbObjectId object to specify the ID of the block with the new arrowhead.

For example:


// Create the circle
OdDbCirclePtr pCircle = OdDbCircle::createObject();
pCircle->setDatabaseDefaults(bBTR->database());
pCircle->setRadius(0.1);
// Create the block table record
OdDbBlockTableRecordPtr ptr = OdDbBlockTableRecord::createObject();
// Append the circle
ptr ->appendOdDbEntity(pCircle);
ptr->setName("Circle_block");
// Create block table
OdDbBlockTablePtr pBlocks  = pDb->getBlockTableId().safeOpenObject(OdDb::kForWrite);
// Add the arrowhead block to the block table
pBlocks->add(ptr);
// Set the arrowhead block to the dimension
pDimension->setDimblk(ptr->objectId());

Dimsah

The Dimsah value controls whether arrowhead blocks are set by Dimblk1 and Dimblk2 or by Dimblk.

If Dimsah is true, the arrowheads are formed by blocks set by the Dimblk1 and Dimblk2 values. If false, a block from Dimblk is used. The initial value is false.

To get the Dimsah value, use the dimsah() method, which returns the Dimsah value as a bool value.

For example:


odPrintConsoleString(L"\nFor setting the arrowheads %s used", ((pDimension->dimsah()) ? L"Dimblk1 and Dimblk2 are" : L"Dimblk is"));

To set or unset the Dimsah value, use the setDimsah() method, which requires one bool value as the Dimsah flag.

For example:


pDimension->setDimsah(true);

Dimasz

The Dimasz value is the size of both arrowheads. If the arrowheads are defined by a block, the Dimasz value defines the scale factor for the block geometry. If the value is 0, no arrowheads are drawn.

The initial value is 0.18.

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

For example:


odPrintConsoleString(L"\nDimasz is %f", pDimension->dimasz());

To set a new Dimasz value, use the setDimasz() method, which requires one double value to specify the new Dimasz value.

For example:


pDimension->setDimasz(2.5);

Dimtsz

The Dimtsz value is the size of oblique strokes to be drawn instead of arrowheads for linear, radial, and diameter dimensions. Dimtsz is the distance, parallel to the dimension line, that the tics extend beyond the extension lines.

If Dimtsz = 0, the arrowheads will be drawn. Positive values determine the size of oblique strokes.

The initial value is 0.

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

For example:


odPrintConsoleString(L"\nDimtsz is %f", pDimension->dimtsz());

To set a new Dimtsz value, use the setDimtsz() method, which requires one double value to specify the new Dimtsz value.

For example:


pDimension->setDimtsz(0.2);

Dimjogang

The Dimjogang value is the jog angle of dimension lines in jogged radius dimensions.

The initial value is 0,7854 (PI/4).

To get the jog angle, use the dimjogang() method, which returns the jog angle as a double value.

For example:


odPrintConsoleString(L"\nJog angle is %f", pDimension->dimjogang());

To set a new jog angle, use the setDimjogang() method, which requires one double parameter to specify the new jog angle.

For example:


pDimension->setDimjogang(0.3);

Dimdle

The Dimdle value is the length of the distance that dimension lines are extended beyond extension lines when arrowheads are architectural, integral, oblique, tick, or none. If the arrowhead type is set to any another value, dimension lines are not extended beyond extension lines.

If the value equals zero, dimension lines are not extended.

The initial value is 0.0.

Note: The Dimdle value doesn't influence diametric, radial, and radial large dimension entities, which do not have extension lines.

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

For example:


odPrintConsoleString(L"\nDimdle value is %f", pDimension->dimdle());

To set a new Dimdle value to a dimension entity, use the setDimdle() method, which requires one double parameter as a new Dimdle value.

For example:


pDimension->setDimdle(0.75);

Dimtofl

The Dimtofl value controls whether a forced line is drawn inside extension lines or the definition entity when dimension lines are placed outside of the extension lines or definition entity. This value is true if a forced line is drawn inside (dimension lines are connected) or false if a forced line is not drawn (dimension lines are open-ended). The initial value is false.

For radial and radial large dimension entities, the forced line connects the end of the single dimension line with the center of the circle or arc. For aligned linear, rotated linear, two-line angular, three-point angular, arc-length, and diametric dimension entities, the forced line connects the end of first dimension line with the end of the second dimension line.

Dimtofl Dimension type
Linear Angular, arc-length Radial Diametric
true
false

To get the Dimtofl value, use the dimtofl() method, which returns the Dimtofl value as a bool value.

For example:


odPrintConsoleString(L"\nForced line %s drawn", ((pDimension->dimtofl()) ? L"is" : L"is not"));

To set a new Dimtofl value to a dimension entity, use the setDimtofl() method, which requires one bool parameter as a new Dimtofl value.

For example:


pDimension->setDimtofl(true);

Dimltype

Dimension lines are associated with a linetype that is used to draw them. The Dimltype value stores an object ID of a linetype for the leader line, both dimension lines, and their extensions. This value does not influence the border around the dimension text box and extension lines.

To get the Dimltype value, use the dimltype() method, which returns the Dimltype value as an object ID of the OdDbObjectId class.

For example:


odPrintConsoleString(L"\nLinetype Id is %d", pDimension->dimltype());

To set a new linetype, use the setDimltype() method, which requires an OdDbObjectId object as an object ID of a new linetype.

For example:


OdDbLinetypeTableRecordPtr lineTabRec = OdDbLinetypeTableRecord::createObject();

OdDbLinetypeTablePtr lineTable = pDb->getLinetypeTableId().safeOpenObject(OdDb::kForWrite);
lineTabRec->setName("Test_line");
lineTable->add(lineTabRec);

lineTabRec->setPatternLength(0.1);
lineTabRec->setNumDashes(9);
lineTabRec->setDashLengthAt(0, 0.2);
lineTabRec->setDashLengthAt(1, -0.2);

pDimension->setDimltype(lineTabRec->objectId());

Dimlwd

The Dimlwd value controls the lineweight for the leader line, both dimension lines, and their extensions based on the one value from the OdDb::LineWeight enumeration. This value also influences the lineweight of the border around the dimension text box when the Dimgap value is negative.


enum LineWeight {
  kLnWt000 = 0,
  kLnWt005 = 5,
  kLnWt009 = 9,
  kLnWt013 = 13,
  kLnWt015 = 15,
  kLnWt018 = 18,
  kLnWt020 = 20,
  kLnWt025 = 25,
  kLnWt030 = 30,
  kLnWt035 = 35,
  kLnWt040 = 40,
  kLnWt050 = 50,
  kLnWt053 = 53,
  kLnWt060 = 60,
  kLnWt070 = 70,
  kLnWt080 = 80,
  kLnWt090 = 90,
  kLnWt100 = 100,
  kLnWt106 = 106,
  kLnWt120 = 120,
  kLnWt140 = 140,
  kLnWt158 = 158,
  kLnWt200 = 200,
  kLnWt211 = 211,
  kLnWtByLayer = -1,
  kLnWtByBlock = -2,
  kLnWtByLwDefault = -3
};

If the Dimlwd value is set to ByLineWeightDefault, the dimension entity uses the default lineweight value. If the Dimlwd value is set to ByBlock, the dimension entity uses the lineweight defined by the block to which it belongs. If the Dimlwd value is set to ByLayer, the dimension entity uses the lineweight defined by the layer to which it belongs.

The initial value is ByBlock.

To get the Dimlwd value, use the dimlwd() method, which returns the Dimlwd value as an integer value.

For example:


odPrintConsoleString(L"\nLineWeight value is %d", pDimension->dimlwd());

To set a new Dimlwd value to a dimension entity, use the setDimlwd() method, which requires one value from the OdDb::LineWeight enumeration as a new Dimlwd value.

For example:


pDimension->setDimlwd(OdDb::LineWeight::kLnWt050);

Dimclrd

The Dimclrd value controls the color of the leader line, arrowheads, and both dimension lines and their extensions. This value also influences the color of the border around the dimension text box when the Dimgap value is negative.

The initial value is a color defined by block.

To get the Dimclrd value, use the dimclrd() method, which returns the Dimclrd value as an object of the OdCmColor class.

For example:


odPrintConsoleString(L"\nLine color is (%d, %d, %d)", pDimension->dimclrd().red,  pDimension->dimclrd().green,  pDimension->dimclrd().blue);

To set a new line color, use the setDimclrd() method, which requires an object of the OdCmColor class as a new color.

For example:


OdCmColor lineCol = OdCmColor();
lineCol.setRGB(0, 255, 0);
pDimension->setDimclrd(lineCol);

See Also

Working with Dimensions

Working with Common Dimension Entity

Working with General Dimension Methods

Positioning Dimension Text

Formatting Dimension Text

Working with Extension Lines

Working with Dimension Fit and Movement

Working with Dimension Tolerances

Working with Dimension Values

Working with Primary Unit Measurements

Working with Alternate Unit Measurements

Marking the Center of Dimensions

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