WorkingDatabase vs MdiActiveDocument.Database

WorkingDatabase vs MdiActiveDocument.Database

Anonymous
Not applicable
2,050 Views
2 Replies
Message 1 of 3

WorkingDatabase vs MdiActiveDocument.Database

Anonymous
Not applicable
Hi,

Sorry about the newby question, but you try to search for the two terms in the subject of this post: just about every thing ever written about AutoCAD and .NET is returned.

What is the difference between instantiating my database with this:
HostApplicationServices.WorkingDatabase
and with this :
Application.DocumentManager.MdiActiveDocument.Database.

Is one better in certain circumstances? They seem to be used interchangeably in the code I see.

Thanks in advance for anyone with the time.
Bernie
0 Likes
2,051 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
The meaning of WorkingDatabase is application defined and so will depend on the host. MdiActiveDocument may or may not exist and may mean something entirely different if the host is not Autocad. Same goes for DocumentManager and Application. If the host is Autocad then they are the same. Edited by: fantum on Mar 26, 2009 12:59 AM
Message 3 of 3

Anonymous
Not applicable
fantum is correct.

Managed and native ObjectARX APIs are divided into two basic layers, one
that is not dependent on AutoCAD (as the 'host'), and can be used in RealDWG
applications (which for managed code, is acdbmdg.dll). and a second layer,
which is completely dependent on AutoCAD and cannot be used in RealDWG
applications (which for managed code, is acmdg.dll).

The HostApplicationServices object resides in the database layer, which
means that it is available to any application even when running in another
host (e.g., a RealDWG host application). The Document, DocumentCollection
and most other AutoCAD document/editor related APIs are in the application
layer (acmgd.dll), and are only available in AutoCAD.

So, if you are writing an application that you want to run in non-AutoCAD
RealDWG host applications, you cannot reference acmdg.dll or use anything
from it, and so the HostApplicationServices object is used to get the
'current' database.

In AutoCAD the two APIs always return the same database.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


wrote in message news:6149531@discussion.autodesk.com...
Hi, Sorry about the newby question, but you try to search for the two
terms in the subject of this post: just about every thing ever written about
AutoCAD and .NET is returned. What is the difference between instantiating
my database with this: HostApplicationServices.WorkingDatabase and
with this : Application.DocumentManager.MdiActiveDocument.Database.
Is one better in certain circumstances? They seem to be used interchangeably
in the code I see. Thanks in advance for anyone with the time. Bernie