<?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 Help regarding renaming assembly file and a part file in it and saving it at same location using iLogic in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-regarding-renaming-assembly-file-and-a-part-file-in-it-and/m-p/9886185#M55723</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I have put together a code which renames the assembly file, one specific part file&amp;nbsp;(which is Litecode Acrylic.ipt) within that assembly and all the related/referenced drawing files I want to rename and overwrites and saves them in the same directory.&lt;/P&gt;&lt;P&gt;The code is working fine for everything, except that after the replacement and everything, when I reopen the newly renamed assembly file,it is still referencing and asking for that one part file that I renamed using iLogic. All the other references are maintained fine, so I guess I am not replacing the reference correctly? I am using this line of code to replace reference of my part file;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Call assOcc.ReferencedDocumentDescriptor.ReferencedFileDescriptor.ReplaceReference(ThisDoc.Path &amp;amp; "\" &amp;amp; newFileName)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the full code in case someone needs it for their projects.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="color: #800000;"&gt;oApp&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisApplication&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;oAD&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;oApp&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ActiveDocument&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;oACD&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;oAD&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ComponentDefinition&lt;/SPAN&gt;

          &lt;SPAN style="color: #800000;"&gt;MasterPos&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;oACD&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;RepresentationsManager&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;PositionalRepresentations&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Item&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"Master"&lt;/SPAN&gt;)
		  &lt;SPAN style="color: #800000;"&gt;MasterPos&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Activate&lt;/SPAN&gt;
&lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Save&lt;/SPAN&gt;()&lt;BR /&gt;&lt;BR /&gt;'Getting filenames/part numbers from excel file
&lt;SPAN style="color: #800000;"&gt;PN_AssyM&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;CellValue&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"SHEET_LXJ LIGHTSHEET linked data 082618.xlsx"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"Sheet1"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"J24"&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;PN_Litecode&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;CellValue&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"SHEET_LXJ LIGHTSHEET linked data 082618.xlsx"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"Sheet1"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"J23"&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;PN_Lightstick&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;CellValue&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"SHEET_LXJ LIGHTSHEET linked data 082618.xlsx"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"Sheet1"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"J25"&lt;/SPAN&gt;)
&lt;SPAN style="color: #808080;"&gt;' Rename and replace main assembly file&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;assemblyFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;PathAndFileName&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;".iam"&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;newAssemblyFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Path&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #800000;"&gt;PN_AssyM&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;".iam"&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;drawingFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;assemblyFileName&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Replace&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;".iam"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;".idw"&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;newDrawingFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Path&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #800000;"&gt;PN_AssyM&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;".idw"&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;File&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Move&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;assemblyFileName&lt;/SPAN&gt;, &lt;SPAN style="color: #800000;"&gt;newAssemblyFileName&lt;/SPAN&gt;)

&lt;SPAN style="color: #808080;"&gt;'Updating assembly drawing&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;drawingFile&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Documents&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Open&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;drawingFileName&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;drawingFile&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReferencedDocumentDescriptors&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Item&lt;/SPAN&gt;(1).&lt;SPAN style="color: #800000;"&gt;ReferencedFileDescriptor&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReplaceReference&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;newAssemblyFileName&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;drawingFile&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Update&lt;/SPAN&gt;()
&lt;SPAN style="color: #800000;"&gt;drawingFile&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Close&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;File&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Move&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;drawingFileName&lt;/SPAN&gt;, &lt;SPAN style="color: #800000;"&gt;newDrawingFileName&lt;/SPAN&gt;)

&lt;SPAN style="color: #808080;"&gt;'Updating Litestick drawing&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;oldLsDrawingFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Path&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"Lightstick Drawing.idw"&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;newLsDrawingFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Path&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #800000;"&gt;PN_Lightstick&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;".idw"&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;lsDrawingFile&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Documents&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Open&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oldLsDrawingFileName&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;lsDrawingFile&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReferencedDocumentDescriptors&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Item&lt;/SPAN&gt;(1).&lt;SPAN style="color: #800000;"&gt;ReferencedFileDescriptor&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReplaceReference&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;newAssemblyFileName&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;lsDrawingFile&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Update&lt;/SPAN&gt;()
&lt;SPAN style="color: #800000;"&gt;lsDrawingFile&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Close&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;File&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Move&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oldLsDrawingFileName&lt;/SPAN&gt;, &lt;SPAN style="color: #800000;"&gt;newLsDrawingFileName&lt;/SPAN&gt;)

