<?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 repalce part in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-repalce-part/m-p/5888266#M59552</link>
    <description>&lt;P&gt;3 main ideas should be mentioned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;Step 1&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;You should scan AssmblyDocument.AllReferencedDocuments collection to find if your “Bracket 1234” part is used in the active assembly. You may check iProperties, parameters, attributes, filenames, etc. to identify your part.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 2&lt;BR /&gt;&lt;SPAN style="line-height: 15px;"&gt;If “Bracket 1234” part document was found you may find all occurrences for this PartDocument:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;'find all occurrences for every part found
Dim oOccEnum As ComponentOccurrencesEnumerator
Set oOccEnum = oAsmDoc.ComponentDefinition.Occurrences.AllReferencedOccurrences(oPartDocument)&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;This oOccEnum collection will contain all occurrences (from all hierarchy levels), so you do not need to traverse recursively the top-level assembly tree.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 3&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;Each component in the oOccEnum collection may be replaced by another component using ComponentOccurrence.Replace method.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you prefer iLogic then you may consider the following function:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Component.Replace(“ComponentToReplaceName”, “OtherPartfilename.ipt”, &amp;lt;replaceAll&amp;gt;)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The third Boolean argument allows you to replace all instances of this component or just the single named instance.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://help.autodesk.com/view/INVNTOR/2015/ENU/?guid=GUID-AFA099F1-B161-4822-914D-307F5CD8FE20" target="_blank"&gt;http://help.autodesk.com/view/INVNTOR/2015/ENU/?guid=GUID-AFA099F1-B161-4822-914D-307F5CD8FE20&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
    <pubDate>Mon, 02 Nov 2015 12:01:05 GMT</pubDate>
    <dc:creator>Vladimir.Ananyev</dc:creator>
    <dc:date>2015-11-02T12:01:05Z</dc:date>
    <item>
      <title>ilogic repalce part</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-repalce-part/m-p/5878313#M59386</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to use illogic to find and replace compontents in an assembly by searching for specific properties in the parts (BOM) and replace these specific parts with another file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ex: If an assembly contains a part with Title: “Bracket 1234” then I want it to be replaced with “Bracket 2345”.&lt;/P&gt;&lt;P&gt;I see examples that this is possible if I have local rules&amp;nbsp;and use the "place ilogic component"-function. B&lt;SPAN&gt;ut this requires&lt;/SPAN&gt; &lt;SPAN&gt;some preparations...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Is it&amp;nbsp;possible to use an ilogic rule that checks through the BOM, find a part with Title "Bracket 1234" and make it replace this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(I do not want to change the node-names).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this possible? And does anyone have an example.&lt;/P&gt;&lt;P&gt;If it is possible is it also possible to manage this with assemblies with more levels (more than one level of assemly)&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2015 16:17:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-repalce-part/m-p/5878313#M59386</guid>
      <dc:creator>tegstette</dc:creator>
      <dc:date>2015-10-26T16:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic repalce part</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-repalce-part/m-p/5888266#M59552</link>
      <description>&lt;P&gt;3 main ideas should be mentioned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;Step 1&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;You should scan AssmblyDocument.AllReferencedDocuments collection to find if your “Bracket 1234” part is used in the active assembly. You may check iProperties, parameters, attributes, filenames, etc. to identify your part.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 2&lt;BR /&gt;&lt;SPAN style="line-height: 15px;"&gt;If “Bracket 1234” part document was found you may find all occurrences for this PartDocument:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;'find all occurrences for every part found
Dim oOccEnum As ComponentOccurrencesEnumerator
Set oOccEnum = oAsmDoc.ComponentDefinition.Occurrences.AllReferencedOccurrences(oPartDocument)&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;This oOccEnum collection will contain all occurrences (from all hierarchy levels), so you do not need to traverse recursively the top-level assembly tree.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 3&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;Each component in the oOccEnum collection may be replaced by another component using ComponentOccurrence.Replace method.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you prefer iLogic then you may consider the following function:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Component.Replace(“ComponentToReplaceName”, “OtherPartfilename.ipt”, &amp;lt;replaceAll&amp;gt;)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The third Boolean argument allows you to replace all instances of this component or just the single named instance.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://help.autodesk.com/view/INVNTOR/2015/ENU/?guid=GUID-AFA099F1-B161-4822-914D-307F5CD8FE20" target="_blank"&gt;http://help.autodesk.com/view/INVNTOR/2015/ENU/?guid=GUID-AFA099F1-B161-4822-914D-307F5CD8FE20&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 12:01:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-repalce-part/m-p/5888266#M59552</guid>
      <dc:creator>Vladimir.Ananyev</dc:creator>
      <dc:date>2015-11-02T12:01:05Z</dc:date>
    </item>
  </channel>
</rss>

