remove offset, add minimum scan area
This commit is contained in:
		@@ -14,7 +14,7 @@ min_g1 = 3
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# maximum number of lines to parse, I don't want to parse the complete file
 | 
					# maximum number of lines to parse, I don't want to parse the complete file
 | 
				
			||||||
# only the first plane is we are interested in
 | 
					# only the first plane is we are interested in
 | 
				
			||||||
max_g1 = 1000
 | 
					max_g1 = 100000000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# g29 keyword
 | 
					# g29 keyword
 | 
				
			||||||
g29_keyword = 'g29'
 | 
					g29_keyword = 'g29'
 | 
				
			||||||
@@ -25,9 +25,8 @@ output_file = folder + 'g29_' + my_file
 | 
				
			|||||||
# input filename
 | 
					# input filename
 | 
				
			||||||
input_file = folder + my_file
 | 
					input_file = folder + my_file
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# offset makes the plane a little bit bigger
 | 
					# minimum scan size
 | 
				
			||||||
offset_x = 10
 | 
					min_size = 40
 | 
				
			||||||
offset_y = 10
 | 
					 | 
				
			||||||
probing_points = 3  # points x points
 | 
					probing_points = 3  # points x points
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# other stuff
 | 
					# other stuff
 | 
				
			||||||
@@ -152,11 +151,19 @@ for i in range(start, end):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
print('x_min:{} x_max:{}\ny_min:{} y_max:{}'.format(min_x, max_x, min_y, max_y))
 | 
					print('x_min:{} x_max:{}\ny_min:{} y_max:{}'.format(min_x, max_x, min_y, max_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
 | 
					    min_x = int(min_x) - offset_x
 | 
				
			||||||
    max_x = int(max_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
 | 
					    min_y = int(min_y) - offset_y
 | 
				
			||||||
    max_y = int(max_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,
 | 
					new_command = 'G29 L{0} R{1} F{2} B{3} P{4}\n'.format(min_x,
 | 
				
			||||||
                                                      max_x,
 | 
					                                                      max_x,
 | 
				
			||||||
                                                      min_y,
 | 
					                                                      min_y,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user