''Renaming and updating Litecode acrylic part file
 &lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;fileMgr&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;FileManager&lt;/SPAN&gt;
 &lt;SPAN style="color: #800000;"&gt;fileMgr&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;FileManager&lt;/SPAN&gt;

&lt;SPAN style="color: #ff0000;"&gt;For&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Each&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;assOcc&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;ComponentOccurrence&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;In&lt;/SPAN&gt; &lt;SPAN style="color: #800080;"&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ActiveDocument&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Occurrences&lt;/SPAN&gt;
	&lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;assOcc&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Definition&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Document&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;DisplayName&lt;/SPAN&gt; = &lt;SPAN style="color: #008080;"&gt;"Litecode acrylic.ipt"&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Then&lt;/SPAN&gt;
	  &lt;SPAN style="color: #800000;"&gt;oldFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #008080;"&gt;"Litecode acrylic.ipt"&lt;/SPAN&gt;
	  &lt;SPAN style="color: #800000;"&gt;newFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;PN_Litecode&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;".ipt"&lt;/SPAN&gt;
	  &lt;SPAN style="color: #800000;"&gt;partDrawingFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Path&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"Litecode acrylic.idw"&lt;/SPAN&gt;
	  &lt;SPAN style="color: #800000;"&gt;newPartDrawingFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Path&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #800000;"&gt;PN_Litecode&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;".idw"&lt;/SPAN&gt;	  
	  
	  &lt;SPAN style="color: #ff0000;"&gt;Call&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;fileMgr&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;CopyFile&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oldFileName&lt;/SPAN&gt;, &lt;SPAN style="color: #800000;"&gt;newFileName&lt;/SPAN&gt;)
	  
	  &lt;SPAN style="color: #ff0000;"&gt;Call&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;assOcc&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReferencedDocumentDescriptor&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReferencedFileDescriptor&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReplaceReference&lt;/SPAN&gt;(&lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Path&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #800000;"&gt;newFileName&lt;/SPAN&gt;)
	  &lt;SPAN style="color: #ff0000;"&gt;Call&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;fileMgr&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;DeleteFile&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oldFileName&lt;/SPAN&gt;)
	''Updating drawing file for litecode acrylic
	  &lt;SPAN style="color: #800000;"&gt;partDrawing&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Documents&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Open&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;partDrawingFileName&lt;/SPAN&gt;)
	  &lt;SPAN style="color: #800000;"&gt;partDrawing&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReferencedDocumentDescriptors&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Item&lt;/SPAN&gt;(1).&lt;SPAN style="color: #800000;"&gt;ReferencedFileDescriptor&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReplaceReference&lt;/SPAN&gt;(&lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Path&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #800000;"&gt;newFileName&lt;/SPAN&gt;)
	  &lt;SPAN style="color: #800000;"&gt;partDrawing&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Update&lt;/SPAN&gt;()
      &lt;SPAN style="color: #800000;"&gt;partDrawing&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Close&lt;/SPAN&gt;
	  &lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;File&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Move&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;partDrawingFileName&lt;/SPAN&gt;, &lt;SPAN style="color: #800000;"&gt;newPartDrawingFileName&lt;/SPAN&gt;)
  &lt;SPAN style="color: #ff0000;"&gt;End&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Next&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 21 Nov 2020 21:29:52 GMT</pubDate>
    <dc:creator>sohaib.as01</dc:creator>
    <dc:date>2020-11-21T21:29:52Z</dc:date>
    <item>
      <title>Help regarding renaming assembly file and a part file in it and saving it at same location using iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-regarding-renaming-assembly-file-and-a-part-file-in-it-and/m-p/9886185#M55723</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I have put together a code which renames the assembly file, one specific part file&amp;nbsp;(which is Litecode Acrylic.ipt) within that assembly and all the related/referenced drawing files I want to rename and overwrites and saves them in the same directory.&lt;/P&gt;&lt;P&gt;The code is working fine for everything, except that after the replacement and everything, when I reopen the newly renamed assembly file,it is still referencing and asking for that one part file that I renamed using iLogic. All the other references are maintained fine, so I guess I am not replacing the reference correctly? I am using this line of code to replace reference of my part file;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Call assOcc.ReferencedDocumentDescriptor.ReferencedFileDescriptor.ReplaceReference(ThisDoc.Path &amp;amp; "\" &amp;amp; newFileName)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the full code in case someone needs it for their projects.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="color: #800000;"&gt;oApp&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisApplication&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;oAD&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;oApp&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ActiveDocument&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;oACD&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;oAD&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ComponentDefinition&lt;/SPAN&gt;

          &lt;SPAN style="color: #800000;"&gt;MasterPos&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;oACD&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;RepresentationsManager&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;PositionalRepresentations&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Item&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"Master"&lt;/SPAN&gt;)
		  &lt;SPAN style="color: #800000;"&gt;MasterPos&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Activate&lt;/SPAN&gt;
&lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Save&lt;/SPAN&gt;()&lt;BR /&gt;&lt;BR /&gt;'Getting filenames/part numbers from excel file
&lt;SPAN style="color: #800000;"&gt;PN_AssyM&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;CellValue&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"SHEET_LXJ LIGHTSHEET linked data 082618.xlsx"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"Sheet1"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"J24"&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;PN_Litecode&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;CellValue&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"SHEET_LXJ LIGHTSHEET linked data 082618.xlsx"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"Sheet1"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"J23"&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;PN_Lightstick&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;CellValue&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"SHEET_LXJ LIGHTSHEET linked data 082618.xlsx"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"Sheet1"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"J25"&lt;/SPAN&gt;)
&lt;SPAN style="color: #808080;"&gt;' Rename and replace main assembly file&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;assemblyFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;PathAndFileName&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;".iam"&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;newAssemblyFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Path&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #800000;"&gt;PN_AssyM&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;".iam"&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;drawingFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;assemblyFileName&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Replace&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;".iam"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;".idw"&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;newDrawingFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Path&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #800000;"&gt;PN_AssyM&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;".idw"&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;File&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Move&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;assemblyFileName&lt;/SPAN&gt;, &lt;SPAN style="color: #800000;"&gt;newAssemblyFileName&lt;/SPAN&gt;)

&lt;SPAN style="color: #808080;"&gt;'Updating assembly drawing&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;drawingFile&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Documents&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Open&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;drawingFileName&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;drawingFile&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReferencedDocumentDescriptors&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Item&lt;/SPAN&gt;(1).&lt;SPAN style="color: #800000;"&gt;ReferencedFileDescriptor&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReplaceReference&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;newAssemblyFileName&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;drawingFile&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Update&lt;/SPAN&gt;()
&lt;SPAN style="color: #800000;"&gt;drawingFile&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Close&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;File&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Move&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;drawingFileName&lt;/SPAN&gt;, &lt;SPAN style="color: #800000;"&gt;newDrawingFileName&lt;/SPAN&gt;)

&lt;SPAN style="color: #808080;"&gt;'Updating Litestick drawing&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;oldLsDrawingFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Path&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"Lightstick Drawing.idw"&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;newLsDrawingFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Path&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #800000;"&gt;PN_Lightstick&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;".idw"&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;lsDrawingFile&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Documents&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Open&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oldLsDrawingFileName&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;lsDrawingFile&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReferencedDocumentDescriptors&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Item&lt;/SPAN&gt;(1).&lt;SPAN style="color: #800000;"&gt;ReferencedFileDescriptor&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReplaceReference&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;newAssemblyFileName&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;lsDrawingFile&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Update&lt;/SPAN&gt;()
&lt;SPAN style="color: #800000;"&gt;lsDrawingFile&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Close&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;File&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Move&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oldLsDrawingFileName&lt;/SPAN&gt;, &lt;SPAN style="color: #800000;"&gt;newLsDrawingFileName&lt;/SPAN&gt;)

''Renaming and updating Litecode acrylic part file
 &lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;fileMgr&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;FileManager&lt;/SPAN&gt;
 &lt;SPAN style="color: #800000;"&gt;fileMgr&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;FileManager&lt;/SPAN&gt;

