<?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: ilogic code to copy and replace in ana ssembly in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-to-copy-and-replace-in-ana-ssembly/m-p/11232555#M139273</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8013420"&gt;@tmathieson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8013420"&gt;@tmathieson&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but, of course, i now have another issue...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;basic program is...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- input parameters&lt;/P&gt;
&lt;P&gt;- delete components from assembly (save assembly)&lt;/P&gt;
&lt;P&gt;- insert new components&lt;/P&gt;
&lt;P&gt;- delete component from directory if it exists&lt;/P&gt;
&lt;P&gt;- rename and save component&lt;/P&gt;
&lt;P&gt;- adds mates, etc, repeat&lt;/P&gt;
&lt;P&gt;the program works fine the first time thru. but if i go to run it again, i get an error with the 1st component 'SaveAs' as shown here.&amp;nbsp; if i save the assembly, close it and open it up again, it runs the way it should. any idea what the issue might be, something stuck in memory that gets cleared out when i close the file...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8013420"&gt;@tmathieson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think I've run into this in the past. The issue might be due to deleting the file on disk, but it still exists in the active document's referenced document collection. Try something like this to unload the document's from memory.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;BR /&gt;Best of luck to you in all of your Inventor pursuits,&lt;BR /&gt;Curtis&lt;BR /&gt;&lt;A href="http://inventortrenches.blogspot.com" target="_blank" rel="noopener"&gt;http://inventortrenches.blogspot.com&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;'remove document references from memory&lt;/SPAN&gt;
&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; x&lt;SPAN&gt;Doc&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;ThisDoc.Document&lt;/SPAN&gt;.&lt;SPAN&gt;AllReferencedDocuments&lt;/SPAN&gt;
	&lt;SPAN&gt;Logger&lt;/SPAN&gt;.&lt;SPAN&gt;Info&lt;/SPAN&gt;(x&lt;SPAN&gt;Doc&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;)
	&lt;SPAN&gt;Try&lt;/SPAN&gt;
		x&lt;SPAN&gt;Doc&lt;/SPAN&gt;.&lt;SPAN&gt;close&lt;/SPAN&gt;
	&lt;SPAN&gt;Catch&lt;/SPAN&gt;
		&lt;SPAN&gt;'Logger.Info(xDoc.FullFileName)&lt;/SPAN&gt;
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;
&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jun 2022 20:24:49 GMT</pubDate>
    <dc:creator>Curtis_Waguespack</dc:creator>
    <dc:date>2022-06-13T20:24:49Z</dc:date>
    <item>
      <title>ilogic code to copy and replace in ana ssembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-to-copy-and-replace-in-ana-ssembly/m-p/11221927#M139079</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i am working on a piece of code that will insert components into an assembly and mate to each other accordingly.&amp;nbsp; i have this working fine, but i want to take all the component and save them with new names and replace the ones in the assembly, basically&amp;nbsp; the "Productivity&amp;gt; Save and Replace" command. searching thru the forms her, it seems like the&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;(component name).SaveAs (new filename, false)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;should save the component with the new name in the same directory as the assembly file, and replace the original part with the newly saved one....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so that is what i am trying to code here, but i keep getting errors like "parameter is incorrect".... on the SaveAs line&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;i&lt;/SPAN&gt; = 1 &lt;SPAN&gt;Then&lt;/SPAN&gt;
			&lt;SPAN&gt;GROUND&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt;
			&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;componentB&lt;/SPAN&gt; = &lt;SPAN&gt;Components&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;PLATE_PRE&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;i&lt;/SPAN&gt;, &lt;SPAN&gt;"SC-H-2R-P1.ipt"&lt;/SPAN&gt;, &lt;SPAN&gt;position&lt;/SPAN&gt; := &lt;SPAN&gt;Nothing&lt;/SPAN&gt;, &lt;SPAN&gt;grounded&lt;/SPAN&gt; := &lt;SPAN&gt;GROUND&lt;/SPAN&gt;, &lt;SPAN&gt;visible&lt;/SPAN&gt; := &lt;SPAN&gt;True&lt;/SPAN&gt;, &lt;SPAN&gt;appearance&lt;/SPAN&gt; := &lt;SPAN&gt;asgreen&lt;/SPAN&gt;)
			&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;doc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt; = &lt;SPAN&gt;Component&lt;/SPAN&gt;.&lt;SPAN&gt;InventorComponent&lt;/SPAN&gt;(&lt;SPAN&gt;PLATE_PRE&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;i&lt;/SPAN&gt;).&lt;SPAN&gt;Definition&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;
			
			&lt;SPAN&gt;File_new_name&lt;/SPAN&gt; = &lt;SPAN&gt;"help-"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;i&lt;/SPAN&gt;
			&lt;SPAN&gt;Logger&lt;/SPAN&gt;.&lt;SPAN&gt;Debug&lt;/SPAN&gt;(&lt;SPAN&gt;File_new_name&lt;/SPAN&gt;)
			&lt;SPAN&gt;doc&lt;/SPAN&gt;.&lt;SPAN&gt;SaveAs&lt;/SPAN&gt;(&lt;SPAN&gt;File_new_name&lt;/SPAN&gt; , &lt;SPAN&gt;False&lt;/SPAN&gt;)
			&lt;SPAN&gt;GROUND&lt;/SPAN&gt;=&lt;SPAN&gt;False&lt;/SPAN&gt;
			&lt;SPAN&gt;GoTo&lt;/SPAN&gt; &lt;SPAN&gt;JUMP_NEXT&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;its probably something to do with how i am defining the doc variable, but not sure.... any help, as always, would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2022 13:36:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-to-copy-and-replace-in-ana-ssembly/m-p/11221927#M139079</guid>
      <dc:creator>tmathieson</dc:creator>
      <dc:date>2022-06-08T13:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic code to copy and replace in ana ssembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-to-copy-and-replace-in-ana-ssembly/m-p/11222016#M139082</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8013420"&gt;@tmathieson&lt;/a&gt;.&amp;nbsp; Here are a few other similar posts with accepted solutions you can review that may help you out.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/save-and-replace-parts-in-an-assembly-using-ilogic/m-p/9412368/highlight/true#M107507" target="_blank" rel="noopener"&gt;Save and replace parts in an assembly using iLogic&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/ilogic-save-and-replace-assembly-and-custom-parts/m-p/10305790/highlight/true#M124310" target="_blank" rel="noopener"&gt;iLogic Save and Replace Assembly and custom parts&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/ilogic-for-save-and-replace-within-an-assembly-by-part-name/m-p/11100186/highlight/true#M136611" target="_blank" rel="noopener"&gt;iLogic for Save and Replace within an assembly by part name&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2022 14:06:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-to-copy-and-replace-in-ana-ssembly/m-p/11222016#M139082</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-06-08T14:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic code to copy and replace in ana ssembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-to-copy-and-replace-in-ana-ssembly/m-p/11227262#M139161</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&amp;nbsp; for replying to this.&amp;nbsp; i had looked at&amp;nbsp; a couple of the links you sent, but the ones i looked at dealt with copying an assembly and components and got overwhelmed by the coding... but dissecting code from &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/105031"&gt;@Curtis_Waguespack&lt;/a&gt; ,&amp;nbsp; by adding&amp;nbsp; the path to the new file name, it works and file is saved!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks to you (and Curtis) for helping out with this, it is much appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but, of course, i now have another issue...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;basic program is...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- input paramters&lt;/P&gt;&lt;P&gt;- delete components from assembly (save assembly)&lt;/P&gt;&lt;P&gt;- insert new components&lt;/P&gt;&lt;P&gt;- delete component from directory if it exists&lt;/P&gt;&lt;P&gt;- rename and save component&lt;/P&gt;&lt;P&gt;- adds mates, etc, repeat&lt;/P&gt;&lt;P&gt;the program works fine the first time thru. but if i go to run it again, i get an error with the 1st component 'SaveAs' as shown here.&amp;nbsp; if i save the assembly, close it and open it up again, it runs the way it should. any idea what the issue might be, something stuck in memory that gets cleared out when i close the file...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;again, really appreciate your help on this.&amp;nbsp; these forms are (work)life savers!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;iLogicVb&lt;/SPAN&gt;.&lt;SPAN&gt;RunRule&lt;/SPAN&gt;(&lt;SPAN&gt;"delete old plates"&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;PLATE_PRE&lt;/SPAN&gt; =&lt;SPAN&gt;PROJECT_NUMBER&lt;/SPAN&gt; &amp;amp;&lt;SPAN&gt;"-P"&lt;/SPAN&gt;
