<?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 Replace Reference mark the Assembly as Dirty in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-reference-mark-the-assembly-as-dirty/m-p/11179135#M36926</link>
    <description>&lt;P&gt;My goal is to replace the reference of an Assembly without marking it as Dirty.I tried to use ReplaceReference alone but this modified my assembly. I just found out when the replace reference has been executed, it will trigger the OnFileResolution, from that, I tried to handle the callback to start using&amp;nbsp;ChildFileDesc2&amp;nbsp; but still the assembly has been modified.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only posible way I can see to achieve that is, Close the Assembly and open it again, from that, the onFileResolution will be fired again and if I try to handle that and start using the&amp;nbsp;ChildFileDesc2&amp;nbsp; instead of original reference(ChildFileDesc1), the assembly is not modified, but I can't use that on my current operation. If you have any trick to do that, please share it to my. Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample Code Below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ChildFileDesc1 = "C:\workspace\Part1.ipt"&lt;/P&gt;&lt;P&gt;ChildFileDesc2 =&amp;nbsp;"C:\workspace2\Part1.ipt" /&lt;STRONG&gt;/ This is a copy of&amp;nbsp;ChildFileDesc1 but located on different folder&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;foreach (Inventor.FileDescriptor ChildFileDesc1 in This.Assembly.File.ReferencedFileDescriptors)&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;{&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;if (ChildFileDesc1.FullFileName.Equals(ChildFileDesc2 .FullName) == false)&lt;/P&gt;&lt;P class="lia-indent-padding-left-90px"&gt;continue;&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;ChildFileDesc.ReplaceReference(ChildFileDesc2 .FullName);&lt;STRONG&gt;//This mark the assembly as dirty, also this will trigger the OnFileResolution callback.&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;}&lt;/P&gt;&lt;P&gt;//This will not modify the assembly&lt;/P&gt;&lt;P&gt;Callback:&amp;nbsp;&lt;/P&gt;&lt;P&gt;void OnFileResolution(string RelativeFileName,&amp;nbsp;string LibraryName,&amp;nbsp;ref byte[]&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;CustomLogicalName,&amp;nbsp;EventTimingEnum BeforeOrAfter,&amp;nbsp;NameValueMap Context,&amp;nbsp;out string FullFileName,&amp;nbsp;out HandlingCodeEnum HandlingCode)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;FullFileName =&amp;nbsp;ChildFileDesc2 ;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;HandlingCode = HandlingCodeEnum.kEventHandled;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
    <pubDate>Thu, 19 May 2022 07:43:26 GMT</pubDate>
    <dc:creator>jmacapagal2CD9H</dc:creator>
    <dc:date>2022-05-19T07:43:26Z</dc:date>
    <item>
      <title>Replace Reference mark the Assembly as Dirty</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-reference-mark-the-assembly-as-dirty/m-p/11179135#M36926</link>
      <description>&lt;P&gt;My goal is to replace the reference of an Assembly without marking it as Dirty.I tried to use ReplaceReference alone but this modified my assembly. I just found out when the replace reference has been executed, it will trigger the OnFileResolution, from that, I tried to handle the callback to start using&amp;nbsp;ChildFileDesc2&amp;nbsp; but still the assembly has been modified.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only posible way I can see to achieve that is, Close the Assembly and open it again, from that, the onFileResolution will be fired again and if I try to handle that and start using the&amp;nbsp;ChildFileDesc2&amp;nbsp; instead of original reference(ChildFileDesc1), the assembly is not modified, but I can't use that on my current operation. If you have any trick to do that, please share it to my. Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample Code Below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ChildFileDesc1 = "C:\workspace\Part1.ipt"&lt;/P&gt;&lt;P&gt;ChildFileDesc2 =&amp;nbsp;"C:\workspace2\Part1.ipt" /&lt;STRONG&gt;/ This is a copy of&amp;nbsp;ChildFileDesc1 but located on different folder&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;foreach (Inventor.FileDescriptor ChildFileDesc1 in This.Assembly.File.ReferencedFileDescriptors)&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;{&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;if (ChildFileDesc1.FullFileName.Equals(ChildFileDesc2 .FullName) == false)&lt;/P&gt;&lt;P class="lia-indent-padding-left-90px"&gt;continue;&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;ChildFileDesc.ReplaceReference(ChildFileDesc2 .FullName);&lt;STRONG&gt;//This mark the assembly as dirty, also this will trigger the OnFileResolution callback.&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;}&lt;/P&gt;&lt;P&gt;//This will not modify the assembly&lt;/P&gt;&lt;P&gt;Callback:&amp;nbsp;&lt;/P&gt;&lt;P&gt;void OnFileResolution(string RelativeFileName,&amp;nbsp;string LibraryName,&amp;nbsp;ref byte[]&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;CustomLogicalName,&amp;nbsp;EventTimingEnum BeforeOrAfter,&amp;nbsp;NameValueMap Context,&amp;nbsp;out string FullFileName,&amp;nbsp;out HandlingCodeEnum HandlingCode)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;FullFileName =&amp;nbsp;ChildFileDesc2 ;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;HandlingCode = HandlingCodeEnum.kEventHandled;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2022 07:43:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-reference-mark-the-assembly-as-dirty/m-p/11179135#M36926</guid>
      <dc:creator>jmacapagal2CD9H</dc:creator>
      <dc:date>2022-05-19T07:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: Replace Reference mark the Assembly as Dirty</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-reference-mark-the-assembly-as-dirty/m-p/11179299#M36927</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;you can set the property back to False.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;ThisAssembly&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;Dirty = False&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 May 2022 09:07:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-reference-mark-the-assembly-as-dirty/m-p/11179299#M36927</guid>
      <dc:creator>petr.meduna</dc:creator>
      <dc:date>2022-05-19T09:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: Replace Reference mark the Assembly as Dirty</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-reference-mark-the-assembly-as-dirty/m-p/11188166#M36928</link>
      <description>&lt;P&gt;Ow great! I thought it was a read-only property. Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 00:31:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-reference-mark-the-assembly-as-dirty/m-p/11188166#M36928</guid>
      <dc:creator>jmacapagal2CD9H</dc:creator>
      <dc:date>2022-05-24T00:31:05Z</dc:date>
    </item>
  </channel>
</rss>

