<?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 parameters in a different part from the iLogic code. in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-parameters-in-a-different-part-from-the-ilogic-code/m-p/8806611#M97674</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1166559"&gt;@Jam_Jumpin&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hoping that below iLogic code may helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;TempFile="C:\Users\***\Target\temp_part.ipt"
TargetFile="C:\Users\***\Target\New file.ipt"

ThisDoc.Document.SaveAs(TempFile, True)

Dim Temp2 As PartDocument 
Temp2 = ThisApplication.Documents.Open(TempFile)

Dim oDef As PartComponentDefinition
oDef = Temp2.ComponentDefinition 

oDef.Parameters.Item("w") = InputBox("Width", "Size", "10")

InventorVb.DocumentUpdate()

Temp2.SaveAs(TargetFile, True)

Temp2.Close&lt;/PRE&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
    <pubDate>Wed, 22 May 2019 06:57:23 GMT</pubDate>
    <dc:creator>chandra.shekar.g</dc:creator>
    <dc:date>2019-05-22T06:57:23Z</dc:date>
    <item>
      <title>Change parameters in a different part from the iLogic code.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-parameters-in-a-different-part-from-the-ilogic-code/m-p/8804719#M97655</link>
      <description>&lt;P&gt;Here's what I am trying to do.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will open the part and run a rule&lt;/P&gt;
&lt;P&gt;Save a copy of the part to a temp location&lt;/P&gt;
&lt;P&gt;Alter some parameters on this part&lt;/P&gt;
&lt;P&gt;Save it to it's final location&lt;/P&gt;
&lt;P&gt;Close the temporary part window.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can do all these things, but the issue is that I do not know how to change the parameter in the temp part, it is changing the parameters in the part that the rule is running in.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;w is the parameter I am trying to change.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;TempFile="C:\Users\***\Target\temp_part.ipt"
TargetFile="C:\Users\***\Target\New file.ipt"

ThisDoc.Document.SaveAs(TempFile , True)
Temp2=ThisApplication.Documents.Open(TempFile)

w = InputBox("Width", "Size", "10")
InventorVb.DocumentUpdate()

Temp2.SaveAs(TargetFile, True)

Temp2.Close&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All the forum posts I could find related to the part being in an assembly which is not how I am doing this. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 13:49:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-parameters-in-a-different-part-from-the-ilogic-code/m-p/8804719#M97655</guid>
      <dc:creator>Jam_Jumpin</dc:creator>
      <dc:date>2019-05-21T13:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: Change parameters in a different part from the iLogic code.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-parameters-in-a-different-part-from-the-ilogic-code/m-p/8805935#M97665</link>
      <description>&lt;P&gt;parameters and properties allow you to specify the file as well as the parameter/property name in an overloaded option.&amp;nbsp; This means you can force the active (or choice) file into the parameter call instead of the 'current' file.&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 21:50:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-parameters-in-a-different-part-from-the-ilogic-code/m-p/8805935#M97665</guid>
      <dc:creator>JamieVJohnson2</dc:creator>
      <dc:date>2019-05-21T21:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: Change parameters in a different part from the iLogic code.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-parameters-in-a-different-part-from-the-ilogic-code/m-p/8806611#M97674</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1166559"&gt;@Jam_Jumpin&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hoping that below iLogic code may helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;TempFile="C:\Users\***\Target\temp_part.ipt"
TargetFile="C:\Users\***\Target\New file.ipt"

ThisDoc.Document.SaveAs(TempFile, True)

Dim Temp2 As PartDocument 
Temp2 = ThisApplication.Documents.Open(TempFile)

Dim oDef As PartComponentDefinition
oDef = Temp2.ComponentDefinition 

oDef.Parameters.Item("w") = InputBox("Width", "Size", "10")

InventorVb.DocumentUpdate()

Temp2.SaveAs(TargetFile, True)

