明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 4002|回复: 6

请问acdbOpenObject,acdbOpenAcDbObject,acdbOpenAcDbEntity()区别?

[复制链接]
发表于 2004-9-23 22:32:00 | 显示全部楼层 |阅读模式
AcDbEntity, AcDbObject的区别是什么? acdbOpenAcDbEntity(), acdbOpenAcDbObject(), acdbOpenObject() Global Function的区别是什么?
使用时注意些什么?
发表于 2004-9-24 08:01:00 | 显示全部楼层
1。AcDbEntity, AcDbObject的区别是什么? 答:AcDbEntity继承自AcDbObject,即除AcDbObject所有的属性和方法之外,还增加有自绘方法(属性也不一定),可以说具有图形特性。 2。acdbOpenAcDbEntity(), acdbOpenAcDbObject(), acdbOpenObject() Global Function的区别是什么?
使用时注意些什么? 答:acdbOpenAcDbEntity专用打开AcDbEntity,acdbOpenAcDbObject专用打开AcDbObject,acdbOpenObject会自动根据你的ObjectId所对应实体类型,调用acdbOpenAcDbEntity或acdbOpenAcDbObject。
 楼主| 发表于 2004-9-24 11:12:00 | 显示全部楼层

回复

谢谢easypower版主
 楼主| 发表于 2004-9-25 00:31:00 | 显示全部楼层

回复

不太明白: rex12:
With acdbOpenAcDbEntity() you can open ONLY Objects derived from AcDbEntity,
With acdbOpenAcDbObject() you can open ONLY Objects NOT derived from AcDbEntity(that is, have no graphics).
acdbOpenObject()-> there are more possibilities. All descriptions you will find in docs.
That is a mention for objects openning. There is no matter if you want to open an AcDb Entity or AcDbObject derived object. Art Cooney:
That's not correct. acdbOpenAcDbObject() will open objects that are derived from AcDbEntity - it will open any type of object. rex12:
well it's may be, I haven't try it, all i have done was to read reference and there that is written.
So the reference is not correct or ...?
Generally, I use acdbOpenObject function to open an object.
Best Regards Art Cooney:
acdbOpenAcDbEntity() checks to see if the object being opened is of a class directly or indirectly derived from
AcDbEntity and returns an error if it is not.
It also takes a reference to an AcDbEntity* as an argument and sets it to point to the opened entity.
acdbOpenAcDbObject will open any object. It takes a reference to an AcDbObject* as AcDbObject* as an argument and
sets it to point to the opened object.
acdbOpenObject() is template function that is implemented for each class and takes a reference to a pointer to that
class and sets it to point to the opened object. This function uses acdbOpenAcDbObject() to do the actual open operation.
 楼主| 发表于 2004-9-25 09:36:00 | 显示全部楼层

解决方法

很好的方法:
Cyrille Fauvel:
I think Art replied on the subject, but just as a matter of coding style
I prefer using AcDbObjectPointer<T> class where T is the class you want to use.
When using this class I do not have to mind about closing the object. AcDbObjectPointer<AcDbLine> myLine (id, AcDb::kForRead);
myLine->setStartPoint(...);
...
// Never call myLine->close()
Ultimately the AcDbObjectPointer<T> is calling acdbOpenAcDbObject() and close for you.
发表于 2004-9-25 13:31:00 | 显示全部楼层
王咣生发表于2004-9-25 0:31:00回复:(王咣生)回复不太明白: rex12: With acdbOpenAcDbEntity() you can open ONLY Objects derived from AcDbEntity, With acdbOpenAcDbObject() you...
有什么不明白???
发表于 2004-9-25 13:32:00 | 显示全部楼层
王咣生发表于2004-9-25 9:36:00回复:(王咣生)解决方法 很好的方法: Cyrille Fauvel: I think Art replied on the subject, but just as a matter of coding style I prefer using ...

Smart Pointer是很好用的 值得推荐
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-26 09:30 , Processed in 0.189329 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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