1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
; MACROCOMMAND=Face Diameter,SFM,DOC,FPR,Z Length,Angle,Tool Number, Max RPM
; MACRODEFAULTS=1,500,.02,.007,-2,0,1,1500
; MACROSVG=LatheMacro.svg,2,10
; O<facing>call [${face.x-f}] [${face.sf-f}] [${face.cut-f}] [${face.feed-f}] [${face.z-f}] [${face.angle-s}] [${face.tool-s}]
; #1 face diameter
; #2 surface speed
; #3 DOC
; #4 feed/rpm
; #5 Face Z length
; #6 face angle
; #7 tool numbber
; #8 max RPM
;Facing
O<facing> sub
O10 IF [#6 NE 0]
(MSG, Angled facing isn't supported yet)
M2
O10 ENDIF
O107 IF [#<_imperial>]
(MSG, IMPERIAL ON)
#1 = [#1 * 25.4]
#2 = [#2 * 304.8] ; sf/m to mm/m
#3 = [#3 * 25.4]
#4 = [#4 * 25.4]
#5 = [#5 * 25.4]
O107 ENDIF
M73
G7 ; Lathe Diameter Mode
G18 ; XZ Plane
G21 ; Metric Units
G90 ; Absolute Distance
#14 = [#<_x> * 2] (starting X)
#13 = #<_z> (starting Z)
(debug, Facing start X #14 mm, Start Z #13 mm)
(debug, Finish Z #5 mm)
(MSG, Unpause To start Facing Macro)
m0
M6 T#7 G43
G96 D#8 S#2 ; Constant Surface Speed Mode
M3
g95 F#4 ; Feed-Per-Rev Mode
g4p1 ; Wait to reach speed
O200 WHILE [#13 GT #5 + #3]
#13=[#13-#3]
G1 Z#13
G1 X#1
G0 Z[#13+#3]
G0 X#14
G0 Z#13
O200 ENDWHILE
G1 Z#5
G1 X#1
G0 Z[#13+#3]
G0 X[#14+#3]
G0 Z#5 ; For touch-off
M5
O<facing> endsub
M2
|