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.

xiaomi-yi.scad 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*
  2. * Created by:
  3. * Thomas Buck <xythobuz@xythobuz.de> in May 2016
  4. *
  5. * Licensed under the
  6. * Creative Commons - Attribution - Share Alike license.
  7. */
  8. // -----------------------------------------------------------
  9. cam_width = 61; // 60.5
  10. cam_depth = 22; // 21.3
  11. cam_height = 43; // 42.1
  12. button_size = 12;
  13. button_dist = 14;
  14. mic_hole = 2;
  15. mic_hole_dist = 17.8;
  16. bottom_hole = 8;
  17. bottom_hole_dist = 17.2;
  18. wifi_hole = 6.4;
  19. wifi_hole_dist = 18;
  20. mount_width = 3; // 3.1
  21. mount_gap = 3.2; // 3.1
  22. mount_depth = 16.4; // 16.4
  23. mount_height = 16.2; // 16.1
  24. mount_hole = 5.2; // 5
  25. mount_hole_dist = 7.8; // 7.7
  26. mount_offset = -7; // -7
  27. wall_size = 1.8;
  28. lip_height = 1;
  29. lip_width = 1.4;
  30. $fn = 20;
  31. // -----------------------------------------------------------
  32. module half_cylinder(d, h) {
  33. rotate([0, 0, 180])
  34. difference() {
  35. cylinder(d = d, h = h);
  36. translate([-(d / 2), 0, -1])
  37. cube([d, d / 2, h + 2]);
  38. }
  39. }
  40. module frame() {
  41. // left wall
  42. translate([0, wall_size, 0])
  43. cube([wall_size, cam_height, cam_depth]);
  44. // right wall
  45. translate([wall_size + cam_width, wall_size, 0])
  46. cube([wall_size, cam_height, cam_depth]);
  47. // bottom wall
  48. cube([cam_width + (2 * wall_size), wall_size, cam_depth]);
  49. // top wall
  50. translate([0, wall_size + cam_height, 0])
  51. cube([cam_width + (2 * wall_size), wall_size, cam_depth]);
  52. }
  53. module frameWithButton() {
  54. difference() {
  55. frame();
  56. // button
  57. translate([wall_size + button_dist, (2 * wall_size) + cam_height + 1, cam_depth / 2])
  58. rotate([90, 0, 0])
  59. cylinder(d = button_size, h = wall_size + 2);
  60. // mic hole
  61. translate([wall_size + cam_width - mic_hole_dist, (2 * wall_size) + cam_height + 1, cam_depth / 2])
  62. rotate([90, 0, 0])
  63. cylinder(d = mic_hole, h = wall_size + 2);
  64. // bottom hole
  65. translate([wall_size + cam_width - bottom_hole_dist, wall_size + 1, cam_depth / 2])
  66. rotate([90, 0, 0])
  67. cylinder(d = bottom_hole, h = wall_size + 2);
  68. // wifi hole
  69. translate([wall_size + cam_width - 1, wall_size + wifi_hole_dist, cam_depth / 2])
  70. rotate([0, 90, 0])
  71. cylinder(d = wifi_hole, h = wall_size + 2);
  72. }
  73. }
  74. module lip() {
  75. // left lip
  76. translate([0, wall_size, 0])
  77. cube([wall_size + lip_width, cam_height, lip_height]);
  78. // right lip
  79. translate([wall_size + cam_width - lip_width, wall_size, 0])
  80. cube([wall_size + lip_width, cam_height, lip_height]);
  81. // bottom lip
  82. cube([cam_width + (2 * wall_size), wall_size + lip_width, lip_height]);
  83. // top lip
  84. translate([0, wall_size + cam_height - lip_width, 0])
  85. cube([cam_width + (2 * wall_size), wall_size + lip_width, lip_height]);
  86. }
  87. module frameLips() {
  88. translate([0, 0, lip_height])
  89. frameWithButton();
  90. lip();
  91. translate([0, 0, cam_depth + lip_height])
  92. lip();
  93. }
  94. module mountArm() {
  95. difference() {
  96. union() {
  97. translate([0, mount_height - (mount_depth / 2), 0])
  98. rotate([0, 90, 0])
  99. half_cylinder(mount_depth, mount_width);
  100. translate([0, -wall_size, -(mount_depth / 2)])
  101. cube([mount_width, mount_height - (mount_depth / 2) + wall_size, mount_depth]);
  102. }
  103. translate([-1, mount_height - mount_hole_dist, 0])
  104. rotate([0, 90, 0])
  105. cylinder(d = mount_hole, h = mount_width + 2);
  106. }
  107. }
  108. module mount() {
  109. mountArm();
  110. translate([mount_width + mount_gap, 0, 0])
  111. mountArm();
  112. }
  113. module cover() {
  114. difference() {
  115. frameLips();
  116. translate([wall_size + ((cam_width - (mount_gap + (2 * mount_width))) / 2) + mount_offset + mount_width, wall_size + cam_height - lip_width - 1, -1])
  117. cube([mount_gap, wall_size + lip_width + 2, cam_depth + (2 * lip_height) + 2]);
  118. }
  119. translate([wall_size + ((cam_width - (mount_gap + (2 * mount_width))) / 2) + mount_offset, (2 * wall_size) + cam_height, lip_height + (cam_depth / 2)])
  120. mount();
  121. }
  122. // -----------------------------------------------------------
  123. cover();