1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- /*
- * Copyright (c) 2022 - 2023 Thomas Buck (thomas@xythobuz.de)
- * Philipp Schönberger (mail@phschoen.de)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * See <http://www.gnu.org/licenses/>.
- */
-
- // ######################
- // ## MX Switch Cutout ##
- // ######################
-
- // https://geekhack.org/index.php?topic=70654.0
- mx_co_w = 14.0;
- mx_co_w_add = 0.8;
- mx_co_h = 14.0;
- mx_co_keycap_w = mx_co_w + 2.5*2;
- mx_co_keycap_h = mx_co_h + 2.5*2;
- mx_co_h_off_1 = 1.0;
- mx_co_h_off_2 = 3.5;
- mx_co_h_off_3 = mx_co_h - 2 * (mx_co_h_off_1 + mx_co_h_off_2);
- mx_co_r = 0.4;
- mx_co_depth = 5 + 3.3 + 0.2;
-
- // https://geekhack.org/index.php?topic=71550.0
- mx_co_th = 1.5 - 0.1;
- mx_co_b_add = 1.0;
- mx_co_b_w = mx_co_w + mx_co_b_add;
- mx_co_b_h = mx_co_h + mx_co_b_add;
-
- mx_travel = 3.9;
-
- module mx_switch_cutout(h)
- {
- translate([-mx_co_w / 2 - mx_co_w_add, -mx_co_h / 2, 0])
- {
- // edge cuts for anti dust
- color("red")
- linear_extrude(h + 1)
- {
- translate([mx_co_w_add, 0])
- {
- square([mx_co_w, mx_co_h]);
-
- for (x = [mx_co_r / 2, mx_co_w - mx_co_r / 2])
- for (y = [mx_co_r / 2, mx_co_h - mx_co_r / 2])
- translate([x, y])
- circle(r = mx_co_r);
- }
- }
-
- // side cutouts
- color("lightblue")
- linear_extrude(h + 1)
- {
- for (x = [-$e, mx_co_w + mx_co_w_add-$e])
- for (y = [0, mx_co_h_off_2 + mx_co_h_off_3])
- translate([x, mx_co_h_off_1 + y, 0])
- square([mx_co_w_add+$e*2, mx_co_h_off_2]);
- }
-
- color("brown")
- translate([mx_co_w_add - mx_co_b_add / 2, -mx_co_b_add / 2, -1])
- cube([mx_co_b_w, mx_co_b_h, h - mx_co_th + 1]);
- }
-
- color("cyan")
- translate([-mx_co_keycap_w/2,-mx_co_keycap_h/2, h])
- cube([mx_co_keycap_w, mx_co_keycap_h, 50]);
- }
-
- module mx_switch_test()
- {
- difference()
- {
- translate([-switch_test_w / 2, -switch_test_w / 2, 0])
- cube([switch_test_w, switch_test_w, wall]);
-
- mx_switch_cutout(wall);
-
- translate([0, -switch_test_w / 2 + 1, wall - 1.0])
- linear_extrude(1.1)
- text("switch test", size = 3, halign = "center");
- }
-
- %translate([0, 0, wall])
- rotate([0, 0, 180])
- mx_switch($t);
- }
|