DBObject vs. Entity

DBObject vs. Entity

Anonymous
Not applicable
3,878 Views
3 Replies
Message 1 of 4

DBObject vs. Entity

Anonymous
Not applicable

I'm really newb in autocad.net. I didn't understand clearly about these type.

in code from Mr. Kean Walmsley:

Transactiontr =  doc.TransactionManager.StartTransaction();

using (tr)

{

            DBObject obj =  tr.GetObject(id, OpenMode.ForWrite);

            ....

             tr.Commit();

}

But I use type Entity also can get the same result. So what is different between them. And how to use them in a good way.

0 Likes
3,879 Views
3 Replies
Replies (3)
Message 2 of 4

Hallex
Advisor
Advisor

If these both are graphical objects

 so there is no difference between them,

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
0 Likes
Message 3 of 4

Anonymous
Not applicable
To quote the ObjectARX docs: "The DBObject class is the base class for all objects that reside in an Database object." The Entity class directly inherits from DBObject. The Transaction.GetObject() method returns a DBObject type and you then cast it to other types. So if your ObjectId references an Entity, you can cast the DBObject to type Entity and then access the Entity members. I recommend you check out the ObjectARX arxmgd.chm file or use Reflector to get a better feel for the AutoCAD .NET inheritance chains.
0 Likes
Message 4 of 4

Hallex
Advisor
Advisor

Thanks, I forgot about ObjectARX docs

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
0 Likes