<?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: Open a drawing file programmatically in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/open-a-drawing-file-programmatically/m-p/3406195#M56353</link>
    <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I active a document?&lt;/P&gt;</description>
    <pubDate>Tue, 10 Apr 2012 09:05:21 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-04-10T09:05:21Z</dc:date>
    <item>
      <title>Open a drawing file programmatically</title>
      <link>https://forums.autodesk.com/t5/net-forum/open-a-drawing-file-programmatically/m-p/3405973#M56347</link>
      <description>&lt;P&gt;Dear. Developpers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to open a drawing file programmatically(automatically).&lt;/P&gt;&lt;P&gt;So for example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I have a file name "test.dwg" and run some custom command like 'openfile", AutoCAD opens "test.dwg" without any prompt.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following code DOESN'T do the job I want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Application.DocumentManager.MdiActiveDocument.SendStringToExecute("OPEN", true, false, true)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is I have to hit enter after the above code is run.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would there be any way to do this?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2012 05:57:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/open-a-drawing-file-programmatically/m-p/3405973#M56347</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-04-10T05:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: Open a drawing file programmatically</title>
      <link>https://forums.autodesk.com/t5/net-forum/open-a-drawing-file-programmatically/m-p/3405987#M56348</link>
      <description>&lt;P&gt;Use following code where DictionaryEntry.Key is the name of the drawing to be opened (full name incl. path)&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;For&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;Each&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; DictionaryEntry &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;In&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; DictionaryDrawingNames&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;If&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; DictionaryEntry.Value = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;True&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;Then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CurrentDrawings.Open(DictionaryEntry.Key,&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;False&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&amp;nbsp; End&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;If&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;Next&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2012 06:08:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/open-a-drawing-file-programmatically/m-p/3405987#M56348</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-04-10T06:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: Open a drawing file programmatically</title>
      <link>https://forums.autodesk.com/t5/net-forum/open-a-drawing-file-programmatically/m-p/3405993#M56349</link>
      <description>&lt;P&gt;Sorry: forgot to put in the definition for CurrentDrawings which is&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Dim &lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;CurrentDrawings &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;&lt;FONT size="2" color="#0000ff" face="Consolas"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" color="#2b91af" face="Consolas"&gt;&lt;FONT size="2" color="#2b91af" face="Consolas"&gt;&lt;FONT size="2" color="#2b91af" face="Consolas"&gt;DocumentCollection&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" color="#2b91af" face="Consolas"&gt;&lt;FONT size="2" color="#2b91af" face="Consolas"&gt;&lt;FONT size="2" color="#2b91af" face="Consolas"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;.DocumentManager&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2012 06:09:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/open-a-drawing-file-programmatically/m-p/3405993#M56349</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-04-10T06:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: Open a drawing file programmatically</title>
      <link>https://forums.autodesk.com/t5/net-forum/open-a-drawing-file-programmatically/m-p/3406019#M56350</link>
      <description>&lt;P&gt;Great~! Thx.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could I ask one more question?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you also know how to open on a currently opened document(window)?&lt;/P&gt;&lt;P&gt;For example, when you first run AutoCAD, "drawing1.dwg" document is opened by default.&lt;/P&gt;&lt;P&gt;So I want to place(or replace) my 'test.dwg" on that document.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code above opens the file in a new window.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you a lot for your help. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2012 06:33:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/open-a-drawing-file-programmatically/m-p/3406019#M56350</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-04-10T06:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Open a drawing file programmatically</title>
      <link>https://forums.autodesk.com/t5/net-forum/open-a-drawing-file-programmatically/m-p/3406091#M56352</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#666699"&gt;&amp;gt;&amp;gt; The problem is I have to hit enter after the above code is run&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;You have not sent the "new line" to the commandline, you just sent "OPEN", if you want to work with SendStringToExecute (what I would not prefere if there is another solution available), then do it including sending the carridge-return:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;Application.DocumentManager.MdiActiveDocument.SendStringToExecute("OPEN"&lt;FONT color="#993300"&gt; &amp;amp; vbCr&lt;/FONT&gt;, true, false, true)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#666699"&gt;&amp;gt;&amp;gt; Do you also know how to open on a currently opened document(window)?&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#666699"&gt;&amp;gt;&amp;gt; For example, when you first run AutoCAD, "drawing1.dwg" document is opened by default.&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#666699"&gt;&amp;gt;&amp;gt; So I want to place(or replace) my 'test.dwg" on that document.&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Activate the "test.dwg" and close the other drawing? But I'm not sure if that is what you are asking for?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2012 07:56:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/open-a-drawing-file-programmatically/m-p/3406091#M56352</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2012-04-10T07:56:58Z</dc:date>
    </item>
    <item>
      <title>Re: Open a drawing file programmatically</title>
      <link>https://forums.autodesk.com/t5/net-forum/open-a-drawing-file-programmatically/m-p/3406195#M56353</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I active a document?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2012 09:05:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/open-a-drawing-file-programmatically/m-p/3406195#M56353</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-04-10T09:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: Open a drawing file programmatically</title>
      <link>https://forums.autodesk.com/t5/net-forum/open-a-drawing-file-programmatically/m-p/3406205#M56354</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;depending on the session-flag in the command-definition when opening a drawing it will be made the active one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have a list of drawings already opened and want to make a specific one the active one then set the &lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;Application.DocumentManager.MdiActiveDocument = newDoc&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;or use the COM-version like&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;ctype(newDoc,Interop.AcadDocument).Activate&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2012 09:19:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/open-a-drawing-file-programmatically/m-p/3406205#M56354</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2012-04-10T09:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: Open a drawing file programmatically</title>
      <link>https://forums.autodesk.com/t5/net-forum/open-a-drawing-file-programmatically/m-p/3734572#M56355</link>
      <description>&lt;P&gt;This doesn't seem to work for 2013. Says that the CurrentDrawings.open is not a member of the DocumentCollection. Did they move it in the API??&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2012 21:32:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/open-a-drawing-file-programmatically/m-p/3734572#M56355</guid>
      <dc:creator>stevenh0616</dc:creator>
      <dc:date>2012-12-12T21:32:00Z</dc:date>
    </item>
  </channel>
</rss>

