<?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: I logic to replace the part number in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/i-logic-to-replace-the-part-number/m-p/10420057#M48616</link>
    <description>&lt;P&gt;Automating a find and replace of iLogic code is probably not the best practice, I'm sure it can be done, but I have another option that might work for your situation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When part number user defined as STRING = 01012021 is created in your main assembly as a User Parameter, you can use that user parameter for the component name.&amp;nbsp; Example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Main assembly has a text User Parameter "ERP_Name1", which is changed to the new ERP name when you copy design the assembly, but still refers to the "Flange" Part I hypothesized earlier.&amp;nbsp; Then you can make the parameter calls using this User parameter, either directly or through a String variable:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Parameter(ERP_Name1, "d0") = PIPE_PRJ_TOP

'Or

Dim DynamicPartName1 As String = Parameter("ERP_Name1") 
Parameter(DynamicPartName1, "d0") = PIPE_PRJ_TOP&lt;/LI-CODE&gt;&lt;P&gt;This should allow your component names to reflect the ERP name and still "Stabilize" the iLogic code.&amp;nbsp; You would need a User Parameter for each component, but that should probably be fine since you would only have to set them up once.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know how this workflow feels in your situation.&lt;/P&gt;</description>
    <pubDate>Fri, 25 Jun 2021 12:07:54 GMT</pubDate>
    <dc:creator>J-Camper</dc:creator>
    <dc:date>2021-06-25T12:07:54Z</dc:date>
    <item>
      <title>I logic to replace the part number</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/i-logic-to-replace-the-part-number/m-p/10415590#M48612</link>
      <description>&lt;P&gt;Hello Forum&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Need help !!!&lt;/P&gt;&lt;P&gt;Can anyone please provide code for " REPLACING THE PART NUMBER " used in I logic,&lt;/P&gt;&lt;P&gt;Since each part is unique number , If I am copying the assembly want to change the parameters&lt;/P&gt;&lt;P&gt;but I logic is built for previous part reference number .. I don't want to go and edit each time in ilogic&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my plan to create new user parameters enter the new drawing number,,&lt;/P&gt;&lt;P&gt;i logic code should replace the existing old part number&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example : Find and replace&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Parameter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;6097-100&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;d0&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;PIPE_PRJ_TOP&lt;/SPAN&gt;
