No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mx_switch.scad 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * Copyright (c) 2022 - 2023 Thomas Buck (thomas@xythobuz.de)
  3. * Philipp Schönberger (mail@phschoen.de)
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * See <http://www.gnu.org/licenses/>.
  16. */
  17. // ######################
  18. // ## MX Switch Cutout ##
  19. // ######################
  20. // https://geekhack.org/index.php?topic=70654.0
  21. mx_co_w = 14.0;
  22. mx_co_w_add = 0.8;
  23. mx_co_h = 14.0;
  24. mx_co_keycap_w = mx_co_w + 2.5*2;
  25. mx_co_keycap_h = mx_co_h + 2.5*2;
  26. mx_co_h_off_1 = 1.0;
  27. mx_co_h_off_2 = 3.5;
  28. mx_co_h_off_3 = mx_co_h - 2 * (mx_co_h_off_1 + mx_co_h_off_2);
  29. mx_co_r = 0.4;
  30. mx_co_depth = 5 + 3.3 + 0.2;
  31. // https://geekhack.org/index.php?topic=71550.0
  32. mx_co_th = 1.5 - 0.1;
  33. mx_co_b_add = 1.0;
  34. mx_co_b_w = mx_co_w + mx_co_b_add;
  35. mx_co_b_h = mx_co_h + mx_co_b_add;
  36. mx_travel = 3.9;
  37. module mx_switch_cutout(h)
  38. {
  39. translate([-mx_co_w / 2 - mx_co_w_add, -mx_co_h / 2, 0])
  40. {
  41. // edge cuts for anti dust
  42. color("red")
  43. linear_extrude(h + 1)
  44. {
  45. translate([mx_co_w_add, 0])
  46. {
  47. square([mx_co_w, mx_co_h]);
  48. for (x = [mx_co_r / 2, mx_co_w - mx_co_r / 2])
  49. for (y = [mx_co_r / 2, mx_co_h - mx_co_r / 2])
  50. translate([x, y])
  51. circle(r = mx_co_r);
  52. }
  53. }
  54. // side cutouts
  55. color("lightblue")
  56. linear_extrude(h + 1)
  57. {
  58. for (x = [-$e, mx_co_w + mx_co_w_add-$e])
  59. for (y = [0, mx_co_h_off_2 + mx_co_h_off_3])
  60. translate([x, mx_co_h_off_1 + y, 0])
  61. square([mx_co_w_add+$e*2, mx_co_h_off_2]);
  62. }
  63. color("brown")
  64. translate([mx_co_w_add - mx_co_b_add / 2, -mx_co_b_add / 2, -1])
  65. cube([mx_co_b_w, mx_co_b_h, h - mx_co_th + 1]);
  66. }
  67. color("cyan")
  68. translate([-mx_co_keycap_w/2,-mx_co_keycap_h/2, h])
  69. cube([mx_co_keycap_w, mx_co_keycap_h, 50]);
  70. }
  71. module mx_switch_test()
  72. {
  73. difference()
  74. {
  75. translate([-switch_test_w / 2, -switch_test_w / 2, 0])
  76. cube([switch_test_w, switch_test_w, wall]);
  77. mx_switch_cutout(wall);
  78. translate([0, -switch_test_w / 2 + 1, wall - 1.0])
  79. linear_extrude(1.1)
  80. text("switch test", size = 3, halign = "center");
  81. }
  82. %translate([0, 0, wall])
  83. rotate([0, 0, 180])
  84. mx_switch($t);
  85. }