Anonymous
in reply to:
Anonymous
09-21-2020
08:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
09-21-2020
08:08 AM
I have managed to find a solution myself with some help from our resellers and to help anyone in the future it is below.
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 >= 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