&lt;SPAN style="color: #ff0000;"&gt;For&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Each&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;assOcc&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;ComponentOccurrence&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;In&lt;/SPAN&gt; &lt;SPAN style="color: #800080;"&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ActiveDocument&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Occurrences&lt;/SPAN&gt;
	&lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;assOcc&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Definition&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Document&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;DisplayName&lt;/SPAN&gt; = &lt;SPAN style="color: #008080;"&gt;"Litecode acrylic.ipt"&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Then&lt;/SPAN&gt;
	  &lt;SPAN style="color: #800000;"&gt;oldFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #008080;"&gt;"Litecode acrylic.ipt"&lt;/SPAN&gt;
	  &lt;SPAN style="color: #800000;"&gt;newFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;PN_Litecode&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;".ipt"&lt;/SPAN&gt;
	  &lt;SPAN style="color: #800000;"&gt;partDrawingFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Path&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"Litecode acrylic.idw"&lt;/SPAN&gt;
	  &lt;SPAN style="color: #800000;"&gt;newPartDrawingFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Path&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #800000;"&gt;PN_Litecode&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;".idw"&lt;/SPAN&gt;	  
	  
	  &lt;SPAN style="color: #ff0000;"&gt;Call&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;fileMgr&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;CopyFile&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oldFileName&lt;/SPAN&gt;, &lt;SPAN style="color: #800000;"&gt;newFileName&lt;/SPAN&gt;)
	  
	  &lt;SPAN style="color: #ff0000;"&gt;Call&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;assOcc&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReferencedDocumentDescriptor&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReferencedFileDescriptor&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReplaceReference&lt;/SPAN&gt;(&lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Path&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #800000;"&gt;newFileName&lt;/SPAN&gt;)
	  &lt;SPAN style="color: #ff0000;"&gt;Call&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;fileMgr&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;DeleteFile&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oldFileName&lt;/SPAN&gt;)
	''Updating drawing file for litecode acrylic
	  &lt;SPAN style="color: #800000;"&gt;partDrawing&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Documents&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Open&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;partDrawingFileName&lt;/SPAN&gt;)
	  &lt;SPAN style="color: #800000;"&gt;partDrawing&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReferencedDocumentDescriptors&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Item&lt;/SPAN&gt;(1).&lt;SPAN style="color: #800000;"&gt;ReferencedFileDescriptor&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReplaceReference&lt;/SPAN&gt;(&lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Path&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #800000;"&gt;newFileName&lt;/SPAN&gt;)
	  &lt;SPAN style="color: #800000;"&gt;partDrawing&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Update&lt;/SPAN&gt;()
      &lt;SPAN style="color: #800000;"&gt;partDrawing&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Close&lt;/SPAN&gt;
	  &lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;File&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Move&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;partDrawingFileName&lt;/SPAN&gt;, &lt;SPAN style="color: #800000;"&gt;newPartDrawingFileName&lt;/SPAN&gt;)
  &lt;SPAN style="color: #ff0000;"&gt;End&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Next&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Nov 2020 21:29:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-regarding-renaming-assembly-file-and-a-part-file-in-it-and/m-p/9886185#M55723</guid>
      <dc:creator>sohaib.as01</dc:creator>
      <dc:date>2020-11-21T21:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding renaming assembly file and a part file in it and saving it at same location using iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-regarding-renaming-assembly-file-and-a-part-file-in-it-and/m-p/9887263#M55724</link>
      <description>&lt;P&gt;No one?? &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5330176"&gt;@JhoelForshav&lt;/a&gt; ?&lt;/P&gt;</description>
      <pubDate>Sun, 22 Nov 2020 17:05:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-regarding-renaming-assembly-file-and-a-part-file-in-it-and/m-p/9887263#M55724</guid>
      <dc:creator>sohaib.as01</dc:creator>
      <dc:date>2020-11-22T17:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding renaming assembly file and a part file in it and saving it at same location using iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-regarding-renaming-assembly-file-and-a-part-file-in-it-and/m-p/9887737#M55725</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8648095"&gt;@sohaib.as01&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's not easy to help if you don't attach any dataset for us to test the code with. I can only speak for myself but if answering a question here requires me to create an entire assembly with parts and drawings just in order to test some code, I often feel like I don't have the time or energy to do so.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can replace a reference to an occurrence the way you do here if the file is a copy of the original.&lt;/P&gt;
