<?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: Change model reference in a drawing rule. Why it doesn't work in Inv 2019? in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-model-reference-in-a-drawing-rule-why-it-doesn-t-work-in/m-p/8714834#M96398</link>
    <description>&lt;P&gt;Thank you for your&amp;nbsp;&lt;SPAN&gt;response.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yes, it's for .ipt only. And I don't use Vault. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Moreover, I noticed that the code still works! The problem was related to several specific files (h&lt;/SPAN&gt;&lt;SPAN&gt;owever, I have not found what was the cause of this error).&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 08 Apr 2019 14:16:58 GMT</pubDate>
    <dc:creator>mikhail_tsarev</dc:creator>
    <dc:date>2019-04-08T14:16:58Z</dc:date>
    <item>
      <title>Change model reference in a drawing rule. Why it doesn't work in Inv 2019?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-model-reference-in-a-drawing-rule-why-it-doesn-t-work-in/m-p/8713916#M96375</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;
&lt;P&gt;I have a rule that perfectly works in 2017. But in Inventor 2019 it doesn't work and I can't understand why...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The rule changes model reference in a drawing to new model with the same name and located same folder as drawing document . &lt;SPAN&gt;This is very useful when you have to create drawings by copying existing documents.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Code:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;odoc = ThisDoc.Document
Dim NF as String = ThisDoc.Path &amp;amp; "\" &amp;amp; ThisDoc.FileName(False)&amp;amp; ".ipt"
Dim oldFD As FileDescriptor
oldFD = odoc.ReferencedFileDescriptors(1).DocumentDescriptor.ReferencedFileDescriptor
oldFD.ReplaceReference(NF)

odoc.Update()
odoc.Save&lt;/PRE&gt;
&lt;P&gt;Need help...&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 08:38:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-model-reference-in-a-drawing-rule-why-it-doesn-t-work-in/m-p/8713916#M96375</guid>
      <dc:creator>mikhail_tsarev</dc:creator>
      <dc:date>2019-04-08T08:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: Change model reference in a drawing rule. Why it doesn't work in Inv 2019?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-model-reference-in-a-drawing-rule-why-it-doesn-t-work-in/m-p/8714168#M96379</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;At the moment I can't test it on 2019; however please let me just make a note about two things on your code:&lt;/P&gt;
&lt;P&gt;- As you are forcing the extension, it only works for .ipt references (if for some reason this drawing is for an iam, it will not work)&lt;/P&gt;
&lt;P&gt;- Is the .idw read only? Don't know if you are using Autodesk Vault, but specially in that case, it may need a checkout&lt;BR /&gt;&lt;BR /&gt;Later on, I will check it on 2019.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 10:20:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-model-reference-in-a-drawing-rule-why-it-doesn-t-work-in/m-p/8714168#M96379</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-04-08T10:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: Change model reference in a drawing rule. Why it doesn't work in Inv 2019?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-model-reference-in-a-drawing-rule-why-it-doesn-t-work-in/m-p/8714834#M96398</link>
      <description>&lt;P&gt;Thank you for your&amp;nbsp;&lt;SPAN&gt;response.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yes, it's for .ipt only. And I don't use Vault. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Moreover, I noticed that the code still works! The problem was related to several specific files (h&lt;/SPAN&gt;&lt;SPAN&gt;owever, I have not found what was the cause of this error).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 14:16:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-model-reference-in-a-drawing-rule-why-it-doesn-t-work-in/m-p/8714834#M96398</guid>
      <dc:creator>mikhail_tsarev</dc:creator>
      <dc:date>2019-04-08T14:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: Change model reference in a drawing rule. Why it doesn't work in Inv 2019?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-model-reference-in-a-drawing-rule-why-it-doesn-t-work-in/m-p/8715105#M96402</link>
      <description>In 2018 its code works, try to find the file for which it does not work and if possible attach it to study the error. regards!</description>
      <pubDate>Mon, 08 Apr 2019 15:48:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-model-reference-in-a-drawing-rule-why-it-doesn-t-work-in/m-p/8715105#M96402</guid>
      <dc:creator>Sergio.D.Suárez</dc:creator>
      <dc:date>2019-04-08T15:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: Change model reference in a drawing rule. Why it doesn't work in Inv 2019?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-model-reference-in-a-drawing-rule-why-it-doesn-t-work-in/m-p/8721504#M96473</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3537266"&gt;@mikhail_tsarev&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try the rule below:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;oThisDoc = ThisDoc.Document&lt;BR /&gt;oThisFileName = ThisDoc.FileName(False) &amp;amp; ".ipt"&lt;BR /&gt;
IPJ = ThisApplication.FileLocations.FileLocationsFile&lt;BR /&gt;IPJ_Folder_Location = Left(IPJ, Len(IPJ) - Len(IPJ_Name))&lt;BR /&gt;&lt;BR /&gt;Dim Folder As New IO.DirectoryInfo(IPJ_Folder_Location)&lt;BR /&gt;Dim FileList As New List(Of String)&lt;BR /&gt;For Each File As IO.FileInfo In Folder.GetFiles(oThisFileName,IO.SearchOption.AllDirectories)&lt;BR /&gt;If File.FullName.Contains(oThisFileName) = True Then&lt;BR /&gt;FileList.Add(File.FullName)&lt;BR /&gt;NieuwFilePath = File.FullName&lt;BR /&gt;doc = ThisDoc.Document&lt;BR /&gt;'Change the Referenced File'&lt;BR /&gt;oFD = doc.ReferencedFileDescriptors(1).DocumentDescriptor.ReferencedFileDescriptor&lt;BR /&gt;oFD.ReplaceReference(NieuwFilePath)&lt;BR /&gt;&lt;BR /&gt;Else &lt;BR /&gt;MsgBox("the file " &amp;amp; oThisFileName &amp;amp; " not found in this project!")&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;Next&lt;BR /&gt;&lt;BR /&gt;iLogicVb.UpdateWhenDone = True&lt;BR /&gt;InventorVb.DocumentUpdate()&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2019 18:18:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-model-reference-in-a-drawing-rule-why-it-doesn-t-work-in/m-p/8721504#M96473</guid>
      <dc:creator>Charlies_3D_T</dc:creator>
      <dc:date>2019-04-10T18:18:57Z</dc:date>
    </item>
  </channel>
</rss>

