TA的每日心情 | 开心 7 小时前 |
---|
签到天数: 20 天 [LV.4]偶尔看看III
管理员
- 积分
- 1393
|
- typedef void (*DoSomethingWithEnt)( AcDbEntity*);
-
- void WalkThrough(AcDbDatabase* db, DoSomethingWithEnt callBack)
- {
- AcDbBlockTable *pBlockTable;
- db->getSymbolTable(pBlockTable, AcDb::kForRead);
- AcDbBlockTableIterator* pBlockIt;
- Acad::ErrorStatus es = pBlockTable->newIterator(pBlockIt);
- if(Acad::eOk != es)
- {
- pBlockTable->close();
- return;
- }
- AcDbBlockTableRecord *pBlockTableRecord;
- for(pBlockIt->start();!pBlockIt->done();pBlockIt->step())
- {
- es = pBlockIt->getRecord(pBlockTableRecord, AcDb::kForRead);
- if(Acad::eOk == es)
- {
- AcDbBlockTableRecordIterator* pEntIt;
- es = pBlockTableRecord->newIterator(pEntIt);
- if(Acad::eOk == es)
- {
- for (pEntIt->start();!pEntIt->done();pEntIt->step())
- {
- AcDbEntity* pEnt;
- es = pEntIt->getEntity(pEnt, AcDb::kForWrite);
- if (Acad::eOk == es)
- {
- callBack(pEnt);
- pEnt->close();
- }
- }
- delete pEntIt;
- }
- pBlockTableRecord->close();
- }
- }
- delete pBlockIt;
- pBlockTable->close();
- }
复制代码 |
|