A two-dimensional solid is an entity that specifies the quadrangle planar figure in world space. The OdDbSolid class is a planar solid object that represents the interface for accessing a solid entity and manipulating its properties. The OdDbSolidPtr class is the typified smart pointer to an instance of the quadrangle entity and is used for storing and passing references to the planar solid object.
To create an instance of the planar solid object, use the createObject() method of the OdDbSolid class that is the static pseudo-constructor. For example:
OdDbSolidPtr pSolid = OdDbSolid::createObject();
The pseudo-constructor initializes the properties of a new instance using default values. After creating, the new planar solid instance must be added in model space, paper space, or a block using the appendOdDbEntity() method. The database associates the object ID with the instance of the planar solid object. 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 idSolid = pBlock->appendOdDbEntity(pSolid);
// Add in the model space
OdDbBlockTableRecordPtr pModel = pDb->getModelSpaceId().safeOpenObject(OdDb::kForWrite);
pModel->appendOdDbEntity(pSolid);
// Add in the paper space
OdDbBlockTableRecordPtr pPaper = pDb->getPaperSpaceId().safeOpenObject(OdDb::kForWrite);
pPaper->appendOdDbEntity(pSolid);
The OdDbSolid class is derived from the OdDbEntity class and inherits the general properties of entities. A pointer to a planar solid object can be converted to an entity object. For example:
OdDbEntityPtr pEntity = pSolid;
The planar solid object has the AcDbSolid class name. To verify an instance, use the isKindOf() and desc() methods. For example:
// Accurate comparing
if(pEntity->isA() == OdDbSolid::desc())
odPrintConsoleString(L"\nEntity is the planar solid");
// Check on belonging
if(pEntity->isKindOf(OdDbSolid::desc()))
odPrintConsoleString(L"\nEntity is derived from the planar solid object");
Specific Planar Solid Properties
Example of Working with the Planar Solid Object
Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.
|