DocumentManager.CurrentDocument vs. DocumentManager.MdiActiveDocument

DocumentManager.CurrentDocument vs. DocumentManager.MdiActiveDocument

Civil3DReminders_com
Mentor Mentor
1,564 Views
1 Reply
Message 1 of 2

DocumentManager.CurrentDocument vs. DocumentManager.MdiActiveDocument

Civil3DReminders_com
Mentor
Mentor

In most of the sample code I've encountered using AutoCAD and Civil 3D the document is gotten using the MdiActiveDocument. 

 

There is also a property for CurrentDocument that appears less often. I can't even find it used on Kean's blog, but it does show up in other's code here in the forum. 

 

Does anyone know the difference?

 

It feels like when AutoCAD was SDI only the CurrentDocument was used and to support MDI the MdiActiveDocument was used to be able to interact between several documents. I've run into a bugs and Autodesk is using CurrentDocument in the Civil 3D API and I think they should be using MdiActiveDocument instead.

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni
0 Likes
1,565 Views
1 Reply
Reply (1)
Message 2 of 2

Norman_Yuan
Mentor
Mentor

The the documents coming with ObjectARX SDK, only the one for ObjectARX (arxref.chm) carries description of the 2 properties (actually 2 functions in C++: curDocument() and mdiActiveDocument() of AcApDocManager class). Here is the quote of the description:

 

curDocument():

<QUOTE>

This function returns the document having current context. The associated function, mdiActiveDocument(), returns the MDI active document. curDocument() and mdiActiveDocument() can be different. You can call curDocument() to make a document "current" without actually activating it. After finish your AcDbDatabase operation under the temporary current document, call setCurDocument(acDocManager->mdiActiveDocument()) to reset the MDI active document as the current document.

</QUOTE>

 

mdiActiveDocument():

<QOUTE>

This function returns the MDI active document. The associated function, curDocument(), returns the document having current context. curDocument() and mdiActiveDocument() can be different. You can call curDocument() to make a document "current" without actually activating it. After finish your AcDbDatabase operation under the temporary current document, call setCurDocument(acDocManager->mdiActiveDocument()) to reset the MDI active document as the current document.

</QUOTE>

 

 

 

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes