Posts: 217
Registered: ‎08-24-2010
Message 1 of 4 (273 Views)

different Between Database definitions

273 Views, 3 Replies
04-22-2013 03:17 AM

what's the different between


 Dim oDb As Database = HostApplicationServices.WorkingDatabase



Dim oDb As Database = Application.DocumentManager.MdiActiveDocument.Database


Dim oDb As Database = Application.DocumentManager.MdiActiveDocument.Editor.Document.Database


Valued Mentor
Posts: 370
Registered: ‎05-06-2012
Message 2 of 4 (250 Views)

Re: different Between Database definitions

04-22-2013 06:26 AM in reply to: Amremad

In AutoCAD they return the same value.


HostApplicationServices is a way to access certain functions in non-AutoCAD host applications (e.g,. RealDWG), where there is no Document object.

Posts: 224
Registered: ‎09-15-2011
Message 3 of 4 (239 Views)

Re: different Between Database definitions

04-22-2013 07:17 AM in reply to: Amremad

Autodesk.AutoCAD.ApplicationServices.Application is a class from assembly acmgd.dll which references acdbmgd.dll


Autodesk.AutoCAD.DatabaseServices.HostApplicationServices is a class from acdbmgd.dll


Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.WorkingDatabase is the active working database of the single-threaded RealDWG process, which is an engine of AutoCAD without UI.


In AutoCAD, Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.WorkingDatabase is a pointer of Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database. So every time you change the active drawing on AutoCAD, it will set MdiActiveDocument.Database to WorkingDatabase. There are many MdiActiveDocument.Databases in DocumentManager, but there is only one WorkingDatabase which is a worker of MdiActiveDocument.Database.


In short, all AutoCAD database tasks are based on RealDWG engine, MdiActiveDocument.Database is an upper layer of WorkingDatabase.


You also see the another answer at the link.





Posts: 224
Registered: ‎09-15-2011
Message 4 of 4 (232 Views)

Re: different Between Database definitions

04-22-2013 07:31 AM in reply to: Amremad

In short, in AutoCAD:
Application.DocumentManager.MdiActiveDocument.Database calls HostApplicationServices.WorkingDatabase to execute the drawing database job.

MdiActiveDocument.Editor.Document = MdiActiveDocument so MdiActiveDocument.Editor.Document.Database = MdiActiveDocument.Database

In RealDWG, there is only HostApplicationServices.WorkingDatabase

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!