Last active
August 13, 2026 06:25
-
-
Save haliphax/901844f48ccaaf5913522bc8a6e1324b to your computer and use it in GitHub Desktop.
Generate chamfer negatives for XDA key caps - https://www.printables.com/model/396950-xda-keycap-set
This file contains hidden or 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
| /* | |
| Here is the key cap set the chamfers are for: | |
| https://www.printables.com/model/396950-xda-keycap-set | |
| */ | |
| // How many units wide the key cap is | |
| width_units = 1; // .25 | |
| // How many units tall the key cap is (*very* rarely needed) | |
| height_units = 1; // .25 | |
| /* [Hidden] */ | |
| $fn = 32; | |
| KEY_SIZE = 19.05; | |
| module pad() { | |
| translate([0, 0, 0.55]) | |
| cube( | |
| [ | |
| (width_units - 1) * KEY_SIZE + 18.15, | |
| (height_units - 1) * KEY_SIZE + 18.15, | |
| 1.1 | |
| ], | |
| true | |
| ); | |
| } | |
| module corner(span, radius) { | |
| width = (width_units - 1) * KEY_SIZE + span; | |
| height = (height_units - 1) * KEY_SIZE + span; | |
| union() { | |
| translate([-width / 2, height / 2, 0]) | |
| circle(r=radius); | |
| polygon([ | |
| [-width / 2, height / 2 - radius], | |
| [-width / 2 + radius, height / 2 - radius], | |
| [-width / 2 + radius, height / 2], | |
| [0, height / 2], | |
| [0, 0], | |
| [-width / 2, 0], | |
| ]); | |
| } | |
| } | |
| module top_corner() { | |
| span = 16.76; | |
| radius = 0.59; | |
| corner(span, radius); | |
| } | |
| module top() { | |
| translate([0, 0, 1.1]) | |
| linear_extrude(0.01) { | |
| top_corner(); | |
| mirror([1, 0, 0]) top_corner(); | |
| mirror([0, 1, 0]) top_corner(); | |
| rotate([0, 0, 180]) top_corner(); | |
| } | |
| } | |
| module bottom_corner() { | |
| span = 15.45; | |
| radius = 0.1; | |
| corner(span, radius); | |
| } | |
| module bottom() { | |
| translate([0, 0, -0.01]) | |
| linear_extrude(0.01) { | |
| bottom_corner(); | |
| mirror([1, 0, 0]) bottom_corner(); | |
| mirror([0, 1, 0]) bottom_corner(); | |
| rotate([0, 0, 180]) bottom_corner(); | |
| } | |
| } | |
| translate([0, 0, -0.02]) | |
| difference() { | |
| pad(); | |
| hull() { | |
| top(); | |
| bottom(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment