From 752c8046773ef326434f63ea7c9f3392fd0a8425 Mon Sep 17 00:00:00 2001 From: Wurstnase Date: Mon, 16 Mar 2015 15:13:16 +0100 Subject: [PATCH] remove offset, add minimum scan area --- Marlin/scripts/g29_auto.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/Marlin/scripts/g29_auto.py b/Marlin/scripts/g29_auto.py index c28352b29..884e62b2a 100644 --- a/Marlin/scripts/g29_auto.py +++ b/Marlin/scripts/g29_auto.py @@ -14,7 +14,7 @@ min_g1 = 3 # maximum number of lines to parse, I don't want to parse the complete file # only the first plane is we are interested in -max_g1 = 1000 +max_g1 = 100000000 # g29 keyword g29_keyword = 'g29' @@ -25,9 +25,8 @@ output_file = folder + 'g29_' + my_file # input filename input_file = folder + my_file -# offset makes the plane a little bit bigger -offset_x = 10 -offset_y = 10 +# minimum scan size +min_size = 40 probing_points = 3 # points x points # other stuff @@ -152,10 +151,18 @@ for i in range(start, end): print('x_min:{} x_max:{}\ny_min:{} y_max:{}'.format(min_x, max_x, min_y, max_y)) -min_x = int(min_x) - offset_x -max_x = int(max_x) + offset_x -min_y = int(min_y) - offset_y -max_y = int(max_y) + offset_y +# resize min/max - values for minimum scan +if max_x - min_x < min_size: + offset_x = int((min_size - (max_x - min_x)) / 2 + 0.5) # int round up + # print('min_x! with {}'.format(int(max_x - min_x))) + min_x = int(min_x) - offset_x + max_x = int(max_x) + offset_x +if max_y - min_y < min_size: + offset_y = int((min_size - (max_y - min_y)) / 2 + 0.5) # int round up + # print('min_y! with {}'.format(int(max_y - min_y))) + min_y = int(min_y) - offset_y + max_y = int(max_y) + offset_y + new_command = 'G29 L{0} R{1} F{2} B{3} P{4}\n'.format(min_x, max_x,