Double Level Loop Programming two levels of WHILE between the WHILE

Copyright 2005, Industrial Press Inc, New York, NY – FANUC CNC Drilling Machine for Plate Custom Macros


180


Chapter 13


Double Level Loop Programming two levels of WHILE between the WHILE-DOn loop and the ENDn de fines the


dou ble level loop – in dents show the pro gram ming struc ture – Fig ure 23:


WHILE [ Condition 1 is true ] DO1


Start of WHILE loop 1


< Body of Loop 1 – Part 1 >


CNC Flanges Drilling Machine


WHILE [ Condition 2 is true ] DO2


Start of WHILE loop 2


< Body of Loop 2 >


END2


End of WHILE loop 2


< Body of Loop 1 – Part 2 >


END1


End of WHILE loop 1


Figure 23


Double level of macro looping – controls two events at the time


The dou ble level loop is also quite com mon, be cause it adds more de ci sion mak ing power to the


macro If prop erly struc tured, it should not pres ent any dif fi cul ties at all Re mem ber that two


events are con trolled si mul ta neously in a dou ble level loop


A sin gle level of loop ing should be easy to un der stand Con tin u ing with the ex am ple of a drilled


hole, the sin gle level macro is suit able to be used when the hole is to be drilled at dif fer ent – but


equally spaced – lo ca tions A bolt cir cle (ex plained in Chap Dished Head Punching Machine ter 20) is an ex cel lent ex am ple


Un der stand ing the dou ble level of loop ing is a bit more dif fi cult The dou ble level of loop ing is


de fined as con trol ling two events at the same time For ex am ple, each hole of an equally spaced


pat tern has two in ter nal grooves that share the same XY lo ca tion Hole lo ca tion macro would be


the first level, and ma chin ing the two grooves would be the sec ond level


Triple Level Loop


Pro gram ming all three lev els of WHILE within the WHILE-DOn and the ENDn de fines the tri ple


level loop The tri ple level loop is Angle Punching much less com mon than the other two, but it does bring even


more de ci sion mak ing power to the mac ros It is very im por tant that a proper struc ture is used


With more lev els, the pos si bil ity of a struc tural or log i cal er ror in creases Also keep in mind that

Leave a Reply