<?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: Issue with Save As(False) changing origional files... in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-with-save-as-false-changing-origional-files/m-p/9126992#M102757</link>
    <description>&lt;P&gt;I pointed to the behavior of SaveAs method. I'm sorry if your problem is not there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Nov 2019 02:31:42 GMT</pubDate>
    <dc:creator>HideoYamada</dc:creator>
    <dc:date>2019-11-05T02:31:42Z</dc:date>
    <item>
      <title>Issue with Save As(False) changing origional files...</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-with-save-as-false-changing-origional-files/m-p/9126021#M102745</link>
      <description>&lt;P&gt;I'm essentially performing a copy design on on an assembly by going through all the occurences, and copying them using the SaveAs command in ilogic. It is working well except for when i have the same part in 2 different assemblies. It will copy the first, and all the parts in it. This also does the parts in the second assembly, before it does a save as of that. The end result is it copies everything fine, However, when i come to open the original second assembly, it has the new copied parts in it.&lt;/P&gt;&lt;P&gt;I have not told inventor to save this file. I have also tried copying the assemblies first, and the parts second, but this also doesn;t seem to work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have any ideas how i can get around this problem? I somehow need to refresh the file from vault, but it doesn;t even know it's changed, so i have to delete it, and get it again... but i cant do that with ilogic because it's read only!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im looping through all my occurences with this sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; &lt;SPAN&gt;SaveAsComponentAndDrawing&lt;/SPAN&gt;(&lt;SPAN&gt;oOcc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt;, &lt;SPAN&gt;TemplateFolder&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;)
	
	&lt;SPAN&gt;i&lt;/SPAN&gt; = &lt;SPAN&gt;i&lt;/SPAN&gt;+1		
	&lt;SPAN&gt;oProgressBar&lt;/SPAN&gt;.&lt;SPAN&gt;Message&lt;/SPAN&gt; = (&lt;SPAN&gt;"Performing Copy Design on Part "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;i&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;" of "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;iStepCount&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;vbCrLf&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;oOcc&lt;/SPAN&gt;.&lt;SPAN&gt;Name&lt;/SPAN&gt;) &lt;SPAN&gt;'...and increase the progress bar scale&lt;/SPAN&gt;
	&lt;SPAN&gt;oProgressBar&lt;/SPAN&gt;.&lt;SPAN&gt;UpdateProgress&lt;/SPAN&gt;

	&lt;SPAN&gt;'full file name with extension&lt;/SPAN&gt;
	&lt;SPAN&gt;CurrentFullFilename&lt;/SPAN&gt; = &lt;SPAN&gt;oOcc&lt;/SPAN&gt;.&lt;SPAN&gt;ReferencedFileDescriptor&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;
	&lt;SPAN&gt;'file name without extension&lt;/SPAN&gt;
	&lt;SPAN&gt;CurrentFilename&lt;/SPAN&gt; = &lt;SPAN&gt;TemplateFolder&lt;/SPAN&gt;  &amp;amp; &lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Path&lt;/SPAN&gt;.&lt;SPAN&gt;GetFileNameWithoutExtension&lt;/SPAN&gt;(&lt;SPAN&gt;CurrentFullFilename&lt;/SPAN&gt;)
	&lt;SPAN&gt;'file extension only&lt;/SPAN&gt;
	&lt;SPAN&gt;oExtension&lt;/SPAN&gt; = &lt;SPAN&gt;CurrentFullFilename&lt;/SPAN&gt;.&lt;SPAN&gt;Substring&lt;/SPAN&gt;(&lt;SPAN&gt;CurrentFullFilename&lt;/SPAN&gt;.&lt;SPAN&gt;Length&lt;/SPAN&gt; - 4)

	&lt;SPAN&gt;CheckIfDrawingExists&lt;/SPAN&gt;(&lt;SPAN&gt;CurrentFilename&lt;/SPAN&gt;)

	&lt;SPAN&gt;oNewFileName&lt;/SPAN&gt; = &lt;SPAN&gt;ReturnNewFileName&lt;/SPAN&gt;(&lt;SPAN&gt;oOcc&lt;/SPAN&gt;)
	
	&lt;SPAN&gt;oNewDrawingName&lt;/SPAN&gt; = &lt;SPAN&gt;oNewFileName&lt;/SPAN&gt;.&lt;SPAN&gt;Substring&lt;/SPAN&gt;(0,&lt;SPAN&gt;oNewFileName&lt;/SPAN&gt;.&lt;SPAN&gt;Length&lt;/SPAN&gt; - 4) &amp;amp; &lt;SPAN&gt;".dwg"&lt;/SPAN&gt;
	&lt;SPAN&gt;'True opens visible, False opens invisible&lt;/SPAN&gt;
	&lt;SPAN&gt;ooDoc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;Documents&lt;/SPAN&gt;.&lt;SPAN&gt;Open&lt;/SPAN&gt;(&lt;SPAN&gt;CurrentFullFilename&lt;/SPAN&gt;, &lt;SPAN&gt;True&lt;/SPAN&gt;) &lt;SPAN&gt;' opens ipt file&lt;/SPAN&gt;
	&lt;SPAN&gt;'set part number&lt;/SPAN&gt;
	&lt;SPAN&gt;ooDoc&lt;/SPAN&gt;.&lt;SPAN&gt;PropertySets&lt;/SPAN&gt;(&lt;SPAN&gt;"Design Tracking Properties"&lt;/SPAN&gt;).&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Part Number"&lt;/SPAN&gt;).&lt;SPAN&gt;Value&lt;/SPAN&gt; = &lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Path&lt;/SPAN&gt;.&lt;SPAN&gt;GetFileNameWithoutExtension&lt;/SPAN&gt;(&lt;SPAN&gt;oNewFileName&lt;/SPAN&gt;)
	
	&lt;SPAN&gt;ooDoc&lt;/SPAN&gt;.&lt;SPAN&gt;SaveAs&lt;/SPAN&gt;(&lt;SPAN&gt;oNewFileName&lt;/SPAN&gt;, &lt;SPAN&gt;False&lt;/SPAN&gt;) &lt;SPAN&gt;' false means open new file&lt;/SPAN&gt;
	&lt;SPAN&gt;'ooDoc.Update()&lt;/SPAN&gt;
	&lt;SPAN&gt;ooDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Close&lt;/SPAN&gt; 

	&lt;SPAN&gt;'Open the current drawing (In same folder location)&lt;/SPAN&gt;
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;DrawingDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DrawingDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;Documents&lt;/SPAN&gt;.&lt;SPAN&gt;Open&lt;/SPAN&gt;(&lt;SPAN&gt;CurrentFilename&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;".dwg"&lt;/SPAN&gt;,&lt;SPAN&gt;True&lt;/SPAN&gt;)
		&lt;SPAN&gt;'Perform 'Save As' on the drawing&lt;/SPAN&gt;
	&lt;SPAN&gt;DrawingDoc&lt;/SPAN&gt;.&lt;SPAN&gt;SaveAs&lt;/SPAN&gt;(&lt;SPAN&gt;oNewDrawingName&lt;/SPAN&gt;, &lt;SPAN&gt;False&lt;/SPAN&gt;) &lt;SPAN&gt;' false means open new file&lt;/SPAN&gt;
	&lt;SPAN&gt;'Replace reference to assembly model&lt;/SPAN&gt;
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oFD&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;FileDescriptor&lt;/SPAN&gt;
	&lt;SPAN&gt;oFD&lt;/SPAN&gt; = &lt;SPAN&gt;DrawingDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ReferencedFileDescriptors&lt;/SPAN&gt;(1).&lt;SPAN&gt;DocumentDescriptor&lt;/SPAN&gt;.&lt;SPAN&gt;ReferencedFileDescriptor&lt;/SPAN&gt;
	&lt;SPAN&gt;oFD&lt;/SPAN&gt;.&lt;SPAN&gt;ReplaceReference&lt;/SPAN&gt;(&lt;SPAN&gt;oNewFileName&lt;/SPAN&gt;)
	&lt;SPAN&gt;DrawingDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Update&lt;/SPAN&gt;()
	&lt;SPAN&gt;Try&lt;/SPAN&gt;
		&lt;SPAN&gt;DrawingDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Parameters&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"i"&lt;/SPAN&gt;).&lt;SPAN&gt;Value&lt;/SPAN&gt; = 1
	&lt;SPAN&gt;Catch&lt;/SPAN&gt;
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;
	&lt;SPAN&gt;DrawingDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Update&lt;/SPAN&gt;
	&lt;SPAN&gt;DrawingDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Save&lt;/SPAN&gt;
	&lt;SPAN&gt;DrawingDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Close&lt;/SPAN&gt;
	&lt;SPAN&gt;'ooDoc.Close&lt;/SPAN&gt;
	
	&lt;SPAN&gt;ComponentArray&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;oNewName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;oExtension&lt;/SPAN&gt;)
				
		&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;subOcc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oOcc&lt;/SPAN&gt;.&lt;SPAN&gt;SubOccurrences&lt;/SPAN&gt;
						
			&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;subOcc&lt;/SPAN&gt;.&lt;SPAN&gt;Name&lt;/SPAN&gt;.&lt;SPAN&gt;Contains&lt;/SPAN&gt;(&lt;SPAN&gt;TemplateCode&lt;/SPAN&gt;) 
				&lt;SPAN&gt;SaveAsComponentAndDrawing&lt;/SPAN&gt;(&lt;SPAN&gt;subOcc&lt;/SPAN&gt;, &lt;SPAN&gt;TemplateFolder&lt;/SPAN&gt;)
			&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
						
		&lt;SPAN&gt;Next&lt;/SPAN&gt;
	
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Nov 2019 16:41:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-with-save-as-false-changing-origional-files/m-p/9126021#M102745</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-11-04T16:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Save As(False) changing origional files...</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-with-save-as-false-changing-origional-files/m-p/9126948#M102755</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got a same trouble few days ago.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.autodesk.com/view/INVNTOR/2020/ENU/?guid=GUID-0BAC50E1-397D-4C42-9ED0-83E06A1A64C2" target="_blank" rel="noopener"&gt;Document.SaveAs Method&lt;/A&gt;&amp;nbsp; in the API Document is written as following :&lt;/P&gt;&lt;P&gt;&amp;gt; Saves this document into a file of the specified name. None of the dependent documents get saved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But as far as I tried, every related documents will be saved.&lt;/P&gt;&lt;P&gt;In my case, the assembly had only part occurrences (no sub assemblies). So I copied (kept) Dirty flag of each Documents of the occurrences, set them false, SaveAs top assembly, and restored Dirty flags.&lt;/P&gt;&lt;P&gt;Even if the assembly has sub assemblies, you will be able to do this. (But you have to write a bit complex code.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;=====&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.freeradical.jp" target="_blank" rel="noopener"&gt;Freeradical&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Hideo Yamada&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2019 01:45:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-with-save-as-false-changing-origional-files/m-p/9126948#M102755</guid>
      <dc:creator>HideoYamada</dc:creator>
      <dc:date>2019-11-05T01:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Save As(False) changing origional files...</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-with-save-as-false-changing-origional-files/m-p/9126992#M102757</link>
      <description>&lt;P&gt;I pointed to the behavior of SaveAs method. I'm sorry if your problem is not there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2019 02:31:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-with-save-as-false-changing-origional-files/m-p/9126992#M102757</guid>
      <dc:creator>HideoYamada</dc:creator>
      <dc:date>2019-11-05T02:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Save As(False) changing origional files...</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-with-save-as-false-changing-origional-files/m-p/9127199#M102762</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;save copy as works like this when used in code. if savecopyas is set to true it only saves new copy of file. if is set to false it saves and replace file in all opened documents. also in your scenario it open it in background as invisible file. my proposoal for you is use savecopyas with true value, then use replace functionality in assembly file. Whats about vault you can determine if file is in vault and you even can refresh it by ilogic.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2019 06:25:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-with-save-as-false-changing-origional-files/m-p/9127199#M102762</guid>
      <dc:creator>marcin_otreba</dc:creator>
      <dc:date>2019-11-05T06:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Save As(False) changing origional files...</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-with-save-as-false-changing-origional-files/m-p/9127517#M102771</link>
      <description>&lt;P&gt;So I've found a work around. Seen as the Refresh Files function does not work, I delete all the template files using&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;My&lt;/SPAN&gt;.&lt;SPAN&gt;Computer&lt;/SPAN&gt;.&lt;SPAN&gt;FileSystem&lt;/SPAN&gt;.&lt;SPAN&gt;DeleteFile&lt;/SPAN&gt;(&lt;SPAN&gt;oFile&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;Then i get all my files before i bring them into my assembly using&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; &lt;SPAN&gt;oVaultConnection&lt;/SPAN&gt;.&lt;SPAN&gt;FileManager&lt;/SPAN&gt;.&lt;SPAN&gt;AcquireFiles&lt;/SPAN&gt;(&lt;SPAN&gt;oSettings&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2019 09:22:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-with-save-as-false-changing-origional-files/m-p/9127517#M102771</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-11-05T09:22:48Z</dc:date>
    </item>
  </channel>
</rss>

