; MACROCOMMAND= Drill Diameter,Finish Depth,SFM,FPR,Tool Number,Peck Depth,Retract Depth ; MACRODEFAULTS=1.0,-1.0,300.0,.007,1,0.2,.1 ; MACROSVG=LatheMacro.svg,6 ; O call [${drill.diameter-f}] [${drill.zdepth-f}] [${drill.sf-f}] [${drill.feed-f}] [${drill.tool-s}] [${drill.peck-f}] [${drill.retract-f}] ; #1 drill diameter ; #2 zdepth ; #3 surface speed ; #4 feed/rpm ; #5 tool number ; #6 peck amount ; #7 peck retract amount - not used right now O sub O100 IF [#<_imperial>] (MSG, IMPERIAL sizes) # = [#1 * 25.4] # = [#2 * 25.4] # = [#3 * 304.8] ; sf/m to mm/m # = [#4 * 25.4] # = [#6 * 25.4] # = [#7 * 25.4] #10 = [[#3 *12] / [3.1415 * #1]] ; RPM from sfm request (debug, Expected Drilling Diameter %d#1) (debug, Peck Increment %.2f#6) (debug, Start Z %f#<_z>) (debug, Finish Z %.2f#2) (debug, Feed %.3f#4 IPM) (debug, Tool %d#5) (debug, %d#3 SFM @ RPM %d#10) O100 ELSE (MSG, METRIC sizes) # = #1 # = #2 # = #3 ;mm/m # = #4 # = #6 # = #7 #10 = [# / [3.1415 * #]] ; RPM from mm/m request (debug, Drilling dia # mm, peck dist # mm) (debug, startz #<_z> mm, depth # mm) (debug, feed # mm/rpm, tool #5) (debug, Surface Speed # mm/m, rpm #10) O100 ENDIF M73 ; save state, restore on exit G7 ; diameter mode G17 ; XY Plane G21 ; Metric Units don't change units! G90 ; Absolute Distance # = #<_z> (starting Z) (MSG, 100% %.4h Unpause To start Drilling Macro) m0 M6 T#5 G43 G97 S#10 ; Constant RPM mode M3 ;Start Spindle G95 F# ; Feed-Per-Rev Mode g4p1 ; Wait to reach speed G0 X0 ; must drill from the centerline. Tool should be zeroed here G00 Z # G98 G83 Z# R# Q# G80 G0 Z # M5 G7 (MSG,Done Drilling Macro) O endsub M2