找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 125|回复: 0

OBJECT ARX 遍历数据库所有图元代码

[复制链接]

1

主题

0

回帖

35

积分

管理员

积分
35
发表于 2024-5-2 22:48:27 | 显示全部楼层 |阅读模式
  1. typedef void (*DoSomethingWithEnt)( AcDbEntity*);
  2. void WalkThrough(AcDbDatabase* db, DoSomethingWithEnt callBack)
  3. {
  4. AcDbBlockTable *pBlockTable;
  5. db->getSymbolTable(pBlockTable, AcDb::kForRead);
  6. AcDbBlockTableIterator* pBlockIt;
  7. Acad::ErrorStatus es = pBlockTable->newIterator(pBlockIt);
  8. if(Acad::eOk != es)
  9. {
  10. pBlockTable->close();
  11. return;
  12. }
  13. AcDbBlockTableRecord *pBlockTableRecord;
  14. for(pBlockIt->start();!pBlockIt->done();pBlockIt->step())
  15. {
  16. es = pBlockIt->getRecord(pBlockTableRecord, AcDb::kForRead);
  17. if(Acad::eOk == es)
  18. {
  19. AcDbBlockTableRecordIterator* pEntIt;
  20. es = pBlockTableRecord->newIterator(pEntIt);
  21. if(Acad::eOk == es)
  22. {
  23. for (pEntIt->start();!pEntIt->done();pEntIt->step())
  24. {
  25. AcDbEntity* pEnt;
  26. es = pEntIt->getEntity(pEnt, AcDb::kForWrite);
  27. if (Acad::eOk == es)
  28. {
  29. callBack(pEnt);
  30. pEnt->close();
  31. }
  32. }
  33. delete pEntIt;
  34. }
  35. pBlockTableRecord->close();
  36. }
  37. }
  38. delete pBlockIt;
  39. pBlockTable->close();
  40. }
复制代码
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|膜结构网

GMT+8, 2025-1-4 12:04 , Processed in 0.133133 second(s), 23 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表