My self-made 3D-printable designs, mainly in OpenSCAD
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.

light-switches.scad 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. mount_width = 40;
  2. mount_height = 35;
  3. mount_wall_depth = 30;
  4. head_dia = 6.0;
  5. head_height = 2.7;
  6. hole_dia = 3.2;
  7. hole_off = 10;
  8. wall = 5;
  9. switch_off = 5;
  10. switch_height_off = 5;
  11. prism_w = 5;
  12. switch_width = 18.2;
  13. switch_depth = 11.5;
  14. switch_height = 11.0;
  15. switch_top_width = 20.8;
  16. switch_top_depth = 14.8;
  17. switch_top_height = 2.1;
  18. switch_add_negative = 1.0;
  19. text_top = "2";
  20. text_bottom = "1";
  21. text_font = "Liberation Sans:style=Bold";
  22. text_h = 10;
  23. text_d = 0.5;
  24. text_spacing = 1.0;
  25. text_off = 7.5;
  26. text_top_off = 6;
  27. text_bottom_off = 10.5;
  28. $fn = 42;
  29. switches_width = switch_depth * 2 + switch_off;
  30. module screw(h) {
  31. translate([0, 0, h - head_height])
  32. cylinder(d1 = hole_dia, d2 = head_dia, h = head_height);
  33. cylinder(d = hole_dia, h = h - head_height + 0.01);
  34. }
  35. module prism(l, w, h) {
  36. polyhedron(
  37. points = [[0,0,0], [l,0,0], [l,w,0], [0,w,0], [0,w,h], [l,w,h]],
  38. faces = [[0,1,2,3],[5,4,3,2],[0,4,5,1],[0,3,4],[5,2,1]]
  39. );
  40. }
  41. module switch(s = 0) {
  42. translate([-s / 2, -s / 2, s - switch_height])
  43. cube([switch_width + s, switch_depth + s, switch_height]);
  44. translate([-(switch_top_width - switch_width) / 2, -(switch_top_depth - switch_depth) / 2, s])
  45. cube([switch_top_width, switch_top_depth, switch_top_height]);
  46. }
  47. module light_switches() {
  48. difference() {
  49. cube([mount_width, mount_height, wall]);
  50. for (i = [0, switch_off + switch_depth]) {
  51. translate([i + switch_depth + (mount_width - switches_width) / 2, switch_height_off, wall])
  52. rotate([0, 0, 90])
  53. switch(switch_add_negative);
  54. }
  55. }
  56. for (i = [0, switch_off + switch_depth]) {
  57. %translate([i + switch_depth + (mount_width - switches_width) / 2, switch_height_off, wall])
  58. rotate([0, 0, 90])
  59. switch();
  60. }
  61. }
  62. module mount() {
  63. difference() {
  64. union() {
  65. cube([wall, wall + mount_wall_depth, mount_width]);
  66. translate([mount_height + wall, wall, 0])
  67. rotate([90, -90, 0])
  68. light_switches();
  69. }
  70. for (i = [0, switch_depth + switch_off]) {
  71. translate([-0.01, wall + mount_wall_depth - hole_off, switch_depth + (mount_width - switches_width) / 2 - switch_depth / 2 + i])
  72. rotate([0, 90, 0])
  73. screw(wall + 0.02);
  74. }
  75. translate([text_off, text_d, switch_depth + (mount_width - switches_width) / 2 + text_top_off])
  76. rotate([90, 0, 0])
  77. linear_extrude(height = text_d + 0.1)
  78. text(text_top, font = text_font, size = text_h, spacing = text_spacing, halign = "center");
  79. translate([text_off, text_d, switch_depth + (mount_width - switches_width) / 2 - text_bottom_off])
  80. rotate([90, 0, 0])
  81. linear_extrude(height = text_d + 0.1)
  82. text(text_bottom, font = text_font, size = text_h, spacing = text_spacing, halign = "center");
  83. }
  84. translate([wall, wall + prism_w, 0])
  85. rotate([0, -90, 180])
  86. prism(mount_width, prism_w, prism_w);
  87. }
  88. mount();