Last active
March 7, 2023 01:23
-
-
Save b2ox/413c935b84a469cac5b7f173d1da9acb to your computer and use it in GitHub Desktop.
Keycap and tilting unit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include <BOSL2/std.scad> | |
module CrossPole(s, l, h) { | |
translate([0, 0, h / 2]) | |
union() { | |
cube([s, l, h], center = true); | |
cube([l, s, h], center = true); | |
} | |
} | |
module KeyTop(kw, kr, kh) { | |
linear_extrude(kh) | |
rect([kw, kw], rounding = kr, $fn = 40); | |
} | |
module Dimple(kw, kr, kh, dd, dh, fs, fc) { | |
difference() { | |
KeyTop(kw, kr, kh); | |
translate([0, 0, kh - dh]) cylinder(h = kh, d = dd, $fn = 40); | |
if (fs) { | |
translate([-dd / 2, -dd, kh - dh]) cube([dd, dd, kh]); | |
} | |
} | |
if (fc) cylinder(h = kh, r = 2, $fn = 40); | |
} | |
module KeyCapBase(kw, kr, kh) { | |
axH = 3.5; | |
exS = 3; | |
exL = 6; | |
inS = exS - 2 * 0.7; // >= 1.3 | |
inL = exL - 2 * 0.7; // >= 4.1 | |
difference() { | |
union() { | |
CrossPole(exS, exL, axH + kh); | |
CrossPole(exS + 1, exL + 1, kh + 1); | |
KeyTop(kw, kr, kh); | |
} | |
translate([0, 0, kh]) CrossPole(inS, inL, axH + 1); | |
} | |
} | |
module Tilting(kw, kr, a) { | |
translate([0, -kw]) | |
rotate([90, 0, 90]) | |
rotate_extrude(angle = a) | |
translate([kw, 0]) | |
rect([kw, kw], rounding = kr, $fn = 40); | |
} | |
module DimpleTilted(kw, kr, kh, dd, dh, fs, fc, a) { | |
Dimple(kw, kr, kh, dd, dh, fs, fc); | |
rotate([0, 180, 0]) Tilting(kw, kr, a); | |
} | |
KeyCapBase(15, 3, 1); | |
translate([0, 20, 0]) Dimple(15, 3, 2, 12, 0.5, true, false); | |
translate([20, 0, 0]) Dimple(15, 3, 2, 12, 0.5 | |
, true, true); | |
translate([-20, 0, 0]) Tilting(15, 3, 15); | |
translate([0, -20, 0]) DimpleTilted(15, 3, 2, 12, 0.5, true, true, 15); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment