<?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 a parameter in certain parts in assembly with ilogic in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-a-parameter-in-certain-parts-in-assembly-with-ilogic/m-p/9759219#M116156</link>
    <description>&lt;P&gt;I have managed to find a solution myself with some help from our resellers and to help anyone in the future it is below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument
'selected components collection
Dim oSelected As ObjectCollection
oSelected = ThisApplication.TransientObjects.CreateObjectCollection
'Check that at least 1 is selected
If oDoc.SelectSet.Count = 0 Then
    MessageBox.Show("Please select a component.", "iLogic")
    Exit Sub 'bail out
End If
Dim oValueList As New ArrayList
    oValueList.Add("Awaiting Approval")
    oValueList.Add("In Production")
    oValueList.Add("Stock")
    oValueList.Add("On Hold")
    oValueList.Add("Site Measure")
Dim oValue As String = InputListBox("Select one option", oValueList, "In Production", "Set Status", "Available Selections")
'add to Object Collection
For i = 1 To oDoc.SelectSet.Count
    If TypeOf oDoc.SelectSet.Item(i) Is ComponentOccurrence Then
        oSelected.Add (oDoc.SelectSet.Item(i))
    End If
Next
Dim Occ As Inventor.ComponentOccurrence
If oSelected.Count &amp;gt;= 1 Then
        For i =1 To oSelected.Count
        
            Occ=oSelected.Item(i)
                       Parameter(Occ.Name, "Status") = oValue
iLogicVb.RunRule(Occ.Name, "Unit Status")
Next
    End If&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 21 Sep 2020 15:08:37 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-09-21T15:08:37Z</dc:date>
    <item>
      <title>Change a parameter in certain parts in assembly with ilogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-a-parameter-in-certain-parts-in-assembly-with-ilogic/m-p/9739888#M115736</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We use a lot of ilogic and rules but I can't figure how to get this process to work, I hope you can help me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Intended workflow&lt;/STRONG&gt;&lt;/U&gt; - ilogic rule to run in an assembly&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Opens up a detailed BOM list (shows multiple instances of the same part, 1.1, 1.2 etc.) and allows selection of the parts required&lt;/LI&gt;&lt;LI&gt;The parts selected are highlighted in the assembly window&lt;/LI&gt;&lt;LI&gt;When a button is clicked the below happens for each selected part&lt;UL&gt;&lt;LI&gt;the parameter called "Status" is changed to "In Production"&lt;/LI&gt;&lt;LI&gt;A rule called "UnitStatus" is run&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is all run in Vault and so in an ideal world I would like to also run the below when the button is clicked on each selected part&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Change to 'In Design' if not already&lt;/LI&gt;&lt;LI&gt;Checkout part to allow change to be saved&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I realise this might be asking a lot but even if I can manually select them in the window or type the item numbers into a text box it'd be a great time saver&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my code so far but it doesn't work and obviously I'm working on the basic window selection version.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oDoc As Document
Dim oPart As AssemblyComponentDefinition
oDoc = ThisApplication.ActiveDocument
oPart = oDoc.ComponentDefinition

'selected components collection
Dim oSelected As ObjectCollection
oSelected = ThisApplication.TransientObjects.CreateObjectCollection


'Check that at least 1 is selected
If oDoc.SelectSet.Count = 0 Then
    'MessageBox.Show("Please select a component.", "iLogic")
    Exit Sub 'bail out
End If


'add to Object Collection

For i = 1 To oDoc.SelectSet.Count
    If TypeOf oDoc.SelectSet.Item(i) Is ComponentOccurrence Then
        oSelected.Add (oDoc.SelectSet.Item(i))
    End If
Next

Dim Occ As ComponentOccurrence


    If oSelected.Count &amp;gt;= 1 Then
        For i =1 To oSelected.Count
        
			Try
			Parameter.Param("Status").Expression = "In Production"
			iLogicVb.RunRule(Occ, "UnitStatus")

			Catch

            End Try
        Next
    End If&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is welcome, thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Adam&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 12:39:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-a-parameter-in-certain-parts-in-assembly-with-ilogic/m-p/9739888#M115736</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-10T12:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: Change a parameter in certain parts in assembly with ilogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-a-parameter-in-certain-parts-in-assembly-with-ilogic/m-p/9747386#M115891</link>
      <description>&lt;P&gt;@Anonymous&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide non confidential sample assembly to check the feasibility.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 08:08:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-a-parameter-in-certain-parts-in-assembly-with-ilogic/m-p/9747386#M115891</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2020-09-15T08:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Change a parameter in certain parts in assembly with ilogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-a-parameter-in-certain-parts-in-assembly-with-ilogic/m-p/9747416#M115893</link>
      <description>&lt;P&gt;Hi Chandra,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for helping, please see the attached assembly and parts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Adam&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 08:24:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-a-parameter-in-certain-parts-in-assembly-with-ilogic/m-p/9747416#M115893</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-15T08:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: Change a parameter in certain parts in assembly with ilogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-a-parameter-in-certain-parts-in-assembly-with-ilogic/m-p/9754459#M116041</link>
      <description>&lt;P&gt;@Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry for late reply,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;iLogic rule inside parts are successfully executed and custom iProperty is also changed for selected component&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2020 04:22:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-a-parameter-in-certain-parts-in-assembly-with-ilogic/m-p/9754459#M116041</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2020-09-18T04:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: Change a parameter in certain parts in assembly with ilogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-a-parameter-in-certain-parts-in-assembly-with-ilogic/m-p/9759219#M116156</link>
      <description>&lt;P&gt;I have managed to find a solution myself with some help from our resellers and to help anyone in the future it is below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument
'selected components collection
Dim oSelected As ObjectCollection
oSelected = ThisApplication.TransientObjects.CreateObjectCollection
'Check that at least 1 is selected
If oDoc.SelectSet.Count = 0 Then
    MessageBox.Show("Please select a component.", "iLogic")
    Exit Sub 'bail out
End If
Dim oValueList As New ArrayList
    oValueList.Add("Awaiting Approval")
    oValueList.Add("In Production")
    oValueList.Add("Stock")
    oValueList.Add("On Hold")
    oValueList.Add("Site Measure")
Dim oValue As String = InputListBox("Select one option", oValueList, "In Production", "Set Status", "Available Selections")
'add to Object Collection
For i = 1 To oDoc.SelectSet.Count
    If TypeOf oDoc.SelectSet.Item(i) Is ComponentOccurrence Then
        oSelected.Add (oDoc.SelectSet.Item(i))
    End If
Next
Dim Occ As Inventor.ComponentOccurrence
If oSelected.Count &amp;gt;= 1 Then
        For i =1 To oSelected.Count
        
            Occ=oSelected.Item(i)
                       Parameter(Occ.Name, "Status") = oValue
iLogicVb.RunRule(Occ.Name, "Unit Status")
Next
    End If&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 21 Sep 2020 15:08:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-a-parameter-in-certain-parts-in-assembly-with-ilogic/m-p/9759219#M116156</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-21T15:08:37Z</dc:date>
    </item>
  </channel>
</rss>

