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

A point is an elementary entity in world space. The OdDbPoint class is a point object that represents the interface for accessing a point entity and manipulating its properties. The OdDbPointPtr class is the typified smart pointer to an instance of the point entity and is used for storing and passing references to the point object.

To create an instance of the point object, use the createObject() method of the OdDbPoint class that is the static pseudo-constructor. For example:


OdDbPointPtr pPoint = OdDbPoint::createObject();

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


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

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

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

The OdDbPoint class is derived from the OdDbEntity class and inherits the general properties of entities. A pointer to a point object can be converted to an entity object. For example:


OdDbEntityPtr pEntity = pPoint;

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


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

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

See Also

Specific Point Properties

Example of Working with the Point Object

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