Hi,
when I run .Net code which opens and activates a drawing, the execution of the .net code stops because another drawing is activated, and therefore the msgbox("..") is not being showed, untill the drawing is activated (in which the .net code originally was executed). How is it possible to show the msgbox or other code and stay in the just opened drawing (without manually reactivating the original drawing)?
(the msgbox is just an example of some code, the solution is not to put the msgbox before opening the drawing)
kind regards,
Wouter
<CommandMethod("OpenDrawing")> Public Sub OpenDrawing() Dim strFileName As String = "d:\test.dwg" Dim acDocMgr As DocumentCollection = Application.DocumentManager Dim ExistingFile As Document = acDocMgr.Open(strFileName, False) acDocMgr.MdiActiveDocument = ExistingFile MsgBox("this msgbox is not displayed untill the original file is re-activated") End Sub
You should execute your code in session mode, try add the CommandFlags.Session to your CommandMethod declaration.
This means that your code runs at application level and not document level. This will require to lock the document you want to operate on, but this way you may operate on multiple drawing without loosing the execution focus.