⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 [arx] 关于acdbopenacdbentity(), acdbopenacdbobject(), acdbopenobject()讨论.txt

📁 看看吧,很好的东西,
💻 TXT
字号:
[???]
//-----------What's the differences between functions acdbOpenAcDbEntity(), acdbOpenAcDbObject(), 
// acdbOpenObject()------------------------------------------------------------------------------
acdbOpenAcDbEntity(), acdbOpenAcDbObject(), acdbOpenObject() 几个函数的区别:

Reply From: 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 possiblities. All descriptions you will find
in docs. That is a maintion for objects openning. There is no matter if you want
to open an AcDbEntity or AcDbObject derived object.

Reply From: Art Cooney
That's not correct. acdbOpenAcDbObject() will open objects that are derived from AcDbEntity - 
it will open any type of object.

Reply From: rex12
Well it's may be, I haven't try it, all i have done was to read the reference and there that is written.
So the reference is not correct or...;
Generally, I use acdbOpenObject function to open an object.

Best Regards.
Rex

Reply From: Art Cooney
I can see how the docs might be confusing. They don't say that the function will not open entities, 
what they say is that the function 'provides a means to open database-resident objects that are not 
derived from AcDbEntity (that is, have no graphics)'. What this is trying to say is that the function
is intended to be used on non-graphical objects. I will work on rewriting this to make it clearer.

I too use acdbOpenObject() so that I can get the type checking that makes sure it really is an object 
of the type I'm expecting.


Reply From: Art Cooney
acdbOpenAcDbEntity() checks to see if the object being opened is a class directly or indirectly from 
AcDbEntity and returns an error if it is not. I 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 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.

Reply From: Cyrille Fauvel
I think Art replied on the subject, but just as a matter of coding style I prefer using the 
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.

i.e.
AcDbObjectPointer<AcDbLine> myLine(id, AcDb::kForRead);
myLine->setStartPoint(...);
// never call myLine->close()
Ultimately the AcDbObjectPointer<T> is calling acdbOpenAcDbObject() and close() for you.

cheers 
cyrille

[???]
//-----------how to convert object type AcDbObjectPointer<T> to AcDbPolyline* type?--------------------

Reply From: J.Daniel Smith
There is an object() method on AcDbObjectPointer<> which will return the pointer.
if (const AcDbPolyline * pPline = AcDbPolyline::cast(ent.object))
{
  //use pPline
}

Dan

Reply From: Cyrille Fauvel
Like Daniel said there is an object() method for that
i.e pEnt.object()
note it is a . and not ->

But you do not need that. It would be better to write you code like this
AcDbObjectPointer <AcDbPolyline> pLine (objid, AcDb::kForRead);
if(pLine.openStatus() == Acad::eOk)
{
  //here it is a AcDbPolyline opened for read
  //I can use pLine-> as if it was a 'AcDbPolyline*'
}

cheers
cyrille



































⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -