The circular arc object uses the center, radius, normal, start angle, end angle, and thickness properties to define the geometry to be drawn. In examples, the pArc variable stores a pointer to the circular arc object.
The Center property defines the center of the circular arc in three-dimensional coordinates. The center has the coordinates (0,0,0) by default.
To get the center, use the center() method which does not have arguments and returns the three-dimensional point as an instance of the OdGePoint3d type. For example:
OdGePoint3d center = pArc->center();
odPrintConsoleString(L"\nArc center = (%g,%g,%g)", center.x, center.y, center.z);
To set the center, use the setCenter() method which requires the three-dimensional point as an argument of the OdGePoint3d type and does not return a value. For example:
OdGePoint3d point(1.1, 3.3, 2.2);
pArc->setCenter(point);
The Radius property defines the radius of the circular arc as a positive Double value in drawing units. The radius is zero by default.
To get the radius, use the radius() method which does not have arguments and returns the radius as a Double value. For example:
odPrintConsoleString(L"\nArc radius = %g", pArc->radius());
To set the radius, use the setRadius() method which requires a positive Double value as an argument and does not return a value. For example:
pArc->setRadius(3.2);
The Normal property defines the normal to the plane in which the circular arc is placed. The normal defines the orientation of the circular arc in world space. The normal has the coordinates (0,0,1) by default.
To get the normal, use the normal() method which does not have arguments and returns the three-dimensional vector as an instance of the OdGeVector3d type. For example:
OdGeVector3d normal = pArc->normal();
odPrintConsoleString(L"\nNormal = (%g,%g,%g)", normal.x, normal.y, normal.z);
To set the normal, use the setNormal() method which requires the three-dimensional vector as an argument of the OdGeVector3d type and does not return a value. The method automatically converts the specified vector to the unit vector. For example:
OdGeVector3d vector(0.707, 0.251, 0.707);
pArc->setNormal(vector);
The setNormal() method automatically converts the specified coordinates to the unit vector. For example:
pArc->setNormal( OdGeVector3d(2.5, 1.2, 3.4) );
OdGeVector3d result = pArc->normal();
odPrintConsoleString(L"\n(%g, %g, %g)", result.x, result.y, result.z);
// (0.569803, 0.273505, 0.774932)
The Start and End Angle properties define the angle from which, and to which, the circular arc is drawn, both as Double values in radians. A positive angle is measured from the OCS X-axis counterclockwise. A negative angle is measured from the OCS X-axis clockwise and is automatically converted to its positive equivalent. If an angle value is more than 2PI, it is automatically converted to the range 0 to 2PI. The start and end angles are zero by default.
To get the start angle, use the startAngle() method which does not have arguments and returns the start angle as a Double value. For example:
odPrintConsoleString(L"\nStart angle = %g", pArc->startAngle());
To set the start angle, use the setStartAngle() method which requires a Double value as an argument and does not return a value. For example:
pArc->setStartAngle(0.707);
To get the end angle, use the endAngle() method which does not have arguments and returns the end angle as a Double value. For example:
odPrintConsoleString(L"\nEnd angle = %g", pArc->endAngle());
To set the end angle, use the setEndAngle() method which requires a Double value as an argument and does not return a value. For example:
pArc->setEndAngle(2.215);
For example, converting an angle:
pArc->setStartAngle(8.45);
pArc->setEndAngle(-1.45);
odPrintConsoleString(L"\nStart = %g, End = %d", pArc->startAngle(), pArc->endAngle());
// Start = 2.16681, End = 4.83319
To find out how to convert start and end angles to have them correct in the XY plane when a normal does not have default coordinates (0, 0, 1), see this FAQ .
The Thickness property defines the thickness of the circular arc as a Double value in drawing units. A positive value defines the thickness to be drawn along the normal direction. A negative value defines the thickness to be drawn in the opposite direction from the normal. A zero value defines an arc without thickness. The thickness is zero by default.
To get the thickness, use the thickness() method which does not have arguments and returns the thickness as a Double value. For example:
odPrintConsoleString(L"\nThickness = %g", pArc->thickness());
To set the thickness, use the setThickness() method which requires a Double value as an argument and does not return a value. For example:
pArc->setThickness(1.5);
Computed Circular Arc Properties
Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.
|