<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: DocumentManager.Open() Is Not the current Document in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6237017#M36562</link>
    <description>&lt;P&gt;When I said "called from", I didn't mean "directly called from", I meant the main calling method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do you start the process which calls this function? a command or a click on a dialog button? if it's from a dialog, is this dialog modal or modeless? if it's a modal dialog, how is opened this dialog?...&lt;/P&gt;</description>
    <pubDate>Mon, 28 Mar 2016 08:53:00 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2016-03-28T08:53:00Z</dc:date>
    <item>
      <title>DocumentManager.Open() Is Not the current Document</title>
      <link>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6236948#M36554</link>
      <description>&lt;P&gt;I used autocad 2012,when I use code to open a drawing like below:&lt;/P&gt;&lt;PRE&gt;Application.DocumentManager.MdiActiveDocument = Application.DocumentManager.Open(path, false);
Document doc = Application.DocumentManager.MdiActiveDocument;
            doc.LockDocument();&lt;/PRE&gt;&lt;P&gt;I got a document, but the document is not what i open, it's the previous document.&lt;/P&gt;&lt;P&gt;Anyone can tell me how to get the document I opened right now~?&lt;/P&gt;&lt;P&gt;Any of your help will do me a big favor,&lt;/P&gt;&lt;P&gt;thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2016 07:04:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6236948#M36554</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-28T07:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: DocumentManager.Open() Is Not the current Document</title>
      <link>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6236952#M36555</link>
      <description>&lt;P&gt;This is what I use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;public static void OpenCadDrawing()
        {
            DocumentCollection d = Application.DocumentManager;
            string FileName = "C:\\Test.dwg"; // Add your full path of the drawing
            if (File.Exists(FileName))
            {
                Document doc = d.Open(FileName, false);
                d.MdiActiveDocument = doc;
            }
            else
            {
                Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\nDrawing can not be found !");
            }
        } 
&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Mar 2016 07:13:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6236952#M36555</guid>
      <dc:creator>_Tharwat</dc:creator>
      <dc:date>2016-03-28T07:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: DocumentManager.Open() Is Not the current Document</title>
      <link>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6236960#M36556</link>
      <description>&lt;P&gt;I tried your solution,&lt;/P&gt;&lt;P&gt;but the code can not go on when it goes to&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;d.MdiActiveDocument = doc;&lt;/PRE&gt;&lt;P&gt;the codes after this could not be called..&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2016 07:23:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6236960#M36556</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-28T07:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: DocumentManager.Open() Is Not the current Document</title>
      <link>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6236977#M36557</link>
      <description>&lt;P&gt;Actually, I tried your way,and here is what I have problem with&lt;/P&gt;&lt;P&gt;when I tried to call&lt;/P&gt;&lt;PRE&gt;Application.DocumentManager.MdiActiveDocument.Name&lt;/PRE&gt;&lt;P&gt;The result is still the previous document,Not the one I Opened it right now...&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2016 07:45:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6236977#M36557</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-28T07:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: DocumentManager.Open() Is Not the current Document</title>
      <link>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6236978#M36558</link>
      <description>&lt;P&gt;&lt;FONT face="georgia,palatino" size="3"&gt;If the problem is only with activating the drawing, try to set the WindowState of the newly opened drawing&amp;nbsp;to Maximized as in the following example.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="georgia,palatino" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="georgia,palatino" size="3"&gt;e.g;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Document doc = d.Open(FileName, false);
doc.Window.WindowState = DocumentWindow.State.Maximized;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="georgia,palatino" size="3"&gt;And you need to add the namespace :&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;using Autodesk.AutoCAD.Windows;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="georgia,palatino" size="3"&gt;&lt;STRONG&gt;EDIT: I made the Window state to Maximized as you wish for.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2016 08:05:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6236978#M36558</guid>
      <dc:creator>_Tharwat</dc:creator>
      <dc:date>2016-03-28T08:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: DocumentManager.Open() Is Not the current Document</title>
      <link>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6236987#M36559</link>
      <description>&lt;P&gt;I can't using the&lt;/P&gt;&lt;PRE&gt;doc.Window.WindowState = DocumentWindow.State.Maximized; &lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;the visual studio always remind me to add use of PresentationCore.dll&lt;/P&gt;&lt;P&gt;Even when I add the namespace before the Window will still get the problem.&lt;BR /&gt;have you faced it~?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2016 08:18:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6236987#M36559</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-28T08:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: DocumentManager.Open() Is Not the current Document</title>
      <link>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6236996#M36560</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your code is called from a CommandMethod attributed class, you have to set the CommandFlags.Session.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;[CommandMethod("Cmd", CommandFlags.Session)]&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Mar 2016 08:20:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6236996#M36560</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2016-03-28T08:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: DocumentManager.Open() Is Not the current Document</title>
      <link>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6236998#M36561</link>
      <description>I just used it in a private function, other place will call the function...</description>
      <pubDate>Mon, 28 Mar 2016 08:23:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6236998#M36561</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-28T08:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: DocumentManager.Open() Is Not the current Document</title>
      <link>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6237017#M36562</link>
      <description>&lt;P&gt;When I said "called from", I didn't mean "directly called from", I meant the main calling method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do you start the process which calls this function? a command or a click on a dialog button? if it's from a dialog, is this dialog modal or modeless? if it's a modal dialog, how is opened this dialog?...&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2016 08:53:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6237017#M36562</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2016-03-28T08:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: DocumentManager.Open() Is Not the current Document</title>
      <link>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6237021#M36563</link>
      <description>&lt;P&gt;I got it&lt;/P&gt;&lt;P&gt;Thank you...&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2016 08:58:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/documentmanager-open-is-not-the-current-document/m-p/6237021#M36563</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-28T08:58:48Z</dc:date>
    </item>
  </channel>
</rss>

