Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
1551 Views, 4 Replies

Change a parameter in certain parts in assembly with ilogic

Hi,

 

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.

 

Intended workflow - ilogic rule to run in an assembly

 

  1. 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
  2. The parts selected are highlighted in the assembly window
  3. When a button is clicked the below happens for each selected part
    • the parameter called "Status" is changed to "In Production"
    • A rule called "UnitStatus" is run

 

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

  1. Change to 'In Design' if not already
  2. Checkout part to allow change to be saved

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

 

This is my code so far but it doesn't work and obviously I'm working on the basic window selection version.

 

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 >= 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

 

Any help is welcome, thanks

 

Adam

 

 

Tags (1)