include include <../config/connector.scad> function connector_size() = [ ]; module connector_shape() { hole = connector_hole; holes = connector_holes; width = connector_width; rounding = connector_rounding; holes_space = width / (holes.x + 1); height = holes_space * (holes.y + 1); module single_side() { module holes() { for (count_x = [-width / 2 : holes_space : width / 2]) { for (count_y = [-height / 2 : holes_space : height / 2]) { side_x = abs(count_x) == width / 2; side_y = abs(count_y) == height / 2; if (!side_x && !side_y) { translate([count_x, count_y]) { circle(d = hole); } } } } } module base() { hull() { for (count = square_corners(width, height, rounding)) { corner(count, rounding, count.y < 0); } } } difference() { base(); holes(); } } module center_side() { hull() { for (count = square_corners(width, width, rounding)) { corner(count, rounding, count.y > 0 || count.x < 0); } } } module rotated(count) { rotate(count) { translate([0, height / 2 + width / 2]) { single_side(); } } } move_x = -width / 2; move_y = width / 2; translate([move_x, move_y]) { render() { rotated(0); rotated(90); center_side(); } } } module connector_object() { color("#FAAFCB") { linear_extrude(height = connector_thickness, center = true) { connector_shape(); } } }