Here's a program that does something like what you asked for. You might also be interested in the file 'interesting-subroutines.ngc', which should be installed in the examples directory.
Jeff (- CUT HERE ----------------------------------------------------------) O100 sub (square [x0] [y0] [z0] [zr] [f1] [f2]) (cut a 1x1 square) (#1 = x0 = left hand corner of square) (#2 = y0 = lower corner of square) (#3 = z0 = depth of cut) (#4 = zr = retract after cut) (#5 = f1 = feed to cutting depth) (#6 = f2 = feed for square) (assumes already at safety height) G0 X#1 Y#2 G1 Z#3 F#5 G1 X[#1+1] F#6 G1 Y[#2+1] G1 X#1 G1 Y#2 G0 Z#4 O100 endsub O200 sub (l2r [x0] [y0] [dx] [count] [z0] [zr] [f1] [f2]) (#1 = x0 = least x coordinate) (#2 = y0 = common y coordinate for all squares) (#3 = dx = increment between x coordinates) (#4 = count = number of squares in row) (#5 = z0 = depth of cut) (#6 = zr = retract after cut) (#7 = f1 = feed to cutting depth) (#8 = f2 = feed for square) (cut squares from left to right at constant Y) (#9 = temporary for count of squares in row) #9=0 O210 while [#9 LT #4] O100 call [#1+#9*#3] [#2] [#5] [#6] [#7] [#8] #9=[#9+1] O210 endwhile O200 endsub O300 sub (r2l [x0] [y0] [dx] [count] [z0] [zr] [f1] [f2]) (parameters as for O200 sub) (cut squares from right to left at constant Y) #9=[#4-1] O310 while [#9 GE 0] O100 call [#1+#9*#3] [#2] [#5] [#6] [#7] [#8] #9=[#9-1] O310 endwhile O300 endsub O400 sub (squares [x0] [y0] [dx] [dy] [xcount] [ycount] [z0] [zr] [f1] [f2]) (#1 = x0 = least x coordinate) (#2 = y0 = least y coordinate) (#3 = dx = increment between x coordinates) (#4 = dy = increment between y coordinates) (#5 = xcount = number of squares in row) (#6 = ycount = number of rows) (#7 = z0 = depth of cut) (#8 = zr = retract after cut) (#9 = f1 = feed to cutting depth) (#10 = f2 = feed for square) (#11 = temporary for count of rows) #11=0 O410 while [#11 LE #6] O420 if [[#11 MOD 2] EQ 0] O200 call [#1] [#2+#11*#4] [#3] [#5] [#7] [#8] [#9] [#10] O420 else O300 call [#1] [#2+#11*#4] [#3] [#5] [#7] [#8] [#9] [#10] O420 endif #11=[#11+1] O410 endwhile O400 endsub G20 M3 S1000 O400 call [0] [0] [1.5] [1.5] [4] [5] [-1] [1] [12] [30] M2 (- CUT HERE ----------------------------------------------------------) ------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users