CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2022 开发者帮助

所有权参考

2024-5-18 18:49| 发布者: admin| 查看: 130| 评论: 0|原作者: admin|来自: AutoCAD

所有权参考

如果要创建自己的所有权层次结构,则需要在所有者和拥有的对象之间设置连接。一个对象不能有多个所有者。

创建所有权连接

  1. 指定所有者拥有该对象。
  2. 指定对象属于所有者。

该协议始终指定从所有者到拥有对象的链接以及从对象到其所有者的向后链接。AcDbObject

以下代码演示如何在所有者与其内容之间设置双向所有权链接:

// Uses the OwnerDemo class defined in the next example
// (see "ObjectARX Example," below).
//
// Sets pOwner to be the owner of pOwned.
//
void
makeOwner(OwnerDemo* pOwner, AcDbObject* pOwned)
{
    // First let pOwner know it is the owner.  This
    // establishes ownership for filing persistence.
    //
    pOwner->setIdData(pOwned->ojectId());
    // Now set up the backpointer so that the owned
    // object knows who its owner is.
    //
    pOwned->setOwnerId(pOwner->objectId());
}

最常用的容器类成员会自动建立双向链接。例如,以下函数调用将块表记录设置为实体的所有者,并将该实体添加到块表记录的拥有实体列表中。

blockTableRecord->appendAcDbEntity( ...);

同样,函数和函数在一个步骤中在所有者与其对象之间建立了双向链接。AcDbDictionary::setAt()AcDbSymbolTable::add()

如果使用 或 直接操作对象 AutoLISP ,则首先使用 将拥有的对象添加到数据库中,然后将其 或实体名称与所有者对象表示中的相应 DXF 组代码相关联。(entmod)(entmake) ® (entmake)ads_name

父主题:

  1. 派生自 AcDbObject

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2025-3-14 07:15

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部