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.

pico_case.scad 6.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. resolution = 20; //[10, 20, 30, 50, 100]
  2. $fn = resolution;
  3. show_frame = false; // [true, false]
  4. show_pico = true; // [true, false]
  5. show_lid = false; // [true, false]
  6. show_button = false; // [true, false]
  7. module rounded_plate(w, h, t, d) {
  8. translate([0, (d/2), 0])
  9. cube([w, (h-d), t]);
  10. translate([(d/2), 0, 0])
  11. cube([(w-d), h, t]);
  12. translate([(d/2), (d/2), 0])
  13. cylinder(h=t, d=d);
  14. translate([w-(d/2), (d/2), 0])
  15. cylinder(h=t, d=d);
  16. translate([(d/2), h-(d/2), 0])
  17. cylinder(h=t, d=d);
  18. translate([w-(d/2), h-(d/2), 0])
  19. cylinder(h=t, d=d);
  20. }
  21. module usb_port() {
  22. translate([0.3, 0, 0])
  23. color("grey")
  24. difference() {
  25. union() {
  26. cube([7.4, 6, 2.7]);
  27. translate([-0.3, 5.4, -0.1])
  28. cube([8, 0.6, 2.9]);
  29. }
  30. }
  31. }
  32. module switch() {
  33. color("grey")
  34. cube([3.5, 4.5, 1]);
  35. color("white")
  36. translate([(3.5/2), (4.5/2), 0])
  37. cylinder(h=1.5, d=3);
  38. }
  39. p_w = 21;
  40. p_h = 51;
  41. p_t = 1.0;
  42. os = 0.35;
  43. b = 2;
  44. module pico() {
  45. translate([((p_w-8)/2), ((p_h+1.3)-6), p_t])
  46. usb_port();
  47. translate([5.25, 36.6, 0.6])
  48. switch();
  49. difference() {
  50. color("green")
  51. cube([p_w, p_h, 1]);
  52. translate([((p_w/2)-5.7), 2, -0.01])
  53. cylinder(h=p_t+0.02, d=2.1);
  54. translate([(p_w-((p_w/2)-5.7)), 2, -0.01])
  55. cylinder(h=p_t+0.02, d=2.1);
  56. translate([((p_w/2)-5.7), (p_h-2), -0.01])
  57. cylinder(h=p_t+0.02, d=2.1);
  58. translate([(p_w-((p_w/2)-5.7)), (p_h-2), -0.01])
  59. cylinder(h=p_t+0.02, d=2.1);
  60. }
  61. }
  62. if (show_pico) {
  63. translate([(os+b), (os+b), 3.4])
  64. pico();
  65. }
  66. if (show_frame) {
  67. union() {
  68. difference() {
  69. // Outer frame
  70. rounded_plate(p_w+(2*(os+b)), p_h+(2*(os+b)), 10, (2*(os+b)));
  71. // Board cut-out
  72. translate([b, b, -1])
  73. cube([p_w+(2*os), p_h+(2*os), 12]);
  74. // USB port cut-out
  75. // translate([b+os+((p_w-10)/2), b+os+((p_h+1)-6), 3.4])
  76. // cube([10, 8, 4.7]);
  77. translate([b+os+((p_w-10)/2), b+(2*os)+p_h-1, 8.1])
  78. rotate([-90, 0, 0])
  79. rounded_plate(10, 4.7, 4.7, 2);
  80. // Lid release cut-out
  81. difference() {
  82. union() {
  83. translate([b+os+((p_w-10)/2), -1, 10-1])
  84. cube([10, 8, 2]);
  85. translate([b+os+((p_w-6)/2), -1, 10-1])
  86. rotate([-90, 0, 0])
  87. cylinder(h=4, d=2);
  88. translate([b+os+((p_w-6)/2), -1, 10-2])
  89. cube([6, 8, 3]);
  90. translate([b+os+((p_w+6)/2), -1, 10-1])
  91. rotate([-90, 0, 0])
  92. cylinder(h=4, d=2);
  93. }
  94. translate([b+os+((p_w+10)/2), -1, 10-1])
  95. rotate([-90, 0, 0])
  96. cylinder(h=4, d=2);
  97. translate([b+os+((p_w-10)/2), -1, 10-1])
  98. rotate([-90, 0, 0])
  99. cylinder(h=4, d=2);
  100. }
  101. // Outer frame
  102. translate([1, 1, 10-1.2])
  103. rounded_plate(p_w+(2*(os+b))-2, p_h+(2*(os+b))-2, 2, (2*(os+b))-2);
  104. // Left top retainer cut-out
  105. translate([b+os+(p_w/2)-(3.2/2)-7.1, b+p_h+(2*os), 10-3+0.2])
  106. cube([3.2, 0.7, 1.0]);
  107. // Right top retainer cut-out
  108. translate([b+os+(p_w/2)-(3.2/2)+7.1, b+p_h+(2*os), 10-3+0.2])
  109. cube([3.2, 0.7, 1.0]);
  110. // Left bottom retainer cut-out
  111. translate([b+os+(p_w/2)-(4/2)-7.1, b+os-0.7, 10-3+0.2])
  112. cube([4, 0.7, 1.0]);
  113. // Right bottom retainer cut-out
  114. translate([b+os+(p_w/2)-(4/2)+7.1, b+os-0.7, 10-3+0.2])
  115. cube([4, 0.7, 1.0]);
  116. // Left retainer cut-out
  117. translate([b-0.7, b+os+(p_h/2)-2, 10-3+0.2])
  118. cube([0.7, 4, 1.0]);
  119. // Right retainer cut-out
  120. translate([b+(2*os)+p_w, b+os+(p_h/2)-2, 10-3+0.2])
  121. cube([0.7, 4, 1.0]);
  122. }
  123. // Left support rail
  124. translate([b+os+(p_w/2)-(3/2)-5.5, 0, 0])
  125. cube([3, p_h+(2*(os+b)), 3.4]);
  126. // Right support rail
  127. translate([b+os+(p_w/2)-(3/2)+5.5, 0, 0])
  128. cube([3, p_h+(2*(os+b)), 3.4]);
  129. // Left top retainer
  130. translate([b+os+(p_w/2)-(2.2/2)-6.1, b+p_h+(2*os)-0.6, 3.4+1+0.5])
  131. cube([2.2, 0.6, 0.8]);
  132. // Right top retainer
  133. translate([b+os+(p_w/2)-(2.2/2)+6.1, b+p_h+(2*os)-0.6, 3.4+1+0.5])
  134. cube([2.2, 0.6, 0.8]);
  135. // Left bottom retainer
  136. translate([b+os+(p_w/2)-(3/2)-5.7, b, 3.4+1+0.])
  137. cube([3, 0.6, 0.8]);
  138. // Right bottom retainer
  139. translate([b+os+(p_w/2)-(3/2)+5.7, b, 3.4+1+0.5])
  140. cube([3, 0.6, 0.8]);
  141. }
  142. }
  143. if (show_lid) {
  144. difference() {
  145. union() {
  146. translate([1+os, 1+os, 10-1.2])
  147. rounded_plate(p_w+(2*b)-2, p_h+(2*b)-2, 1, (2*b)-2);
  148. translate([(os+b), (os+b), 10-3])
  149. rounded_plate(p_w, p_h, 2, (2*b)-3);
  150. // Left top retainer
  151. translate([b+os+(p_w/2)-(2.2/2)-7.1, b+p_h+os, 10-3+0.4])
  152. cube([2.2, 0.6, 0.6]);
  153. // Right top retainer
  154. translate([b+os+(p_w/2)-(2.2/2)+7.1, b+p_h+os, 10-3+0.4])
  155. cube([2.2, 0.6, 0.6]);
  156. // Left bottom retainer
  157. translate([b+os+(p_w/2)-(3/2)-7.1, b+os-0.5, 10-3+0.3])
  158. cube([3, 0.6, 0.6]);
  159. // Right bottom retainer
  160. translate([b+os+(p_w/2)-(3/2)+7.1, b+os-0.5, 10-3+0.3])
  161. cube([3, 0.6, 0.6]);
  162. // Left retainer
  163. translate([b+os-0.6, b+os+(p_h/2)-1.5, 10-3+0.3])
  164. cube([0.6, 3, 0.6]);
  165. // Right retainer
  166. translate([b+os+p_w, b+os+(p_h/2)-1.5, 10-3+0.3])
  167. cube([0.6, 3, 0.6]);
  168. }
  169. // USB port cut-out
  170. translate([b+os+((p_w-10)/2), b+p_h+(2*os)-2, 10-4.2])
  171. cube([10, 8, 2.4]);
  172. // Lid release cut-out
  173. translate([b+os+((p_w-10)/2), -1, 10-4.2])
  174. cube([10, 8, 3]);
  175. // Switch cut-out
  176. translate([(os+b)+7, (os+b)+38.85, 0])
  177. cylinder(h=10, d=5);
  178. // Inset
  179. translate([(os+b)+1, (os+b)+1, 10-4])
  180. cube([p_w-2, p_h-2, 3]);
  181. }
  182. // Switch surround
  183. translate([(os+b), (os+b)+38.85-6, 10-2])
  184. cube([p_w, 1, 1]);
  185. translate([(os+b), (os+b)+38.85+5, 10-2])
  186. cube([p_w, 1, 1]);
  187. }
  188. if (show_button) {
  189. color("red")
  190. union() {
  191. translate([(os+b)+7, (os+b)+38.85, 7.5])
  192. cylinder(h=2.3, d=4.4);
  193. difference() {
  194. translate([(os+b)+7, (os+b)+38.85, 6.5])
  195. cylinder(h=2, d=7.6);
  196. translate([(os+b)+7, (os+b)+38.85, 6.5])
  197. cylinder(h=1, d=6.6);
  198. }
  199. }
  200. }