&lt;SPAN&gt;Parameter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;60975-100&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;d1&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;-&lt;/SPAN&gt;&lt;SPAN&gt;Sqrt&lt;/SPAN&gt; &lt;SPAN&gt;((&lt;/SPAN&gt;&lt;SPAN&gt;PIPE_X&lt;/SPAN&gt; &lt;SPAN&gt;*&lt;/SPAN&gt; &lt;SPAN&gt;PIPE_X&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt; &lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;PIPE_Y&lt;/SPAN&gt;&lt;SPAN&gt;*&lt;/SPAN&gt;&lt;SPAN&gt;PIPE_Y&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;
&lt;SPAN&gt;Parameter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;60975-100&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;d2&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;((&lt;/SPAN&gt;&lt;SPAN&gt;PIPE_Z&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;SPAN&gt;PIPE_PRJ_TOP&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;SPAN&gt;2.5&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;my required code.. to replace "6097-100" / "6097" with new number.. which will be entered in user parameters at top assembly...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Vijay&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 19:16:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/i-logic-to-replace-the-part-number/m-p/10415590#M48612</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-06-23T19:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: I logic to replace the part number</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/i-logic-to-replace-the-part-number/m-p/10415625#M48613</link>
      <description>&lt;P&gt;Maybe this ? From top level assembly :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oDoc&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: #800000;"&gt;oDoc&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;oAssCompDef&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;oAssCompDef&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;oDoc&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;oOcc&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;For&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Each&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oOcc&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;In&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oAssCompDef&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Occurrences&lt;/SPAN&gt;
	
	&lt;SPAN style="color: #ff0000;"&gt;Try&lt;/SPAN&gt; 
		
		&lt;SPAN style="color: #800000;"&gt;oOcc&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Definition&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Parameters&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;UserParameters&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Item&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"PartParameterName1"&lt;/SPAN&gt;).&lt;SPAN style="color: #800000;"&gt;Value&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;oAssCompDef&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Parameters&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;UserParameters&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Item&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"TopAssyParameterName1"&lt;/SPAN&gt;).&lt;SPAN style="color: #800000;"&gt;Value&lt;/SPAN&gt;
		&lt;SPAN style="color: #800000;"&gt;oOcc&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Definition&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Parameters&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;UserParameters&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Item&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"PartParameterName2"&lt;/SPAN&gt;).&lt;SPAN style="color: #800000;"&gt;Value&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;oAssCompDef&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Parameters&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;UserParameters&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Item&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"TopAssyParameterName2"&lt;/SPAN&gt;).&lt;SPAN style="color: #800000;"&gt;Value&lt;/SPAN&gt;
	        &lt;SPAN style="color: #800000;"&gt;oOcc&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Definition&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Parameters&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;UserParameters&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Item&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"PartParameterName3"&lt;/SPAN&gt;).&lt;SPAN style="color: #800000;"&gt;Value&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;oAssCompDef&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Parameters&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;UserParameters&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Item&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"TopAssyParameterName3"&lt;/SPAN&gt;).&lt;SPAN style="color: #800000;"&gt;Value&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt;        Catch&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: #ff0000;"&gt;Next&lt;/SPAN&gt;	&lt;/PRE&gt;&lt;P&gt;Replace parameters name as needed. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FINET L.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 19:32:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/i-logic-to-replace-the-part-number/m-p/10415625#M48613</guid>
      <dc:creator>FINET_Laurent</dc:creator>
      <dc:date>2021-06-23T19:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: I logic to replace the part number</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/i-logic-to-replace-the-part-number/m-p/10415827#M48614</link>
      <description>&lt;P&gt;@Anonymous,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I understand correctly, you have an assembly with iLogic rule to drive parameters in component parts/assemblies.&amp;nbsp; Then you want to be able to copy design that assembly with new component parts/assemblies and have the iLogic work without changing it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If that is correct, you should stabilize your browser node names.&amp;nbsp; For example:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Parameter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;6097-100&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;d0&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;PIPE_PRJ_TOP&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;You would want to rename the browser node for "6097-100" to be more generic, and not have them rename to part number.&amp;nbsp; I don't know what this part is, but lets just say it is a pipe Flange.&amp;nbsp; You rename the browser node to "Flange" and then use this line in your iLogic code:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Parameter("Flange", "d0") = PIPE_PRJ_TOP&lt;/LI-CODE&gt;&lt;P&gt;With the name stabilized, you can copy design the main assembly as many times as you need and the new part number for the "Flange" component, whatever it is, won't matter.&amp;nbsp; The re-named browser node would remain the same and your iLogic would not have to change.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 21:04:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/i-logic-to-replace-the-part-number/m-p/10415827#M48614</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2021-06-23T21:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: I logic to replace the part number</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/i-logic-to-replace-the-part-number/m-p/10418898#M48615</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for the code and help..&lt;/P&gt;&lt;P&gt;as you more generic name " flange" , could be given in top assembly while copying it for next design all defined parameters will work.. in my case.. each part name is linked to external drawing generator number while its linked to ERP system,, unless it wont save in that format .. ERP wont recognise the part..&amp;nbsp;&lt;/P&gt;&lt;P&gt;if some one copying my model.. they can't trace and change the genric number to ERP number its trick is int.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;let me keep it simple words..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;step 1... create user parameter which is unique number generated by ERP .. for eg.. 01012021&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;same number entered in main assembly , as part number user defined as STRING = 01012021&lt;/P&gt;&lt;P&gt;step2 ;&amp;nbsp; below parameter "7560975-100" is old part , should replace with new number mentioned above&lt;/P&gt;&lt;P&gt;nothing but find and replace..&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Parameter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;7560975-100&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;d0&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;PIPE_PRJ_TOP&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;the reason behind is I have many parts with featured derived assly and part..&lt;/P&gt;&lt;P&gt;can't keep it maually , //&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hope its clear.. can&amp;nbsp; I get VBA code&lt;/P&gt;&lt;P&gt;looking forward for soln.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Vijay&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 22:39:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/i-logic-to-replace-the-part-number/m-p/10418898#M48615</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-06-24T22:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: I logic to replace the part number</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/i-logic-to-replace-the-part-number/m-p/10420057#M48616</link>
      <description>&lt;P&gt;Automating a find and replace of iLogic code is probably not the best practice, I'm sure it can be done, but I have another option that might work for your situation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When part number user defined as STRING = 01012021 is created in your main assembly as a User Parameter, you can use that user parameter for the component name.&amp;nbsp; Example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Main assembly has a text User Parameter "ERP_Name1", which is changed to the new ERP name when you copy design the assembly, but still refers to the "Flange" Part I hypothesized earlier.&amp;nbsp; Then you can make the parameter calls using this User parameter, either directly or through a String variable:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Parameter(ERP_Name1, "d0") = PIPE_PRJ_TOP

'Or

Dim DynamicPartName1 As String = Parameter("ERP_Name1") 
Parameter(DynamicPartName1, "d0") = PIPE_PRJ_TOP&lt;/LI-CODE&gt;&lt;P&gt;This should allow your component names to reflect the ERP name and still "Stabilize" the iLogic code.&amp;nbsp; You would need a User Parameter for each component, but that should probably be fine since you would only have to set them up once.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know how this workflow feels in your situation.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jun 2021 12:07:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/i-logic-to-replace-the-part-number/m-p/10420057#M48616</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2021-06-25T12:07:54Z</dc:date>
    </item>
  </channel>
</rss>

