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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
; MACROCOMMAND=Thread X, SFM, Tool Number, Pitch, Z, Internal, External
; MACRODEFAULTS=1,300,1,.015,1,False,true
; MACROSVG=LatheMacro.svg,5
; O<threading>call [${thread.x-f}] [${thread.sf-f}] [${thread.tool-s}] [${thread.pitch-f}] [${thread.z-f}] [${thread.internal}] [${thread.external}]
; #1=thread.x
; #2=thread.sf
; #3=thread.tool-s
; #4=thread.pitch-f
; #5=thread.z-f
; #6=thread.internal
; #7=thread.external
;threading
O<threading> sub
O107 IF [#<_imperial>]
(MSG, IMPERIAL ON)
#1 = [#1 * 25.4] ; start X
#2 = [#2 * 304.8] ; sf/m to mm/m
#4 = [#4 * 25.4] ; pitch
#5 = [#5 * 25.4] ; z finish
O107 ENDIF
G7 ; Lathe Diameter Mode
G18 ; XZ Plane
G21 ; Metric Units
G90 ; Absolute Distance
#14 = [#<_x> * 2] (starting X)
#13 = #<_z> (starting Z)
O50 IF [#6 GT 0.5]
(debug, INTERNAL Threading thread dia-#1)
(debug, start-#13)
(debug, finish-#5)
(debug, Pitch-#4)
(debug, Depth-#3)
O50 ELSE
#<OD> = [#1 - 0.108 * #4]
#<ID> = [#1 - 1.0825 * #4]
(debug, EXTERNAL Threading OD = #<OD> ID = #<ID>)
O50 ENDIF
(MSG, Unpause To start Threading Macro)
m0
M6 T#3 G43
G96 D200 S#2 ; Constant Surface Speed Mode
M3
g95 F0.1 ; Feed-Per-Rev Mode
g4p1 ; Wait to reach speed
;Threading
; Internal
O51 IF [#6 GT 0.5]
#<OD> = [#1]
#<ID> = [#1 - 1.3 * #4]
;g1X [#<ID> - 1] ;thread truncation
;g0 Z #13
;g1 X #<ID>
;g1 Z #5
G0 X[#<ID> - 1]
g0 Z #13
#3 = [#4 * 1.3]
g1X [#<ID> - 1]
g76 p#4 z#5 i1 j0.2 k#3 h3 r1.5 q29.5 e0 l0
; External
O51 ELSE
#<OD> = [#1 - 0.108 * #4]
#<ID> = [#1 - 1.0825 * #4]
; EXTERNAL Threading OD = #<OD> ID = #<ID>)
#3 = [#4 * 1.0825]
g1X [#<OD> + 1] ;final thread truncation
g0 z#13
g1 X #<OD>
g1 Z #5
G0 X[#<OD> +1]
G0 Z #13
g76 p#4 z#5 i-1 j0.2 k#3 h3 r1.5 q29.5 e0 l0
O51 ENDIF
G0 Z #13
m5
O<threading> endsub
M2
|