.NET

Reply
New Member
bernies
Posts: 1
Registered: ‎03-26-2009
Message 1 of 3 (411 Views)

WorkingDatabase vs MdiActiveDocument.Database

411 Views, 2 Replies
03-26-2009 03:02 AM
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
Distinguished Contributor
fantum
Posts: 313
Registered: ‎12-06-2004
Message 2 of 3 (410 Views)

Re: WorkingDatabase vs MdiActiveDocument.Database

03-26-2009 05:59 AM in reply to: bernies
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
*Tony Tanzillo
Message 3 of 3 (411 Views)

Re: WorkingDatabase vs MdiActiveDocument.Database

03-26-2009 07:13 AM in reply to: bernies
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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community