<?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 AutoCAD 2014. MdiActiveDocument return null. in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/autocad-2014-mdiactivedocument-return-null/m-p/5946154#M37738</link>
    <description>&lt;P&gt;I try get Active AutoCAD document inside handler of custom event which run when data updated on server. Inside this handler I try call CommandMethod by command name.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;public static void API_DataUpdate(ServerKey arg1, ServerData arg2)
        {
cmdName="TestCommand";
cmdName = cmdName.TrimEnd() + " ";
                 document = AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
document.SendStringToExecute(cmdName, true, false, true);

        }&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;But inside this handler MdiActiveDocument return null &lt;/STRONG&gt;also DocumentCollection contains document in which I try run command, and also document is active inside AutoCAD. Why it's hapened ? Identical code with this handler perfectly works via AutoCAD 2015/2016.&lt;/P&gt;</description>
    <pubDate>Thu, 10 Dec 2015 17:58:11 GMT</pubDate>
    <dc:creator>galaxyblazer</dc:creator>
    <dc:date>2015-12-10T17:58:11Z</dc:date>
    <item>
      <title>AutoCAD 2014. MdiActiveDocument return null.</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-2014-mdiactivedocument-return-null/m-p/5946154#M37738</link>
      <description>&lt;P&gt;I try get Active AutoCAD document inside handler of custom event which run when data updated on server. Inside this handler I try call CommandMethod by command name.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;public static void API_DataUpdate(ServerKey arg1, ServerData arg2)
        {
cmdName="TestCommand";
cmdName = cmdName.TrimEnd() + " ";
                 document = AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
document.SendStringToExecute(cmdName, true, false, true);

        }&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;But inside this handler MdiActiveDocument return null &lt;/STRONG&gt;also DocumentCollection contains document in which I try run command, and also document is active inside AutoCAD. Why it's hapened ? Identical code with this handler perfectly works via AutoCAD 2015/2016.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 17:58:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-2014-mdiactivedocument-return-null/m-p/5946154#M37738</guid>
      <dc:creator>galaxyblazer</dc:creator>
      <dc:date>2015-12-10T17:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD 2014. MdiActiveDocument return null.</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-2014-mdiactivedocument-return-null/m-p/5946926#M37739</link>
      <description>&lt;P&gt;Hi GalaxyBlazer,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not sure which version it came in with (I know it is in 2015), but the Document.SendCommand has been replaced with Editor.Command and Editor.CommandAsync.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you considered posting this in the &lt;A href="https://forums.autodesk.com/t5/net/bd-p/152" target="_self"&gt;.NET forum&lt;/A&gt;? You may get some better responses than mine from the experts.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2015 01:53:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-2014-mdiactivedocument-return-null/m-p/5946926#M37739</guid>
      <dc:creator>BrentBurgess1980</dc:creator>
      <dc:date>2015-12-11T01:53:32Z</dc:date>
    </item>
    <item>
      <title>Re : AutoCAD 2014. MdiActiveDocument return null.</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-2014-mdiactivedocument-return-null/m-p/5947124#M37740</link>
      <description>&lt;P&gt;Your event handler is not running in the main thread. You need to use a synchronization mechanism to call your code in the main thread.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2015 07:48:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-2014-mdiactivedocument-return-null/m-p/5947124#M37740</guid>
      <dc:creator>FRFR1426</dc:creator>
      <dc:date>2015-12-11T07:48:45Z</dc:date>
    </item>
    <item>
      <title>Re : AutoCAD 2014. MdiActiveDocument return null.</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-2014-mdiactivedocument-return-null/m-p/5947132#M37741</link>
      <description>&lt;P&gt;But why it's hapaned in AutoCAD 2014 ?&amp;nbsp; What the different between AutoCAD 2014 and 2015/2016?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2015 07:58:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-2014-mdiactivedocument-return-null/m-p/5947132#M37741</guid>
      <dc:creator>galaxyblazer</dc:creator>
      <dc:date>2015-12-11T07:58:05Z</dc:date>
    </item>
    <item>
      <title>Re : AutoCAD 2014. MdiActiveDocument return null.</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-2014-mdiactivedocument-return-null/m-p/5947245#M37742</link>
      <description>&lt;P&gt;This is the nature of synchronization issues to be unpredictable. It can work on one PC and not on another. It can work on one version and not another. There's nothing specific to the 2014 version.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2015 09:35:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-2014-mdiactivedocument-return-null/m-p/5947245#M37742</guid>
      <dc:creator>FRFR1426</dc:creator>
      <dc:date>2015-12-11T09:35:02Z</dc:date>
    </item>
    <item>
      <title>Re : AutoCAD 2014. MdiActiveDocument return null.</title>
      <link>https://forums.autodesk.com/t5/net-forum/autocad-2014-mdiactivedocument-return-null/m-p/5947355#M37743</link>
      <description>&lt;P&gt;Also in 2015 and later versions, &lt;A href="https://msdn.microsoft.com/fr-fr/library/windows/desktop/ms682661%28v=vs.85%29.aspx?f=255&amp;amp;MSPPError=-2147217396" target="_self"&gt;fibers &lt;/A&gt;have been disabled by default.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2015 11:44:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/autocad-2014-mdiactivedocument-return-null/m-p/5947355#M37743</guid>
      <dc:creator>FRFR1426</dc:creator>
      <dc:date>2015-12-11T11:44:02Z</dc:date>
    </item>
  </channel>
</rss>