&lt;P&gt;I think your problem is more the way you rename the document in which you're working (IO.File.Move). If I create an assembly and rename it like that, the entire assembly file gets messed up and I cannot save it afterwards (The assembly document has properties for filename, document name etc that doesn't correspond to the actual file name anymore).&lt;/P&gt;
&lt;P&gt;I'd say your best option would be to create a copy of the assembly with a different name and change its references. I cant think of any robust way to rename a file while you have it open like that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This thread may be helpful:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-customization/restoration-of-broken-links-using-ilogic/m-p/9600331#M112533" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-customization/restoration-of-broken-links-using-ilogic/m-p/9600331#M112533&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Nov 2020 23:26:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-regarding-renaming-assembly-file-and-a-part-file-in-it-and/m-p/9887737#M55725</guid>
      <dc:creator>JhoelForshav</dc:creator>
      <dc:date>2020-11-22T23:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding renaming assembly file and a part file in it and saving it at same location using iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-regarding-renaming-assembly-file-and-a-part-file-in-it-and/m-p/9887753#M55726</link>
      <description>&lt;P&gt;After some further thought... What if you rename your file this way?&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oldFileName&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;String&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Document&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;FullFileName&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;newFileName&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;String&lt;/SPAN&gt; = &lt;SPAN style="color: #008080;"&gt;"C:\Users\Jhoel\Desktop\Forum\NewName.iam"&lt;/SPAN&gt;
&lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Document&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;SaveAs&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;newFileName&lt;/SPAN&gt;, &lt;SPAN style="color: #ff0000;"&gt;False&lt;/SPAN&gt;) &lt;SPAN style="color: #808080;"&gt;'Save with new name&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;File&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Delete&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oldFileName&lt;/SPAN&gt;) &lt;SPAN style="color: #808080;"&gt;'Delete old file&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;That seems to work... Then just remember to save the assembly after you've changed the references.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Nov 2020 23:45:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-regarding-renaming-assembly-file-and-a-part-file-in-it-and/m-p/9887753#M55726</guid>
      <dc:creator>JhoelForshav</dc:creator>
      <dc:date>2020-11-22T23:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding renaming assembly file and a part file in it and saving it at same location using iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-regarding-renaming-assembly-file-and-a-part-file-in-it-and/m-p/9889957#M55727</link>
      <description>&lt;P&gt;hey &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5330176"&gt;@JhoelForshav&lt;/a&gt;, you are qute right, its quite uneasy and difficult to understand the code as to how it runs when you dont have the complete data set for the code to run onto. Thats why I providing my assembly and all the referenced files here so that you can better understand whats causing the problem.&lt;/P&gt;&lt;P&gt;When you open the assembly a form will pop up, just press the "Rename and Overwrite files" button and it will rename and overwrite the files in same directory while the main assembly is open.&lt;/P&gt;&lt;P&gt;Now after renaming, the workflow I devised tells me to close the opened assembly without saving it and then reopen the newly renamed main assembly file, and here comes the problem that it now asks for the missing part "Litecode Acrylic.ipt" even though I have tried replacing its reference in the rule named "Renaming parts".&lt;/P&gt;&lt;P&gt;Hope you can better understand my problem now &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2020 19:14:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-regarding-renaming-assembly-file-and-a-part-file-in-it-and/m-p/9889957#M55727</guid>
      <dc:creator>sohaib.as01</dc:creator>
      <dc:date>2020-11-23T19:14:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding renaming assembly file and a part file in it and saving it at same location using iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-regarding-renaming-assembly-file-and-a-part-file-in-it-and/m-p/9891090#M55728</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8648095"&gt;@sohaib.as01&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As I said. The approach is wrong from the beginning. You can't rename the files like that - it will corrupt the files.&lt;/P&gt;
