<?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 Inventor new instance on close in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-new-instance-on-close/m-p/9586559#M112206</link>
    <description>&lt;P&gt;Hey&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;im having a small issue with an invisible document appearing in my taskbar when i close inventor. This appears mainly after i run my app so i mustn't be closing something properly. In summary, here is my document open / save close process&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Import step file using translator (no open file before import)&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Call oSTEPTranslator.Open(oDataMedium, oContext, oOptions, oTarget)&lt;/LI-CODE&gt;&lt;P&gt;2. Create a document view from the import&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Dim oDoc As Inventor.Document = oTarget
oDoc.Views.Add()&lt;/LI-CODE&gt;&lt;P&gt;3. Process all of the components in this document (not saved yet)&lt;/P&gt;&lt;P&gt;4. Rebuild &amp;amp; update active assembly (document from step 1)&lt;/P&gt;&lt;P&gt;5. Create a temp doc to hold the original ActiveDoc&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Dim OldDoc As Inventor.AssemblyDocument = AddinGlobal.InventorApp.ActiveDocument&lt;/LI-CODE&gt;&lt;P&gt;6. SaveAs the current ActiveDoc into a new location&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; AddinGlobal.InventorApp.ActiveDocument.SaveAs(PathRoot &amp;amp; AssyName &amp;amp; ".iam", True)&lt;/LI-CODE&gt;&lt;P&gt;7. Open the newly saved document as a new assembly&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Dim NewDoc As Inventor.AssemblyDocument = AddinGlobal.InventorApp.Documents.Open(PathRoot &amp;amp; AssyName &amp;amp; ".iam", True)&lt;/LI-CODE&gt;&lt;P&gt;8. Close the old doc that i created as the ActiveDoc prior to saving&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;OldDoc.Close(True)&lt;/LI-CODE&gt;&lt;P&gt;9. Iterate assembly and SaveAs all components then replacing them in the assembly for the saved ones&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This should leave 1 assembly active (the new one) and the old ones closed or is that not the case? Does item 2 actually create another document and is that the rogue document? Somewhere in this process is an invisible document. For every other process, i pass the ActiveDocument through instead creating document instances for example-&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Private Sub DoSomething()
'process stuff here
Call NextSub(_InvApp.ActiveDocument)
End Sub

Private Sub NextSub(ByRef CurrDoc As AssemblyDocument)
'do something with CurrDoc
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem highlights when a new project is initiated as all documents need to be closed...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help greatly appreciated&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;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jun 2020 05:05:55 GMT</pubDate>
    <dc:creator>NachitoMax</dc:creator>
    <dc:date>2020-06-18T05:05:55Z</dc:date>
    <item>
      <title>Inventor new instance on close</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-new-instance-on-close/m-p/9586559#M112206</link>
      <description>&lt;P&gt;Hey&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;im having a small issue with an invisible document appearing in my taskbar when i close inventor. This appears mainly after i run my app so i mustn't be closing something properly. In summary, here is my document open / save close process&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Import step file using translator (no open file before import)&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Call oSTEPTranslator.Open(oDataMedium, oContext, oOptions, oTarget)&lt;/LI-CODE&gt;&lt;P&gt;2. Create a document view from the import&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Dim oDoc As Inventor.Document = oTarget
oDoc.Views.Add()&lt;/LI-CODE&gt;&lt;P&gt;3. Process all of the components in this document (not saved yet)&lt;/P&gt;&lt;P&gt;4. Rebuild &amp;amp; update active assembly (document from step 1)&lt;/P&gt;&lt;P&gt;5. Create a temp doc to hold the original ActiveDoc&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Dim OldDoc As Inventor.AssemblyDocument = AddinGlobal.InventorApp.ActiveDocument&lt;/LI-CODE&gt;&lt;P&gt;6. SaveAs the current ActiveDoc into a new location&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; AddinGlobal.InventorApp.ActiveDocument.SaveAs(PathRoot &amp;amp; AssyName &amp;amp; ".iam", True)&lt;/LI-CODE&gt;&lt;P&gt;7. Open the newly saved document as a new assembly&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Dim NewDoc As Inventor.AssemblyDocument = AddinGlobal.InventorApp.Documents.Open(PathRoot &amp;amp; AssyName &amp;amp; ".iam", True)&lt;/LI-CODE&gt;&lt;P&gt;8. Close the old doc that i created as the ActiveDoc prior to saving&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;OldDoc.Close(True)&lt;/LI-CODE&gt;&lt;P&gt;9. Iterate assembly and SaveAs all components then replacing them in the assembly for the saved ones&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This should leave 1 assembly active (the new one) and the old ones closed or is that not the case? Does item 2 actually create another document and is that the rogue document? Somewhere in this process is an invisible document. For every other process, i pass the ActiveDocument through instead creating document instances for example-&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Private Sub DoSomething()
'process stuff here
Call NextSub(_InvApp.ActiveDocument)
End Sub

Private Sub NextSub(ByRef CurrDoc As AssemblyDocument)
'do something with CurrDoc
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem highlights when a new project is initiated as all documents need to be closed...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help greatly appreciated&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2020 05:05:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-new-instance-on-close/m-p/9586559#M112206</guid>
      <dc:creator>NachitoMax</dc:creator>
      <dc:date>2020-06-18T05:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Inventor new instance on close</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-new-instance-on-close/m-p/9598798#M112508</link>
      <description>&lt;P&gt;A little hard to follow, but kind of sounds like this built-in iLogic Sub may be able to help.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oDoc As Document
oDoc.ReleaseReference&lt;/LI-CODE&gt;&lt;P&gt;I only put the Dim oDoc As Document, in there to activate iLogic Rule Editor's intellisense type ability, to show what id does.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Release Reference screen capture.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/787543iF29547BDE7B6E4D0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Release Reference screen capture.png" alt="Release Reference screen capture.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jun 2020 15:11:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-new-instance-on-close/m-p/9598798#M112508</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-06-24T15:11:00Z</dc:date>
    </item>
  </channel>
</rss>

