<?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: eNoDocument Exception when auto-loading CustomCUIX in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/enodocument-exception-when-auto-loading-customcuix/m-p/3566706#M54090</link>
    <description>&lt;P&gt;Better use instead:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800000"&gt;&amp;nbsp;&amp;nbsp; AcadDocument acdoc = doc.AcadDocument as AcadDocument;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#800000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acdoc.SendCommand("_CUILOAD+&amp;nbsp; "MyCui.cuix"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + " ",&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800000"&gt;"\n");&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and also use:&lt;/P&gt;&lt;P&gt;using &lt;FONT face="arial,helvetica,sans-serif"&gt;Autodesk.AutoCAD.Interop.Common;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;using &lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Autodesk.AutoCAD.Interop;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in References&lt;/P&gt;&lt;P&gt;Just on the quick glance, sorry&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;~'J'~&lt;/P&gt;</description>
    <pubDate>Mon, 06 Aug 2012 14:29:00 GMT</pubDate>
    <dc:creator>Hallex</dc:creator>
    <dc:date>2012-08-06T14:29:00Z</dc:date>
    <item>
      <title>eNoDocument Exception when auto-loading CustomCUIX</title>
      <link>https://forums.autodesk.com/t5/net-forum/enodocument-exception-when-auto-loading-customcuix/m-p/3566444#M54088</link>
      <description>&lt;P&gt;Hi, I have the following block of code in myPlugin.cs in IExtensionApplication.Initialize() method...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; object oldCmdEcho = Application.GetSystemVariable("CMDECHO");&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; object oldFileDia = Application.GetSystemVariable("FILEDIA");&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Application.SetSystemVariable("CMDECHO", 0);&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Application.SetSystemVariable("FILEDIA", 0);&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Document doc = Application.DocumentManager.MdiActiveDocument;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; doc.SendStringToExecute(&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "_.cuiload "&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + "MyCui.cuix"&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + " ",&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; false, false, false&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; );&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Application.SetSystemVariable("FILEDIA", oldFileDia);&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Application.SetSystemVariable("CMDECHO", oldCmdEcho);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Assuming MyCui.cuix already exists)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's fine if I load this managed dll via "netload" command (after the document is loaded)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it seems there is a problem if I try to load this using demand load (auto-load at AutoCad startup)&lt;/P&gt;&lt;P&gt;It seems like DocumentManager.MdiActiveDocument gets called before the document is fully loaded.&lt;/P&gt;&lt;P&gt;This code gives me eNoDocument exception.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anybody else have had the same issue?&lt;/P&gt;&lt;P&gt;Is there other approaches to auto-load the custom cuix?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help always.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Aug 2012 11:47:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/enodocument-exception-when-auto-loading-customcuix/m-p/3566444#M54088</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-06T11:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: eNoDocument Exception when auto-loading CustomCUIX</title>
      <link>https://forums.autodesk.com/t5/net-forum/enodocument-exception-when-auto-loading-customcuix/m-p/3566472#M54089</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; Is there other approaches to auto-load the custom cuix?&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;don't use SendCommand, at least not when you start it during the initialization-process.&lt;/P&gt;&lt;P&gt;You have either the chance to use an eventhandler watching AutoCAD to get quiescent (and then do your SendCommand) or load the menues with the menu-collection-functions.&lt;/P&gt;&lt;P&gt;Make sure that when you already have loaded the menu (AutoCAD normally starts with the menues that where loaded previously), so an additional load would result in an error.&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; using demand load (auto-load at AutoCad startup)&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Be careful! "demand-load" loads a command (and it's modules) at the time a command is started by the user, not when AutoCAD starts! "demand-load" and "load during AutoCAD-start" are two different things!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Mon, 06 Aug 2012 12:06:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/enodocument-exception-when-auto-loading-customcuix/m-p/3566472#M54089</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2012-08-06T12:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: eNoDocument Exception when auto-loading CustomCUIX</title>
      <link>https://forums.autodesk.com/t5/net-forum/enodocument-exception-when-auto-loading-customcuix/m-p/3566706#M54090</link>
      <description>&lt;P&gt;Better use instead:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800000"&gt;&amp;nbsp;&amp;nbsp; AcadDocument acdoc = doc.AcadDocument as AcadDocument;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#800000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acdoc.SendCommand("_CUILOAD+&amp;nbsp; "MyCui.cuix"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + " ",&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800000"&gt;"\n");&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and also use:&lt;/P&gt;&lt;P&gt;using &lt;FONT face="arial,helvetica,sans-serif"&gt;Autodesk.AutoCAD.Interop.Common;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;using &lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Autodesk.AutoCAD.Interop;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in References&lt;/P&gt;&lt;P&gt;Just on the quick glance, sorry&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;~'J'~&lt;/P&gt;</description>
      <pubDate>Mon, 06 Aug 2012 14:29:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/enodocument-exception-when-auto-loading-customcuix/m-p/3566706#M54090</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-08-06T14:29:00Z</dc:date>
    </item>
  </channel>
</rss>