&lt;P&gt;I ran your code from the form and when it completed I couldn't even close the form. The assembly file that remains open doesn't exist anymore&amp;nbsp; - its file properties doesn't match what exists in the system.&lt;/P&gt;
&lt;P&gt;When you get this type of error trying to close an iLogic form you know something is very wrong with the file.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="error.PNG" style="width: 905px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/847937iC98EFABFE58D992F/image-size/large?v=v2&amp;amp;px=999" role="button" title="error.PNG" alt="error.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2020 06:42:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-regarding-renaming-assembly-file-and-a-part-file-in-it-and/m-p/9891090#M55728</guid>
      <dc:creator>JhoelForshav</dc:creator>
      <dc:date>2020-11-24T06:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding renaming assembly file and a part file in it and saving it at same location using iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-regarding-renaming-assembly-file-and-a-part-file-in-it-and/m-p/9891196#M55729</link>
      <description>&lt;P&gt;I rewrote the rule using my suggested approach (Saving the files with the new names and then delete the originals). It works for me when I've tested it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN style="color: #800080;"&gt;iLogicVb&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Automation&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;RulesOnEventsEnabled&lt;/SPAN&gt; = &lt;SPAN style="color: #ff0000;"&gt;False&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Try&lt;/SPAN&gt;	
&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;FilesToDelete&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;New&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;List&lt;/SPAN&gt;(&lt;SPAN style="color: #ff0000;"&gt;Of&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;String&lt;/SPAN&gt;)
&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oAsm&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;AssemblyDocument&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ActiveDocument&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oAsmDef&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;AssemblyComponentDefinition&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;oAsm&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ComponentDefinition&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;MasterPos&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;PositionalRepresentation&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;oAsmDef&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;RepresentationsManager&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;PositionalRepresentations&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Item&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"Master"&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;MasterPos&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Activate&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;oAsm&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Save&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;PN_AssyM&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;CellValue&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"SHEET_LXJ LIGHTSHEET linked data 082618.xlsx"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"Sheet1"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"J24"&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;PN_Litecode&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;CellValue&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"SHEET_LXJ LIGHTSHEET linked data 082618.xlsx"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"Sheet1"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"J23"&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;PN_Lightstick&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;CellValue&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"SHEET_LXJ LIGHTSHEET linked data 082618.xlsx"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"Sheet1"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"J25"&lt;/SPAN&gt;)
&lt;SPAN style="color: #808080;"&gt;' Rename and move file&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;assemblyFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;PathAndFileName&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;".iam"&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;FilesToDelete&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Add&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;assemblyFileName&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;newAssemblyFileName&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Path&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #800000;"&gt;PN_AssyM&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;".iam"&lt;/SPAN&gt;
&lt;SPAN style="color: #808080;"&gt;'Save assembly with new name&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;oAsm&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;SaveAs&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;newAssemblyFileName&lt;/SPAN&gt;, &lt;SPAN style="color: #ff0000;"&gt;False&lt;/SPAN&gt;)
&lt;SPAN style="color: #808080;"&gt;'Replace part reference&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;For&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Each&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oRefDoc&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;Document&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;In&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oAsm&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReferencedDocuments&lt;/SPAN&gt;
	&lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oRefDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;DisplayName&lt;/SPAN&gt; = &lt;SPAN style="color: #008080;"&gt;"Litecode acrylic.ipt"&lt;/SPAN&gt;
		&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oRefDocFileName&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;String&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;oRefDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;FullFileName&lt;/SPAN&gt;
		&lt;SPAN style="color: #800000;"&gt;FilesToDelete&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Add&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oRefDocFileName&lt;/SPAN&gt;)
		&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oRefDocNewFileName&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;String&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Path&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;GetDirectoryName&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oRefDocFileName&lt;/SPAN&gt;) &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #800000;"&gt;PN_Litecode&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;".ipt"&lt;/SPAN&gt;
		&lt;SPAN style="color: #800000;"&gt;oRefDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;SaveAs&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oRefDocNewFileName&lt;/SPAN&gt;, &lt;SPAN style="color: #ff0000;"&gt;False&lt;/SPAN&gt;)
		&lt;SPAN style="color: #800000;"&gt;oAsm&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;File&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReferencedFileDescriptors&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Item&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oRefDocFileName&lt;/SPAN&gt;).&lt;SPAN style="color: #800000;"&gt;ReplaceReference&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oRefDocNewFileName&lt;/SPAN&gt;)
		&lt;SPAN style="color: #808080;"&gt;'And the drawing&lt;/SPAN&gt;
		&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;DrawingFileName&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;String&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Path&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;GetDirectoryName&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oRefDocFileName&lt;/SPAN&gt;) &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Path&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;GetFileNameWithoutExtension&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oRefDocFileName&lt;/SPAN&gt;) &amp;amp; &lt;SPAN style="color: #008080;"&gt;".idw"&lt;/SPAN&gt;
		&lt;SPAN style="color: #800000;"&gt;FilesToDelete&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Add&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;DrawingFileName&lt;/SPAN&gt;)
		&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oDrawDoc&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;DrawingDocument&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Documents&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Open&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;DrawingFileName&lt;/SPAN&gt;, &lt;SPAN style="color: #ff0000;"&gt;False&lt;/SPAN&gt;)
		&lt;SPAN style="color: #800000;"&gt;oDrawDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;File&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReferencedFileDescriptors&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Item&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oRefDocFileName&lt;/SPAN&gt;).&lt;SPAN style="color: #800000;"&gt;ReplaceReference&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oRefDocNewFileName&lt;/SPAN&gt;)
		&lt;SPAN style="color: #800000;"&gt;oDrawDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Update&lt;/SPAN&gt;()
		&lt;SPAN style="color: #800000;"&gt;oDrawDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;SaveAs&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Path&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;GetDirectoryName&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oRefDocNewFileName&lt;/SPAN&gt;) &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Path&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;GetFileNameWithoutExtension&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oRefDocNewFileName&lt;/SPAN&gt;) &amp;amp; &lt;SPAN style="color: #008080;"&gt;".idw"&lt;/SPAN&gt;, &lt;SPAN style="color: #ff0000;"&gt;False&lt;/SPAN&gt;)
		&lt;SPAN style="color: #800000;"&gt;oDrawDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Close&lt;/SPAN&gt;
		&lt;SPAN style="color: #800000;"&gt;oAsm&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Save&lt;/SPAN&gt;
		&lt;SPAN style="color: #ff0000;"&gt;Exit&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;For&lt;/SPAN&gt;
	&lt;SPAN style="color: #ff0000;"&gt;End&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Next&lt;/SPAN&gt;
