#1=3 (side of square to level) #2=0.125 (safe height) #3=-0.075 (depth) #4=0.25 (tool diameter) #5=7.5 (feed rate) #6=[#4 * 1/2] (width of each pass) (Drill unitial corners. These spill outside official area by half the diameter of the tool) O200 sub (5 step routine to mill square) G91 (rltv crd) (1 = 6) (2 = 7) G1 y #1 G1 x [[2*#2-1]*#1] G1 y [-2*#2*#1] G1 x [-2*#2*#1] G1 y [2*#2*#1] O200 endsub G90 (abs crd) (Goto centre) G0 x [#1 / 2] y [#1 / 2] G1 z #3 f #5 G91 (rltv crd) (Start loop that mills squares) #7=[1] O10 While [[2 * #6 * #7] lt #1] O200 call [#6] [#7] #7=[#7+1] O10 endwhile (Final square to get area to correct size) G90 (abs crd) G1 x [0 + #4 / 2] y [#1 - [#4 / 2]] G1 x 0 y #1 G1 x [0 + #4 / 2] y [#1 - [#4 / 2]] G1 x [#1 - [#4 / 2]] y [#1 - [#4 / 2]] G1 x #1 y#1 G1 x [#1 - [#4 / 2]] y [#1 - [#4 / 2]] G1 x [#1 - [#4 / 2]] y [0 + #4 / 2] G1 x #1 y 0 G1 x [#1 - [#4 / 2]] y [0 + #4 / 2] G1 x [0 + #4 / 2] y [0 + #4 / 2] G1 x 0 y 0 G1 x [0 + #4 / 2] y [0 + #4 / 2] G1 x [0 + #4 / 2] y [#1 - [#4 / 2]] G0 z #2 G0 x 0 y 0 M30 M2