drill.ngc
1 ; MACROCOMMAND= Drill Diameter,Finsh Depth,SFM,FPR,Tool Number,Peck Depth,Retract Depth 2 ; MACRODEFAULTS=1,-1,300,.007,1,0.2,.1 3 ; MACROSVG=LatheMacro.svg,6 4 ; O<drill> call [${drill.diameter-f}] [${drill.zdepth-f}] [${drill.sf-f}] [${drill.feed-f}] [${drill.tool-s}] [${drill.peck-f}] [${drill.retract-f}] 5 6 ; #1 drill diameter 7 ; #2 zdepth 8 ; #3 speed 9 ; #4 feed/rpm 10 ; #5 tool number 11 ; #6 peck amount 12 ; #7 peck retract amount - not used right now 13 14 O<drill> sub 15 16 (MSG, Press Cycle Start To start Drilling Macro) 17 m0 18 19 M73 ; save state, restore on exit 20 21 G7 ; diameter mode 22 G17 ; XY Plane 23 ;G21 ; Metric Units don't change units! 24 G90 ; Absolute Distance 25 26 #13 = #<_z> (starting Z) 27 28 M6 T#5 G43 29 30 O51 IF [#<_metric>] 31 #10 = [[1000 * #3] / [3.1415 * #1]] ; metric mode RPM 32 #11 = 2 ;retract plane 33 O51 ELSE 34 #10 = [[#3 * 12 / 3.1415] / #1] ; inch mode RPM 35 #11 = 0.05 ; retract plane 36 O51 ENDIF 37 38 G97 S#10 ; Constant RPM mode 39 m3 ;Start Spindle 40 g95 F#4 ; Feed-Per-Rev Mode 41 42 g4p1 ; Wait to reach speed 43 44 (debug, Drilling dia #1 depth #2 startz #13 speed #3 feed/rpm #4 tool #5 peck dist #6 rpm #10) 45 46 G0 X0 ; must drill from the centerline. Tool should be zeroed here 47 G00 Z #13 48 G98 49 G83 Z#2 R#13 Q#6 50 G80 51 52 G0 Z #13 53 M5 54 G7 55 56 O<drill> endsub 57 58 M2