&lt;SPAN&gt;Sentence&lt;/SPAN&gt; = &lt;SPAN&gt;PLATE_LAYOUT&lt;/SPAN&gt;
&lt;SPAN&gt;Words&lt;/SPAN&gt; = &lt;SPAN&gt;Sentence&lt;/SPAN&gt;.&lt;SPAN&gt;Split&lt;/SPAN&gt;(&lt;SPAN&gt;Separators&lt;/SPAN&gt;)
&lt;SPAN&gt;NUM_PLATES&lt;/SPAN&gt; = (&lt;SPAN&gt;UBound&lt;/SPAN&gt;(&lt;SPAN&gt;Words&lt;/SPAN&gt;) + 1)
&lt;SPAN&gt;Logger&lt;/SPAN&gt;.&lt;SPAN&gt;Debug&lt;/SPAN&gt;(&lt;SPAN&gt;NUM_PLATES&lt;/SPAN&gt;)
&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;NUM_PLATES&lt;/SPAN&gt; &amp;gt; 16 &lt;SPAN&gt;Then&lt;/SPAN&gt;
	&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"TOO MANY PLATES - 16 MAX"&lt;/SPAN&gt;)
	&lt;SPAN&gt;GoTo&lt;/SPAN&gt; &lt;SPAN&gt;OVEROUT&lt;/SPAN&gt;
