From 448ee99a44bb0baaf889a80ab3beb16cb75999c8 Mon Sep 17 00:00:00 2001 From: Sam Hadow Date: Tue, 24 Mar 2026 18:51:06 +0100 Subject: [PATCH] backplate --- backplate.scad | 127 +++++++++++++++++++++---------------- backplate_ortholinear.scad | 100 +++++++++++++++++++++++++++++ 2 files changed, 171 insertions(+), 56 deletions(-) create mode 100644 backplate_ortholinear.scad diff --git a/backplate.scad b/backplate.scad index 28d4e91..2bfa11a 100644 --- a/backplate.scad +++ b/backplate.scad @@ -1,29 +1,53 @@ -// --- Toggle which part to render --- -render_part = "full"; +render_part = "full"; // "full", "left", or "right" -// --- Parameters --- -columns = 14; -rows = 5; +// Parameters: u_size = 19.05; +plate_thickness = 1.5; +margin = 5.0; +// Switches and stabilizers 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; - -// Stabilizer stab_w = 6.9; -stab_h = 11.2; +stab_h = 13.5; -// --- 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; +// ANSI 60% Layout +layout = [ + [[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[2,1,2]], + [[1.5,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1.5,0,0]], + [[1.75,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[2.25,1,2]], + [[2.25,1,2],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,0,0],[2.75,1,2]], + [[1.25,0,0],[1.25,0,0],[1.25,0,0],[6.25,1,6.25],[1.25,0,0],[1.25,0,0],[1.25,0,0],[1.25,0,0]] +]; + +plate_width = (15 * u_size) + (margin * 2); +plate_height = (5 * u_size) + (margin * 2); + + +module split_mask() { + x1 = 7.0; // Top row + x2 = 7.5; // Row 2 + x3 = 7.75; // Row 3 + x4 = 6.25; // Row 4 down to bottom + + linear_extrude(height = plate_thickness + 5, center = true) { + polygon(points = [ + [0, plate_height + 1], + [margin + x1 * u_size, plate_height + 1], + [margin + x1 * u_size, margin + 4 * u_size], + [margin + x2 * u_size, margin + 4 * u_size], + [margin + x2 * u_size, margin + 3 * u_size], + [margin + x3 * u_size, margin + 3 * u_size], + [margin + x3 * u_size, margin + 2 * u_size], + [margin + x4 * u_size, margin + 2 * u_size], + [margin + x4 * u_size, -1], + [0, -1] + ]); + } +} -// --- Modules --- module switch_cutout() { union() { cube([switch_inner_width, switch_total_height, plate_thickness + 2], center=true); @@ -35,66 +59,57 @@ module switch_cutout() { } module stabilizer_cutout(wire_len_u) { - dist = (wire_len_u == 6.25) ? 100 : 23.85; + dist = (wire_len_u >= 6) ? 100 : 23.85; union() { switch_cutout(); for(m = [-1, 1]) { translate([m * dist/2, 0, 0]) - cube([stab_w, stab_h, plate_thickness + 2], center=true); + cube([stab_w, stab_h, plate_thickness + 2], center=true); } } } +module generate_row_cutouts(row_list, current_x_u, y_pos, index = 0) { + if (index < len(row_list)) { + key = row_list[index]; + w = key[0]; + has_stab = key[1]; + stab_size = key[2]; + center_x = (current_x_u * u_size) + (w * u_size / 2); + translate([center_x, y_pos, 0]) { + if (has_stab == 1) stabilizer_cutout(stab_size); + else switch_cutout(); + } + generate_row_cutouts(row_list, current_x_u + w, y_pos, index + 1); + } +} + 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(); - } - } + translate([margin, margin, plate_thickness/2]) { + for (r = [0 : len(layout) - 1]) { + let (row_data = layout[r], y_pos = (len(layout) - 1 - r) * u_size + (u_size/2)) { + generate_row_cutouts(row_data, 0, y_pos); } } } } } -// --- Render --- +// 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() { + intersection() { whole_plate(); - translate([split_point, 0, -1]) cube([split_point, plate_height, plate_thickness + 2]); + translate([0,0,plate_thickness/2]) split_mask(); + } +} else if (render_part == "right") { + translate([-(margin + 4 * u_size), 0, 0]) + difference() { + whole_plate(); + translate([0,0,plate_thickness/2]) split_mask(); } } else { whole_plate(); + %translate([0,0,plate_thickness/2]) split_mask(); } \ No newline at end of file diff --git a/backplate_ortholinear.scad b/backplate_ortholinear.scad new file mode 100644 index 0000000..28d4e91 --- /dev/null +++ b/backplate_ortholinear.scad @@ -0,0 +1,100 @@ +// --- 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; + +// Stabilizer +stab_w = 6.9; +stab_h = 11.2; + +// --- 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([stab_w, stab_h, 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(); +} \ No newline at end of file