![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifoQZdvjqrNbNdlyAaC1y_SOkbqe6muFDEjj8Dga-0OGC3sLMUj2DdQEVfMEw0tn64XCFnaVasdooFR8iKAzmDlwv5PRwRNbvty8VRzweWRgcgm-OD3SoqKxDRAYjfpXgK7PihCQSdJjG1/s320/While...DO....jpg)
While Do loop is used when a pass in a program is constantly repeat.
There are main three logic are used in this loop.
LT: Less than
LE: Less than or equal to
GT: Greater than
GE: Greater than or equal to
For example
from XOYO (Left Front Corner)to
N01 X200
N02 Y100
N03 X0
N04 Y0
Here shown program is rectangular single planner pass at some height. Now this pass is continuously repet in at some depth. So the conventional program like. If depth of cut is 5 mm(only for understanding) and depth is 15 mm than
%
O0001
N1 G0 G91 G28 Z0
N2 G90 G54 X0 Y0 M03 S2000
N3 Z5
N4 G01 Z-5 F200
N10 X200
N11 Y100
N12 X0
N13 Y0
N14 Z-10
N15 X200
N16 Y100
N17 X0
N18 Y0
N19 Z-15
N20 X200
N21 Y100
N22 X0
N23 Y0
N29 Z5
N30 G0 G91 G28 Z0
N31 M05
N32 M30
%
So now the While...DO... program is done in such a way.
%
O0001
#100=5 (First depth of cut variable)
#101=5 (Global depth of cut variable)
#102=15 (Total Depth)
G0 G91 G28 Z0
G90 G54 X0 X0 M03 S2000
WHILE[#100LE#102]DO1 (Looping below pass until #100 does not get less than or equal to #102)
G1 Z-#100 F200
X200
Y100
X0
Y0
#100=#100+#101 (additional for next cut)
END1 (loop end)
Z5
G0 G91 G28 Z0
M05
M30
%
Simulation