Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good Morning All,
I have a general question regarding iLogic.
I am quite new to programming and I'm sure someone on here could help.
I have quite a long IfThen statement which branches based on a range of sizes (see part of it below):
If PinOD = 25 mm Then 'Pin Dia = 25mm
SlotLocation = 16 mm
NonRotBase = 5 mm
SlotWidth = 7.9 mm
RotDia = 17 mm
Else If PinOD > 25 And PinOD <=30 Then 'Pin Dia Range = 26-30mm
SlotLocation = 17 mm
NonRotBase = 6 mm
SlotWidth = 10.2 mm
RotDia = 17 mm
Else If PinOD >=32 And PinOD <=38 Then 'Pin Dia Range = 32-38mm
SlotLocation = 21 mm
NonRotBase = 6 mm
SlotWidth = 10.2 mm
RotDia = 25 mm
Else If PinOD >=39 And PinOD <=40 Then 'Pin Dia Range = 39-40mm
SlotLocation = 25 mm
NonRotBase = 7 mm
SlotWidth = 12.2 mm
RotDia = 32 mm
Else If PinOD >=44 And PinOD <=51 Then 'Pin Dia Range = 44-51mm
SlotLocation = 25 mm
NonRotBase = 9 mm
SlotWidth = 12.2 mm
RotDia = 37 mm
Else If PinOD >=54 And PinOD <=64 Then 'Pin Dia Range = 54-64mm
SlotLocation = 28 mm
NonRotBase = 12 mm
SlotWidth = 14.2 mm
RotDia = 47 mm"
.... the list continues another 22 times to cover the range of pins
I have considered the case construct, but this may turn out to be just as long.
Is there an way of compressing the code to a more elegant solution than the lengthy option(s)??
Thank you
Regards
Darren
Regards
Darren
I have a general question regarding iLogic.
I am quite new to programming and I'm sure someone on here could help.
I have quite a long IfThen statement which branches based on a range of sizes (see part of it below):
If PinOD = 25 mm Then 'Pin Dia = 25mm
SlotLocation = 16 mm
NonRotBase = 5 mm
SlotWidth = 7.9 mm
RotDia = 17 mm
Else If PinOD > 25 And PinOD <=30 Then 'Pin Dia Range = 26-30mm
SlotLocation = 17 mm
NonRotBase = 6 mm
SlotWidth = 10.2 mm
RotDia = 17 mm
Else If PinOD >=32 And PinOD <=38 Then 'Pin Dia Range = 32-38mm
SlotLocation = 21 mm
NonRotBase = 6 mm
SlotWidth = 10.2 mm
RotDia = 25 mm
Else If PinOD >=39 And PinOD <=40 Then 'Pin Dia Range = 39-40mm
SlotLocation = 25 mm
NonRotBase = 7 mm
SlotWidth = 12.2 mm
RotDia = 32 mm
Else If PinOD >=44 And PinOD <=51 Then 'Pin Dia Range = 44-51mm
SlotLocation = 25 mm
NonRotBase = 9 mm
SlotWidth = 12.2 mm
RotDia = 37 mm
Else If PinOD >=54 And PinOD <=64 Then 'Pin Dia Range = 54-64mm
SlotLocation = 28 mm
NonRotBase = 12 mm
SlotWidth = 14.2 mm
RotDia = 47 mm"
.... the list continues another 22 times to cover the range of pins
I have considered the case construct, but this may turn out to be just as long.
Is there an way of compressing the code to a more elegant solution than the lengthy option(s)??
Thank you
Regards
Darren
Regards
Darren
Solved! Go to Solution.