The methods described in this topic are available for dimension entities that have either two extension lines (aligned linear, rotated linear, two-line angular, three-point angular, arc-length) or a single extension line (ordinate). These methods are not available for diametric, radial, and radial large dimension entities — these dimensions do not have extension lines.
The Dimse1 and Dimse2 values control the suppression of the first and second extension lines respectively. The single extension line of the ordinate dimension entity can not be suppressed.
These values are true if the corresponding extension line is not drawn (suppressed) or false if the extension line is drawn (not suppressed).
The initial value is false.
Dimse1 | false | true | false | true |
Dimse2 | false | false | true | true |
Linear dimension | ||||
Angular, arc-length dimensions |
To get the value of Dimse1 and Dimse2, use the dimse1() and dimse2() methods, which return extension line suppression values as bool values.
For example:
odPrintConsoleString(L"\nFirst extension line is %s", ((pDimension->dimse1()) ? L"suppressed" : L"is not suppressed"));
odPrintConsoleString(L"\nSecond extension line is %s", ((pDimension->dimse2()) ? L"suppressed" : L"is not suppressed"));
To show or hide extension lines, use the setDimse1() and setDimse2() methods, which require one bool value as a suppression flag.
For example:
pDimension->setDimse1(true);
pDimension->setDimse2(true);
The Dimexe value stores the length of the distance (as a non-negative double value) that extension lines are extended beyond dimension lines. Note that the single extension line of the ordinate dimension entity can not be extended.
If the value equals zero, extension lines are not extended.
The initial value is 0.18.
To get the Dimexe value, use the dimexe() method, which returns the extension line extension length as a double value.
For example:
odPrintConsoleString(L"\nExtension line extension length is %f", pDimension->dimexe());
To set the new value of the extension line extension length, use the setDimexe() method, which requires one double value as the new length.
For example:
pDimension->setDimexe(0.2);
The Dimexo value stores the length of the distance (as a non-negative double value) that the extension or definition point is offset from the beginning of an extension line.
If the value equals zero, extension lines begin at the extension or definition points.
The initial value is 0.0625.
To get the offset distance, use the dimexo() method, which returns the offset length as a double value.
For example:
odPrintConsoleString(L"\nExtension line offset is %f", pDimension->dimexo());
To set the new offset distance, use the setDimexo() method, which requires one double value to specify the new offset.
For example:
pDimension->setDimexo(0.3);
The DimfxlOn flag controls whether extension lines have a fixed length. This value is true if extension lines have a fixed length defined by the the Dimfxl value, or false if the length of extension lines is not fixed. The initial value is false.
If the DimfxlOn value is set to true, the Dimfxl value specifies the length of extension lines.
The extension line length is the distance between the beginning of an extension line and the cross-point with a dimension line. The extension and offset are not included in the length.
If the extension line length is a negative value, extension lines are drawn from the outside to the cross-points with dimension lines, towards the extension points.
To get the Dimfxl and DimfxlOn values, use the dimfxl() and dimfxlon() methods, which return the Dimfxl value as a double value and the DimfxlOn value as a bool value.
For example:
odPrintConsoleString(L"\nExtension lines %s fixed length", ((pDimension->dimfxlon()) ? L"have" : L"have no"));
odPrintConsoleString(L"\nExtension lines fixed length is %f", pDimension->dimfxl());
To set or unset the DimfxlOn value, use the setDimfxlon() method, which requires one bool value as the Dimsah flag.
To set a new fixed length of extension lines, use the setDimfxl() method, which requires one double parameter to specify the new length.
For example:
pDimension->setDimfxlon(true);
pDimension->setDimfxl(1.2);
Extension lines are associated with a linetype that is used to draw them. For dimensions that have two extension lines, the Dimltex1 and Dimltex2 values store the linetype object ID for the first and second extension lines respectively. For the single extension line of an ordinate dimension entity, only the Dimltex2 value is used.
To get the Dimltex1 and Dimltex2 values, use the dimltex1() and dimltex2() methods, which return the Dimltex1 and Dimltex2 values as objects of the OdDbObjectId class.
For example:
odPrintConsoleString(L"\nFirst extension line linetype Id is %d", pDimension->dimltex1());
odPrintConsoleString(L"\nSecond extension line linetype Id is %d", pDimension->dimltex2());
To set a new linetype, use the setDimltex1() and setDimltex2() methods, which require an OdDbObjectId object as an object ID of the 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->setDimltex1(lineTabRec->objectId());
pDimension->setDimltex2(lineTabRec->objectId());
The Dimlwe value stores the lineweight assigned to both the first and second extension lines based on one value from the OdDb::LineWeight enumeration.
If the Dimlwe value is set to ByLineWeightDefault, the dimension entity uses the default lineweight value. If the Dimlwe value is set to ByBlock, the dimension entity uses the lineweight defined by the block to which it belongs. If the Dimlwe value is set to ByLayer, the dimension entity uses the lineweight defined by the layer to which it belongs.
The initial value is ByBlock.
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
};
To get the Dimlwe value, use the dimlwe() method, which returns the Dimlwe value as an integer value.
For example:
odPrintConsoleString(L"\nExtension line lineWeight value is %d", pDimension->dimlwe());
To set a new Dimlwe value to a dimension entity, use the setDimlwe() method, which requires one value from the OdDb::LineWeight enumeration as a new Dimlwe value.
For example:
pDimension->setDimlwe(OdDb::LineWeight::kLnWt018);
The Dimclre value controls the color of extension lines.
The initial value is the color defined by a block.
To get the Dimclre value, use the dimclre() method, which returns the Dimclre value as an object of the OdCmColor class.
For example:
odPrintConsoleString(L"\nExtension line color is (%d, %d, %d)", pDimension->dimclre().red(), pDimension->dimclre().green(), pDimension->dimclre().blue());
To set a new line color, use the setDimclre() method, which requires an object of the OdCmColor class as the new color.
For example:
OdCmColor extLineCol = OdCmColor();
extLineCol.setRGB(100, 200, 0);
pDimension->setDimclrd(extLineCol);
Working with Common Dimension Entity
Working with General Dimension Methods
Working with Dimension Fit and Movement
Working with Dimension Tolerances
Working with Primary Unit Measurements
Working with Alternate Unit Measurements
Marking the Center of Dimensions
Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.
|