Hello
I am a beginner at ilogic and I am playing around with some ilogic rules, but cannot seem to figure this one out... I need a simple ilogic rule that does something like this:
'set the Base Quantity to the parameter Each
Is there anyone that can help me out?
Hi,
Please refer to the code below. Hope it helps you.
doc = ThisDoc.Document
If doc.FileSaveCounter = 0 Then
' If the file is not yet saved (typical for new parts from a template) – do nothing
MsgBox("The Document has not been saved!")
Else
Dim oAssDef As AssemblyComponentDefinition
oAssDef = doc.ComponentDefinition
Dim oBOMType As BOMQuantityTypeEnum
oAssDef.BOMQuantity.GetBaseQuantity (oBOMType)
If oBOMType = BOMQuantityTypeEnum.kEachBOMQuantity Then
'If the file is saved (has a filename) and BOM-quantity is ?Each? - do nothing
MsgBox("The BOM Quantity type is Each!")
Else
'If the file is saved (has a filename) and BOM-quantity is not ?Each? - set BOM-quantity to ?Each?
MsgBox("The BOM Quantity type is NOT Each!")
oAssDef.BOMQuantity.SetBaseQuantity (BOMQuantityTypeEnum.kEachBOMQuantity)
End If
End If