请问acdbOpenObject,acdbOpenAcDbObject,acdbOpenAcDbEntity()区别?
AcDbEntity, AcDbObject的区别是什么?acdbOpenAcDbEntity(), acdbOpenAcDbObject(), acdbOpenObject() Global Function的区别是什么?<BR>使用时注意些什么? 1。AcDbEntity, AcDbObject的区别是什么?
答:AcDbEntity继承自AcDbObject,即除AcDbObject所有的属性和方法之外,还增加有自绘方法(属性也不一定),可以说具有图形特性。
2。acdbOpenAcDbEntity(), acdbOpenAcDbObject(), acdbOpenObject() Global Function的区别是什么?<BR>使用时注意些什么?
答:acdbOpenAcDbEntity专用打开AcDbEntity,acdbOpenAcDbObject专用打开AcDbObject,acdbOpenObject会自动根据你的ObjectId所对应实体类型,调用acdbOpenAcDbEntity或acdbOpenAcDbObject。
回复
谢谢easypower版主回复
不太明白:rex12:<BR> With acdbOpenAcDbEntity() you can open ONLY Objects derived from AcDbEntity,<BR> With acdbOpenAcDbObject() you can open ONLY Objects NOT derived from AcDbEntity(that is, have no graphics).<BR> acdbOpenObject()-> there are more possibilities. All descriptions you will find in docs.<BR> 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:<BR> That's not correct. acdbOpenAcDbObject() will open objects that are derived from AcDbEntity - it will open any type of object.
rex12:<BR> well it's may be, I haven't try it, all i have done was to read reference and there that is written.<BR> So the reference is not correct or ...?<BR> Generally, I use acdbOpenObject function to open an object.<BR> Best Regards
Art Cooney:<BR> acdbOpenAcDbEntity() checks to see if the object being opened is of a class directly or indirectly derived from <BR> AcDbEntity and returns an error if it is not.<BR> It also takes a reference to an AcDbEntity* as an argument and sets it to point to the opened entity.<BR> acdbOpenAcDbObject will open any object. It takes a reference to an AcDbObject* as AcDbObject* as an argument and <BR> sets it to point to the opened object.<BR> acdbOpenObject() is template function that is implemented for each class and takes a reference to a pointer to that<BR> class and sets it to point to the opened object. This function uses acdbOpenAcDbObject() to do the actual open operation.<BR>
解决方法
很好的方法:<BR> Cyrille Fauvel:<BR> I think Art replied on the subject, but just as a matter of coding style <BR> I prefer using AcDbObjectPointer<T> class where T is the class you want to use.<BR> When using this class I do not have to mind about closing the object.AcDbObjectPointer<AcDbLine> myLine (id, AcDb::kForRead);<BR> myLine->setStartPoint(...);<BR> ...<BR> // Never call myLine->close()<BR> Ultimately the AcDbObjectPointer<T> is calling acdbOpenAcDbObject() and close for you.<BR> 王咣生发表于2004-9-25 0:31:00static/image/common/back.gif回复:(王咣生)回复不太明白:
rex12: With acdbOpenAcDbEntity() you can open ONLY Objects derived from AcDbEntity, With acdbOpenAcDbObject() you...
有什么不明白???<BR> 王咣生发表于2004-9-25 9:36:00static/image/common/back.gif回复:(王咣生)解决方法 很好的方法: Cyrille Fauvel: I think Art replied on the subject, but just as a matter of coding style I prefer using ...
<BR>Smart Pointer是很好用的
值得推荐
页:
[1]