- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
ILOGIC BOM UPDATING ISSUE
Hello,
I attached my entire assembly, this way you can actually look at the code for yourself. The issue is with the code in the "EVENTTRIGGERRULE". There are two separate actions happening, the first code is triggered when either "sewn" or "formed" is selected in the form. Then It will determine which parts are active and set them either to Phantom or Normal based on whether sewn or formed was chosen. The issue is that it does not always update correctly and I have checked the code but it looked all right.
The second part of the code is triggered by the inputs of "Collar1" and "Collar2" in the form, this is a numerical input. Based of the inputs it will choose the correct clamp to use based on the input size and if it is over 12" then It will determine the quantity of clamps based on the Variable parameters. Anything under 12" uses 1 clamp. So the issue is that the BOM will not update the quantities when the clamp is over 12". I tried using event triggers but It is still having issues.
I would really appreciate some help because I have tried everything I could think of.
Thank you,
Cameron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
You seem to be missing a bit of logic from the two lines:
If O_CLAMP Then
which is causing an error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Sorry, ignore that last comment.
I'm getting an error on this line of code:
ThisBOM.OverrideQuantity("Model Data","11000138", 2)
Not sure why yet, the error message isn't very helpful
The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I found that if I separate the component.active code from the this.bom code into separate IF Statements it does a better job at updating the BOM quantities.
'Clamp 48>ID<=60
ElseIf (60>=O_COLLAR2 And O_COLLAR2>48) Then
If (10>=VARIABLE_8 And VARIABLE_8>8.25) Then
Component.IsActive("11000138") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000138")
'ThisBOM.OverrideQuantity("Model Data","11000138", 5)
ElseIf (12>=VARIABLE_8 And VARIABLE_8>10) Then
Component.IsActive("11000071") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000071")
'ThisBOM.OverrideQuantity("Model Data","11000071", 5)
End If
End If
End If
'Clamp 48>ID<=60
ElseIf (60>=O_COLLAR2 And O_COLLAR2>48) Then
If (10>=VARIABLE_8 And VARIABLE_8>8.25) Then
ThisBOM.OverrideQuantity("Model Data","11000138", 5)
ElseIf (12>=VARIABLE_8 And VARIABLE_8>10) Then
ThisBOM.OverrideQuantity("Model Data","11000071", 5)
End If
End If
End If
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
That code is working good so far, but now I'm getting this error when I save my drawing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Post your currently code up here using the proper
this
and I can see If I can help.
--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization
iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread
Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects
Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help
Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
'TURNING COLLAR PARTS PHANTOM WHEN BELLOWS TYPE = FORMED
If O_COLLAR_SEWING_TYPE= "FORMED" Then
ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("Ilogic").Activate
iLogicVb.UpdateWhenDone=True
' set a reference to the assembly component definintion
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
If Component.IsActive("ROUND_FLANGE1")=True Then
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("ROUND_FLANGE1") = True Then
oOccurrence.Definition.BOMStructure = 51971 'Phantom
End If
Next
End If
If Component.IsActive("ROUND_FLANGE2")=True Then
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("ROUND_FLANGE2") = True Then
oOccurrence.Definition.BOMStructure = 51971 'Phantom
End If
Next
End If
If Component.IsActive("ROUND_FLANGE3")=True Then
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("ROUND_FLANGE3") = True Then
oOccurrence.Definition.BOMStructure = 51971 'Phantom
End If
Next
End If
If Component.IsActive("ROUND_FLANGE4")=True Then
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("ROUND_FLANGE4") = True Then
oOccurrence.Definition.BOMStructure = 51971 'Phantom
End If
Next
End If
If Component.IsActive("ROUND_COLLAR1")=True Then
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("ROUND_COLLAR1") = True Then
oOccurrence.Definition.BOMStructure = 51971 'Phantom
End If
Next
End If
If Component.IsActive("ROUND_COLLAR2")=True Then
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("ROUND_COLLAR2") = True Then
oOccurrence.Definition.BOMStructure = 51971 'Phantom
End If
Next
End If
If Component.IsActive("EXPANDED_COLLAR1")=True Then
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("EXPANDED_COLLAR1") = True Then
oOccurrence.Definition.BOMStructure = 51971 'Phantom
End If
Next
End If
If Component.IsActive("EXPANDED_COLLAR2")=True Then
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("EXPANDED_COLLAR2") = True Then
oOccurrence.Definition.BOMStructure = 51971 'Phantom
End If
Next
End If
If Component.IsActive("CONE_END1")=True Then
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("CONE_END1") = True Then
oOccurrence.Definition.BOMStructure = 51971 'Phantom
End If
Next
End If
If Component.IsActive("CONE_END2")=True Then
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("CONE_END2") = True Then
oOccurrence.Definition.BOMStructure = 51971 'Phantom
End If
Next
End If
End If
If O_COLLAR_SEWING_TYPE= "SEWN" Then
ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("Ilogic").Activate
iLogicVb.UpdateWhenDone=True
' set a reference to the assembly component definintion
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
If Component.IsActive("ROUND_FLANGE1")=True Then
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("ROUND_FLANGE1") = True Then
oOccurrence.Definition.BOMStructure = 51970 'NORMAL
End If
Next
End If
If Component.IsActive("ROUND_FLANGE2")=True Then
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("ROUND_FLANGE2") = True Then
oOccurrence.Definition.BOMStructure = 51970 'NORMAL
End If
Next
End If
If Component.IsActive("ROUND_FLANGE3")=True Then
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("ROUND_FLANGE3") = True Then
oOccurrence.Definition.BOMStructure = 51970 'NORMAL
End If
Next
End If
If Component.IsActive("ROUND_FLANGE4")=True Then
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("ROUND_FLANGE4") = True Then
oOccurrence.Definition.BOMStructure = 51970 'NORMAL
End If
Next
End If
If Component.IsActive("ROUND_COLLAR1")=True Then
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("ROUND_COLLAR1") = True Then
oOccurrence.Definition.BOMStructure = 51970 'NORMAL
End If
Next
End If
If Component.IsActive("ROUND_COLLAR2")=True Then
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("ROUND_COLLAR2") = True Then
oOccurrence.Definition.BOMStructure = 51970 'NORMAL
End If
Next
End If
If Component.IsActive("EXPANDED_COLLAR1")=True Then
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("EXPANDED_COLLAR1") = True Then
oOccurrence.Definition.BOMStructure = 51970 'NORMAL
End If
Next
End If
If Component.IsActive("EXPANDED_COLLAR2")=True Then
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("EXPANDED_COLLAR2") = True Then
oOccurrence.Definition.BOMStructure = 51970 'NORMAL
End If
Next
End If
If Component.IsActive("CONE_END1")=True Then
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("CONE_END1") = True Then
oOccurrence.Definition.BOMStructure = 51970 'NORMAL
End If
Next
End If
If Component.IsActive("CONE_END2")=True Then
For Each oOccurrence In oAsmCompDef.Occurrences
If oOccurrence.Name.Contains("CONE_END2") = True Then
oOccurrence.Definition.BOMStructure = 51970 'NORMAL
End If
Next
End If
End If
'------------------------------------------------------------------------------------------------------------------------------------------------------------------
'VARIABLE SWITCH COLLAR1
If (24>=O_COLLAR1 And O_COLLAR1>12) Then
VARIABLE_1 = O_COLLAR1/2
Else
VARIABLE_1=0
End If
If (36>=O_COLLAR1 And O_COLLAR1>24) Then
VARIABLE_3 = O_COLLAR1/3
Else
VARIABLE_3 = 0
End If
If (48>=O_COLLAR1 And O_COLLAR1>36) Then
VARIABLE_5 = O_COLLAR1/4
Else
VARIABLE_5 = 0
End If
If (60>=O_COLLAR1 And O_COLLAR1>48) Then
VARIABLE_7 = O_COLLAR1/5
Else
VARIABLE_7= 0
End If
'VARIABLE SWITCH COLLAR2
If (24>=O_COLLAR2 And O_COLLAR2>12) Then
VARIABLE_2 = O_COLLAR2/2
Else
VARIABLE_2=0
End If
If (36>=O_COLLAR2 And O_COLLAR2>24) Then
VARIABLE_4 = O_COLLAR2/3
Else
VARIABLE_4 = 0
End If
If (48>=O_COLLAR2 And O_COLLAR2>36) Then
VARIABLE_6 = O_COLLAR2/4
Else
VARIABLE_6 = 0
End If
If (60>=O_COLLAR2 And O_COLLAR2>48) Then
VARIABLE_8 = O_COLLAR2/5
Else
VARIABLE_8 = 0
End If
'CLAMP SELECTION SEWN O_COLLAR1 CODE
Component.IsActive("11000063") = False
Component.IsActive("11000064") = False
Component.IsActive("11000065") = False
Component.IsActive("11000066") = False
Component.IsActive("11000067") = False
Component.IsActive("11000068") = False
Component.IsActive("11000069") = False
Component.IsActive("11000070") = False
Component.IsActive("11000071") = False
Component.IsActive("11000138") = False
If O_CLAMP Then
If (O_COLLAR1<= 1.25) And O_COLLAR1> 0 Then'Or (O_COLLAR2<=1.25) Then
Component.IsActive("11000063") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000063")
ElseIf (1.75>=O_COLLAR1 And O_COLLAR1>1.25) Then'Or (1.75>=O_COLLAR2 And O_COLLAR2>1.25) Then
Component.IsActive("11000064") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000064")
ElseIf (2.25>=O_COLLAR1 And O_COLLAR1>1.75)Then' Or (2.25>=O_COLLAR2 And O_COLLAR2>1.75) Then
Component.IsActive("11000065") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000065")
ElseIf (2.75>=O_COLLAR1 And O_COLLAR1>2.25)Then' Or (2.75>=O_COLLAR2 And O_COLLAR2>2.25) Then
Component.IsActive("11000066") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000066")
ElseIf (4>=O_COLLAR1 And O_COLLAR1>2.75)Then' Or (4>=O_COLLAR2 And O_COLLAR2>2.75) Then
Component.IsActive("11000067") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000067")
ElseIf (6>=O_COLLAR1 And O_COLLAR1>4) Then'Or (6>=O_COLLAR2 And O_COLLAR2>4) Then
Component.IsActive("11000068") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000068")
ElseIf (7>=O_COLLAR1 And O_COLLAR1>6) Then'Or (7>=O_COLLAR2 And O_COLLAR2>6) Then
Component.IsActive("11000069") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000069")
ElseIf (8.25>=O_COLLAR1 And O_COLLAR1>7) Then'Or (8.25>=O_COLLAR2 And O_COLLAR2>7) Then
Component.IsActive("11000070") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000070")
ElseIf (10>=O_COLLAR1 And O_COLLAR1>8.25)Then' Or (10>=O_COLLAR2 And O_COLLAR2>8.25) Then
Component.IsActive("11000138") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000138")
ElseIf (12>=O_COLLAR1 And O_COLLAR1>10)Then' Or (12>=O_COLLAR2 And O_COLLAR2>10) Then
Component.IsActive("11000071") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000071")
'O_CLAMP >12ID<=24
ElseIf (24>=O_COLLAR1 And O_COLLAR1>12) Then'Or (24>=O_COLLAR2 And O_COLLAR2>12) Then
If (7>=VARIABLE_1 And VARIABLE_1>6)Then' Or (7>=VARIABLE_2 And VARIABLE_2>6) Then
Component.IsActive("11000069") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000069")
'ThisBOM.OverrideQuantity("Model Data","11000069", 2)
ElseIf (8.25>=VARIABLE_1 And VARIABLE_1>7) Then'Or (8.25>=VARIABLE_2 And VARIABLE_2>7) Then
Component.IsActive("11000070") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000070")
'ThisBOM.OverrideQuantity("Model Data","11000070",2)
ElseIf (10>=VARIABLE_1 And VARIABLE_1>8.25)Then' Or (10>=VARIABLE_2 And VARIABLE_2>8.25) Then
Component.IsActive("11000138") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000138")
'ThisBOM.OverrideQuantity("Model Data","11000138", 2)
ElseIf (12>=VARIABLE_1 And VARIABLE_1>10) Then'Or (12>=VARIABLE_2 And VARIABLE_2>10) Then
Component.IsActive("11000071") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000071")
'ThisBOM.OverrideQuantity("Model Data","11000071", 2)
End If
'Clamp 24>ID<=36
ElseIf (36>=O_COLLAR1 And O_COLLAR1>24) Then'Or (36>=O_COLLAR2 And O_COLLAR2>24) Then
If (8.25>=VARIABLE_3 And VARIABLE_3>7) Then'Or (8.25>=VARIABLE_4 And VARIABLE_4>7) Then
Component.IsActive("11000070") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000070")
'ThisBOM.OverrideQuantity("Model Data","11000070", 3)
ElseIf (10>=VARIABLE_3 And VARIABLE_3>8.25)Then' Or (10>=VARIABLE_4 And VARIABLE_4>8.25) Then
Component.IsActive("11000138") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000138")
'ThisBOM.OverrideQuantity("Model Data","11000138", 3)
ElseIf (12>=VARIABLE_3 And VARIABLE_3>10)Then' Or (12>=VARIABLE_4 And VARIABLE_4>10) Then
Component.IsActive("11000071") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000071")
'ThisBOM.OverrideQuantity("Model Data","11000071", 3)
End If
'Clamp 36>ID<=48
ElseIf (48>=O_COLLAR1 And O_COLLAR1>36) Then'Or (48>=O_COLLAR2 And O_COLLAR2>36) Then
If (10>=VARIABLE_5 And VARIABLE_5>8.25) Then'Or (10>=VARIABLE_6 And VARIABLE_6>8.25) Then
Component.IsActive("11000138") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000138")
'ThisBOM.OverrideQuantity("Model Data","11000138", 4)
ElseIf (12>=VARIABLE_5 And VARIABLE_5>10) Then'Or (12>=VARIABLE_6 And VARIABLE_6>10) Then
Component.IsActive("11000071") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000071")
'ThisBOM.OverrideQuantity("Model Data","11000071", 4)
End If
'Clamp 48>ID<=60
ElseIf (60>=O_COLLAR1 And O_COLLAR1>48) Then'Or (60>=O_COLLAR2 And O_COLLAR2>48) Then
If (10>=VARIABLE_7 And VARIABLE_7>8.25) Then'Or (10>=VARIABLE_8 And VARIABLE_8>8.25) Then
Component.IsActive("11000138") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000138")
'ThisBOM.OverrideQuantity("Model Data","11000138", 5)
ElseIf (12>=VARIABLE_7 And VARIABLE_7>10) Then'Or (12>=VARIABLE_8 And VARIABLE_8>10) Then
Component.IsActive("11000071") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000071")
'ThisBOM.OverrideQuantity("Model Data","11000071", 5)
End If
End If
End If
'COLLAR 2
If O_CLAMP Then
If (O_COLLAR2<=1.25) And O_COLLAR2> 0 Then
Component.IsActive("11000063") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000063")
ElseIf (1.75>=O_COLLAR2 And O_COLLAR2>1.25) Then
Component.IsActive("11000064") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000064")
ElseIf (2.25>=O_COLLAR2 And O_COLLAR2>1.75) Then
Component.IsActive("11000065") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000065")
ElseIf (2.75>=O_COLLAR2 And O_COLLAR2>2.25) Then
Component.IsActive("11000066") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000066")
ElseIf (4>=O_COLLAR2 And O_COLLAR2>2.75) Then
Component.IsActive("11000067") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000067")
ElseIf (6>=O_COLLAR2 And O_COLLAR2>4) Then
Component.IsActive("11000068") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000068")
ElseIf (7>=O_COLLAR2 And O_COLLAR2>6) Then
Component.IsActive("11000069") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000069")
ElseIf (8.25>=O_COLLAR2 And O_COLLAR2>7) Then
Component.IsActive("11000070") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000070")
ElseIf (10>=O_COLLAR2 And O_COLLAR2>8.25) Then
Component.IsActive("11000138") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000138")
ElseIf (12>=O_COLLAR2 And O_COLLAR2>10) Then
Component.IsActive("11000071") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000071")
'O_CLAMP >12ID<=24
ElseIf (24>=O_COLLAR2 And O_COLLAR2>12) Then
If (7>=VARIABLE_2 And VARIABLE_2>6) Then
Component.IsActive("11000069") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000069")
'ThisBOM.OverrideQuantity("Model Data",11000069, 2)
ElseIf (8.25>=VARIABLE_2 And VARIABLE_2>7) Then
Component.IsActive("11000070") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000070")
'ThisBOM.OverrideQuantity("Model Data",11000070,2)
ElseIf (10>=VARIABLE_2 And VARIABLE_2>8.25) Then
Component.IsActive("11000138") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000138")
'ThisBOM.OverrideQuantity("Model Data","11000138", 2)
ElseIf (12>=VARIABLE_2 And VARIABLE_2>10) Then
Component.IsActive("11000071") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000071")
'ThisBOM.OverrideQuantity("Model Data","11000071",2)
End If
'Clamp 24>ID<=36
ElseIf (36>=O_COLLAR2 And O_COLLAR2>24) Then
If (8.25>=VARIABLE_4 And VARIABLE_4>7) Then
Component.IsActive("11000070") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000070")
'ThisBOM.OverrideQuantity("Model Data","11000070", 3)
ElseIf (10>=VARIABLE_4 And VARIABLE_4>8.25) Then
Component.IsActive("11000138") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000138")
'ThisBOM.OverrideQuantity("Model Data","11000138", 3)
ElseIf (12>=VARIABLE_4 And VARIABLE_4>10) Then
Component.IsActive("11000071") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000071")
'ThisBOM.OverrideQuantity("Model Data","11000071", 3)
End If
'Clamp 36>ID<=48
ElseIf (48>=O_COLLAR2 And O_COLLAR2>36) Then
If (10>=VARIABLE_6 And VARIABLE_6>8.25) Then
Component.IsActive("11000138") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000138")
'ThisBOM.OverrideQuantity("Model Data","11000138", 4)
ElseIf (12>=VARIABLE_6 And VARIABLE_6>10) Then
Component.IsActive("11000071") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000071")
'ThisBOM.OverrideQuantity("Model Data","11000071", 4)
End If
'Clamp 48>ID<=60
ElseIf (60>=O_COLLAR2 And O_COLLAR2>48) Then
If (10>=VARIABLE_8 And VARIABLE_8>8.25) Then
Component.IsActive("11000138") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000138")
'ThisBOM.OverrideQuantity("Model Data","11000138", 5)
ElseIf (12>=VARIABLE_8 And VARIABLE_8>10) Then
Component.IsActive("11000071") = True
'quantity = ThisBOM.CalculateQuantity("Model Data", "11000071")
'ThisBOM.OverrideQuantity("Model Data","11000071", 5)
End If
End If
End If
'----------------------------------------------------------------------------------------------------------------------------------------------
'O_CLAMP >12ID<=24
If O_CLAMP Then
If (O_COLLAR1<= 1.25) And O_COLLAR1> 0 Then'Or (O_COLLAR2<=1.25) Then
'Component.IsActive("11000063") = True
quantity = ThisBOM.CalculateQuantity("Model Data", "11000063")
ElseIf (1.75>=O_COLLAR1 And O_COLLAR1>1.25) Then'Or (1.75>=O_COLLAR2 And O_COLLAR2>1.25) Then
'Component.IsActive("11000064") = True
quantity = ThisBOM.CalculateQuantity("Model Data", "11000064")
ElseIf (2.25>=O_COLLAR1 And O_COLLAR1>1.75)Then' Or (2.25>=O_COLLAR2 And O_COLLAR2>1.75) Then
'Component.IsActive("11000065") = True
quantity = ThisBOM.CalculateQuantity("Model Data", "11000065")
ElseIf (2.75>=O_COLLAR1 And O_COLLAR1>2.25)Then' Or (2.75>=O_COLLAR2 And O_COLLAR2>2.25) Then
'Component.IsActive("11000066") = True
quantity = ThisBOM.CalculateQuantity("Model Data", "11000066")
ElseIf (4>=O_COLLAR1 And O_COLLAR1>2.75)Then' Or (4>=O_COLLAR2 And O_COLLAR2>2.75) Then
'Component.IsActive("11000067") = True
quantity = ThisBOM.CalculateQuantity("Model Data", "11000067")
ElseIf (6>=O_COLLAR1 And O_COLLAR1>4) Then'Or (6>=O_COLLAR2 And O_COLLAR2>4) Then
'Component.IsActive("11000068") = True
quantity = ThisBOM.CalculateQuantity("Model Data", "11000068")
ElseIf (7>=O_COLLAR1 And O_COLLAR1>6) Then'Or (7>=O_COLLAR2 And O_COLLAR2>6) Then
'Component.IsActive("11000069") = True
quantity = ThisBOM.CalculateQuantity("Model Data", "11000069")
ElseIf (8.25>=O_COLLAR1 And O_COLLAR1>7) Then'Or (8.25>=O_COLLAR2 And O_COLLAR2>7) Then
'Component.IsActive("11000070") = True
quantity = ThisBOM.CalculateQuantity("Model Data", "11000070")
ElseIf (10>=O_COLLAR1 And O_COLLAR1>8.25)Then' Or (10>=O_COLLAR2 And O_COLLAR2>8.25) Then
'Component.IsActive("11000138") = True
quantity = ThisBOM.CalculateQuantity("Model Data", "11000138")
ElseIf (12>=O_COLLAR1 And O_COLLAR1>10)Then' Or (12>=O_COLLAR2 And O_COLLAR2>10) Then
'Component.IsActive("11000071") = True
quantity = ThisBOM.CalculateQuantity("Model Data", "11000071")
ElseIf (24>=O_COLLAR1 And O_COLLAR1>12) Then'Or (24>=O_COLLAR2 And O_COLLAR2>12) Then
If (7>=VARIABLE_1 And VARIABLE_1>6)Then' Or (7>=VARIABLE_2 And VARIABLE_2>6) Then
ThisBOM.OverrideQuantity("Model Data","11000069", 2)
ElseIf (8.25>=VARIABLE_1 And VARIABLE_1>7) Then'Or (8.25>=VARIABLE_2 And VARIABLE_2>7) Then
ThisBOM.OverrideQuantity("Model Data","11000070",2)
ElseIf (10>=VARIABLE_1 And VARIABLE_1>8.25)Then' Or (10>=VARIABLE_2 And VARIABLE_2>8.25) Then
ThisBOM.OverrideQuantity("Model Data","11000138", 2)
ElseIf (12>=VARIABLE_1 And VARIABLE_1>10) Then'Or (12>=VARIABLE_2 And VARIABLE_2>10) Then
ThisBOM.OverrideQuantity("Model Data","11000071", 2)
End If
'Clamp 24>ID<=36
ElseIf (36>=O_COLLAR1 And O_COLLAR1>24) Then'Or (36>=O_COLLAR2 And O_COLLAR2>24) Then
If (8.25>=VARIABLE_3 And VARIABLE_3>7) Then'Or (8.25>=VARIABLE_4 And VARIABLE_4>7) Then
ThisBOM.OverrideQuantity("Model Data","11000070", 3)
ElseIf (10>=VARIABLE_3 And VARIABLE_3>8.25)Then' Or (10>=VARIABLE_4 And VARIABLE_4>8.25) Then
ThisBOM.OverrideQuantity("Model Data","11000138", 3)
ElseIf (12>=VARIABLE_3 And VARIABLE_3>10)Then' Or (12>=VARIABLE_4 And VARIABLE_4>10) Then
ThisBOM.OverrideQuantity("Model Data","11000071", 3)
End If
'Clamp 36>ID<=48
ElseIf (48>=O_COLLAR1 And O_COLLAR1>36) Then'Or (48>=O_COLLAR2 And O_COLLAR2>36) Then
If (10>=VARIABLE_5 And VARIABLE_5>8.25) Then'Or (10>=VARIABLE_6 And VARIABLE_6>8.25) Then
ThisBOM.OverrideQuantity("Model Data","11000138", 4)
ElseIf (12>=VARIABLE_5 And VARIABLE_5>10) Then'Or (12>=VARIABLE_6 And VARIABLE_6>10) Then
ThisBOM.OverrideQuantity("Model Data","11000071", 4)
End If
'Clamp 48>ID<=60
ElseIf (60>=O_COLLAR1 And O_COLLAR1>48) Then'Or (60>=O_COLLAR2 And O_COLLAR2>48) Then
If (10>=VARIABLE_7 And VARIABLE_7>8.25) Then'Or (10>=VARIABLE_8 And VARIABLE_8>8.25) Then
ThisBOM.OverrideQuantity("Model Data","11000138", 5)
ElseIf (12>=VARIABLE_7 And VARIABLE_7>10) Then'Or (12>=VARIABLE_8 And VARIABLE_8>10) Then
ThisBOM.OverrideQuantity("Model Data","11000071", 5)
End If
End If
End If
'COLLAR 2
If O_CLAMP Then
'O_CLAMP >12ID<=24
If (O_COLLAR2<=1.25)And O_COLLAR2> 0 Then
'Component.IsActive("11000063") = True
quantity = ThisBOM.CalculateQuantity("Model Data", "11000063")
ElseIf (1.75>=O_COLLAR2 And O_COLLAR2>1.25) Then
'Component.IsActive("11000064") = True
quantity = ThisBOM.CalculateQuantity("Model Data", "11000064")
ElseIf (2.25>=O_COLLAR2 And O_COLLAR2>1.75) Then
'Component.IsActive("11000065") = True
quantity = ThisBOM.CalculateQuantity("Model Data", "11000065")
ElseIf (2.75>=O_COLLAR2 And O_COLLAR2>2.25) Then
'Component.IsActive("11000066") = True
quantity = ThisBOM.CalculateQuantity("Model Data", "11000066")
ElseIf (4>=O_COLLAR2 And O_COLLAR2>2.75) Then
'Component.IsActive("11000067") = True
quantity = ThisBOM.CalculateQuantity("Model Data", "11000067")
ElseIf (6>=O_COLLAR2 And O_COLLAR2>4) Then
'Component.IsActive("11000068") = True
quantity = ThisBOM.CalculateQuantity("Model Data", "11000068")
ElseIf (7>=O_COLLAR2 And O_COLLAR2>6) Then
'Component.IsActive("11000069") = True
quantity = ThisBOM.CalculateQuantity("Model Data", "11000069")
ElseIf (8.25>=O_COLLAR2 And O_COLLAR2>7) Then
'Component.IsActive("11000070") = True
quantity = ThisBOM.CalculateQuantity("Model Data", "11000070")
ElseIf (10>=O_COLLAR2 And O_COLLAR2>8.25) Then
'Component.IsActive("11000138") = True
quantity = ThisBOM.CalculateQuantity("Model Data", "11000138")
ElseIf (12>=O_COLLAR2 And O_COLLAR2>10) Then
'Component.IsActive("11000071") = True
quantity = ThisBOM.CalculateQuantity("Model Data", "11000071")
ElseIf (24>=O_COLLAR2 And O_COLLAR2>12) Then
If (7>=VARIABLE_2 And VARIABLE_2>6) Then
ThisBOM.OverrideQuantity("Model Data","11000069", 2)
ElseIf (8.25>=VARIABLE_2 And VARIABLE_2>7) Then
ThisBOM.OverrideQuantity("Model Data","11000070",2)
ElseIf (10>=VARIABLE_2 And VARIABLE_2>8.25) Then
ThisBOM.OverrideQuantity("Model Data","11000138", 2)
ElseIf (12>=VARIABLE_2 And VARIABLE_2>10) Then
ThisBOM.OverrideQuantity("Model Data","11000071",2)
End If
'Clamp 24>ID<=36
ElseIf (36>=O_COLLAR2 And O_COLLAR2>24) Then
If (8.25>=VARIABLE_4 And VARIABLE_4>7) Then
ThisBOM.OverrideQuantity("Model Data","11000070", 3)
ElseIf (10>=VARIABLE_4 And VARIABLE_4>8.25) Then
ThisBOM.OverrideQuantity("Model Data","11000138", 3)
ElseIf (12>=VARIABLE_4 And VARIABLE_4>10) Then
ThisBOM.OverrideQuantity("Model Data","11000071", 3)
End If
'Clamp 36>ID<=48
ElseIf (48>=O_COLLAR2 And O_COLLAR2>36) Then
If (10>=VARIABLE_6 And VARIABLE_6>8.25) Then
ThisBOM.OverrideQuantity("Model Data","11000138", 4)
ElseIf (12>=VARIABLE_6 And VARIABLE_6>10) Then
ThisBOM.OverrideQuantity("Model Data","11000071", 4)
End If
'Clamp 48>ID<=60
ElseIf (60>=O_COLLAR2 And O_COLLAR2>48) Then
If (10>=VARIABLE_8 And VARIABLE_8>8.25) Then
ThisBOM.OverrideQuantity("Model Data","11000138", 5)
ElseIf (12>=VARIABLE_8 And VARIABLE_8>10) Then
ThisBOM.OverrideQuantity("Model Data","11000071", 5)
End If
End If
End If
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
If you are using this with iTriggers it is HIGHLY, HIGHLY recommended you go back through the code and replace
ThisApplication.ActiveDocument
with
ThisDoc.Document
Using the latter ensures that the rule grabs the document that the rule was triggered in, not the document that is at the forefront of the screen.
Also, add this at the very start:
If ThisDoc.Document.DocumentType <> kAssemblyDocumentObject Then
MsgBox("Rule only for assemblies; was triggered to run for: " & vblf & vblf & _
ThisDoc.Document.FullFileName & vblf & vblf & _
"... Aborting Rule!")
Exit Sub
End if
--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization
iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread
Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects
Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help
Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Nah, AFAIK event triggers are fine. Same deal required with switching to ThisDoc vs ActiveDoc though.
--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization
iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread
Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects
Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help
Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm getting this error when I save my drawing now. I get it around 20 times, I have to keep clicking ok till it stops.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Debug and find out what is making it error.
In iLogic, you can do this by placing
MsgBox("Made it to here 1")
or something similar within the code to see the last line that runs before it fails.
Also, if it is run on am assembly file that hasn't been saved yet, it will give an error.
--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization
iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread
Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects
Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help
Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type