]> git.scottworley.com Git - tattlekey/blob - housing/cherryVoid.scad
server: Start
[tattlekey] / housing / cherryVoid.scad
1 // Retrieved from https://www.thingiverse.com/thing:4120804
2
3 // Riskable's Cherry MX void/cutout module for making keyboard (top) plates and key switch testers
4
5 $fn = 32;
6
7 use <roundedCube.scad> // Because it's nice to have rounded corners on these sorts of things
8
9 // AUTHOR: Riskable <riskable@youknowwhat.com>
10 // VERSION: 1.1 (Changelog is at the bottom)
11 // LICENSE: Creative Commons - Attribution - Non-Commercial (if you want to use it in a commercial setting/product just ask!)
12
13 // NOTES
14 /*
15 * Feel free to use this .scad in your own projects to add proper Cherry MX-styled switch cutouts to keyboards, perhipherals, testers, or whatever you like.
16 * You can just copy cherry_switch_void() into your own code if you like--it's entirely self-contained and reasonably small. Just make sure to credit, "This module was written by Riskable:" or something like that =)
17 */
18
19 /* Creates the shape of a (proper) Cherry MX switch hole.
20 height: The thickness, really. Doesn't impact PLATE_THICKNESS
21 x_extra: Extra (void) space on the X axis (e.g. to save some plastic). Doesn't change the top plate.
22 y_extra: Extra (void) space on the Y axis. Same thing as X.
23 tolerance: Extra room on all sides (0.1 default should be good for most printers)
24 plate_thickness: How thick the top plate will be. Typical Cherry MX plates are about 1.5mm thick.
25 */
26 module cherry_switch_void(height=12, x_extra=0, y_extra=0, tolerance=0.1, plate_thickness=1.5, corner_radius=0.5) { // Cherry MX body is supposed to be 11.6mm
27 switch_width = 15.6;
28 switch_length = 14; // Slightly shorter because we're making an acurate profile (see below)
29 center_space = 3.5; // Space between the cutouts on the sides of the switch
30 sides_width = (5+center_space); // Taken from the Cherry MX developer PDF
31 // Make the basic switch shape:
32 cube(
33 [switch_length+tolerance, switch_length+tolerance, height],
34 center=true);
35 // Profile for the sides:
36 translate([0,sides_width/2,0])
37 cube([switch_width-tolerance, center_space+tolerance, height], center=true);
38 translate([0,-sides_width/2,0])
39 cube([switch_width-tolerance,center_space+tolerance, height], center=true);
40 // Fill out the rest with a solid cube so that there's a top plate + empty space beneath
41 translate([0,0,plate_thickness])
42 roundedCube(
43 [switch_width+x_extra, switch_width+y_extra, height],
44 r=corner_radius, center=true);
45 }
46
47 /*
48 CHANGELOG:
49 1.1: Now using roundedCube so the interior edges aren't so sharp.
50 1.0: Initial release
51 */