王咣生 发表于 2004-9-23 22:32:00

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

AcDbEntity, AcDbObject的区别是什么?
acdbOpenAcDbEntity(), acdbOpenAcDbObject(), acdbOpenObject() Global Function的区别是什么?
使用时注意些什么?

easypower 发表于 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 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 myLine (id, AcDb::kForRead);
                                       myLine->setStartPoint(...);
                                       ...
                                       // Never call myLine->close()
                                       Ultimately the AcDbObjectPointer is calling acdbOpenAcDbObject() and close for you.

easypower 发表于 2004-9-25 13:31:00


有什么不明白???

easypower 发表于 2004-9-25 13:32:00


Smart Pointer是很好用的
值得推荐
页: [1]
查看完整版本: 请问acdbOpenObject,acdbOpenAcDbObject,acdbOpenAcDbEntity()区别?