|
AcDbObjectId CCommonFuntion::PostToModelSpace(AcDbEntity* pEnt)
{
// 获得指向块表的指针
AcDbBlockTable *pBlockTable = NULL;
//workingDatabase()能够获得一个指向当前活动的图形数据库的指针,
acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable, AcDb::kForRead);
// 获得指向特定的块表记录(模型空间)的指针
AcDbBlockTableRecord *pBlockTableRecord = NULL;
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite);
AcDbObjectId entId;
// 将AcDbLine类的对象添加到块表记录中
pBlockTableRecord->appendAcDbEntity(entId, pEnt);
// 关闭图形数据库的各种对象
pBlockTable->close();
pBlockTableRecord->close();
pEnt->close();
return entId;
} |
|