Newer
Older
;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)
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]
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
;(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> +1]
;G1 X [#<X_coord> - #<majorflat>]
;G1 Z #<Z_coord>
;G0 X #<X_coord>
;G96 D1000 S#<feed_rpm> ; limit RPM in threading mode
G97 S1000
G76 P#<pitch> Z#<Z_coord> i-1 j#<cutdepth> k#<threaddepth> H2 R1.5 Q29.5 E0 L0