找回密码
 立即注册

QQ登录

只需一步,快速开始

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

创建匿名组

[复制链接]

1

主题

0

回帖

37

积分

管理员

积分
37
发表于 2024-6-5 07:54:04 | 显示全部楼层 |阅读模式
  1. int acdbAddAnonGrpRet2Lsp()
  2. {
  3. // TODO: Implement the command
  4. resbuf *pArg =acedGetArgs ();
  5. struct resbuf *startRb = NULL;
  6. AcDbGroup *pGroup = new AcDbGroup();
  7. AcDbObjectId grpId;
  8. AcDbDictionary *pGroupDict;
  9. Acad::ErrorStatus es;
  10. AcApDocument *curDoc;
  11. //get the group dictionary
  12. AcDbDatabase *pDb = acdbHostApplicationServices()->
  13.   workingDatabase();
  14. if (Acad::eOk == (es = acDocManager->lockDocument(
  15.   curDoc=acDocManager->curDocument())))
  16.   es = pDb->getGroupDictionary(pGroupDict,AcDb::kForWrite);
  17. if (es != Acad::eOk)
  18.   return es;
  19. //make an anonymous entry
  20. if ((es = pGroupDict->setAt(L"*", pGroup, grpId)) ==
  21.   Acad::eOk) {
  22.   //retrieve its name char *pNam;
  23.   pGroup->close();
  24. }
  25. // create a resbuf with our ObjectID in it
  26. struct resbuf *newRb = acutBuildList (RTLONG, grpId, RTNONE);
  27. // if ok
  28. if (newRb != NULL) {
  29.   // if this is the first time we've done this
  30.   if (startRb == NULL) {
  31.    // then set this as the start
  32.    startRb = newRb;
  33.   }
  34.   // otherwise add it to the end of our list
  35.   else {
  36.    // create a pointer to the beginning of our resbuf list
  37.    struct resbuf *ptr = startRb;
  38.    // find the end of our list
  39.    while (ptr->rbnext != NULL)
  40.     ptr = ptr->rbnext;
  41.    // now attach our newly create resbuf to the end
  42.    ptr->rbnext = newRb;
  43.   }
  44. }
  45. pGroupDict->close();
  46. acDocManager->unlockDocument(curDoc);
  47. acedRetList(startRb);
  48. acutRelRb(startRb);
  49. return (RTNORM);
  50. }
复制代码
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-1-6 14:45 , Processed in 0.131523 second(s), 23 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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