include <../config/connector.scad> include <../config/plate.scad> include function connector_holes_pattern() = [ [connector_mount_width / 2, connector_mount_height / 2], [connector_mount_width / 2, -connector_mount_height / 2], [0, connector_mount_height / 2], [0, -connector_mount_height / 2], [-connector_mount_width / 2, connector_mount_height / 2], [-connector_mount_width / 2, -connector_mount_height / 2], ]; module connector_object() { depth = connector_depth; height = connector_height; rounding = connector_rounding; thickness = connector_thickness; rods = connector_rods; hole = connector_hole; screwdriver_hole = connector_screwdriver_hole; module cross_shape(scaled = false, cut = true) { module corner(x = 0, y = 0) { translate([x, y]) { circle(r = rounding); } } move_x = depth / 2 - rounding; move_y = height / 2 - rounding; if (!scaled) { difference() { hull() { corner(move_x, move_y); corner(-move_x, move_y); corner(-move_x, -move_y); } if (cut) { cross_shape(scaled = true); } } } else { scaled_x = (move_x - rods) / move_x; scaled_y = (move_y - rods) / move_y; scale([scaled_x, scaled_y]) { x_change = move_x - move_x * scaled_x; y_change = move_y - move_y * scaled_y; translate([-x_change / 2, y_change / 2]) cross_shape(scaled = false, cut = false); } } } module base_object() { rotate([90, 0, 0]) { linear_extrude(height = thickness, center = true) { cross_shape(); } } } module top_holes(size = height) { for (count = connector_holes_pattern()) { translate([count.x, count.y, 0]) { cylinder(h = size, r = hole / 2, center = true); translate([0, 0, -rods]) { cylinder( h = size, r = screwdriver_hole / 2, center = true ); } } } } module side_holes() { rotate([0, 90, 180]) { top_holes(size = depth); } } module final_object() { difference() { base_object(); top_holes(); side_holes(); } } color("#222222") { render() { final_object(); } } }