115 lines
3.8 KiB
OpenSCAD
115 lines
3.8 KiB
OpenSCAD
render_part = "full"; // "full", "left", or "right"
|
|
|
|
// 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;
|
|
stab_w = 6.9;
|
|
stab_h = 13.5;
|
|
|
|
// 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]
|
|
]);
|
|
}
|
|
}
|
|
|
|
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) ? 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 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, 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
|
|
if (render_part == "left") {
|
|
intersection() {
|
|
whole_plate();
|
|
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();
|
|
} |