Drawings SDK Developer Guide > Working with .dwg Files > Working with Entities > Working with Specific Entitites > Working with Circles > Overview of Circles
Overview of Circles

A circle is a parametric entity that specifies the closed circular figure in world space. The OdDbCircle class is the circle object that represents the interface for accessing a circle entity and manipulating its properties. The OdDbCirclePtr class is the typified smart pointer to an instance of the circle entity and is used for storing and passing references to the circle object.

To create an instance of the circle object, use the createObject() method of the OdDbCircle class which is the static pseudo-constructor. For example:


OdDbCirclePtr pCircle = OdDbCircle::createObject();

The pseudo-constructor initializes the properties of a new instance using default values. After creating, the new circle instance must be added in model space, paper space, or a block using the appendOdDbEntity() method. The database associates the object ID with the circle instance. In examples, the pDb variable stores a pointer to the database object. For example:


// Add in the block
OdDbBlockTablePtr pBlocks = pDb->getBlockTableId().safeOpenObject(OdDb::kForRead);
OdDbBlockTableRecordPtr pBlock = pBlocks->getAt(L"BLOCK", OdDb::kForWrite)
OdDbObjectId idCircle = pBlock->appendOdDbEntity(pCircle);

// Add in the model space
OdDbBlockTableRecordPtr pModel = pDb->getModelSpaceId().safeOpenObject(OdDb::kForWrite);
pModel->appendOdDbEntity(pCircle);

// Add in the paper space
OdDbBlockTableRecordPtr pPaper = pDb->getPaperSpaceId().safeOpenObject(OdDb::kForWrite);
pPaper->appendOdDbEntity(pCircle);

The OdDbCircle class is derived from the OdDbCurve class and inherits the common properties of parametric curves. The OdDbCurve class is derived from the OdDbEntity class, therefore the OdDbCircle class also inherits the general properties of entities. A pointer to a circle object can be converted to an entity object or a curve object. For example:


OdDbEntityPtr pEntity = pCircle;
OdDbCurvePtr pCurve = pCircle;

The circle object has the AcDbCircle class name. To verify an instance, use the isKindOf() and desc() methods. For example:


// Accurate comparing
if(pEntity->isA() == OdDbCircle::desc())
  odPrintConsoleString(L"\nEntity is the circle");

// Check on belonging
if(pEntity->isKindOf(OdDbCircle::desc()))
  odPrintConsoleString(L"\nEntity is derived from the circle object");

See Also

Specific Circle Properties

Computed Circle Properties

Example of Working with the Circle Object

Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.