def create_patterns(layer, island, settings, model): enough_space = True offsets_delta = -abs(settings.extrusionWidth + settings.offsetsDelta) if settings.offsetsNr: island.print_perimeters = True if settings.offsetsNr > 1: island.outer_infill = offset.execute(island.perimeters, offsets_delta, settings.offsetsNr - 1) if (len(island.outer_infill) + 1) < settings.offsetsNr: # there was not enough space for all offsets enough_space = False if settings.linesEnable and enough_space: # check if there is extra room inside the most inner offset to print lines # create offsets and check if all of them completed nr = max(settings.offsetsMinNrForLines, 1) space_offsets = offset.execute(island.inner_perimeter, offsets_delta, nr) if len(space_offsets) is nr: # enough space for line infill delta = settings.linesDelta + settings.extrusionWidth max_connection_dist = delta * settings.linesConnectionDistFactor if model.cache_lines is None: model.cache_lines = line.get_aabb_lines(model.aabb, delta) island.inner_infill = line.execute( delta, _get_lines_rotation(layer.seq_nr, settings), model.aabb.center, max_connection_dist, space_offsets[0], model.cache_lines)
def execute(delta, nr, aabb, initial_delta=0): initial_delta += delta * nr contour = to_ndarray([(aabb.min - initial_delta)[:2], [aabb.min[0] - initial_delta, aabb.max[1] + initial_delta], (aabb.max + initial_delta)[:2], [aabb.max[0] + initial_delta, aabb.min[1] - initial_delta]]) offsets = offset.execute([contour], -abs(delta), nr) return [o[0] for o in offsets]
def execute(delta, nr, aabb, initial_delta=0): initial_delta += delta * nr contour = to_ndarray([ (aabb.min - initial_delta)[:2], [aabb.min[0] - initial_delta, aabb.max[1] + initial_delta], (aabb.max + initial_delta)[:2], [aabb.max[0] + initial_delta, aabb.min[1] - initial_delta] ]) offsets = offset.execute([contour], -abs(delta), nr) return [o[0] for o in offsets]
def fill_layer(layer, contours, settings, model): for island_contours in pcu.define_islands(contours): # get shrinked contours for the island offsets = offset.execute(island_contours, -abs(settings.extrusionWidth / 2)) if offsets: for island_perimeters in pcu.define_islands(offsets[0]): island = Island(perimeters=island_perimeters) layer.islands.append(island) create_patterns(layer, island, settings, model) create_skirts(layer, settings, model)