下面的代码从 andfunctions 中创建的行和圆中创建一组 (),并将该组放入 GROUP 字典中。线和圆的对象 ID 将传递到函数中。请注意如何打开 GROUP 字典进行写入、修改,然后显式关闭。pGroupcreateLine()createCircle() void createGroup(AcDbObjectIdArray& objIds, char* pGroupName) { AcDbGroup *pGroup = new AcDbGroup(pGroupName); // Put the group in the group dictionary which resides // in the named object dictionary. // AcDbDictionary *pGroupDict; acdbHostApplicationServices()->workingDatabase() ->getGroupDictionary(pGroupDict, AcDb::kForWrite); AcDbObjectId pGroupId; pGroupDict->setAt(pGroupName, pGroup, pGroupId); pGroupDict->close(); // Now that the group has been added, it has an ObjectID. // This is important since the group will become a persistent // reactor for the added entities... for (int i = 0; i < objIds.length(); i++) { pGroup->append(objIds[i]); } pGroup->close(); } |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:05
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.