// --- Toggle which part to render --- render_part = "full"; // --- Parameters --- columns = 14; rows = 5; u_size = 19.05; switch_outer_width = 14.2; switch_inner_width = 13.2; switch_total_height = 14.2; notch_height = 4.0; plate_thickness = 1.5; margin = 5.0; // --- Calculated Plate Dimensions --- plate_width = (columns - 1) * u_size + switch_outer_width + (margin * 2); plate_height = (rows - 1) * u_size + switch_total_height + (margin * 2); split_point = plate_width / 2; // --- Modules --- module switch_cutout() { union() { cube([switch_inner_width, switch_total_height, plate_thickness + 2], center=true); translate([0, (switch_total_height - (switch_total_height-notch_height)/2)/2, 0]) cube([switch_outer_width, (switch_total_height-notch_height)/2, plate_thickness + 2], center=true); translate([0, -(switch_total_height - (switch_total_height-notch_height)/2)/2, 0]) cube([switch_outer_width, (switch_total_height-notch_height)/2, plate_thickness + 2], center=true); } } module stabilizer_cutout(wire_len_u) { dist = (wire_len_u == 6.25) ? 100 : 23.85; union() { switch_cutout(); for(m = [-1, 1]) { translate([m * dist/2, 0, 0]) { cube([3.3, 14.0, plate_thickness + 2], center=true); translate([m * 0.5, 0, 0]) cube([4.3, 8.0, plate_thickness + 2], center=true); } } } } module whole_plate() { difference() { cube([plate_width, plate_height, plate_thickness]); translate([margin + switch_outer_width/2, margin + switch_total_height/2, plate_thickness/2]) { for (r = [0 : rows - 1]) { for (c = [0 : columns - 1]) { translate([c * u_size, r * u_size, 0]) { // --- ROW 0: BOTTOM ROW --- if (r == 0) { if (c < 3) { switch_cutout(); } else if (c == 3) { translate([u_size * 3, 0, 0]) stabilizer_cutout(6.25); } else if (c >= 10) { switch_cutout(); } } // --- ROW 2: THIRD ROW (ENTER) --- else if (r == 2) { if (c < 12) { switch_cutout(); } else if (c == 12) { translate([u_size * 0.5, 0, 0]) stabilizer_cutout(2); } } // --- ALL OTHER ROWS --- else { switch_cutout(); } } } } } } } // --- Render --- if (render_part == "left") { intersection() { whole_plate(); cube([split_point, plate_height, plate_thickness + 2]); } } else if (render_part == "right") { translate([-split_point, 0, 0]) intersection() { whole_plate(); translate([split_point, 0, -1]) cube([split_point, plate_height, plate_thickness + 2]); } } else { whole_plate(); }