找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 696|回复: 5

[ARX程序]:急!!!请教晓东

[复制链接]
发表于 2004-11-9 17:48:57 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
acedCommand (RTSTR,"_pline",RTSTR,"指定起点",RTNONE);
这个命令之后我通过反映器commadEnded得到了命令结束时候的消息后需要将一个扩展数据附给所画的多段线..
但是因为acdbOpenObject在commadEnded之后不能打开实体
请晓东帮忙解决这个问题
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2004-11-9 21:46:17 | 显示全部楼层
ref. below pls:
-----------------------------
AcTransaction::getObject Function virtual Acad::ErrorStatus

getObject(

AcDbObject*& obj,

AcDbObjectId objectId,

AcDb::OpenMode mode,

bool openErasedObject = false) = 0;

obj Returns pointer to obtained object
objectId Input objectId of object to obtain
mode Input mode to obtain in
openErasedObject Input Boolean indicating whether to obtain erased objects

This function is the transaction equivalent of acdbOpenObject. A pointer to the object identified by objectId is obtained under the transaction and returned in the obj argument. The mode argument specifies how the object is to be treated--as AcDb::kForRead, AcDb::kForWrite, or AcDb::kForNotify. If the openErasedObject Boolean is true, then even an erased object can be obtained. If openErasedObject is false, then trying to obtain an erased entity results in an error return value.

Returns Acad::eOk if successful. If openErasedObject is false, then trying to obtain an erased object results in a return status of Acad::eWasErased. If there are currently no transactions, then it returns Acad::eNoActiveTransactions.

Reminder Obtaining an object pointer via getObject() runs in parallel with acdbOpenObject(). This means that both can be in effect at the same time with AcDb::kForWrite status in both. For more information, see the section on transactions in the ObjectARX Developer's Guide.
[/COLOR]
Note This function is duplicated in the AcTransactionManager class where it always operates on the topmost AcTransaction object (by calling the getObject() function in the topmost transaction object). Only the topmost transaction is allowed to obtain entities, so using the AcTransactionManager version of this function is safer and easier.
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2004-11-10 00:06:09 | 显示全部楼层
在这种问题上要使用事务管理,很容易出问题:它要求必须是顶层事务对象。
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2004-11-10 00:29:44 | 显示全部楼层
如何解决这个问题呢?请详细点说明好吗
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2004-11-11 00:17:19 | 显示全部楼层
最初由 Hellow 发布
[B]在这种问题上要使用事务管理,很容易出问题:它要求必须是顶层事务对象。 [/B]

-------------
在我的成功试例中有点意外,不是顶层事务的对象也可以get 到
(也许是我理解有错?)
下面代码处在 *** ::commandEnded() 中:

  1.     struct resbuf      xData=NULL;
  2.     AcDbObjectId       ObjId;
  3.     AcDbEntity       *pEnt=NULL;
  4.     AcTransactionManager *acTrans;

  5.     .....
  6.     // get the object  ID >>   ObjId;     (from acdbEntLast()...?)
  7.     .....
  8.     // build  xData list  >>>   xData;
  9.     .....

  10.     acTrans = acTransactionManagerPtr();
  11.     acTrans->startTransaction();
  12.     acTrans->getObject( (AcDbObject *&)pEnt, ObjId, AcDb::kForWrite, FALSE);
  13.     pEnt->setXData( xData);
  14.     pEnt->close();
  15.     acTrans->endTransaction();
复制代码
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2004-11-11 11:42:53 | 显示全部楼层
呵呵..我已经解决了..谢谢了
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-9-22 06:38 , Processed in 0.448451 second(s), 41 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表