Drawings SDK Developer Guide > Working with .dwg Files > Working with Entities > Working with Specific Entitites > Working with 3D Faces > Overview of 3D Faces
Overview of 3D Faces

A 3D face is an entity that specifies a three-dimensional quadrangle figure in world space. Vertices of the 3D face are not placed in a single plane. The OdDbFace class is the face object that represents the interface for accessing a face entity and manipulating its properties. The OdDbFacePtr class is the typified smart pointer to an instance of the face entity and is used for storing and passing references to the face object.

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


OdDbFacePtr pFace = OdDbFace::createObject();

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


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

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

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

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


OdDbEntityPtr pEntity = pFace;

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


// Accurate comparing
if(pEntity->isA() == OdDbFace::desc())
  odPrintConsoleString(L"\nEntity is the 3D face");

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

See Also

Specific 3D Face Properties

Example of Working with the 3D Face Object

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