I Logic to set part numbers.

I Logic to set part numbers.

Anonymous
Not applicable
391 Views
1 Reply
Message 1 of 2

I Logic to set part numbers.

Anonymous
Not applicable

I have a something strange hapening here. I have created a part that adjusts to design and under cenrtn conditions we have partnumbers that i would like to reflect in the stock number property. I have writen the ilogic code to do just htat but for some reason when i asign a paramitor to 30 deg it will not work properly. 

 

SyntaxEditor Code Snippet

MessageBox.Show(InclienAngle, "InclienAngle")
MessageBox.Show(NoseOver, "NoseOver")

PlateAngle = InclienAngle + NoseOver
MessageBox.Show(PlateAngle, "PlateAngle")

'MessageBox.Show(PlateAngle, "PlateAngle")
If Length = 119 Then
    PNumber = "Skirt Plate B"
Else 
    PNumber = "Skirt Plate A"
End If
If Pitch = 9 Then
MessageBox.Show(PlateAngle, "PlateAngle")
    Select Case Floor(PlateAngle)
        Case = 30
            ShopRef = "SR2000309, " + PNumber
            MessageBox.Show(ShopRef, "PlateAngle")
        Case = 32
            ShopRef = "SR2000801, " + PNumber
            MessageBox.Show(ShopRef, "PlateAngle")
        Case = 35
            ShopRef = "SR2000310, " + PNumber
            MessageBox.Show(ShopRef, "PlateAngle")
        Case = 40
            ShopRef = "SR2000311, " + PNumber
            MessageBox.Show(ShopRef, "PlateAngle")
        Case = 45
            ShopRef = "SR2000312, " + PNumber
            MessageBox.Show(ShopRef, "PlateAngle")
    End Select
End If


iProperties.Value("Project", "Stock Number") = ShopRef
iProperties.Value("Project", "Part Number") = PNumber

 

 

I have added the messagebox to help troubleshoot. but it works on 32, 35, 40, and 45deg but the 30 does not work. I don't see any reason this would not work but for some reason it does not seam to read the Case = 30 lines.

0 Likes
Accepted solutions (1)
392 Views
1 Reply
Reply (1)
Message 2 of 2

smilinger
Advisor
Advisor
Accepted solution

My guess, it is something about precision.

 

Somehow your PlateAngle may be 29.999999999, so Floor(PlateAngle) = 29.

 

Try use PlateAngle = Round(PlateAngle, 7) before comparison.

 

Just my guess.

0 Likes