backplate
This commit is contained in:
+71
-56
@@ -1,29 +1,53 @@
|
|||||||
// --- Toggle which part to render ---
|
render_part = "full"; // "full", "left", or "right"
|
||||||
render_part = "full";
|
|
||||||
|
|
||||||
// --- Parameters ---
|
// Parameters:
|
||||||
columns = 14;
|
|
||||||
rows = 5;
|
|
||||||
u_size = 19.05;
|
u_size = 19.05;
|
||||||
|
plate_thickness = 1.5;
|
||||||
|
margin = 5.0;
|
||||||
|
|
||||||
|
// Switches and stabilizers
|
||||||
switch_outer_width = 14.2;
|
switch_outer_width = 14.2;
|
||||||
switch_inner_width = 13.2;
|
switch_inner_width = 13.2;
|
||||||
switch_total_height = 14.2;
|
switch_total_height = 14.2;
|
||||||
notch_height = 4.0;
|
notch_height = 4.0;
|
||||||
|
|
||||||
plate_thickness = 1.5;
|
|
||||||
margin = 5.0;
|
|
||||||
|
|
||||||
// Stabilizer
|
|
||||||
stab_w = 6.9;
|
stab_w = 6.9;
|
||||||
stab_h = 11.2;
|
stab_h = 13.5;
|
||||||
|
|
||||||
// --- Calculated Plate Dimensions ---
|
// ANSI 60% Layout
|
||||||
plate_width = (columns - 1) * u_size + switch_outer_width + (margin * 2);
|
layout = [
|
||||||
plate_height = (rows - 1) * u_size + switch_total_height + (margin * 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],[1,0,0],[1,0,0],[1,0,0],[2,1,2]],
|
||||||
split_point = plate_width / 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() {
|
module switch_cutout() {
|
||||||
union() {
|
union() {
|
||||||
cube([switch_inner_width, switch_total_height, plate_thickness + 2], center=true);
|
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) {
|
module stabilizer_cutout(wire_len_u) {
|
||||||
dist = (wire_len_u == 6.25) ? 100 : 23.85;
|
dist = (wire_len_u >= 6) ? 100 : 23.85;
|
||||||
union() {
|
union() {
|
||||||
switch_cutout();
|
switch_cutout();
|
||||||
for(m = [-1, 1]) {
|
for(m = [-1, 1]) {
|
||||||
translate([m * dist/2, 0, 0])
|
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() {
|
module whole_plate() {
|
||||||
difference() {
|
difference() {
|
||||||
cube([plate_width, plate_height, plate_thickness]);
|
cube([plate_width, plate_height, plate_thickness]);
|
||||||
|
translate([margin, margin, plate_thickness/2]) {
|
||||||
translate([margin + switch_outer_width/2, margin + switch_total_height/2, plate_thickness/2]) {
|
for (r = [0 : len(layout) - 1]) {
|
||||||
for (r = [0 : rows - 1]) {
|
let (row_data = layout[r], y_pos = (len(layout) - 1 - r) * u_size + (u_size/2)) {
|
||||||
for (c = [0 : columns - 1]) {
|
generate_row_cutouts(row_data, 0, y_pos);
|
||||||
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 ---
|
// Render
|
||||||
if (render_part == "left") {
|
if (render_part == "left") {
|
||||||
intersection() { whole_plate(); cube([split_point, plate_height, plate_thickness + 2]); }
|
intersection() {
|
||||||
} else if (render_part == "right") {
|
|
||||||
translate([-split_point, 0, 0]) intersection() {
|
|
||||||
whole_plate();
|
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 {
|
} else {
|
||||||
whole_plate();
|
whole_plate();
|
||||||
|
%translate([0,0,plate_thickness/2]) split_mask();
|
||||||
}
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user