In the following examples, the pLeader variable stores a pointer to the leader object.
A leader entity is always a planar object. A leader object projects existing vertices onto its plane, so the leader plane should be specified before adding vertices.
To get the plane for a leader, use the getPlane() method which requires a reference to a variable of the OdGePlane type in which the plane instance must be saved as the first argument, a reference to a variable of the OdDb::Planarity type in which the plane type must be saved as the second argument, and returns the plane properties through arguments and the resulting code. For example:
OdResult eRes;
OdGePlane plane3d;
double a, b, c, d;
OdDb::Planarity planarity;
eRes = pLeader->getPlane(plane3d, planarity);
if(eRes == eOk)
{
plane3d.getCoefficients(a, b, c, d);
odPrintConsoleString(L"\nleader plane is (%g * X + %g * Y + %g * Z + %g)", a, b, c, d);
}
To set the plane for a leader, use the setPlane() method which requires a reference to a variable of the OdGePlane type which contatins the plane data. For example:
OdGePlane plane3d = OdGePlane();
plane3d.set(0, -0.2, 0.5, 0);
pLeader->setPlane(plane3d);
A leader's appearance depends on its dimension style; see the Working with General Dimension Methods topic. Like a dimension entity, it can have overrides for DIMASZ, DIMCLRD, DIMGAP, DIMLDRBLK, DIMLWD, DIMSAH, DIMSCALE, DIMTAD, DIMTXSTY, DIMTXT; see System Variables D (dimasz() / setDimasz() for getting and setting size of the arrowhead, dimclrd() / setDimclrd() for getting and setting the color for dimension lines, leader lines, and arrowheads etc.).
To check the enabling of arrowheads for this leader entity, use the isArrowHeadEnabled() method, which returns "true" if arrowheads are enabled for this entity. For example:
odPrintConsoleString(L"\nArrowhead is %s", ((pLeader->isArrowHeadEnabled()) ? L"enabled" : L"disabled"));
To enable arrowheads, use the enableArrowHead() method, which allows you to enable arrowheads. For example:
pLeader->enableArrowHead();
To disable arrowheads, use the disableArrowHead() method, which allows you to disable arrowheads. For example:
pLeader->disableArrowHead();
To check whether or not the entity has an arrowhead, use the hasArrowHead() method, which returns true if the arrowhead size is greater than zero, or if the arrowhead is enabled and the length of the first leader segment is greater than 2*(arrowhead size). For example:
odPrintConsoleString(L"\nLeader %s arrowhead", ((pLeader->hasArrowHead()) ? L"has" : L"has no"));
Working with General Dimension Methods
Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.
|