Linear dimensions measure and represent the length between two points as a dimension entity in primary and alternate units. To define the placement, a linear dimension entity requires the first extension point from which the length is measured and the first extension line begins, the second extension point up to which the length is measured and from which the second extension line begins, a point on the line through which the dimension lines pass, a text point in which the dimension text box is placed, an oblique angle which defines the slope of a dimension, and the normal which orients the dimension in WCS. The straight line that connects the first point with the second point is the definition line. A linear dimension entity can be rotated, scaled, and oriented in WCS.
Linear dimension entities can be measured in two ways:
A linear dimension entity consists of the following elements:
The common structure of a linear dimension entity is defined by the text movement, text fit, and text position relative to the dimension and extension lines (inside or outside).
Dimension text can be moved, but result can vary depending on the Dimtmove value. Dimtmove can be set to one of the following values:
For working with linear dimension objects, use the OdDbAlignedDimension and OdDbRotatedDimension classes, which represent aligned and rotated dimensions and allow users to access linear dimension entities and manipulate their properties. The OdDbAlignedDimensionPtr and OdDbRotatedDimensionPtr classes are the typified smart pointers to an instances of those entities, and they are used for storing and passing references to the linear dimension objects.
To create and initialize a new instance of a linear dimension entity, see Overview of Specific Entities.
The main methods of the OdDbAlignedDimension class are listed below:
The main methods of the OdDbRotatedDimension class are listed below:
The next example demonstrates how to work with an aligned dimension entity.
// Create two poits to measure the length between them
OdGePoint3d line1Pt, line2Pt;
line1Pt.x = 5;
line1Pt.y = 6;
line2Pt = line1Pt + OdGeVector3d(3.0, 2.0, 0.0);
// Create the line between those points
OdDbLinePtr pLine = OdDbLine::createObject();
pLine->setDatabaseDefaults(bBTR->database());
bBTR->appendOdDbEntity(pLine);
pLine->setStartPoint(line1Pt);
pLine->setEndPoint(line2Pt);
// Create alined dimension
OdDbAlignedDimensionPtr pDimension = OdDbAlignedDimension::createObject();
pDimension->setDatabaseDefaults(bBTR->database());
bBTR->appendOdDbEntity(pDimension);
// Create the point threw which the dimension line will be drawn
OdGePoint3d dimLinePt;
dimLinePt.x = 10;
dimLinePt.y = 7;
pDimension->setXLine1Point(pLine->startPoint());
pDimension->setXLine2Point(pLine->endPoint());
pDimension->setDimLinePoint(dimLinePt);
pDimension->useDefaultTextPosition();
// Set text rotation angle
pDimension->setTextRotation(1);
// Set DIMTMOVE system variable to "1"
pDimension->setDimtmove(1);
// Set objique angle - it is the angle between the extension lines and perpendiculars to the dmension line
pDimension->setOblique(2);
The next example demonstrates how to work with a rotated dimension entity.
// Create two poits to measure the length between them
OdGePoint3d line1Pt, line2Pt;
line1Pt.x = 10;
line1Pt.y = 6;
line2Pt = line1Pt + OdGeVector3d(3.0, 2.0, 0.0);
// Create the line between those points
OdDbLinePtr pLine = OdDbLine::createObject();
pLine->setDatabaseDefaults(bBTR->database());
bBTR->appendOdDbEntity(pLine);
pLine->setStartPoint(line1Pt);
pLine->setEndPoint(line2Pt);
// Create rotated dimension
OdDbRotatedDimensionPtr pDimension = OdDbRotatedDimension::createObject();
pDimension->setDatabaseDefaults(bBTR->database());
bBTR->appendOdDbEntity(pDimension);
// Create the point threw which the dimension line will be drawn
OdGePoint3d dimLinePt;
dimLinePt.x = 15;
dimLinePt.y = 7;
pDimension->setXLine1Point(pLine->startPoint());
pDimension->setXLine2Point(pLine->endPoint());
pDimension->setDimLinePoint(dimLinePt);
pDimension->useDefaultTextPosition();
// Set rotation angle
pDimension->setRotation(1);
Overview of Angular Dimensions
Overview of Arc-Length Dimensions
Overview of Diametric Dimensions
Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.
|