Temp2.Close&lt;/PRE&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2019 06:57:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-parameters-in-a-different-part-from-the-ilogic-code/m-p/8806611#M97674</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2019-05-22T06:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: Change parameters in a different part from the iLogic code.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-parameters-in-a-different-part-from-the-ilogic-code/m-p/8806662#M97676</link>
      <description>&lt;P&gt;Error on Line 12 : Property 'Item' is 'ReadOnly'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Line 12 is&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN style="color: #800000;"&gt;oDef&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #800000;"&gt;Parameters&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #800000;"&gt;Item&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-weight: bold;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;w&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-weight: bold;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="color: #000000; font-weight: bold;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #800080; font-weight: bold;"&gt;InputBox&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-weight: bold;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;Width&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;Size&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;10&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-weight: bold;"&gt;)&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2019 07:13:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-parameters-in-a-different-part-from-the-ilogic-code/m-p/8806662#M97676</guid>
      <dc:creator>Jam_Jumpin</dc:creator>
      <dc:date>2019-05-22T07:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: Change parameters in a different part from the iLogic code.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-parameters-in-a-different-part-from-the-ilogic-code/m-p/8806666#M97677</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1166559"&gt;@Jam_Jumpin&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please provide non confidential sample part to test? please mention the Inventor version as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2019 07:15:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-parameters-in-a-different-part-from-the-ilogic-code/m-p/8806666#M97677</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2019-05-22T07:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: Change parameters in a different part from the iLogic code.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-parameters-in-a-different-part-from-the-ilogic-code/m-p/8806696#M97679</link>
      <description>&lt;P&gt;Simply using a square block to test. Attached.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Inventor 2018&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2019 07:28:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-parameters-in-a-different-part-from-the-ilogic-code/m-p/8806696#M97679</guid>
      <dc:creator>Jam_Jumpin</dc:creator>
      <dc:date>2019-05-22T07:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: Change parameters in a different part from the iLogic code.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-parameters-in-a-different-part-from-the-ilogic-code/m-p/8806960#M97682</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1166559"&gt;@Jam_Jumpin&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try below iLogic code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;TempFile="C:\Users\***\Target\temp_part.ipt"
TargetFile="C:\Users\***\Target\New file.ipt"

ThisDoc.Document.SaveAs(TempFile, True)

Dim Temp2 As PartDocument 
Temp2 = ThisApplication.Documents.Open(TempFile, True)

Dim oDef As PartComponentDefinition
oDef = Temp2.ComponentDefinition 

oDef.Parameters.Item("w").Expression = InputBox("Width", "Size", "10") 
 
Call Temp2.Update 

Temp2.SaveAs(TargetFile, True)

Temp2.Close&lt;/PRE&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2019 09:37:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-parameters-in-a-different-part-from-the-ilogic-code/m-p/8806960#M97682</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2019-05-22T09:37:19Z</dc:date>
    </item>
    <item>
      <title>Re: Change parameters in a different part from the iLogic code.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-parameters-in-a-different-part-from-the-ilogic-code/m-p/8809996#M97731</link>
      <description>&lt;P&gt;Thanks, that works now but I don't understand why it works. Please can you have a look? I have commented out what I think is happening in each stage.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also don't really understand what the command DIM does.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's great getting help on the internet but if I don't understand it I will never learn to do it myself.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;'location of temporary folder
TempFile="***\temp_part.ipt"
'Location of target folder
TargetFile="***\New file.ipt"

'Save a temporary file
ThisDoc.Document.SaveAs(TempFile, True)

'Declares Temp2 as a PartDocument variable?
Dim Temp2 As PartDocument 
'Switches ilogic focus to the open temp file?
Temp2 = ThisApplication.Documents.Open(TempFile, True)

'Definies the temp part's parameters as a variable?
Dim oDef As PartComponentDefinition
'Switches iLogic focus to the temp parameters instead of where rule is running?
oDef = Temp2.ComponentDefinition 
'Sets the temp part parameter from input box
oDef.Parameters.Item("w").Expression = InputBox("Width", "Size", "10") 
 
'forces a rebuild?
Call Temp2.Update 
'Saves temp file as new file in target location
Temp2.SaveAs(TargetFile, True)
'Close Temp file
Temp2.Close&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 May 2019 11:31:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-parameters-in-a-different-part-from-the-ilogic-code/m-p/8809996#M97731</guid>
      <dc:creator>Jam_Jumpin</dc:creator>
      <dc:date>2019-05-23T11:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: Change parameters in a different part from the iLogic code.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-parameters-in-a-different-part-from-the-ilogic-code/m-p/8810054#M97733</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1166559"&gt;@Jam_Jumpin&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ThisDoc means always focus would be in a document where iLogic rule is running. To shift the focus to current document, Temp2 variable is defined. After that, parameters are accessed from componentdefinition.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2019 11:57:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-parameters-in-a-different-part-from-the-ilogic-code/m-p/8810054#M97733</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2019-05-23T11:57:23Z</dc:date>
    </item>
  </channel>
</rss>

