<?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: Change activedocument in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5464259#M41765</link>
    <description>&lt;P&gt;Do you think it could be something to do with the command flag?&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jan 2015 17:22:06 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-01-09T17:22:06Z</dc:date>
    <item>
      <title>Change activedocument</title>
      <link>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5464054#M41759</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm running a command from an original drawing to open a another drawingand apply some edits to it. I open the newdrawing with;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim FileName As String = "C:\XXX.dwg"&lt;/P&gt;&lt;P&gt;Dim acDocMgr As DocumentCollection = Application.DocumentManager&lt;BR /&gt;Dim opdoc As Document = DocumentCollectionExtension.Open(acDocMgr, FileName)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then when I run the editing code after this code it applies the edits to original drawing, as I believe this is still the active drawing - my question is what is the best way apply these edits to the new just opened drawing? Can I switch the active document to the new drawing...? Or is there another way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Harry&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 15:11:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5464054#M41759</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-01-09T15:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: Change activedocument</title>
      <link>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5464120#M41760</link>
      <description>&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;did u try after opening the drawing to put&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;opdoc = Application.DocumentManager.MdiActiveDocument&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 16:00:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5464120#M41760</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-01-09T16:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: Change activedocument</title>
      <link>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5464146#M41761</link>
      <description>&lt;P&gt;yeh, should have said, that is the next line in the current script&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 16:15:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5464146#M41761</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-01-09T16:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: Change activedocument</title>
      <link>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5464164#M41762</link>
      <description>&lt;P&gt;So i thought if I try and close the original drawing before opening the new one with;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim doccol As DocumentCollection = Application.DocumentManager&lt;/P&gt;&lt;P&gt;DocumentCollectionExtension.CloseAll(doccol)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It might automatically set the new drawing it opens as the "activedocument"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Buuuut that didn't work, it can't close it throwing an error saying "document is busy"&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 16:21:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5464164#M41762</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-01-09T16:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: Change activedocument</title>
      <link>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5464181#M41763</link>
      <description>&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim doc As Document = Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CloseAndDiscard(doc)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; doc = Nothing&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;works in my skript just fine&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but even this will work it is just a workaround and in the end would not realy serve ur goal&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;have a look on this threat &lt;A href="https://forums.autodesk.com/t5/net/how-to-switch-between-multiple-open-documents/td-p/3724860" target="_self"&gt;http://forums.autodesk.com/t5/net/how-to-switch-between-multiple-open-documents/td-p/3724860&lt;/A&gt;&lt;/P&gt;&lt;P&gt;maybe it solves ur problem&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it just came to my mind: did u set commandflag.session?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 16:56:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5464181#M41763</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-01-09T16:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: Change activedocument</title>
      <link>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5464242#M41764</link>
      <description>&lt;P&gt;mmm, tried a few things with this;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Application.DocumentManager.DocumentActivationEnabled = True&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I understand it this enables a new doc to be activated when a new window has been opended but doesn't seem to get any better results;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the&amp;nbsp;code im using can you see any glaring errors?;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Imports Autodesk.AutoCAD.ApplicationServices&lt;BR /&gt;Imports Autodesk.AutoCAD.DatabaseServices&lt;BR /&gt;Imports Autodesk.AutoCAD.EditorInput&lt;BR /&gt;Imports Autodesk.AutoCAD.Geometry&lt;BR /&gt;Imports Autodesk.AutoCAD.GraphicsInterface&lt;BR /&gt;Imports Autodesk.AutoCAD.Runtime&lt;BR /&gt;Imports System.Collections.Generic&lt;/P&gt;&lt;P&gt;Namespace CustomMove&lt;BR /&gt;Public Class Commands&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;lt;CommandMethod("copymove", CommandFlags.UsePickSet)&amp;gt; _&lt;BR /&gt;Public Shared Sub CustomMoveCmd()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim FileName As String = "C:\xxxx.dwg"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Application.DocumentManager.DocumentActivationEnabled = True&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim acDocMgr As DocumentCollection = Application.DocumentManager&lt;BR /&gt;Dim opdoc As Document = DocumentCollectionExtension.Add(acDocMgr, FileName)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'opdoc = Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument&lt;/P&gt;&lt;P&gt;Dim db As Database = doc.Database&lt;BR /&gt;Dim ed As Editor = doc.Editor&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;etc....&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 17:13:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5464242#M41764</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-01-09T17:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: Change activedocument</title>
      <link>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5464259#M41765</link>
      <description>&lt;P&gt;Do you think it could be something to do with the command flag?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 17:22:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5464259#M41765</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-01-09T17:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Change activedocument</title>
      <link>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5464305#M41766</link>
      <description>&lt;P&gt;yes i think so&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;u need commandflag.session when u want change something outside a specific document (if u want for ex open close or add documents)&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 17:53:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5464305#M41766</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-01-09T17:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: Change activedocument</title>
      <link>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5464375#M41767</link>
      <description>&lt;P&gt;In your paticular case, you need to set CommandFlas.Session flag (along with others, if necessary and suitable).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 18:32:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5464375#M41767</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2015-01-09T18:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: Change activedocument</title>
      <link>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5466729#M41768</link>
      <description>&lt;P&gt;Hi harry&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just found a nice way to swich between different databases!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HostApplicationServices.WorkingDatabase = db 'the database u want to swich to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hope this solves ur problem&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS: u dont need to set sessionflags.session for this to work &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jan 2015 19:01:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/change-activedocument/m-p/5466729#M41768</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-01-12T19:01:40Z</dc:date>
    </item>
  </channel>
</rss>

