Newer
Older
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
94
95
96
;threading
o<threading> sub
o<backup_status> call
o<clear-axis-notif> call
#<X_coord> = #1
#<feed_rpm> = #2
#<tool_number> = #3
#<pitch> = #4
#<Z_coord> = #5
#<interior> = #6
#<exterior> = #7
#<coolant> = #8
O100 if [#<tool_number> NE #<_current_tool>]
(MSG,ERROR : Set tool before use macro)
O100 return [-2] ; indicate failure to epilog
O100 endif
G8 ; Lathe radius Mode
G18 ; XZ Plane
G90 ; Absolute Distance
#<X_coord> = [#<X_coord> / 2.0]
#<starting_X> = [#<_x> * 2] (starting X)
#<starting_Z> = #<_z> (starting Z)
G96 D1500 S#<feed_rpm> ; Constant Surface Speed Mode
M4 ; Start Spindle
G4 P2 ; Wait to reach speed
O110 if [#<coolant>]
M8
O110 endif
#<height> = [0.86603 * #<pitch>]
#<majorflat> = [#<height> * 0.125]
#<minorflat> = [#<height> * 0.250]
#<threaddepth> = [#<height> * 0.625]
;(DEBUG,#<height> #<majorflat> #<minorflat> #<threaddepth>)
O200 if [#<_metric>]
#<cutdepth> = 0.2
#<flatfeed> = 0.1
O200 else
#<cutdepth> = 0.007
#<flatfeed> = 0.004
O200 endif
;(DEBUG,test)
G95 F#<flatfeed> ; Feed-Per-Rev Mode
;(DEBUG,Test2)
;Threading
;(DEBUG,Test3)
O300 if [#<interior> GT 0.5] ;internal
;(DEBUG,interior)
;cut the minor flat diameter
;(DEBUG,INTERNAL Threading thread dia-#<X_coord> startZ-#<starting_Z> finishZ-#<Z_coord> Pitch-#<pitch> Tool-#<tool_number>)
G0 Z #<starting_Z>
G0 X [#<X_coord> + #<minorflat> - #<height>]
G1 Z #<Z_coord>
G0 X [#<X_coord> - #<height>]
G0 Z #<starting_Z>
G96 D600 S#<feed_rpm> ; limit RPM in threading mode
G76 P#<pitch> Z#<Z_coord> i#<minorflat> j#<cutdepth> k#<threaddepth> H3 R1.5 Q29.5 E0 L0
G0 X [#<X_coord> - 0.5]
O300 else ;external
;(DEBUG,Test2)
;(DEBUG,TEST)
; cut the major diameter
(DEBUG,EXTERNAL Threading thread dia-#<X_coord> startZ-#<starting_Z> finishZ-#<Z_coord> Pitch-#<pitch> Tool-#<tool_number> MF #<majorflat>)
G0 Z #<starting_Z>
G0 X #<X_coord>
G1 X [#<X_coord> - #<majorflat>]
G1 Z #<Z_coord>
G0 X #<X_coord>
G0 Z #<starting_Z>
G96 D600 S#<feed_rpm> ; limit RPM in threading mode
G4 p2
G76 P#<pitch> Z#<Z_coord> i[-#<majorflat>] j#<cutdepth> k#<threaddepth> H3 R1.5 Q29.5 E0 L0
G0 X [#<X_coord> + 0.5]
O300 endif
;(DEBUG,Test4)
G0 Z#<starting_Z>
M5
M9
o<backup_restore> call ; restore g20/21, g90/g91, feedrate cuter-comp and other using now global _backup_var
o<threading> endsub
M2
%