&lt;SPAN&gt;Else&lt;/SPAN&gt;
	&lt;SPAN&gt;GROUND&lt;/SPAN&gt; = &lt;SPAN&gt;False&lt;/SPAN&gt;		
	&lt;SPAN&gt;i&lt;/SPAN&gt; = 0
	&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;i&lt;/SPAN&gt; = 1 &lt;SPAN&gt;To&lt;/SPAN&gt; &lt;SPAN&gt;NUM_PLATES&lt;/SPAN&gt;
		&lt;SPAN&gt;PLATE_NAME&lt;/SPAN&gt; = &lt;SPAN&gt;PLATE_PRE&lt;/SPAN&gt; &amp;amp; (&lt;SPAN&gt;i&lt;/SPAN&gt;)
		&lt;SPAN&gt;Logger&lt;/SPAN&gt;.&lt;SPAN&gt;Debug&lt;/SPAN&gt;(&lt;SPAN&gt;PLATE_NAME&lt;/SPAN&gt;)
		&lt;SPAN&gt;'MessageBox.Show(PLATE_NAME, "PLATE #")&lt;/SPAN&gt;
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;i&lt;/SPAN&gt; = 1 &lt;SPAN&gt;Then&lt;/SPAN&gt;
			&lt;SPAN&gt;GROUND&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt;
			&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;componentB&lt;/SPAN&gt; = &lt;SPAN&gt;Components&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;PLATE_PRE&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;i&lt;/SPAN&gt;, &lt;SPAN&gt;"SC-H-2R-P1.ipt"&lt;/SPAN&gt;, &lt;SPAN&gt;position&lt;/SPAN&gt; := &lt;SPAN&gt;Nothing&lt;/SPAN&gt;, &lt;SPAN&gt;grounded&lt;/SPAN&gt; := &lt;SPAN&gt;GROUND&lt;/SPAN&gt;, &lt;SPAN&gt;visible&lt;/SPAN&gt; := &lt;SPAN&gt;True&lt;/SPAN&gt;, &lt;SPAN&gt;appearance&lt;/SPAN&gt; := &lt;SPAN&gt;asgreen&lt;/SPAN&gt;)
			&lt;SPAN&gt;doc&lt;/SPAN&gt;= &lt;SPAN&gt;Component&lt;/SPAN&gt;.&lt;SPAN&gt;InventorComponent&lt;/SPAN&gt;(&lt;SPAN&gt;PLATE_PRE&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;i&lt;/SPAN&gt;).&lt;SPAN&gt;Definition&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;
			&lt;SPAN&gt;sPath&lt;/SPAN&gt; = &lt;SPAN&gt;Component&lt;/SPAN&gt;.&lt;SPAN&gt;InventorComponent&lt;/SPAN&gt;(&lt;SPAN&gt;PLATE_PRE&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;i&lt;/SPAN&gt;).&lt;SPAN&gt;ReferencedFileDescriptor&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;
			&lt;SPAN&gt;File_new_name&lt;/SPAN&gt; = &lt;SPAN&gt;PLATE_PRE&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;i&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;".ipt"&lt;/SPAN&gt;
			&lt;SPAN&gt;Logger&lt;/SPAN&gt;.&lt;SPAN&gt;Debug&lt;/SPAN&gt;(&lt;SPAN&gt;File_new_name&lt;/SPAN&gt;)
			&lt;SPAN&gt;Logger&lt;/SPAN&gt;.&lt;SPAN&gt;Debug&lt;/SPAN&gt;(&lt;SPAN&gt;sPath&lt;/SPAN&gt;)
			&lt;SPAN&gt;sSplit&lt;/SPAN&gt; = &lt;SPAN&gt;sPath&lt;/SPAN&gt;.&lt;SPAN&gt;Split&lt;/SPAN&gt;(&lt;SPAN&gt;"\"&lt;/SPAN&gt;)
			&lt;SPAN&gt;'get the Upper Bounds of the array&lt;/SPAN&gt;
		&lt;SPAN&gt;'knowing that this will be the File name with extention &lt;/SPAN&gt;
		&lt;SPAN&gt;sName&lt;/SPAN&gt; = &lt;SPAN&gt;sSplit&lt;/SPAN&gt;(&lt;SPAN&gt;UBound&lt;/SPAN&gt;(&lt;SPAN&gt;sSplit&lt;/SPAN&gt;))
			&lt;SPAN&gt;'remove file name from path&lt;/SPAN&gt;
			&lt;SPAN&gt;sPath&lt;/SPAN&gt; = &lt;SPAN&gt;Replace&lt;/SPAN&gt;(&lt;SPAN&gt;sPath&lt;/SPAN&gt;, &lt;SPAN&gt;sName&lt;/SPAN&gt;,&lt;SPAN&gt;""&lt;/SPAN&gt;)
			&lt;SPAN&gt;Logger&lt;/SPAN&gt;.&lt;SPAN&gt;Debug&lt;/SPAN&gt;(&lt;SPAN&gt;sPath&lt;/SPAN&gt;)
			&lt;SPAN&gt;file_delete&lt;/SPAN&gt; = (&lt;SPAN&gt;sPath&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;File_new_name&lt;/SPAN&gt;)
	&lt;SPAN&gt;'check to see if file exists.  delete if it does&lt;/SPAN&gt;
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;Dir&lt;/SPAN&gt;(&lt;SPAN&gt;file_delete&lt;/SPAN&gt;) &amp;lt;&amp;gt; &lt;SPAN&gt;""&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
			&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"it exists"&lt;/SPAN&gt;, &lt;SPAN&gt;"Title"&lt;/SPAN&gt;)
			&lt;SPAN&gt;Kill&lt;/SPAN&gt;(&lt;SPAN&gt;file_delete&lt;/SPAN&gt;)
		&lt;SPAN&gt;Else&lt;/SPAN&gt; 
			&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"no file in directory"&lt;/SPAN&gt;, &lt;SPAN&gt;"Title"&lt;/SPAN&gt;)
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
			&lt;SPAN&gt;'save new part &lt;/SPAN&gt;
	        &lt;SPAN&gt;doc&lt;/SPAN&gt;.&lt;SPAN&gt;SaveAs&lt;/SPAN&gt;(&lt;SPAN&gt;sPath&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;File_new_name&lt;/SPAN&gt;, &lt;SPAN&gt;False&lt;/SPAN&gt;)
			&lt;SPAN&gt;GROUND&lt;/SPAN&gt;=&lt;SPAN&gt;False&lt;/SPAN&gt;
			&lt;SPAN&gt;GoTo&lt;/SPAN&gt; &lt;SPAN&gt;JUMP_NEXT&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 13:43:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-to-copy-and-replace-in-ana-ssembly/m-p/11227262#M139161</guid>
      <dc:creator>tmathieson</dc:creator>
      <dc:date>2022-06-10T13:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic code to copy and replace in ana ssembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-to-copy-and-replace-in-ana-ssembly/m-p/11227408#M139174</link>
      <description>&lt;P&gt;Interesting issue.&amp;nbsp; If 'PROJECT_NUMBER' value had not changed from first run to second run, I would think that would be caught by the file exists check.&amp;nbsp; Almost sounds like the kind of thing that a well placed document update/rebuild might have been able to fix, but I'm guessing you have already checked that out.&amp;nbsp; There is a command for clearing iLogic's memory you could try, but it honestly sounds like a long shot if it were to fix anything.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;ThisApplication.CommandManager.ControlDefinitions.Item("iLogic.FreeILogicMemory").Execute&lt;/LI-CODE&gt;
