找回密码
 立即注册

QQ登录

只需一步,快速开始

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

长事务

[复制链接]

1

主题

0

回帖

37

积分

管理员

积分
37
发表于 2024-5-4 18:43:15 | 显示全部楼层 |阅读模式
  1. static void zffObjectARX采用MyCommand14(void)
  2. {
  3. // Add your code for command zffObjectARX.采用MyCommand14 here
  4. ACHAR* fileName;
  5. AcDbDatabase* pDb;
  6. AcDbObjectId transId;
  7. struct resbuf* filename;
  8. filename=acutNewRb(RTSTR);
  9. acedGetFileD(采用T("请选择要检出的图"),NULL,采用T("dwg"),0,filename);
  10. pDb=new AcDbDatabase(Adesk::kFalse);
  11. fileName=filename->resval.rstring;
  12. pDb->readDwgFile(fileName);
  13. AcDbBlockTable *pBlk=NULL;
  14. AcDbBlockTableRecord *pBlkRcd=NULL;
  15. pDb->getSymbolTable(pBlk,AcDb::kForRead);
  16. pBlk->getAt(ACDB采用MODEL采用SPACE,pBlkRcd,AcDb::kForRead);
  17. pBlk->close();
  18. AcDbObjectIdArray objIds;
  19. AcDbBlockTableRecordIterator* it=NULL;
  20. pBlkRcd->newIterator(it);
  21. pBlkRcd->close();
  22. AcDbEntity* pEnt=NULL;
  23. for (it->start();!it->done();it->step())
  24. {
  25. it->getEntity(pEnt,AcDb::kForRead);
  26. if (pEnt->isKindOf(AcDbCircle::desc()))
  27. {
  28. objIds.append(pEnt->objectId());
  29. }
  30. }
  31. pEnt->close();
  32. delete it;
  33. AcDbBlockTable* pBlkCur=NULL;
  34. AcDbBlockTableRecord* pBlkRcdCur=NULL;
  35. acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlkCur,AcDb::kForRead);
  36. pBlkCur->getAt(ACDB采用MODEL采用SPACE,pBlkRcdCur,AcDb::kForWrite);
  37. pBlkCur->close();
  38. AcDbObjectId objIdCur=pBlkRcdCur->objectId();
  39. pBlkRcdCur->close();
  40. AcDbIdMapping p;
  41. acapLongTransactionManagerPtr()->checkOut(transId,objIds,objIdCur,p);
  42. //AcDbObject* pObj=NULL;
  43. AcDbLongTransaction* pLongTrans;
  44. if (acdbOpenObject(pLongTrans,transId,AcDb::kForWrite)==Acad::eOk)
  45. {
  46. //AcDbLongTransaction* pLongTrans=AcDbLongTransaction::cast(pObj);
  47. AcDbLongTransWorkSetIterator* pItor=NULL;
  48. pLongTrans->newWorkSetIterator(pItor);
  49. int index;
  50. acedGetInt(采用T("\n输入要改变的颜色值:"),&index);
  51. for (pItor->start();!pItor->done();pItor->step())
  52. {
  53. AcDbEntity* pEnt1=NULL;
  54. acdbOpenObject(pEnt1,pItor->objectId(),AcDb::kForWrite);
  55. pEnt1->setColorIndex(index);
  56. pEnt1->close();
  57. }
  58. delete pItor;
  59. ACHAR str[20]={0};
  60. acedGetString(0,采用T("\n观察实体的改变,按回车结束!"),str);
  61. pLongTrans->close();
  62. }
  63. acapLongTransactionManagerPtr()->checkIn(transId,p);
  64. pDb->saveAs(fileName);
  65. acutRelRb(filename);
  66. delete pDb;
  67. pDb=NULL;
  68. }
复制代码
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-1-4 13:07 , Processed in 0.113111 second(s), 23 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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