|
// 根据块名称获取块定义id
static AcDbObjectId GetBlockDefinitionByName(const CString& blockName)
{
AcDbBlockTable *pBlockTable;
acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlockTable, AcDb::kForRead);
AcDbBlockTableRecord *pBlockTableRecord;
Acad::ErrorStatus es = pBlockTable->getAt(blockName, pBlockTableRecord, AcDb::kForRead);
pBlockTable->close();
AcDbObjectId objId;
if(es == Acad::eOk)
{
objId = pBlockTableRecord->objectId();
pBlockTableRecord->close();
}
return objId;
} |
|