The circle object uses the center, radius, normal, and thickness properties to define the geometry to be drawn. In examples, the pCircle variable stores a pointer to the circle object.
The Center property defines the center of the circle 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 = pCircle->center();
odPrintConsoleString(L"\nCenter = (%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.5, 2.5, 0.5);
pCircle->setCenter(point);
The Radius property defines the radius of the circle 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"\nRadius = %g", pCircle->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:
pCircle->setRadius(3.2);
The Normal property defines the normal to the plane in which the circle is placed. The normal defines the orientation of the circle 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 = pCircle->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. For example:
OdGeVector3d vector(0.707, 0.215, 0.707);
pCircle->setNormal(vector);
The setNormal() method automatically converts the specified coordinates to the unit vector. For example:
pCircle->setNormal( OdGeVector3d(2.5, 1.2, 3.4) );
OdGeVector3d result = pCircle->normal();
odPrintConsoleString(L"\n(%g, %g, %g)", result.x, result.y, result.z);
// (0.569803, 0.273505, 0.774932)
The Thickness property defines the thickness of the circle 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 a circle 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", pCircle->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:
pCircle->setThickness(1.5);
Example of Working with the Circle Object
Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.
|