&lt;P&gt;And here is the API for clearing Inventor's internal clipboard:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;ThisApplication.CommandManager.ClearPrivateEvents&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 14:35:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-to-copy-and-replace-in-ana-ssembly/m-p/11227408#M139174</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-06-10T14:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic code to copy and replace in ana ssembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-to-copy-and-replace-in-ana-ssembly/m-p/11232555#M139273</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8013420"&gt;@tmathieson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8013420"&gt;@tmathieson&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but, of course, i now have another issue...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;basic program is...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- input parameters&lt;/P&gt;
&lt;P&gt;- delete components from assembly (save assembly)&lt;/P&gt;
&lt;P&gt;- insert new components&lt;/P&gt;
&lt;P&gt;- delete component from directory if it exists&lt;/P&gt;
&lt;P&gt;- rename and save component&lt;/P&gt;
&lt;P&gt;- adds mates, etc, repeat&lt;/P&gt;
&lt;P&gt;the program works fine the first time thru. but if i go to run it again, i get an error with the 1st component 'SaveAs' as shown here.&amp;nbsp; if i save the assembly, close it and open it up again, it runs the way it should. any idea what the issue might be, something stuck in memory that gets cleared out when i close the file...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8013420"&gt;@tmathieson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think I've run into this in the past. The issue might be due to deleting the file on disk, but it still exists in the active document's referenced document collection. Try something like this to unload the document's from memory.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;BR /&gt;Best of luck to you in all of your Inventor pursuits,&lt;BR /&gt;Curtis&lt;BR /&gt;&lt;A href="http://inventortrenches.blogspot.com" target="_blank" rel="noopener"&gt;http://inventortrenches.blogspot.com&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;'remove document references from memory&lt;/SPAN&gt;
&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; x&lt;SPAN&gt;Doc&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;ThisDoc.Document&lt;/SPAN&gt;.&lt;SPAN&gt;AllReferencedDocuments&lt;/SPAN&gt;
	&lt;SPAN&gt;Logger&lt;/SPAN&gt;.&lt;SPAN&gt;Info&lt;/SPAN&gt;(x&lt;SPAN&gt;Doc&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;)
	&lt;SPAN&gt;Try&lt;/SPAN&gt;
		x&lt;SPAN&gt;Doc&lt;/SPAN&gt;.&lt;SPAN&gt;close&lt;/SPAN&gt;
	&lt;SPAN&gt;Catch&lt;/SPAN&gt;
		&lt;SPAN&gt;'Logger.Info(xDoc.FullFileName)&lt;/SPAN&gt;
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;
&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 20:24:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-to-copy-and-replace-in-ana-ssembly/m-p/11232555#M139273</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2022-06-13T20:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic code to copy and replace in ana ssembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-to-copy-and-replace-in-ana-ssembly/m-p/11233930#M139294</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8013420"&gt;@tmathieson&lt;/a&gt;.&amp;nbsp; This tip is along the same train of thought as what &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/105031"&gt;@Curtis_Waguespack&lt;/a&gt; was talking about.&lt;/P&gt;
&lt;P&gt;Here are a couple lines of Inventor API code that you might find useful in scenarios like that.&lt;/P&gt;
&lt;P&gt;When you open a document invisibly (Visibility set to False), (assuming it was not already opened in the background by the assembly before that) it is considered a hidden document, and you can use the ReleaseReference method to release the reference to it that you created by opening it.&amp;nbsp; However it may leave a remnant in session memory, so you can use the Documents.CloseAll(True) method to clear any/all documents that are no longer being referenced from Inventor's session memory.&amp;nbsp; Just a couple more tools for the toolbox.&lt;/P&gt;
&lt;P&gt;Document.ReleaseReference - (&lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=Document_ReleaseReference" target="_blank" rel="noopener"&gt;Link1&lt;/A&gt;, &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-C00D258E-00FE-40DB-B92F-FD6EDC498F37" target="_blank" rel="noopener"&gt;Link2&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;ThisApplication.Documents.CloseAll(True) - (&lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=Documents_CloseAll" target="_blank" rel="noopener"&gt;Link1&lt;/A&gt;, &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GUID-32E7853B-8221-4B5D-A11F-788F72A2D1A7" target="_blank" rel="noopener"&gt;Link2&lt;/A&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 12:12:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-to-copy-and-replace-in-ana-ssembly/m-p/11233930#M139294</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-06-14T12:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic code to copy and replace in ana ssembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-to-copy-and-replace-in-ana-ssembly/m-p/11235011#M139315</link>
      <description>&lt;P&gt;hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt; , and &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/105031"&gt;@Curtis_Waguespack&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks so much!!&amp;nbsp; Curtis, i tried your code, turn the debugging on, but it did not send any file names to the log, so i assume it didn't find anything in Memory?&amp;nbsp; i still had the same issue, so i tried &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp; suggestion, "ThisApplication.Documents.CloseAll(True)", and away we go!!&amp;nbsp; have run it a dozen times and it working fine, so on to the next step!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;funny that Curtis code didn't find anything but "ThisApplication.Documents.CloseAll(True)" found some.???&amp;nbsp; anyways, it works! much thanks for both of you for your&amp;nbsp; thought, ideas, and CODE!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i will leave you alone for a while :+)&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 19:59:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-to-copy-and-replace-in-ana-ssembly/m-p/11235011#M139315</guid>
      <dc:creator>tmathieson</dc:creator>
      <dc:date>2022-06-14T19:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic code to copy and replace in ana ssembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-to-copy-and-replace-in-ana-ssembly/m-p/11235030#M139316</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8013420"&gt;@tmathieson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My example was only looking at the files referenced by the active document...&amp;nbsp;WCrihfield's was looking at all documents and closing those that could be closed. I was likely misremembering the issue or solution when I encountered this problem... or my situation was just a bit different. In any case, I'm happy to hear you were able to resolve it!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;BR /&gt;Best of luck to you in all of your Inventor pursuits,&lt;BR /&gt;Curtis&lt;BR /&gt;&lt;A href="http://inventortrenches.blogspot.com" target="_blank"&gt;http://inventortrenches.blogspot.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 20:06:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-code-to-copy-and-replace-in-ana-ssembly/m-p/11235030#M139316</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2022-06-14T20:06:22Z</dc:date>
    </item>
  </channel>
</rss>