&lt;SPAN style="color: #808080;"&gt;'Update assembly drawing&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;AsmDrawingFileName&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;String&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Path&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;GetDirectoryName&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;assemblyFileName&lt;/SPAN&gt;) &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Path&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;GetFileNameWithoutExtension&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;assemblyFileName&lt;/SPAN&gt;) &amp;amp; &lt;SPAN style="color: #008080;"&gt;".idw"&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;FilesToDelete&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Add&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;AsmDrawingFileName&lt;/SPAN&gt;)
&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;AsmDrawingFileNameNew&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;String&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Path&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;GetDirectoryName&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;newAssemblyFileName&lt;/SPAN&gt;) &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Path&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;GetFileNameWithoutExtension&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;newAssemblyFileName&lt;/SPAN&gt;) &amp;amp; &lt;SPAN style="color: #008080;"&gt;".idw"&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oAssyDrawing&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;DrawingDocument&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Documents&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Open&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;AsmDrawingFileName&lt;/SPAN&gt;, &lt;SPAN style="color: #ff0000;"&gt;False&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;oAssyDrawing&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;File&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReferencedFileDescriptors&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Item&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;assemblyFileName&lt;/SPAN&gt;).&lt;SPAN style="color: #800000;"&gt;ReplaceReference&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;newAssemblyFileName&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;oAssyDrawing&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Update&lt;/SPAN&gt;()
&lt;SPAN style="color: #800000;"&gt;oAssyDrawing&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;SaveAs&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;AsmDrawingFileNameNew&lt;/SPAN&gt;, &lt;SPAN style="color: #ff0000;"&gt;False&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;oAssyDrawing&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Close&lt;/SPAN&gt;

&lt;SPAN style="color: #808080;"&gt;'Update LightStick drawing&lt;/SPAN&gt;

