|
@@ -14,7 +14,7 @@ min_g1 = 3
|
14
|
14
|
|
15
|
15
|
# maximum number of lines to parse, I don't want to parse the complete file
|
16
|
16
|
# only the first plane is we are interested in
|
17
|
|
-max_g1 = 1000
|
|
17
|
+max_g1 = 100000000
|
18
|
18
|
|
19
|
19
|
# g29 keyword
|
20
|
20
|
g29_keyword = 'g29'
|
|
@@ -25,9 +25,8 @@ output_file = folder + 'g29_' + my_file
|
25
|
25
|
# input filename
|
26
|
26
|
input_file = folder + my_file
|
27
|
27
|
|
28
|
|
-# offset makes the plane a little bit bigger
|
29
|
|
-offset_x = 10
|
30
|
|
-offset_y = 10
|
|
28
|
+# minimum scan size
|
|
29
|
+min_size = 40
|
31
|
30
|
probing_points = 3 # points x points
|
32
|
31
|
|
33
|
32
|
# other stuff
|
|
@@ -152,10 +151,18 @@ for i in range(start, end):
|
152
|
151
|
|
153
|
152
|
print('x_min:{} x_max:{}\ny_min:{} y_max:{}'.format(min_x, max_x, min_y, max_y))
|
154
|
153
|
|
155
|
|
-min_x = int(min_x) - offset_x
|
156
|
|
-max_x = int(max_x) + offset_x
|
157
|
|
-min_y = int(min_y) - offset_y
|
158
|
|
-max_y = int(max_y) + offset_y
|
|
154
|
+# resize min/max - values for minimum scan
|
|
155
|
+if max_x - min_x < min_size:
|
|
156
|
+ offset_x = int((min_size - (max_x - min_x)) / 2 + 0.5) # int round up
|
|
157
|
+ # print('min_x! with {}'.format(int(max_x - min_x)))
|
|
158
|
+ min_x = int(min_x) - offset_x
|
|
159
|
+ max_x = int(max_x) + offset_x
|
|
160
|
+if max_y - min_y < min_size:
|
|
161
|
+ offset_y = int((min_size - (max_y - min_y)) / 2 + 0.5) # int round up
|
|
162
|
+ # print('min_y! with {}'.format(int(max_y - min_y)))
|
|
163
|
+ min_y = int(min_y) - offset_y
|
|
164
|
+ max_y = int(max_y) + offset_y
|
|
165
|
+
|
159
|
166
|
|
160
|
167
|
new_command = 'G29 L{0} R{1} F{2} B{3} P{4}\n'.format(min_x,
|
161
|
168
|
max_x,
|