platform.scad 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. include <../config/platform.scad>
  2. include <../config/thread.scad>
  3. include <corner.scad>
  4. include <wall.scad>
  5. function platform_full_support_depth()
  6. = platform_support_depth
  7. + thread_height
  8. + platform_thickness;
  9. function platform_top_width()
  10. = platform_width
  11. - corner_radius * 2;
  12. function platform_side_width()
  13. = platform_height
  14. - corner_radius * 2;
  15. module platform_side_holes(thread = false) {
  16. move_x
  17. = platform_side_width() / 2
  18. - corner_radius
  19. - thread_screw;
  20. move_top_y
  21. = platform_full_support_depth() / 2
  22. - thread_screw;
  23. move_bottom_y
  24. = thread_top_diameter / 2
  25. - move_top_y;
  26. module thread(move_x, move_y) {
  27. translate([move_x, move_y]) {
  28. thread_object(false, platform_thickness);
  29. }
  30. }
  31. module screw(move_x, move_y) {
  32. translate([move_x, move_y]) {
  33. thread_screw_object(thread_height);
  34. }
  35. }
  36. if (thread) {
  37. screw(move_x, move_top_y);
  38. screw(0, move_top_y);
  39. thread(move_x, move_bottom_y);
  40. thread(-move_x, move_bottom_y);
  41. } else {
  42. thread_screw_hole(move_x, move_top_y);
  43. thread_screw_hole(0, move_top_y);
  44. thread_screw_hole(move_x, move_bottom_y);
  45. thread_screw_hole(-move_x, move_bottom_y);
  46. }
  47. }
  48. module platform_top_holes(thread = false) {
  49. move_x
  50. = platform_top_width() / 2
  51. - corner_radius
  52. - thread_screw;
  53. move_top_y
  54. = platform_full_support_depth() / 2
  55. - thread_screw;
  56. move_bottom_y
  57. = thread_top_diameter / 2
  58. - move_top_y;
  59. module thread(move_x, move_y) {
  60. translate([move_x, move_y]) {
  61. thread_object(false, platform_thickness);
  62. }
  63. }
  64. module screw(move_x, move_y) {
  65. translate([move_x, move_y]) {
  66. thread_screw_object(thread_height);
  67. }
  68. }
  69. if (thread) {
  70. screw(move_x, move_top_y);
  71. screw(-move_x, move_top_y);
  72. thread(move_x, move_bottom_y);
  73. thread(-move_x, move_bottom_y);
  74. } else {
  75. thread_screw_hole(move_x, move_top_y);
  76. thread_screw_hole(-move_x, move_top_y);
  77. thread_screw_hole(move_x, move_bottom_y);
  78. thread_screw_hole(-move_x, move_bottom_y);
  79. }
  80. }
  81. module platform_mount_object() {
  82. rounding = corner_radius;
  83. holes_width
  84. = platform_width
  85. - rounding * 2
  86. - thread_screw * 2
  87. - platform_side_thickness * 2;
  88. holes_height
  89. = platform_height
  90. - rounding * 2
  91. - thread_screw * 2
  92. - platform_side_thickness;
  93. module base_shape() {
  94. move_x = platform_width / 2 - rounding;
  95. move_y = platform_height / 2 - rounding;
  96. hull() {
  97. corner(move_x, move_y);
  98. corner(-move_x, move_y);
  99. corner(move_x, -move_y);
  100. corner(-move_x, -move_y);
  101. }
  102. }
  103. base_thickness
  104. = platform_thickness
  105. + thread_height;
  106. module base_object() {
  107. linear_extrude(height = base_thickness, center = true) {
  108. base_shape();
  109. }
  110. }
  111. module bottom_object() {
  112. center = base_thickness / 2 - thread_height / 2;
  113. render() {
  114. difference() {
  115. base_object();
  116. translate([0, 0, center]) {
  117. rotate([180, 0, 0]) {
  118. width = holes_width;
  119. height = holes_height;
  120. thickness = platform_thickness;
  121. wall_thread_object(width, height, thickness);
  122. }
  123. }
  124. }
  125. }
  126. }
  127. module side_shape() {
  128. module cutout_shape() {
  129. move_x
  130. = platform_width / 2
  131. - platform_side_thickness
  132. - rounding;
  133. move_top_y
  134. = platform_height / 2
  135. - platform_side_thickness
  136. - rounding;
  137. move_bottom_y
  138. = -platform_height / 2
  139. + rounding;
  140. hull() {
  141. corner(move_x, move_top_y);
  142. corner(-move_x, move_top_y);
  143. corner(move_x, move_bottom_y, false);
  144. corner(-move_x, move_bottom_y, false);
  145. }
  146. }
  147. module bottom_cutout_shape() {
  148. bottom
  149. = rounding / 2
  150. - platform_height / 2;
  151. translate([0, bottom]) {
  152. square([platform_width, rounding], center = true);
  153. }
  154. }
  155. render() {
  156. difference() {
  157. base_shape();
  158. cutout_shape();
  159. bottom_cutout_shape();
  160. }
  161. }
  162. }
  163. module side_object() {
  164. thickness = platform_support_depth;
  165. linear_extrude(height = thickness, center = true) {
  166. side_shape();
  167. }
  168. }
  169. bottom_center
  170. = thread_height / 2
  171. + platform_thickness / 2
  172. - platform_full_support_depth() / 2;
  173. side_center
  174. = platform_support_depth / 2
  175. + thread_height
  176. + platform_thickness
  177. - platform_full_support_depth() / 2;
  178. module layer_base_object() {
  179. translate([0, 0, bottom_center]) {
  180. bottom_object();
  181. }
  182. translate([0, 0, side_center]) {
  183. side_object();
  184. }
  185. }
  186. module top_holes() {
  187. center_y
  188. = platform_height / 2
  189. - thread_height / 2;
  190. translate([0, center_y, 0]) {
  191. rotate([90, 0, 0]) {
  192. platform_top_holes(true);
  193. }
  194. }
  195. }
  196. module left_holes() {
  197. center_x
  198. = platform_width / 2
  199. - thread_height / 2;
  200. translate([center_x, 0, 0]) {
  201. mirror([0, 1, 0]) {
  202. rotate([90, 0, 270]) {
  203. platform_side_holes(true);
  204. }
  205. }
  206. }
  207. }
  208. module right_holes() {
  209. center_x
  210. = thread_height / 2
  211. - platform_width / 2;
  212. translate([center_x, 0, 0]) {
  213. rotate([90, 0, 90]) {
  214. platform_side_holes(true);
  215. }
  216. }
  217. }
  218. render() {
  219. difference() {
  220. layer_base_object();
  221. top_holes();
  222. left_holes();
  223. right_holes();
  224. }
  225. }
  226. }
  227. module platform_top_shape() {
  228. move_x
  229. = platform_top_width() / 2
  230. - corner_radius;
  231. move_y
  232. = platform_depth / 2
  233. - corner_radius;
  234. module base_shape() {
  235. hull() {
  236. corner(move_x, move_y);
  237. corner(-move_x, move_y);
  238. corner(move_x, -move_y);
  239. corner(-move_x, -move_y);
  240. }
  241. }
  242. holes_y
  243. = platform_full_support_depth() / 2
  244. - platform_depth / 2;
  245. difference() {
  246. base_shape();
  247. translate([0, holes_y]) {
  248. platform_top_holes();
  249. }
  250. }
  251. }
  252. module platform_top_object() {
  253. height = platform_thickness;
  254. color("#9711EE") {
  255. render() {
  256. linear_extrude(height = height, center = true) {
  257. platform_top_shape();
  258. }
  259. }
  260. }
  261. }
  262. module platform_side_shape() {
  263. move_x
  264. = platform_side_width() / 2
  265. - corner_radius;
  266. move_y
  267. = platform_depth / 2
  268. - corner_radius;
  269. module base_shape() {
  270. hull() {
  271. corner(0, -move_y / 1.5);
  272. corner(move_x, -move_y / 1.5);
  273. corner(move_x, -move_y);
  274. corner(-move_x, -move_y);
  275. }
  276. hull() {
  277. corner(0, -move_y / 1.5);
  278. corner(move_x, -move_y / 1.5);
  279. corner(move_x, move_y);
  280. }
  281. }
  282. holes_y
  283. = platform_full_support_depth() / 2
  284. - platform_depth / 2;
  285. difference() {
  286. base_shape();
  287. translate([0, holes_y]) {
  288. platform_side_holes();
  289. }
  290. }
  291. }
  292. module platform_side_object() {
  293. height = platform_thickness;
  294. color("#DA25B3") {
  295. render() {
  296. linear_extrude(height = height, center = true) {
  297. platform_side_shape();
  298. }
  299. }
  300. }
  301. }