&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;lsDrawingFileName&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;String&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Path&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;GetDirectoryName&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;assemblyFileName&lt;/SPAN&gt;) &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;"Lightstick Drawing.idw"&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;FilesToDelete&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Add&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;lsDrawingFileName&lt;/SPAN&gt;)
&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;newLsDrawingFileName&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;String&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Path&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;GetDirectoryName&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;assemblyFileName&lt;/SPAN&gt;) &amp;amp; &lt;SPAN style="color: #008080;"&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #800000;"&gt;PN_Lightstick&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color: #008080;"&gt;".idw"&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;lsDrawing&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;DrawingDocument&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Documents&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Open&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;lsDrawingFileName&lt;/SPAN&gt;, &lt;SPAN style="color: #ff0000;"&gt;False&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;lsDrawing&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;File&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ReferencedFileDescriptors&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Item&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;assemblyFileName&lt;/SPAN&gt;).&lt;SPAN style="color: #800000;"&gt;ReplaceReference&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;newAssemblyFileName&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;lsDrawing&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Update&lt;/SPAN&gt;()
&lt;SPAN style="color: #800000;"&gt;lsDrawing&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;SaveAs&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;newLsDrawingFileName&lt;/SPAN&gt;, &lt;SPAN style="color: #ff0000;"&gt;False&lt;/SPAN&gt;)
&lt;SPAN style="color: #800000;"&gt;lsDrawing&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Close&lt;/SPAN&gt;

&lt;SPAN style="color: #800080;"&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Documents&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;CloseAll&lt;/SPAN&gt;(&lt;SPAN style="color: #ff0000;"&gt;True&lt;/SPAN&gt;)
&lt;SPAN style="color: #ff0000;"&gt;For&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Each&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oFileName&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;String&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;In&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;FilesToDelete&lt;/SPAN&gt;
	&lt;SPAN style="color: #800000;"&gt;IO&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;File&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Delete&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;oFileName&lt;/SPAN&gt;)
&lt;SPAN style="color: #ff0000;"&gt;Next&lt;/SPAN&gt;

&lt;SPAN style="color: #800000;"&gt;oAsm&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Update&lt;/SPAN&gt;
&lt;SPAN style="color: #800000;"&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Show&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"Success!"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080;"&gt;"Rename files"&lt;/SPAN&gt;, &lt;SPAN style="color: #800000;"&gt;MessageBoxButtons&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;OK&lt;/SPAN&gt;, &lt;SPAN style="color: #800000;"&gt;MessageBoxIcon&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Information&lt;/SPAN&gt;)

&lt;SPAN style="color: #ff0000;"&gt;Catch&lt;/SPAN&gt;
&lt;SPAN style="color: #800080;"&gt;iLogicVb&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Automation&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;RulesOnEventsEnabled&lt;/SPAN&gt; = &lt;SPAN style="color: #ff0000;"&gt;True&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;End&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Try&lt;/SPAN&gt;
&lt;SPAN style="color: #800080;"&gt;iLogicVb&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Automation&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;RulesOnEventsEnabled&lt;/SPAN&gt; = &lt;SPAN style="color: #ff0000;"&gt;True&lt;/SPAN&gt;
&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Nov 2020 07:56:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-regarding-renaming-assembly-file-and-a-part-file-in-it-and/m-p/9891196#M55729</guid>
      <dc:creator>JhoelForshav</dc:creator>
      <dc:date>2020-11-24T07:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding renaming assembly file and a part file in it and saving it at same location using iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-regarding-renaming-assembly-file-and-a-part-file-in-it-and/m-p/9895795#M55730</link>
      <description>&lt;P&gt;Hey &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5330176"&gt;@JhoelForshav&lt;/a&gt;&amp;nbsp; Thanks for the reply and your kind guidance.&lt;/P&gt;&lt;P&gt;In the back of my head I kind of knew that the issue might be coz of the way I was saving the file, but I just didnt know for sure how to avoid this workflow. I will test out your code tomorrow and see if it works fine for me, as to what I want to achieve. Though it does look perfect when I am dry running it.&lt;/P&gt;&lt;P&gt;Bundle of thanks mate.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 21:21:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-regarding-renaming-assembly-file-and-a-part-file-in-it-and/m-p/9895795#M55730</guid>
      <dc:creator>sohaib.as01</dc:creator>
      <dc:date>2020-11-25T21:21:07Z</dc:date>
    </item>
  </channel>
</rss>

