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.

table.scad 27KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. /*
  2. * Resources used:
  3. * https://www.thingiverse.com/thing:16627
  4. * https://www.chiefdelphi.com/t/timing-pulley-design-tutorial/383204
  5. *
  6. * Hardware required:
  7. * https://www.banggood.com/15pcs-Transparent-Pulley-Wheel-with-625zz-Double-Bearing-for-V-slot-3D-Printer-p-1575067.html?cur_warehouse=CN&rmmds=search
  8. * 2x NEMA17 stepper
  9. * 2040 extrusions, lengths see console output
  10. * 2020 extrusions, lengths see console output
  11. * GT2 belt, lengths see console output
  12. */
  13. include <config.scad>;
  14. use <gt2_pulley.scad>;
  15. use <common.scad>;
  16. $fn = 42;
  17. /***********************************
  18. ********** Printed Parts **********
  19. ***********************************/
  20. module belt_pulley(tc, dia, for_motor = 1) {
  21. difference() {
  22. union() {
  23. cylinder(d = dia + belt_pulley_rim * 2, h = (belt_pulley_width - belt_pulley_tooth_width) / 2);
  24. translate([0, 0, (belt_pulley_width - belt_pulley_tooth_width) / 2])
  25. gt2_2mm_pulley(tc, belt_pulley_tooth_width);
  26. cylinder(d = dia, h = (belt_pulley_width - belt_pulley_tooth_width) / 2);
  27. translate([0, 0, (belt_pulley_width - belt_pulley_tooth_width) / 2 + belt_pulley_tooth_width])
  28. cylinder(d = dia + belt_pulley_rim * 2, h = (belt_pulley_width - belt_pulley_tooth_width) / 2);
  29. }
  30. if (for_motor) {
  31. // motor shaft hole
  32. translate([0, 0, -1])
  33. cylinder(d = belt_pulley_axis_hole, h = belt_pulley_width + 2);
  34. // grub screw
  35. for (i = [0, 90])
  36. translate([0, 0, belt_pulley_width / 2])
  37. rotate([90, 0, i])
  38. cylinder(d = belt_pulley_fix_dia, h = dia / 2 + 1);
  39. } else {
  40. // bearing hole
  41. translate([0, 0, -1])
  42. cylinder(d = bearing_outer, h = belt_pulley_width + 2);
  43. // grub screw
  44. for (i = [0, 90, 180, 270])
  45. translate([0, 0, (i > 90 ? 1 : -1) * 2])
  46. translate([0, 0, belt_pulley_width / 2])
  47. rotate([90, 0, i])
  48. cylinder(d = belt_pulley_fix_dia, h = dia / 2 + 1);
  49. }
  50. }
  51. }
  52. module belt_tensioner_diff() {
  53. translate([-50, -belt_tensioner_diff_len, -belt_tensioner_diff_height / 2])
  54. cube([100, belt_tensioner_diff_len, belt_tensioner_diff_height]);
  55. translate([-belt_tensioner_diff_width / 2, -belt_tensioner_diff_len, -50])
  56. cube([belt_tensioner_diff_width, belt_tensioner_diff_len, 100]);
  57. }
  58. module belt_tensioner_mount_rail(height) {
  59. echo("belt tensioner", "t-nut", str(height * 2, "x"), str(motor_mount_hole_size_nominal, "mm"));
  60. difference() {
  61. if (height == 1) {
  62. for (i = [ 10, -10 - belt_tensioner_wall ])
  63. translate([i, 0, 0])
  64. cube([belt_tensioner_wall, belt_tensioner_mount_depth, 20 + belt_tensioner_wall]);
  65. } else {
  66. for (i = [ 10, -10 - belt_tensioner_wall ])
  67. translate([i, 0, -20])
  68. cube([belt_tensioner_wall, belt_tensioner_mount_depth, 40 + belt_tensioner_wall]);
  69. }
  70. for (i = [ 10, -10 ])
  71. translate([-10 - belt_tensioner_wall - 1, belt_tensioner_mount_depth / 2, i])
  72. rotate([0, 90, 0])
  73. cylinder(d = motor_mount_hole_size, h = 20 + 2 * belt_tensioner_wall + 2);
  74. }
  75. }
  76. module belt_tensioner_mount(height) {
  77. echo("belt tensioner", "screw", "1x", str("M", belt_tensioner_screw), str(">", belt_tensioner_diff_len + belt_tensioner_wall + 5 - real_belt_pulley_dia, "mm"));
  78. echo("belt tensioner", "nut", "1x", str("M", belt_tensioner_screw));
  79. belt_tensioner_mount_rail(height);
  80. difference() {
  81. hull() {
  82. if (height == 1) {
  83. for (i = [ 10, -10 - belt_tensioner_wall ])
  84. translate([i, 0, 0])
  85. cube([belt_tensioner_wall, 1, 20 + belt_tensioner_wall]);
  86. } else {
  87. for (i = [ 10, -10 - belt_tensioner_wall ])
  88. translate([i, 0, -20])
  89. cube([belt_tensioner_wall, 1, 40 + belt_tensioner_wall]);
  90. }
  91. translate([-10, -belt_tensioner_diff_len - belt_tensioner_wall - 5, 25 - 21])
  92. cube([20, belt_tensioner_wall, 20 + 1]);
  93. }
  94. translate([-10 - belt_tensioner_wall - 1, 0, -22])
  95. cube([20 + 2 * belt_tensioner_wall + 2, 50, 50]);
  96. translate([-10, 0, -22])
  97. cube([20, 50, 50]);
  98. translate([0, 0, 10 + belt_pulley_off])
  99. belt_tensioner_diff();
  100. translate([0, -belt_tensioner_diff_len - belt_tensioner_wall - 5 + 30 - 1, real_belt_pulley_dia / 2 + 0.175])
  101. rotate([90, 0, 0])
  102. cylinder(d = belt_tensioner_screw_hole, h = 30);
  103. }
  104. }
  105. module belt_tensioner_moving() {
  106. %color("red")
  107. translate([-belt_pulley_width / 2, 0, 0])
  108. rotate([0, 90, 0])
  109. rotate([0, 0, -acos(anim_pos_x * -2 + 1)])
  110. belt_pulley(teethcount, real_belt_pulley_dia, 0);
  111. color("cyan")
  112. difference() {
  113. for (i = [-1, 1])
  114. scale([i, 1, 1])
  115. translate([belt_pulley_width / 2 + belt_tensioner_moving_gap, belt_tensioner_moving_overlap - belt_tensioner_moving_len, -belt_tensioner_moving_height / 2])
  116. cube([belt_tensioner_wall, belt_tensioner_moving_len, belt_tensioner_moving_height]);
  117. translate([-belt_pulley_width / 2 - belt_tensioner_wall - belt_tensioner_moving_gap - 1, 0, 0])
  118. rotate([0, 90, 0])
  119. cylinder(d = axis_hole_diameter, h = belt_pulley_width + 2 * (belt_tensioner_wall + belt_tensioner_moving_gap) + 2);
  120. }
  121. color("cyan")
  122. translate([-belt_pulley_width / 2 - belt_tensioner_moving_gap, -belt_tensioner_moving_len + belt_tensioner_moving_overlap, -belt_tensioner_moving_height / 2])
  123. difference() {
  124. cube([belt_pulley_width + 2 * belt_tensioner_moving_gap, belt_tensioner_wall, belt_tensioner_moving_height]);
  125. translate([belt_pulley_width / 2 + belt_tensioner_moving_gap, belt_tensioner_wall + 1, belt_tensioner_moving_height / 2])
  126. rotate([90, 0, 0])
  127. cylinder(d = belt_tensioner_screw_hole, h = belt_tensioner_wall + 2);
  128. }
  129. }
  130. module belt_tensioner(height, length = 100, visual = 1) {
  131. if (visual)
  132. %translate([-10, 0, 0])
  133. if (length > 0) {
  134. if (height == 1) {
  135. rail_2020_y(length, "only for visualization");
  136. } else {
  137. rail_2040_y(length, "only for visualization");
  138. }
  139. }
  140. translate([0, -belt_tensioner_travel * $t, 0])
  141. translate([0, -real_belt_pulley_dia / 2, 10 + belt_pulley_off])
  142. belt_tensioner_moving();
  143. color("orange")
  144. belt_tensioner_mount(height);
  145. %color("yellow")
  146. translate([-belt_width / 2, -real_belt_pulley_dia / 2, 10 + real_belt_pulley_dia / 2 + belt_pulley_off - belt_thickness / 2])
  147. cube([belt_width, length + real_belt_pulley_dia / 2 + nema17_size / 2, belt_thickness]);
  148. %color("yellow")
  149. translate([-belt_width / 2, -real_belt_pulley_dia / 2, 10 - real_belt_pulley_dia / 2 - belt_thickness / 2 + belt_pulley_off])
  150. cube([belt_width, length + real_belt_pulley_dia / 2 + nema17_size / 2, belt_thickness]);
  151. }
  152. module motor_mount(height) {
  153. echo("motor mount", "t-nut", str(height * 2, "x"), str(motor_mount_hole_size_nominal, "mm"));
  154. echo("motor mount", "screw", "4x", str("M", nema17_hole_size), str(motor_mount_height + 2, "-", motor_mount_height + 4, "mm"));
  155. %color("yellow")
  156. translate([-nema17_len, 0, nema17_size - belt_pulley_off])
  157. rotate([0, 90, 0])
  158. nema17(nema17_len);
  159. %color("red")
  160. translate([motor_mount_height - belt_pulley_width / 2 + 10, nema17_size / 2, nema17_size / 2 - belt_pulley_off])
  161. rotate([0, 90, 0])
  162. rotate([0, 0, -acos(anim_pos_x * -2 + 1)])
  163. belt_pulley(teethcount, real_belt_pulley_dia, 1);
  164. color("cyan")
  165. difference() {
  166. hull() {
  167. translate([0, 0, -belt_pulley_off])
  168. cube([motor_mount_height, nema17_size, nema17_size]);
  169. translate([0, nema17_size, (nema17_size - 20) / 2])
  170. cube([motor_mount_height, motor_mount_length, height * 20]);
  171. }
  172. translate([0, 0, -belt_pulley_off])
  173. translate([-nema17_len, 0, nema17_size])
  174. rotate([0, 90, 0]) {
  175. nema17_holes_face(nema17_len, motor_mount_height + 5, nema17_hole_size + screw_gap);
  176. translate([nema17_size / 2, nema17_size / 2, nema17_len - 1])
  177. cylinder(d = nema17_center_size + 2, h = motor_mount_height + 2);
  178. }
  179. for (i = [0, motor_mount_hole_off])
  180. for (j = [0, 20 * (height - 1)])
  181. translate([0, i, j])
  182. translate([-1, nema17_size - motor_mount_hole_off / 2 + motor_mount_length / 2, nema17_size / 2])
  183. rotate([0, 90, 0]) {
  184. cylinder(d = motor_mount_hole_size, h = motor_mount_height + 2);
  185. }
  186. }
  187. }
  188. /***********************************
  189. ************** Plate **************
  190. ***********************************/
  191. module plate_holes(h) {
  192. for (i = [-1, 1])
  193. for (j = [-1, 1])
  194. translate([i * plate_mount_screws_distance_x / 2, j * plate_mount_screws_distance_y / 2, -1])
  195. cylinder(d = plate_mount_screw_hole, h = h + 2);
  196. }
  197. module plate() {
  198. echo("alu plate", "bed", plate_x, plate_y, "holes", plate_mount_screws_distance_x, plate_mount_screws_distance_y);
  199. difference() {
  200. cube([plate_x, plate_y, plate_z]);
  201. translate([plate_x / 2, plate_y / 2, 0])
  202. plate_holes(plate_z);
  203. }
  204. }
  205. /************************************
  206. ************** Y-Axis **************
  207. ************************************/
  208. module endstop_pcb() {
  209. difference() {
  210. cube([endstop_pcb_width, endstop_pcb_depth, endstop_pcb_height]);
  211. for (i = [0, 1])
  212. translate([endstop_pcb_hole_dist_x, -1, endstop_pcb_height - endstop_pcb_hole_dist_y - i * endstop_pcb_hole_dist])
  213. rotate([-90, 0, 0])
  214. cylinder(d = endstop_pcb_hole, h = endstop_pcb_depth + 2);
  215. }
  216. translate([0, 0, endstop_pcb_height - endstop_pcb_switchpoint])
  217. rotate([0, -90, 0])
  218. cylinder(d = endstop_pcb_hole, h = endstop_pcb_switchpoint);
  219. }
  220. module endstop_mount_v1() {
  221. %color("yellow")
  222. translate([-endstop_pcb_mount_off_w, -endstop_pcb_depth - endstop_pcb_mount_off_d, endstop_pcb_mount_off_h])
  223. endstop_pcb();
  224. color("blue")
  225. difference() {
  226. cube([endstop_mount_width, endstop_mount_depth, 40]);
  227. for (i = [0, 1])
  228. translate([endstop_mount_width / 2, -1, 10 + 20 * i])
  229. rotate([-90, 0, 0])
  230. cylinder(d = motor_mount_hole_size, h = endstop_mount_depth + 2);
  231. }
  232. color("blue")
  233. difference() {
  234. union() {
  235. hull() {
  236. translate([-endstop_mount_slot_length, 0, 40 - endstop_mount_add_height])
  237. cube([endstop_mount_slot_length, endstop_mount_depth, endstop_mount_add_height]);
  238. translate([0, 0, endstop_pcb_height - endstop_pcb_hole_dist_y - endstop_pcb_hole_dist])
  239. translate([-endstop_pcb_mount_off_w, -endstop_pcb_mount_off_d, endstop_pcb_mount_off_h - endstop_mount_slot_width / 2])
  240. cube([endstop_mount_slot_length, endstop_mount_slot_depth, endstop_mount_slot_width]);
  241. for (i = [0, 1])
  242. translate([0, 0, endstop_pcb_height - endstop_pcb_hole_dist_y - i * endstop_pcb_hole_dist])
  243. translate([-endstop_pcb_mount_off_w, -endstop_pcb_mount_off_d, endstop_pcb_mount_off_h - endstop_mount_slot_width / 2])
  244. cube([endstop_mount_slot_length, endstop_mount_slot_depth, endstop_mount_slot_width]);
  245. }
  246. }
  247. translate([-endstop_pcb_mount_off_w, -endstop_pcb_depth - endstop_pcb_mount_off_d, endstop_pcb_mount_off_h])
  248. for (i = [0, 1])
  249. translate([endstop_pcb_hole_dist_x, -1, endstop_pcb_height - endstop_pcb_hole_dist_y - i * endstop_pcb_hole_dist])
  250. rotate([-90, 0, 0]) {
  251. cylinder(d = endstop_pcb_hole, h = endstop_pcb_depth + 20);
  252. translate([0, 0, 1 + endstop_pcb_depth + endstop_mount_slot_depth])
  253. cylinder(d = endstop_mount_nut_hole, h = 20, $fn = 6);
  254. }
  255. }
  256. }
  257. module endstop_mount_v2() {
  258. %color("yellow")
  259. translate([-endstop_pcb_mount_off_w, -endstop_pcb_depth - endstop_pcb_mount_off_d, endstop_pcb_mount_off_h])
  260. endstop_pcb();
  261. color("blue")
  262. difference() {
  263. cube([endstop_mount_width, endstop_mount_depth, 40]);
  264. for (i = [0, 1])
  265. translate([endstop_mount_width / 2, -1, 10 + 20 * i])
  266. rotate([-90, 0, 0])
  267. cylinder(d = motor_mount_hole_size, h = endstop_mount_depth + 2);
  268. }
  269. color("blue")
  270. difference() {
  271. union() {
  272. hull() {
  273. translate([-endstop_mount_slot_length, 0, 40 - endstop_mount_add_height])
  274. cube([endstop_mount_slot_length, endstop_mount_depth, endstop_mount_add_height]);
  275. translate([0, 0, endstop_pcb_height - endstop_pcb_hole_dist_y - endstop_pcb_hole_dist])
  276. translate([-endstop_pcb_mount_off_w, -endstop_pcb_mount_off_d, endstop_pcb_mount_off_h - endstop_mount_slot_width / 2])
  277. cube([endstop_mount_slot_length, endstop_mount_slot_depth, endstop_mount_slot_width]);
  278. }
  279. hull() {
  280. for (i = [0, 1])
  281. translate([0, 0, endstop_pcb_height - endstop_pcb_hole_dist_y - i * endstop_pcb_hole_dist])
  282. translate([-endstop_pcb_mount_off_w, -endstop_pcb_mount_off_d, endstop_pcb_mount_off_h - endstop_mount_slot_width / 2])
  283. cube([endstop_mount_slot_length, endstop_mount_slot_depth, endstop_mount_slot_width]);
  284. }
  285. }
  286. translate([-endstop_pcb_mount_off_w, -endstop_pcb_depth - endstop_pcb_mount_off_d, endstop_pcb_mount_off_h])
  287. for (i = [0, 1])
  288. translate([endstop_pcb_hole_dist_x, -1, endstop_pcb_height - endstop_pcb_hole_dist_y - i * endstop_pcb_hole_dist])
  289. rotate([-90, 0, 0]) {
  290. cylinder(d = endstop_pcb_hole, h = endstop_pcb_depth + 20);
  291. translate([0, 0, 1 + endstop_pcb_depth + endstop_mount_slot_depth])
  292. cylinder(d = endstop_mount_nut_hole, h = 20, $fn = 6);
  293. }
  294. }
  295. }
  296. module endstop_mount() {
  297. if (use_endstop_mount_v2) {
  298. endstop_mount_v2();
  299. } else {
  300. endstop_mount_v1();
  301. }
  302. }
  303. module belt_mount(h) {
  304. difference() {
  305. hull() {
  306. translate([-belt_mount_width / 2, -belt_mount_depth / 2, 0])
  307. cube([belt_mount_width, belt_mount_depth, h]);
  308. translate([-belt_mount_full_width / 2, belt_mount_depth / 2, 0])
  309. cube([belt_mount_full_width, 1, h]);
  310. }
  311. translate([-belt_slot_width / 2, -belt_slot_depth / 2, -1])
  312. cube([belt_slot_width, belt_slot_depth, h + 2]);
  313. translate([-belt_mount_full_width / 2, -belt_mount_depth / 2 - 0.1, h / 2])
  314. rotate([-90, 0, 0])
  315. prism(belt_mount_full_width, h / 2 + 0.1, belt_mount_depth + 0.1);
  316. }
  317. }
  318. module eccentric() {
  319. translate([0, 0, eccentric_height_add]) {
  320. cylinder(d = eccentric_dia_main, h = eccentric_height_main);
  321. translate([0, 0, -eccentric_height_inset])
  322. cylinder(d = eccentric_dia_inset, h = eccentric_height_inset);
  323. }
  324. }
  325. module y_carriage_post() {
  326. rotate([0, 0, 90])
  327. difference() {
  328. cylinder(d = y_carriage_post_dia, h = y_carriage_post_len, $fn = 6);
  329. translate([0, 0, -1])
  330. cylinder(d = y_carriage_post_screw_hole, h = (y_carriage_post_len - y_carriage_post_center) / 2 + 1);
  331. translate([y_carriage_post_hole_off, 0, (y_carriage_post_len + y_carriage_post_center) / 2])
  332. cylinder(d = y_carriage_post_screw_hole, h = (y_carriage_post_len - y_carriage_post_center) / 2 + 1);
  333. }
  334. }
  335. module y_carriage_posts() {
  336. for (i = [-1, 1])
  337. for (j = [-1, 1])
  338. translate([i * y_carriage_wheel_x_dist / 2, j * y_carriage_wheel_y_dist / 2, 0]) {
  339. if (use_custom_eccentric) {
  340. color("yellow")
  341. eccentric();
  342. %color("yellow")
  343. translate([0, eccentric_hole_off, y_carriage_pulley_off])
  344. rail_wheel();
  345. } else {
  346. color("blue")
  347. y_carriage_post();
  348. %color("yellow")
  349. translate([0, y_carriage_post_hole_off, y_carriage_pulley_off])
  350. rail_wheel();
  351. }
  352. }
  353. }
  354. module carriage_spacer() {
  355. difference() {
  356. cube([y_carriage_x, y_carriage_y, carriage_spacer_height]);
  357. translate([y_carriage_x / 2, y_carriage_y / 2, 0])
  358. plate_holes(carriage_spacer_height);
  359. translate([carriage_spacer_cut_x / 2 * sqrt(2) + y_carriage_x / 2, -1, -1])
  360. rotate([0, -90, 45])
  361. prism(carriage_spacer_height + 2, carriage_spacer_cut_x, carriage_spacer_cut_x);
  362. translate([-carriage_spacer_cut_x / 2 * sqrt(2) + y_carriage_x / 2, y_carriage_y + 1, -1])
  363. rotate([0, -90, 225])
  364. prism(carriage_spacer_height + 2, carriage_spacer_cut_x, carriage_spacer_cut_x);
  365. translate([-1, y_carriage_y / 2 - carriage_spacer_cut_y / 2 * sqrt(2), -1])
  366. rotate([0, -90, -45])
  367. prism(carriage_spacer_height + 2, carriage_spacer_cut_y, carriage_spacer_cut_y);
  368. translate([y_carriage_x + 1, y_carriage_y / 2 + carriage_spacer_cut_y / 2 * sqrt(2), -1])
  369. rotate([0, -90, -225])
  370. prism(carriage_spacer_height + 2, carriage_spacer_cut_y, carriage_spacer_cut_y);
  371. }
  372. }
  373. // also used as base for x-carriage
  374. // axis = 0 --> all holes, usable for both
  375. // axis = 1 --> holes for x-carriage
  376. // axis = 2 --> holes for y-carriage
  377. module y_carriage(axis = 0) {
  378. if (axis == 1) {
  379. echo("t-nut", "x-carriage", "2");
  380. }
  381. if (use_custom_eccentric) {
  382. echo("eccentric", "carriage", "4");
  383. echo("screw", "carriage", "M5x30", "4");
  384. echo("nut", "carriage", "M5", "4");
  385. }
  386. color("green")
  387. difference() {
  388. union() {
  389. cube([y_carriage_x, y_carriage_y, y_carriage_h]);
  390. translate([y_carriage_x / 2, y_carriage_y / 2, 0])
  391. for (i = [-1, 1])
  392. translate([0, i * (y_carriage_y + belt_mount_depth) / 2, 0])
  393. scale([1, -i, 1])
  394. belt_mount(y_carriage_h);
  395. // additional "meat" for eccentric inset
  396. translate([y_carriage_x / 2, y_carriage_y / 2, y_carriage_h])
  397. for (i = [-1, 1])
  398. for (j = [-1, 1])
  399. translate([i * y_carriage_wheel_x_dist / 2, j * y_carriage_wheel_y_dist / 2, 0])
  400. if (use_custom_eccentric)
  401. cylinder(d = eccentric_inset_wall, h = eccentric_height_add);
  402. }
  403. translate([y_carriage_x / 2, y_carriage_y / 2, 0])
  404. plate_holes(y_carriage_h);
  405. // holes to mount y-axis to x-carriage
  406. if ((axis == 0) || (axis == 1)) {
  407. translate([(y_carriage_x - plate_mount_screws_distance_x) / 2, 0, 0])
  408. for (i = [0, 1])
  409. translate([i * plate_mount_screws_distance_x, y_carriage_y / 2, -1])
  410. cylinder(d = y_carriage_post_screw_hole, h = y_carriage_h + 2);
  411. for (i = [x_carriage_holder_l - x_carriage_holder_hole_off, y_carriage_y - x_carriage_holder_l + x_carriage_holder_hole_off])
  412. translate([y_carriage_x / 2, i, -1])
  413. cylinder(d = y_carriage_post_screw_hole, h = y_carriage_h + 2);
  414. }
  415. // holes for wheel posts
  416. translate([y_carriage_x / 2, y_carriage_y / 2, 0])
  417. for (i = [-1, 1])
  418. for (j = [-1, 1])
  419. translate([i * y_carriage_wheel_x_dist / 2, j * y_carriage_wheel_y_dist / 2, -1])
  420. if (use_custom_eccentric) {
  421. cylinder(d = eccentric_screw_hole, h = y_carriage_h + 2);
  422. translate([0, 0, y_carriage_h + eccentric_height_add + 1 - eccentric_inset_hole])
  423. cylinder(d = eccentric_dia_inset, h = eccentric_inset_hole + 1);
  424. cylinder(d = eccentric_screw_hole_dia, h = eccentric_screw_hole_h + 1);
  425. } else {
  426. cylinder(d = y_carriage_post_screw_hole, h = y_carriage_h + 2);
  427. }
  428. }
  429. %translate([y_carriage_x / 2, y_carriage_y / 2, y_carriage_h])
  430. y_carriage_posts();
  431. }
  432. module y_axis() {
  433. translate([y_carriage_x / 2, y_axis_animation_position, 20 + y_carriage_h + y_carriage_rail_dist])
  434. rotate([0, 180, 0]) {
  435. y_carriage(2);
  436. color("cyan")
  437. translate([0, 0, -carriage_spacer_height - 0.01])
  438. carriage_spacer();
  439. }
  440. color("grey")
  441. translate([-10, 0, 0])
  442. rail_2040_y(y_axis_rail_len, "y-axis");
  443. translate([- motor_mount_height - 10, y_axis_rail_len + nema17_size, nema17_size / 2 + 10])
  444. rotate([180, 0, 0])
  445. motor_mount(2);
  446. translate([10 + endstop_mount_depth, y_axis_rail_len - endstop_mount_width, -20])
  447. rotate([0, 0, 90])
  448. endstop_mount();
  449. belt_tensioner(2, y_axis_rail_len, 0);
  450. }
  451. /************************************
  452. ************** X-Axis **************
  453. ************************************/
  454. module x_carriage_holder() {
  455. echo("t-nut", "x-carriage-holder", "2");
  456. difference() {
  457. union() {
  458. cube([x_carriage_holder_l, x_carriage_holder_w, x_carriage_holder_h]);
  459. cube([x_carriage_holder_h, x_carriage_holder_w, 20]);
  460. }
  461. translate([0, (x_carriage_holder_w - x_carriage_holder_rail_hole_dist) / 2, 0])
  462. for (i = [0, x_carriage_holder_rail_hole_dist])
  463. translate([-1, i, 10])
  464. rotate([0, 90, 0])
  465. cylinder(d = y_carriage_post_screw_hole, h = x_carriage_holder_h + 2);
  466. translate([-(y_carriage_y - plate_mount_screws_distance_y) / 2, y_carriage_x / 2, 0])
  467. rotate([0, 0, 90])
  468. plate_holes(x_carriage_holder_h);
  469. translate([x_carriage_holder_hole_off, x_carriage_holder_w / 2, -1])
  470. cylinder(d = y_carriage_post_screw_hole, h = x_carriage_holder_h + 2);
  471. }
  472. }
  473. module x_carriage() {
  474. translate([0, -y_carriage_x / 2, y_carriage_h + y_carriage_rail_dist + 20])
  475. rotate([0, 180, -90])
  476. y_carriage(1);
  477. /*
  478. color("purple")
  479. for (i = [-1, 1])
  480. translate([y_carriage_y / 2, 0, 0])
  481. scale([i, 1, 1])
  482. translate([y_carriage_y / 2 - x_carriage_holder_l, 0, 0])
  483. translate([0, -x_carriage_holder_w / 2, 20 + y_carriage_h + y_carriage_rail_dist])
  484. x_carriage_holder();
  485. */
  486. }
  487. module x_axis() {
  488. translate([x_axis_animation_position + 10, 0, 0])
  489. x_carriage();
  490. color("grey")
  491. translate([0, -10, 0])
  492. rail_2040_x(x_axis_rail_len, "x-axis");
  493. translate([x_axis_rail_len + nema17_size, motor_mount_height + 10, nema17_size / 2 + 10])
  494. rotate([0, 180, 90])
  495. motor_mount(2);
  496. translate([x_axis_rail_len - endstop_mount_width, -10 - endstop_mount_depth, -20])
  497. endstop_mount();
  498. rotate([0, 0, -90])
  499. belt_tensioner(2, x_axis_rail_len, 0);
  500. }
  501. /************************************
  502. ************* Assembly *************
  503. ************************************/
  504. module assembly_y_axis_plate() {
  505. translate([0, -y_carriage_y / 2 - y_axis_animation_position, 0])
  506. y_axis();
  507. %translate([-plate_x / 2, -plate_y / 2, 20 + y_carriage_h + y_carriage_rail_dist + carriage_spacer_height])
  508. plate();
  509. }
  510. module assembly_x_axis() {
  511. x_axis();
  512. translate([x_axis_animation_position + y_carriage_y / 2, -y_axis_rail_len / 2, 20 + y_carriage_h + y_carriage_rail_dist])
  513. translate([10, y_axis_animation_position + y_carriage_y / 2, 20])
  514. assembly_y_axis_plate();
  515. }
  516. module rail_foot() {
  517. difference() {
  518. union() {
  519. sphere(d = foot_dia);
  520. translate([0, 0, foot_dia / 2])
  521. sphere(d = foot_nut_base_dia);
  522. }
  523. translate([-foot_dia / 2 - 1, -foot_dia / 2 - 1, -foot_dia / 2 - 1])
  524. cube([foot_dia + 2, foot_dia + 2, foot_dia / 2 + 1]);
  525. translate([-foot_nut_base_dia / 2 - 1, -foot_nut_base_dia / 2 - 1, foot_dia / 2])
  526. cube([foot_nut_base_dia + 2, foot_nut_base_dia + 2, foot_nut_base_dia / 2 + 1]);
  527. translate([0, 0, -1])
  528. cylinder(d = foot_screw_dia, h = foot_dia / 2 + 2);
  529. translate([0, 0, -1])
  530. cylinder(d = foot_screw_head_dia, h = foot_screw_head_height + 1);
  531. }
  532. }
  533. module assembly() {
  534. translate([-x_axis_rail_len / 2, 0, 20]) {
  535. assembly_x_axis();
  536. if (use_double_supports) {
  537. color("grey")
  538. for (i = [1, -1])
  539. scale([1, i, 1])
  540. translate([left_support_off, -left_support_len - 10, -20])
  541. rail_2020_y(left_support_len, "left support");
  542. color("grey")
  543. for (i = [1, -1])
  544. scale([1, i, 1])
  545. translate([x_axis_rail_len - 20 - right_support_off, -right_support_len - 10, -20])
  546. rail_2020_y(right_support_len, "right support");
  547. for (i = [0, 1])
  548. for (j = [1, -1])
  549. translate([i * x_axis_rail_len - (i * 2 - 1) * (right_support_off + 10), j * (right_support_len - 10), -40 - 0]) {
  550. %color("grey")
  551. cylinder(d = 5.0, h = 25);
  552. %color("green")
  553. rail_foot();
  554. }
  555. } else {
  556. color("grey")
  557. translate([x_axis_rail_len / 2, 0, -40])
  558. for (i = [1, -1])
  559. scale([i, 1, 1])
  560. translate([x_axis_rail_len / 2 - bottom_support_off, -bottom_support_len / 2, 0])
  561. rail_2020_y(bottom_support_len, "bottom supports");
  562. for (i = [0, 1])
  563. for (j = [1, -1])
  564. translate([i * x_axis_rail_len - (i * 2 - 1) * (bottom_support_off - 10), j * (bottom_support_len / 2 - 40), -40 - 20]) {
  565. %color("grey")
  566. cylinder(d = 5.0, h = 25);
  567. %color("green")
  568. rail_foot();
  569. }
  570. }
  571. }
  572. }
  573. module xy_table() {
  574. translate([-point_that_reaches_everywhere_x, -point_that_reaches_everywhere_y, -40 + -40 + (y_carriage_rail_dist + y_carriage_h) * -2 + -plate_z - carriage_spacer_height])
  575. assembly();
  576. }
  577. /***********************************
  578. ************ Rendering ************
  579. ***********************************/
  580. //dispenser();
  581. //rail_2020_x(100);
  582. //rail_wheel();
  583. //rail_foot();
  584. //motor_mount(1);
  585. //motor_mount(2);
  586. //belt_pulley(teethcount, real_belt_pulley_dia, 1);
  587. //belt_tensioner_mount(2);
  588. //belt_tensioner_moving();
  589. //belt_tensioner(1);
  590. //belt_tensioner(2);
  591. //belt_pulley(teethcount, real_belt_pulley_dia, 0);
  592. //y_carriage_post();
  593. //x_carriage_holder();
  594. //translate([0, -50, 0])
  595. //y_carriage(0);
  596. //y_carriage(1);
  597. //y_carriage(2);
  598. //x_carriage();
  599. //carriage_spacer();
  600. //y_axis();
  601. //x_axis();
  602. //assembly();
  603. xy_table();