CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ObjectARX 开发指南

将组添加到组字典

2023-1-1 07:20| 发布者: admin| 查看: 291| 评论: 0|来自: AutoCAD

下面的代码从 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();
}

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-19 13:55

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部