<?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 Close current document using local rule without producing error in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/close-current-document-using-local-rule-without-producing-error/m-p/8289598#M84041</link>
    <description>&lt;P&gt;I have a Part file with a local iLogic rule which does "some stuff" to configure Inventor. After the rule is done, I want it to close the part document that it's in. I have the following code at the end of my rule to do just that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ThisDoc.Document.Close&lt;/PRE&gt;&lt;P&gt;This works just fine; the iLogic does everything I want, then fires this line and the document closes. However, immediately afterwards, I get the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Close Current Doc Error.png" style="width: 437px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/549843iB31CF5633902AA42/image-size/large?v=v2&amp;amp;px=999" role="button" title="Close Current Doc Error.png" alt="Close Current Doc Error.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm about 99% certain this is because the rule isn't able to properly finish executing and hand off control back over to Inventor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm able to continue just fine after that, Inventor doesn't crash or anything, but I want to avoid this error popping up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, is there some way to get around this? Just for kicks I tried adding an "On Error Resume Next" before the Close line, but it didn't make any difference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions? Or is it impossible to avoid this error?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(PS, the local rule does need to remain a local rule).&lt;/P&gt;</description>
    <pubDate>Mon, 24 Sep 2018 23:10:06 GMT</pubDate>
    <dc:creator>DRoam</dc:creator>
    <dc:date>2018-09-24T23:10:06Z</dc:date>
    <item>
      <title>Close current document using local rule without producing error</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/close-current-document-using-local-rule-without-producing-error/m-p/8289598#M84041</link>
      <description>&lt;P&gt;I have a Part file with a local iLogic rule which does "some stuff" to configure Inventor. After the rule is done, I want it to close the part document that it's in. I have the following code at the end of my rule to do just that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ThisDoc.Document.Close&lt;/PRE&gt;&lt;P&gt;This works just fine; the iLogic does everything I want, then fires this line and the document closes. However, immediately afterwards, I get the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Close Current Doc Error.png" style="width: 437px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/549843iB31CF5633902AA42/image-size/large?v=v2&amp;amp;px=999" role="button" title="Close Current Doc Error.png" alt="Close Current Doc Error.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm about 99% certain this is because the rule isn't able to properly finish executing and hand off control back over to Inventor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm able to continue just fine after that, Inventor doesn't crash or anything, but I want to avoid this error popping up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, is there some way to get around this? Just for kicks I tried adding an "On Error Resume Next" before the Close line, but it didn't make any difference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions? Or is it impossible to avoid this error?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(PS, the local rule does need to remain a local rule).&lt;/P&gt;</description>
      <pubDate>Mon, 24 Sep 2018 23:10:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/close-current-document-using-local-rule-without-producing-error/m-p/8289598#M84041</guid>
      <dc:creator>DRoam</dc:creator>
      <dc:date>2018-09-24T23:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: Close current document using local rule without producing error</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/close-current-document-using-local-rule-without-producing-error/m-p/8291203#M84042</link>
      <description>&lt;P&gt;Is this the only document open in Inventor when it closes?&amp;nbsp; If this rule is run from an Assembly then it would be better to close the document from the Assembly file, I'm not sure of your workflow it's just a suggestion.&amp;nbsp; Other than that I'd try transferring that Document close line to an External Rule then have&amp;nbsp;iLogicVb.RunExternalRule("Close Document") at the end of the local rule.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 14:45:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/close-current-document-using-local-rule-without-producing-error/m-p/8291203#M84042</guid>
      <dc:creator>philip1009</dc:creator>
      <dc:date>2018-09-25T14:45:28Z</dc:date>
    </item>
  </channel>
</rss>

