summaryrefslogtreecommitdiffstats
path: root/gcode/biquad.ngc
blob: 5bffc0ab04717d3ce2975b62bcbd53a8744d7ade (plain)
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
%
( *************************************************************************** )
( * Biquad tool                                                             * )
( * Metrical RS274/NGC program                                              * )
( * Copyright 2009 Michael Buesch <mb@bu3sch.de>                            * )
( * Licensed under the GNU/GPL version 3                                    * )
( *************************************************************************** )

#100 = 3.0		( Cutter radius; must be 3 +-0.1 )
#101 = 4000		( Roughing speed in min^-1 )
#102 = 4000		( Finecut speed in min^-1 )
#103 = 350		( Roughing feed in mm/min )
#104 = 350		( Finecut feed in mm/min )
#105 = -5		( Z depth )
#106 = 1		( Z stepping while roughing )
#107 = 0.1		( X/Y stepping in finecut )
#108 = 0.05		( Roughing G64 tolerance )
#109 = 0.01		( Finecut G64 tolerance )

G17 G40 G49 G80 G90 G94 G61 G21


O3 sub ( Square subroutine. #1=X-offset, #2=Y-offset, #3=G42.1-offset )
	G0 X[-20 + #1] Y[-25 + #2]
	G42.1 D[[#100 + #3] * 2]
	G1 X[-24.388 + #1] Y[-23.433 + #2]
	G1 X[-1.909 + #1] Y[-0.955 + #2]
	G3 X[-1.909 + #1] Y[0.955 + #2] I-0.955 J0.955
	G1 X[-20.612 + #1] Y[19.658 + #2]
	G3 X[-22.521 + #1] Y[19.658 + #2] I-0.955 J-0.955
	G1 X[-41.224 + #1] Y[0.955 + #2]
	G3 X[-41.224 + #1] Y[-0.955 + #2] I0.955 J-0.955
	G1 X[-22.521 + #1] Y[-19.658 + #2]
	G3 X[-20.612 + #1] Y[-19.658 + #2] I0.955 J0.955
	G40 G1 X[-20 + #1] Y[-25 + #2]
O3 endsub

O1 sub ( Roughing subroutine )
	G64 P#108
	G0 X-51 Y-23 Z5 S#101 F#103

	M3
	#200 = 0
	O11 while [ 1 ]
		#200 = [#200 - #106]
		O12 if [#200 lt #105]
			#200 = #105
		O12 endif
		G0 Z#200

		( Outer frame )
		G1 X-24.5
		G1 Y-23.5
		G1 X-18.5
		G1 Y-23
		G1 X18.5
		G1 Y-23.5
		G1 X24.5
		G1 Y-23
		G1 X45.5
		G1 Y23
		G1 X24.5
		G1 Y23.5
		G1 X18.5
		G1 Y23
		G1 X-18.5
		G1 Y23.5
		G1 X-24.5
		G1 Y23
		G1 X-45.5
		G1 Y-23

		( Lower left )
		G0 X-37.988
		G1 X-45.5 Y-15.488
		G0 Y-8.417
		G1 X-30.917 Y-23
		G0 Y-25

		( Lower center )
		G0 X-12.217
		G0 Y-23
		G1 X0 Y-10.783
		G1 X12.217 Y-23
		G0 X5.146
		G1 X0 Y-17.854
		G1 X-5.146 Y-23
		G0 Y-25 X12

		( Lower right )
		G0 X30.917
		G0 Y-23
		G1 X45.5 Y-8.417
		G0 Y-15.488
		G1 X37.988 Y-23
		G0 X45.5 Y-15.488

		( Upper right )
		G0 Y8.417
		G1 X30.917 Y23
		G0 X37.988
		G1 X45.5 Y15.488
		G0 X31 Y25

		( Upper center )
		G0 X12.217
		G0 Y23
		G1 X0 Y10.783
		G1 X-12.217 Y23
		G0 X-5.146
		G1 X0 Y17.854
		G1 X5.146 Y23
		G0 X-12 Y25

		( Upper left )
		G0 X-30.917
		G0 Y23
		G1 X-45.5 Y8.417
		G0 Y15.488
		G1 X-37.988 Y23

		G0 X-45.5 Y15.488
		G0 Y-8.417
		G0 X-30.917 Y-23
		G0 X-20 Y-25

		( Left square roughing )
		O3 call [0] [0] [0.3]
		( Right square roughing )
		G0 X[-20 + 43.134] Y-25
		O3 call [43.134] [0] [0.3]

		O13 if [#200 eq #105]
			O11 break
		O13 endif
		G0 X-51 Y-25
		G0 Y-23
	O11 endwhile
O1 endsub

O2 sub ( Finecut subroutine )
	G64 P#109
	( FIXME do a run with Z raised by 0.3 )

	( Left square )
	G0 X-20 Y-25 Z#105 S#102 F#104
	M3
	#200 = 0.30
	O21 while [ 1 ]
		#200 = [#200 - #107]
		O22 if [#200 lt 0]
			#200 = 0
		O22 endif

		O3 call [0] [0] [#200]

		O23 if [#200 eq 0]
			O21 break
		O23 endif
	O21 endwhile

	( Right square )
	G0 X[-20 + 43.134] Y-25 Z#105 S#102 F#104
	#200 = 0.30
	O25 while [ 1 ]
		#200 = [#200 - #107]
		O26 if [#200 lt 0]
			#200 = 0
		O26 endif

		O3 call [43.134] [0] [#200]

		O27 if [#200 eq 0]
			O25 break
		O27 endif
	O25 endwhile
O2 endsub


T1 M6
G54 G0 X0 Y0 Z5 S#2

O1 call ( Call roughing )
O2 call ( Call finecut )

G0 Z5 M5
M30

%
vim: syntax=rs274ngc ts=4
bues.ch cgit interface