platform.scad 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. include <../config/platform.scad>
  2. include <../config/thread.scad>
  3. include <../config/wall.scad>
  4. include <../config/hook.scad>
  5. include <thread.scad>
  6. function platform_mount_holes_move_x() = (
  7. platform_support_depth / 2
  8. - platform_rounding
  9. - thread_top_diameter / 2
  10. );
  11. function platform_mount_holes_move_y() = (
  12. platform_support_thickness / 2
  13. - platform_rounding
  14. - thread_top_diameter / 2
  15. );
  16. function platform_mount_holes() = [
  17. [-platform_mount_holes_move_x(), 0],
  18. [-platform_mount_holes_move_x(), platform_mount_holes_move_y()],
  19. [-platform_mount_holes_move_x(), -platform_mount_holes_move_y()],
  20. [platform_mount_holes_move_x(), platform_mount_holes_move_y()],
  21. [platform_mount_holes_move_x(), -platform_mount_holes_move_y()],
  22. ];
  23. module platform_support_object() {
  24. module base_shape() {
  25. move_x = platform_support_depth / 2 - platform_rounding;
  26. move_y = platform_support_height / 2 - platform_rounding;
  27. size = platform_rounding;
  28. hull() {
  29. translate([-move_x, move_y]) {
  30. square(size * 2, center = true);
  31. }
  32. translate([move_x, move_y]) {
  33. circle(r = size);
  34. }
  35. translate([-move_x, -move_y]) {
  36. circle(r = size);
  37. }
  38. }
  39. }
  40. module base_object() {
  41. thickness = platform_support_thickness;
  42. rotate([90, 0, 0]) {
  43. linear_extrude(height = thickness, center = true) {
  44. base_shape();
  45. }
  46. }
  47. }
  48. module base_thread_object() {
  49. oversize = max(
  50. platform_support_depth,
  51. platform_support_height
  52. );
  53. render() {
  54. thread_object(false, oversize);
  55. }
  56. }
  57. module wall_thread_object(move_y = 0, move_z = 0) {
  58. move_x = -platform_support_depth / 2
  59. + thread_height / 2
  60. + platform_support_screw_thickness;
  61. translate([move_x, move_y, move_z]) {
  62. rotate([0, 270, 0]) {
  63. base_thread_object();
  64. }
  65. }
  66. }
  67. module wall_threads_object() {
  68. base_move_y = platform_support_thickness
  69. - platform_support_thickness % wall_holes_space;
  70. base_move_z = platform_support_height
  71. - platform_support_height % wall_holes_space;
  72. move_y = base_move_y / 2;
  73. move_z = base_move_z / 2;
  74. for (count_y = [-move_y : wall_holes_space : move_y]) {
  75. for (count_z = [-move_z : wall_holes_space : move_z]) {
  76. wall_thread_object(count_y, count_z);
  77. }
  78. }
  79. }
  80. module platform_thread_object(move_x, move_y) {
  81. move_z = platform_support_height / 2
  82. - thread_height / 2
  83. - platform_support_screw_thickness;
  84. translate([move_x, move_y, move_z]) {
  85. base_thread_object();
  86. }
  87. }
  88. module platform_threads_object() {
  89. for (count = platform_mount_holes()) {
  90. platform_thread_object(count.x, count.y);
  91. }
  92. }
  93. color("#239ddc") {
  94. render() {
  95. difference() {
  96. base_object();
  97. wall_threads_object();
  98. platform_threads_object();
  99. }
  100. }
  101. }
  102. }
  103. module platform_shape() {
  104. module base_shape() {
  105. move_x = platform_width / 2 - platform_rounding;
  106. move_y = platform_depth / 2 - platform_rounding;
  107. hull() {
  108. translate([move_x, move_y]) {
  109. circle(r = platform_rounding);
  110. }
  111. translate([-move_x, move_y]) {
  112. circle(r = platform_rounding);
  113. }
  114. translate([move_x, -move_y]) {
  115. square(platform_rounding * 2, center = true);
  116. }
  117. translate([-move_x, -move_y]) {
  118. square(platform_rounding * 2, center = true);
  119. }
  120. }
  121. }
  122. module bonding_holes() {
  123. for (count = platform_mount_holes()) {
  124. move_y = count.x
  125. - platform_depth / 2
  126. + platform_support_depth / 2;
  127. translate([count.y, move_y]) {
  128. circle(r = thread_screw / 2);
  129. }
  130. }
  131. move_x = platform_width / 2 - platform_rounding;
  132. top_y = platform_depth / 2 - platform_rounding;
  133. bottom_y = platform_support_depth - top_y;
  134. center_y = platform_support_depth / 2;
  135. translate([move_x, top_y]) {
  136. circle(r = thread_screw / 2);
  137. }
  138. translate([-move_x, top_y]) {
  139. circle(r = thread_screw / 2);
  140. }
  141. translate([move_x, bottom_y]) {
  142. circle(r = thread_screw / 2);
  143. }
  144. translate([-move_x, bottom_y]) {
  145. circle(r = thread_screw / 2);
  146. }
  147. translate([-move_x, center_y]) {
  148. circle(r = thread_screw / 2);
  149. }
  150. translate([move_x, center_y]) {
  151. circle(r = thread_screw / 2);
  152. }
  153. }
  154. module mounting_holes() {
  155. top_y = platform_mounting_holes_spacing / 2
  156. + platform_mounting_holes_move;
  157. bottom_y = -platform_mounting_holes_spacing / 2
  158. + platform_mounting_holes_move;
  159. translate([0, top_y]) {
  160. circle(r = platform_mounting_screw / 2);
  161. }
  162. translate([0, bottom_y]) {
  163. circle(r = platform_mounting_screw / 2);
  164. }
  165. }
  166. module useable_holes() {
  167. move_x = platform_width / 2
  168. - hook_mounting_hole / 2
  169. - platform_rounding * 2;
  170. top_y = platform_depth / 2
  171. - hook_mounting_hole / 2
  172. - platform_rounding * 4
  173. - wall_holes_space / 2;
  174. bottom_y = platform_support_depth
  175. - top_y;
  176. translate([move_x, top_y - wall_holes_space / 2]) {
  177. circle(r = hook_mounting_hole / 2);
  178. }
  179. translate([move_x, top_y + wall_holes_space / 2]) {
  180. circle(r = hook_mounting_hole / 2);
  181. }
  182. translate([-move_x, top_y - wall_holes_space / 2]) {
  183. circle(r = hook_mounting_hole / 2);
  184. }
  185. translate([-move_x, top_y + wall_holes_space / 2]) {
  186. circle(r = hook_mounting_hole / 2);
  187. }
  188. translate([move_x, bottom_y - wall_holes_space / 2]) {
  189. circle(r = hook_mounting_hole / 2);
  190. }
  191. translate([move_x, bottom_y + wall_holes_space / 2]) {
  192. circle(r = hook_mounting_hole / 2);
  193. }
  194. translate([-move_x, bottom_y - wall_holes_space / 2]) {
  195. circle(r = hook_mounting_hole / 2);
  196. }
  197. translate([-move_x, bottom_y + wall_holes_space / 2]) {
  198. circle(r = hook_mounting_hole / 2);
  199. }
  200. }
  201. difference() {
  202. base_shape();
  203. bonding_holes();
  204. mounting_holes();
  205. useable_holes();
  206. }
  207. }
  208. module platform_object() {
  209. color("#9bdf20") {
  210. render() {
  211. linear_extrude(height = platform_thickness, center = true) {
  212. platform_shape();
  213. }
  214. }
  215. }
  216. }