include <../config/connector.scad> module connector_shape() { rounding = connector_depth / 2; move = connector_width - rounding * 2; width = connector_width; module base_shape(split = false) { if (!split) { hull() { circle(r = rounding); translate([move, 0]) { circle(r = rounding); } } } else { translate([-move, 0]) { base_shape(split = false); } } } module holes(split = false) { if (!split) { space_y = rounding * 2 / (connector_holes_in_y + 1); space_x = move / (connector_holes_in_x - 1); for (count_y = [-rounding : space_y : rounding]) { if (count_y != rounding && count_y != -rounding) { for (count_x = [0 : space_x : move]) { translate([count_x, count_y]) { circle(r = connector_hole / 2); } } } } } else { translate([-move, 0]) { holes(split = false); } } } module final_shape(split = false) { difference() { base_shape(split); holes(split); } } module final_solid() { render() { hull() { base_shape(split = false); if (connector_dual) { base_shape(split = true); } rotate(180 - connector_angle) { final_shape(split = true); } } } } module final_holes() { holes(split = false); rotate(180 - connector_angle) { holes(split = true); } } render() { difference() { final_solid(); final_holes(); } } } module connector_object() { color("#FAAFCB") { linear_extrude(height = connector_thickness, center = true) { connector_shape(); } } }