Files
keyboard_scad/spacebar_ortholinear.scad
T
2026-03-24 21:20:03 +01:00

84 lines
2.2 KiB
OpenSCAD

// Parameters
$fn = 64;
// Dimensions
u_spacing = 19.05;
// 7U: 1U base + 6 additionals U
width_base = 18.2 + (6 * u_spacing); // 132.5mm
width_top = 14.5 + (6 * u_spacing);
depth_base = 18.2;
depth_top = 14.5;
height = 9.0;
corner_radius = 2.5;
// Stem
stem_h = 5.0;
stem_outer_d = 5.5;
cross_l = 4.1;
cross_w1 = 1.25;
cross_w2 = 1.15;
// Stab spacing
// 6.25U standard wire
stab_spacing = 100;
module rounded_rectangle(w, d, h, r) {
hull() {
translate([r, r, 0]) cylinder(r=r, h=h);
translate([w - r, r, 0]) cylinder(r=r, h=h);
translate([r, d - r, 0]) cylinder(r=r, h=h);
translate([w - r, d - r, 0]) cylinder(r=r, h=h);
}
}
module xda_body() {
difference() {
hull() {
rounded_rectangle(width_base, depth_base, 0.1, corner_radius);
translate([(width_base - width_top)/2, (depth_base - depth_top)/2, height - 0.1])
rounded_rectangle(width_top, depth_top, 0.1, corner_radius);
}
// Hollow out the inside
translate([0,0,-0.5])
hull() {
translate([1.5, 1.5, 0])
rounded_rectangle(width_base - 3, depth_base - 3, 0.1, corner_radius/2);
translate([(width_base - width_top)/2 + 1.5, (depth_base - depth_top)/2 + 1.5, height - 2.5])
rounded_rectangle(width_top - 3, depth_top - 3, 0.1, corner_radius/2);
}
}
}
module single_stem_unit() {
intersection() {
cylinder(d=stem_outer_d, h=height - 0.5);
difference() {
cylinder(d=stem_outer_d, h=height);
translate([0, 0, -0.1]) {
cube([cross_l, cross_w1, stem_h * 2], center=true);
cube([cross_w2, cross_l, stem_h * 2], center=true);
}
}
}
}
module all_stems() {
// Main Center Stem
translate([width_base/2, depth_base/2, 0])
single_stem_unit();
// Stabilizer Stems
translate([width_base/2 - stab_spacing/2, depth_base/2, 0])
single_stem_unit();
translate([width_base/2 + stab_spacing/2, depth_base/2, 0])
single_stem_unit();
}
// Render
union() {
xda_body();
all_stems();
}