def _process_one_grid_line((positions, minz, maxz, model, cutter, physics)): """ This function assumes, that the positions are next to each other. Otherwise the dynamic over-sampling (in get_max_height_dynamic) is pointless. """ return get_max_height_dynamic(model, cutter, positions, minz, maxz, physics)
def GenerateToolPathLineDrop(self, pa, line, minz, maxz, horiz_step, previous_z, draw_callback=None): if line.minz >= previous_z: # the line is not below maxz -> nothing to be done return pa.new_direction(0) pa.new_scanline() if not self.combined_model: # no obstacle -> minimum height # TODO: this "max(..)" is not correct for inclined lines points = [ Point(line.p1.x, line.p1.y, max(minz, line.p1.z)), Point(line.p2.x, line.p2.y, max(minz, line.p2.z)), ] else: # TODO: this "max(..)" is not correct for inclined lines. p1 = Point(line.p1.x, line.p1.y, max(minz, line.p1.z)) p2 = Point(line.p2.x, line.p2.y, max(minz, line.p2.z)) distance = line.len # we want to have at least five steps each num_of_steps = max(5, 1 + ceil(distance / horiz_step)) # steps may be negative x_step = (p2.x - p1.x) / (num_of_steps - 1) y_step = (p2.y - p1.y) / (num_of_steps - 1) x_steps = [(p1.x + i * x_step) for i in range(num_of_steps)] y_steps = [(p1.y + i * y_step) for i in range(num_of_steps)] step_coords = zip(x_steps, y_steps) # TODO: this "min(..)" is not correct for inclided lines. This # should be fixed in "get_max_height". points = get_max_height_dynamic( self.combined_model, self.cutter, step_coords, min(p1.z, p2.z), maxz, self.physics ) for point in points: if point is None: # exceeded maxz - the cutter has to skip this point pa.end_scanline() pa.new_scanline() continue pa.append(point) if draw_callback and points: draw_callback(tool_position=points[-1], toolpath=pa.paths) pa.end_scanline() pa.end_direction()
def GenerateToolPathLineDrop(self, pa, line, minz, maxz, horiz_step, previous_z, draw_callback=None): if line.minz >= previous_z: # the line is not below maxz -> nothing to be done return pa.new_direction(0) pa.new_scanline() if not self.combined_model: # no obstacle -> minimum height # TODO: this "max(..)" is not correct for inclined lines points = [Point(line.p1.x, line.p1.y, max(minz, line.p1.z)), Point(line.p2.x, line.p2.y, max(minz, line.p2.z))] else: # TODO: this "max(..)" is not correct for inclined lines. p1 = Point(line.p1.x, line.p1.y, max(minz, line.p1.z)) p2 = Point(line.p2.x, line.p2.y, max(minz, line.p2.z)) distance = line.len # we want to have at least five steps each num_of_steps = max(5, 1 + ceil(distance / horiz_step)) # steps may be negative x_step = (p2.x - p1.x) / (num_of_steps - 1) y_step = (p2.y - p1.y) / (num_of_steps - 1) x_steps = [(p1.x + i * x_step) for i in range(num_of_steps)] y_steps = [(p1.y + i * y_step) for i in range(num_of_steps)] step_coords = zip(x_steps, y_steps) # TODO: this "min(..)" is not correct for inclided lines. This # should be fixed in "get_max_height". points = get_max_height_dynamic(self.combined_model, self.cutter, step_coords, min(p1.z, p2.z), maxz, self.physics) for point in points: if point is None: # exceeded maxz - the cutter has to skip this point pa.end_scanline() pa.new_scanline() continue pa.append(point) if draw_callback and points: draw_callback(tool_position=points[-1], toolpath=pa.paths) pa.end_scanline() pa.end_direction()