IF-ELSE-THEN NOT RUNNING PROPERLY-ILOGIC

IF-ELSE-THEN NOT RUNNING PROPERLY-ILOGIC

cameron.frederiksen
Enthusiast Enthusiast
419 Views
3 Replies
Message 1 of 4

IF-ELSE-THEN NOT RUNNING PROPERLY-ILOGIC

cameron.frederiksen
Enthusiast
Enthusiast

 I realized that Inventor has issues running this code. The code works but if the drawing associated to the assembly model is not updated every time you make a change, it does update your code. So I found that cleaning up my code a bit helped a little. Now the main issue is that when I use

 ThisBOM.OverrideQuantity("Model Data","11000138", "5"I have to refresh the drawing and model and even sometime close the program for it to update the quantities in the BOM. Is there anyway to have this update correctly everytime?

 

 

CLAMP SELECTION SEWN ID1 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_SEWN And O_CLAMP_SEWN Then 
    If (ID1<= 1.25) Or (ID2<=1.25) Then
        Component.IsActive("11000063") = True
        Else
    End If 
    
    If (1.75>=ID1 And ID1>1.25) Or (1.75>=ID2 And ID2>1.25) Then
        Component.IsActive("11000064") = True
        Else
    End If

    If (2.25>=ID1 And ID1>1.75) Or (2.25>=ID2 And ID2>1.75) Then
        Component.IsActive("11000065") = True
        Else
    End If

    If (2.75>=ID1 And ID1>2.25) Or (2.75>=ID2 And ID2>2.25) Then
        Component.IsActive("11000066") = True
        Else
    End If

    If (4>=ID1 And ID1>2.75) Or (4>=ID2 And ID2>2.75) Then
        Component.IsActive("11000067") = True
        Else
    End If

    If (6>=ID1 And ID1>4) Or (6>=ID2 And ID2>4) Then
        Component.IsActive("11000068") = True
        Else
    End If

    If ((7>=ID1 And ID1>6) Or (7>=ID2 And ID2>6)) Then
        Component.IsActive("11000069") = True
        Else
    End If

    If (8.25>=ID1 And ID1>7) Or (8.25>=ID2 And ID2>7) Then
        Component.IsActive("11000070") = True
        Else
    End If


    If (10>=ID1 And ID1>8.25) Or (10>=ID2 And ID2>8.25) Then
        Component.IsActive("11000138") = True
        Else
    End If

    If (12>=ID1 And ID1>10) Or (12>=ID2 And ID2>10) Then
        Component.IsActive("11000071") = True
        Else
    End If

'CLAMP >12ID<=24
    If (24>=ID1 And ID1>12) Or (24>=ID2 And ID2>12) Then
         If (7>=VARIABLE_ID1 And VARIABLE_ID1>6) Or (7>=VARIABLE_ID2 And VARIABLE_ID2>6) Then
            Component.IsActive("11000069") = True
        Else
        End If
    
        If (8.25>=VARIABLE_ID1 And VARIABLE_ID1>7) Or (8.25>=VARIABLE_ID2 And VARIABLE_ID2>7) Then
            Component.IsActive("11000070") = True
        Else
        End If
    
        If (10>=VARIABLE_ID1 And VARIABLE_ID1>8.25) Or (10>=VARIABLE_ID2 And VARIABLE_ID2>8.25) Then
        Component.IsActive("11000138") = True
        Else
        End If
    
        If (12>=VARIABLE_ID1 And VARIABLE_ID1>10) Or (12>=VARIABLE_ID2 And VARIABLE_ID2>10) Then
        Component.IsActive("11000071") = True
        Else
        End If
    End If 
    
'Clamp 24>ID<=36
    If (36>=ID1 And ID1>24) Or (36>=ID2 And ID2>24) Then
 
        If (8.25>=VARIABLE_ID3 And VARIABLE_ID3>7) Or (8.25>=VARIABLE_ID4 And VARIABLE_ID4>7) Then
            Component.IsActive("11000070") = True
            ThisBOM.OverrideQuantity("Model Data","11000070", "3")
        Else
        End If

        If (10>=VARIABLE_ID3 And VARIABLE_ID3>8.25) Or (10>=VARIABLE_ID4 And VARIABLE_ID4>8.25) Then
            Component.IsActive("11000138") = True
            ThisBOM.OverrideQuantity("Model Data","11000138", "3")
        Else
        End If
    
        If (12>=VARIABLE_ID3 And VARIABLE_ID3>10) Or (12>=VARIABLE_ID4 And VARIABLE_ID4>10) Then
            Component.IsActive("11000071") = True
            ThisBOM.OverrideQuantity("Model Data","11000071", "3")
        Else
        End If
    Else
    End If 

'Clamp 36>ID<=48
    If (48>=ID1 And ID1>36) Or (48>=ID2 And ID2>36) Then
 
        If (10>=VARIABLE_ID5 And VARIABLE_ID5>8.25) Or (10>=VARIABLE_ID6 And VARIABLE_ID6>8.25) Then
            Component.IsActive("11000138") = True
            ThisBOM.OverrideQuantity("Model Data","11000138", "4")
        Else
        End If
    
        If (12>=VARIABLE_ID5 And VARIABLE_ID5>10) Or (12>=VARIABLE_ID6 And VARIABLE_ID6>10) Then
            Component.IsActive("11000071") = True
            ThisBOM.OverrideQuantity("Model Data","11000071", "4")
        Else
        End If
    End If 

'Clamp 48>ID<=60
    If (60>=ID1 And ID1>48) Or (60>=ID2 And ID2>48) Then
 
        If ((10>=VARIABLE_ID7 And VARIABLE_ID7>8.25) Or (10>=VARIABLE_ID8 And VARIABLE_ID8>8.25)) Then
            Component.IsActive("11000138") = True
            ThisBOM.OverrideQuantity("Model Data","11000138", "5")
        Else
        End If
    
        If (12>=VARIABLE_ID7 And VARIABLE_ID7>10) Or (12>=VARIABLE_ID8 And VARIABLE_ID8>10) Then
            Component.IsActive("11000071") = True
            ThisBOM.OverrideQuantity("Model Data","11000071", "5") 
        Else
        End If
    End If 
End If
0 Likes
Accepted solutions (1)
420 Views
3 Replies
Replies (3)
Message 2 of 4

cameron.frederiksen
Enthusiast
Enthusiast

Now I tried using select case and having the user input the quantities and clamp number, but the issue is still the same. I have to keep updated the drawing/model and even having to close the autodesk 2017 program and then It might update the BOM quantities.

 

'CLAMP SELECTION OVER 12"
If ID1 >12 Then
quantity = ThisBOM.CalculateQuantity("Model Data", "11000063")
quantity = ThisBOM.CalculateQuantity("Model Data", "11000064")
quantity = ThisBOM.CalculateQuantity("Model Data", "11000065")
quantity = ThisBOM.CalculateQuantity("Model Data", "11000066")
quantity = ThisBOM.CalculateQuantity("Model Data", "11000067")
quantity = ThisBOM.CalculateQuantity("Model Data", "11000068")
quantity = ThisBOM.CalculateQuantity("Model Data", "11000069")
quantity = ThisBOM.CalculateQuantity("Model Data", "11000070")
quantity = ThisBOM.CalculateQuantity("Model Data", "11000071")
quantity = ThisBOM.CalculateQuantity("Model Data", "11000138")

 

Select Case O_CLAMP_ID1
Case "11000063"
Component.IsActive("11000063") = True
Case "11000064"
Component.IsActive("11000064") = True
Case "11000065"
Component.IsActive("11000065") = True
Case "11000066"
Component.IsActive("11000066") = True
Case "11000067"
Component.IsActive("11000067") = True
Case "11000068"
Component.IsActive("11000068") = True
Case "11000069"
Component.IsActive("11000069") = True
Case "11000070"
Component.IsActive("11000070") = True
Case "11000071"
Component.IsActive("11000071") = True
End Select
ThisBOM.OverrideQuantity("Model Data",O_CLAMP_ID1, O_CLAMP_QTY)
End If

0 Likes
Message 3 of 4

cameron.frederiksen
Enthusiast
Enthusiast

So basically I found that I have to save the Model, then the drawing. Then the drawing says the context is open in another file and I need to save that file so I hit okay and it brings me back to the model where I try to save it, but then it says I need to save from a different level of detail so I then have to go through and save all the level of details, then go back to the illogic level of detail and save that. Once, I do all that I open my illogic form and change the quantities and then they final F***ing update.

0 Likes
Message 4 of 4

cameron.frederiksen
Enthusiast
Enthusiast
Accepted solution

running an event trigger on my illogic rules forced the bom to update.

0 Likes