11; MACROCOMMAND= Drill Diameter,Finish Depth,SFM,FPR,Tool Number,Peck Depth,Retract Depth
2- ; MACRODEFAULTS=1,-1,300,.007,1,0.2,.1
2+ ; MACRODEFAULTS=1.0 ,-1.0 ,300.0 ,.007,1,0.2,.1
33; MACROSVG=LatheMacro.svg,6
44; O<drill> call [${drill.diameter-f}] [${drill.zdepth-f}] [${drill.sf-f}] [${drill.feed-f}] [${drill.tool-s}] [${drill.peck-f}] [${drill.retract-f}]
55
66; #1 drill diameter
77; #2 zdepth
8- ; #3 speed
8+ ; #3 surface speed
99; #4 feed/rpm
1010; #5 tool number
1111; #6 peck amount
1212; #7 peck retract amount - not used right now
1313
1414O<drill> sub
1515
16- O107 IF [#<_imperial>]
17- (MSG, IMPERIAL ON)
18- #1 = [#1 * 25.4]
19- #2 = [#2 * 3.28]
20- #3 = [#3 * 25.4]
21- #4 = [#4 * 25.4]
22- #6 = [#6 * 25.4]
23- #7 = [#7 * 25.4]
24- O107 ENDIF
25-
26- (MSG, Press Cycle Start To start Drilling Macro)
27- m0
16+ O100 IF [#<_imperial>]
17+ (MSG, IMPERIAL sizes)
18+ #<diam> = [#1 * 25.4]
19+ #<zDepth> = [#2 * 25.4]
20+ #<surfaceSpeed> = [#3 * 304.8] ; sf/m to mm/m
21+ #<fpr> = [#4 * 25.4]
22+ #<peck> = [#6 * 25.4]
23+ #<retract> = [#7 * 25.4]
24+ #10 = [[#3 *12] / [3.1415 * #1]] ; RPM from sfm request
25+
26+ (debug, Expected Drilling Diameter %d#1)
27+ (debug, Peck Increment %.2f#6)
28+ (debug, Start Z %f#<_z>)
29+ (debug, Finish Z %.2f#2)
30+ (debug, Feed %.3f#4 IPM)
31+ (debug, Tool %d#5)
32+ (debug, %d#3 SFM @ RPM %d#10)
33+ O100 ELSE
34+ (MSG, METRIC sizes)
35+ #<diam> = #1
36+ #<zDepth> = #2
37+ #<surfaceSpeed> = #3 ;mm/m
38+ #<fpr> = #4
39+ #<peck> = #6
40+ #<retract> = #7
41+ #10 = [#<surfaceSpeed> / [3.1415 * #<diam>]] ; RPM from mm/m request
42+
43+ (debug, Drilling dia #<diam> mm, peck dist #<peck> mm)
44+ (debug, startz #<_z> mm, depth #<zDepth> mm)
45+ (debug, feed #<fpr> mm/rpm, tool #5)
46+ (debug, Surface Speed #<surfaceSpeed> mm/m, rpm #10)
47+ O100 ENDIF
2848
2949M73 ; save state, restore on exit
3050
@@ -33,36 +53,30 @@ G17 ; XY Plane
3353G21 ; Metric Units don't change units!
3454G90 ; Absolute Distance
3555
36- #13 = #<_z> (starting Z)
56+ #<zStart> = #<_z> (starting Z)
3757
38- M6 T#5 G43
58+ (MSG, 100% %.4h Unpause To start Drilling Macro)
59+ m0
3960
40- O51 IF [#<_metric>]
41- #10 = [[1000 * #3] / [3.1415 * #1]] ; metric mode RPM
42- #11 = 2 ;retract plane
43- O51 ELSE
44- #10 = [[#3 * 12 / 3.1415] / #1] ; inch mode RPM
45- #11 = 0.05 ; retract plane
46- O51 ENDIF
61+ M6 T#5 G43
4762
4863G97 S#10 ; Constant RPM mode
4964M3 ;Start Spindle
50- G95 F#4 ; Feed-Per-Rev Mode
65+ G95 F#<fpr> ; Feed-Per-Rev Mode
5166
5267g4p1 ; Wait to reach speed
5368
54- (debug, Drilling dia #1 depth #2 startz #13 speed #3 feed/rpm #4 tool #5 peck dist #6 rpm #10)
55-
56- G0 X0 ; must drill from the centerline. Tool should be zeroed here
57- G00 Z #13
58- G98
59- G83 Z#2 R#13 Q#6
60- G80
69+ G0 X0 ; must drill from the centerline. Tool should be zeroed here
70+ G00 Z #<zStart>
71+ G98
72+ G83 Z#<zDepth> R#<zStart> Q#<peck>
73+ G80
6174
62- G0 Z #13
63- M5
64- G7
75+ G0 Z #<zStart>
76+ M5
77+ G7
6578
79+ (MSG,Done Drilling Macro)
6680O<drill> endsub
6781
6882M2
0 commit comments