-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathturning.ngc
66 lines (57 loc) · 1.16 KB
/
turning.ngc
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
;Turning
O<turning> sub
G8 ; Radius mode (easier maths)
G18 ; XZ Plane
G21 ; Metric Units
G90 ; Absolute Distance
G91.1 ; but not for arcs
M6 T#8 G43
#1 = [#1 / 2] ; because of radius mode
#14 = [#<_x>] (starting X)
#13 = #<_z> (starting Z)
#20 = [#6 * SIN[#7]]
#21 = [#6 * COS[#7]]
#22 = [#6 / COS[#7]]
#23 = [#5 + #6 - #20]
#24 = [[#13 - #23] * TAN[#7]]
G96 D2500 S#2 ; Constant Surface Speed Mode
m3 ;Start Spindle
g95 F#4 ; Feed-Per-Rev Mode
O90 IF [#9 GT 0.5]
M8
O90 ENDIF
g4p1 ; Wait to reach speed
O100 WHILE [#14 GT [#1 + #3 / 2]]
g0 X #14
#14=[#14-#3 / 2]
G1 X #14
G1 Z #23 X[#14 + #24]
O101 IF [#6 GT 0]
G2 Z#5 X[#14 + #24 + #21] I#21 K#20
G1 X[#14 + #24 + #21 + #3/2]
O101 ELSE
G1 X[#14 + #24 + [#3 * .6]]
O101 ENDIF
O104 IF [#7 LT 0]
G0 X#14
O104 ENDIF
G0 Z[#13]
O100 ENDWHILE
G0 x#1
G1 Z #23 X[#1 + #24]
O102 IF [#6 GT 0]
G2 Z#5 X[#1 + #24 + #21] I#21 K#20
G1 X[#1 + #24 + #21 + #3]
O102 ELSE
G1 X[#1 + #24 + #3]
O102 ENDIF
O106 IF [#7 LT 0]
G0 X#14
O106 ENDIF
M9
G0 Z #13
G0 X #1 ; For touch-off
M5
G7
O<turning> endsub
M2