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);app
// 關閉圖形數據庫的各類對象
pBlockTable->close();
pBlockTableRecord->close();
pEnt->close();指針
return entId;
}對象