include <../config/pattern.scad> module pattern(width, height) { module single() { move_x = pattern_size_x / 2 - pattern_width / 2; move_y = pattern_size_y / 2 - pattern_width / 2; hull() { translate([-move_x, move_y]) { circle(d = pattern_width); } translate([move_x, -move_y]) { circle(d = pattern_width); } } } move_x = pattern_size_x + pattern_space_x; move_y = pattern_size_y + pattern_space_y; abs_width = width - (width % move_x); abs_height = height - (height % move_y); corner_x = abs_width / 2 - move_x / 2; corner_y = abs_height / 2 - move_y / 2; for (count_x = [-corner_x : move_x : corner_x]) { for (count_y = [-corner_y : move_y : corner_y]) { translate([count_x, count_y]) { single(); } } } }