Angular dimensions measure and represent an angle in degrees, radians, or grads. There are two kinds of angular dimension entities:
An angular dimension entity can be rotated, scaled, and oriented in WCS.
An angular dimension entity consists of the following elements:
The common structure of an angular 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 the result can vary depending on the Dimtmove value. Dimtmove can be set to one of the following values:
For working with angular dimension objects, use the OdDb2LineAngularDimension and OdDb3PointAngularDimension classes, which represent two-line angular and three-point angular dimensions and allow users to access angular dimension entities and manipulate their properties. The OdDb2LineAngularDimensionPtr and OdDb3PointAngularDimensionPtr classes are the typified smart pointers to an instances of those entities, and they are used for storing and passing references to the angular dimension objects.
To create and initialize a new instance of an angular dimension entity, see Overview of Specific Entities.
The main methods of the OdDb2LineAngularDimension class are listed below:
The main methods of the OdDb3PointAngularDimension class are listed below:
The next example demonstrates how to work with a three-point angular dimension entity.
// Create an arc to be dimensioned
OdDbArcPtr pArc = OdDbArc::createObject();
// Set default setting to the arc
pArc->setDatabaseDefaults(pDb);
bBTR->appendOdDbEntity(pArc);
// Set arc data
OdGePoint3d center(6,6,0);
pArc->setCenter(center);
pArc->setStartAngle(OdaToRadian(45.0));
pArc->setEndAngle(OdaToRadian(135.0));
pArc->setRadius(1);
// Create three-point angular dimension entity
OdDb3PointAngularDimensionPtr pDimension = OdDb3PointAngularDimension::createObject();
// Set default setting to the dimension
pDimension->setDatabaseDefaults(pDb);
bBTR->appendOdDbEntity(pDimension);
pDimension->setDatabaseDefaults(pDb);
// Set dimension center
pDimension->setCenterPoint(pArc->center());
// Set point on the dimension arc
pDimension->setArcPoint(pArc->center() + OdGeVector3d(pArc->radius() + 0.0, 1.0, 0.0));
// Set start point
OdGePoint3d startPoint;
pArc->getStartPoint(startPoint);
pDimension->setXLine1Point(startPoint);
// Set end point
OdGePoint3d endPoint;
pArc->getEndPoint(endPoint);
pDimension->setXLine2Point(endPoint);
The next example demonstrates how to work with a two-line angular dimension entity.
// Create center and vectors for definition lines
OdGePoint3d center(4,0,0);
OdGeVector3d v1(0.5, 0.1, 0);
OdGeVector3d v2(0.6, 0.7, 0);
OdGeVector3d v3 = v2 + OdGeVector3d(0.5, 1.0, 0.0);
// Create the first definition line
pLine1 = OdDbLine::createObject();
pLine1->setDatabaseDefaults(pDb);
bBTR->appendOdDbEntity(pLine1);
pLine1->setStartPoint(center + v1);
pLine1->setEndPoint (center + v2);
// Rotate the vectors to create the second definition line
double rot = OdaToRadian(60.0);
v1.rotateBy(rot, OdGeVector3d::kZAxis);
v2.rotateBy(rot, OdGeVector3d::kZAxis);
// Create the second definition line
OdDbLinePtr pLine2 = OdDbLine::createObject();
pLine2->setDatabaseDefaults(pDb);
bBTR->appendOdDbEntity(pLine2);
pLine2->setStartPoint(center + v1);
pLine2->setEndPoint (center + v2);
// Create the two-line angular dimension entity
OdDb2LineAngularDimensionPtr pDimension = OdDb2LineAngularDimension::createObject();
// Set default setting to the dimension
bBTR->appendOdDbEntity(pDimension);
pDimension->setDatabaseDefaults(pDb);
// Set the point for the dimension arc
v3.rotateBy(rot/2.0, OdGeVector3d::kZAxis);
pDimension->setArcPoint(center + v3);
// Set the start and end point of the first definition line
pLine1->getStartPoint(startPoint);
pDimension->setXLine1Start(startPoint);
pLine1->getEndPoint(endPoint);
pDimension->setXLine1End(endPoint);
// Set the start and end point of the second definition line
pLine2->getStartPoint(startPoint);
pDimension->setXLine2Start(startPoint);
pLine2->getEndPoint(endPoint);
pDimension->setXLine2End(endPoint);
Overview of Arc-Length Dimensions
Overview of Diametric Dimensions
Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.
|