将组添加到组字典
下面的代码在 and 函数中创建的线和圆之外创建一个组 (),并将该组放入 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, 2024-12-15 13:15
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.