; 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) (MSG, ) # = [#1 * 25.4] # = [#2 * 25.4] # = [#3 * .3048] ; sf/m to m/m # = [#4 * 25.4] # = [#6 * 25.4] # = [#7 * 25.4] #10 = [[#3 *12] / [3.1415 * #1]] ; RPM from sfm request (debug, Drill Diameter: %d#1 in) (debug, Peck Increment: %.3f#6 in) (debug, Start Z: %.3f#<_z> in) (debug, Finish Z: %.3f#2 in) (debug, Feed: %.3f#4 in/rev) (debug, Tool: %d#5) (debug, Speed: %d#3 sfm @ %d#10 rpm) O100 ELSE (MSG, METRIC sizes) # = #1 # = #2 # = #3 ;m/m # = #4 # = #6 # = #7 #10 = [# / [3.1415 * #]] ; rpm from m/m request (debug, Drilling Diameter: %d# mm) (debug, Peck Distance: %.2f# mm) (debug, Start Z: %.2f#<_z> mm) (debug, Finish depth: %.2f# mm) (debug, Feed: %.2f# mm/rev) (debug, Tool: %d#5) (debug, Speed %d# m/min @ #10 rpm) 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, 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