CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ObjectARX 开发指南

所有权参考

2022-12-31 22:03| 发布者: admin| 查看: 266| 评论: 0|来自: 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()

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


路过

雷人

握手

鲜花

鸡蛋

最新评论

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

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

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部