Без опису
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  1. include <config.scad>;
  2. use <gt2_pulley.scad>;
  3. use <common.scad>
  4. extruder_slot_gap_vert = 1;
  5. extruder_slot_gap_horz = 2;
  6. extruder_real_nut_dia = 6.3;
  7. extruder_add_nut_height = 5.0;
  8. extruder_arm_dia = extruder_travel + extruder_slot_gap_vert;
  9. extruder_arm_post_dia = 9.5;
  10. extruder_arm_width = 15.0;
  11. extruder_arm_axis_dia = 20.0;
  12. extruder_arm_flare_off = 3.0;
  13. extruder_arm_axis_h = 10.0;
  14. extruder_arm_post_h = 20.0;
  15. extruder_arm_off = 10;
  16. actuator_slot_w = extruder_arm_dia + bearing_outer + extruder_slot_gap_horz;
  17. actuator_slot_h = bearing_outer + extruder_slot_gap_vert;
  18. actuator_width = actuator_slot_w + 20;
  19. actuator_height = actuator_slot_h + 20;
  20. actuator_wall = bearing_height + 2;
  21. actuator_rod_len = 100;
  22. actuator_rod_len_add_bottom = 50;
  23. show_extruder_maximum_positions = false;
  24. extruder_maximum_positions = 12;
  25. linear_bearing_inner = 8.2;
  26. linear_bearing_outer = 15.0;
  27. linear_bearing_height = 25.0;
  28. linear_mount_inner = linear_bearing_outer + 0.5;
  29. linear_mount_wall = 3.0;
  30. linear_mount_outer = linear_mount_inner + 2 * linear_mount_wall;
  31. linear_mount_height = linear_bearing_height;
  32. linear_mount_width = 40.0;
  33. linear_mount_cut = 5.0;
  34. linear_mount_tab_off = linear_mount_wall;
  35. linear_mount_tab_width = 7.0;
  36. linear_mount_add_width = 8.0;
  37. linear_mount_add_height = 35.0;
  38. actuator_rod = 8.0;
  39. actuator_rod_wall = 2.5;
  40. actuator_rod_width = actuator_rod + 2 * actuator_rod_wall;
  41. actuator_rod_h = 6.0;
  42. actuator_rod_inset = 3.0;
  43. actuator_bearing_off = 12.5;
  44. actuator_bearing_dist = extruder_arm_off + extruder_arm_post_h - actuator_wall + actuator_rod_width - 1.5; // TODO not correct formula, but matches for now
  45. gearbox_spacer = gearbox_wall / 2;
  46. gb_endstop_off = 21;
  47. gb_endstop_slit_len = 1.0;
  48. $fn = 42;
  49. echo("extruder gear factor", pow(large_teeth / small_teeth, gear_stages));
  50. module linear_bearing() {
  51. difference() {
  52. cylinder(d = linear_bearing_outer, h = linear_bearing_height);
  53. translate([0, 0, -1])
  54. cylinder(d = linear_bearing_inner + 1, h = linear_bearing_height + 2);
  55. }
  56. }
  57. module gear_pulley(dia, teeth) {
  58. if (draw_pulleys) {
  59. gt2_2mm_pulley(teeth, pulley_teeth_height);
  60. } else {
  61. cylinder(d = dia, h = pulley_teeth_height);
  62. }
  63. translate([0, 0, pulley_teeth_height])
  64. cylinder(d = pulley_mount_dia, h = pulley_mount_height);
  65. }
  66. module gear_stage() {
  67. translate([0, gears_dist / 2, (gear_stage_height - pulley_height) / 2]) {
  68. %color("yellow")
  69. rotate([0, 0, -acos(anim_pos_extruder * -2 + 1)])
  70. gear_pulley(large_dia, large_teeth);
  71. %color("yellow")
  72. translate([0, -gears_dist, 0])
  73. rotate([0, 0, -acos(anim_pos_extruder * -2 + 1)])
  74. gear_pulley(small_dia, small_teeth);
  75. }
  76. }
  77. module center_plate() {
  78. difference() {
  79. cube([gearbox_width, gearbox_height, gear_stages_dist]);
  80. for(i = [-1, 1])
  81. translate([gearbox_width / 2, gearbox_height / 2 + i * gears_dist / 2, 0]) {
  82. for(j = [-1, gear_stages_dist - bearing_height])
  83. translate([0, 0, j])
  84. cylinder(d = bearing_outer, h = bearing_height + 1);
  85. translate([0, 0, -1])
  86. cylinder(d = axis_hole_diameter, h = gear_stages_dist + 2);
  87. }
  88. for (i = [0, gearbox_width - gear_stages_dist])
  89. for (j = [-1, gearbox_height - extruder_wall_hole_depth])
  90. translate([gear_stages_dist / 2 + i, j, gear_stages_dist / 2])
  91. rotate([-90, 0, 0])
  92. cylinder(d = extruder_wall_hole_nut, h = extruder_wall_hole_depth + 1);
  93. }
  94. }
  95. module outer_plate() {
  96. difference() {
  97. cube([gearbox_width, gearbox_height, gearbox_wall]);
  98. for (i = [0, gearbox_width - gearbox_wall])
  99. for (j = [-1, gearbox_height - extruder_wall_hole_depth])
  100. translate([gearbox_wall / 2 + i, j, gearbox_wall / 2])
  101. rotate([-90, 0, 0])
  102. cylinder(d = extruder_wall_hole_nut, h = extruder_wall_hole_depth + 1);
  103. }
  104. }
  105. module gb_front_wall() {
  106. difference() {
  107. color("cyan")
  108. translate([-gearbox_width / 2, -gearbox_height / 2, -gearbox_wall])
  109. outer_plate();
  110. for (i = [-1, 1])
  111. translate([0, i * gears_dist / 2, -bearing_height])
  112. outer_bearings();
  113. }
  114. }
  115. module gb_back_wall() {
  116. difference() {
  117. color("cyan")
  118. translate([-gearbox_width / 2, -gearbox_height / 2, gear_stage_height * gear_stages + gear_stages_dist * (gear_stages - 1)])
  119. outer_plate();
  120. translate([-gearbox_width / 2, -gearbox_height / 2, gear_stage_height * gear_stages + gear_stages_dist * (gear_stages - 1)])
  121. translate([0, (gear_stages % 2) ? 0 : gears_dist, 0])
  122. translate([(gearbox_width - nema17_size) / 2, -nema17_size / 2 + (gearbox_height - gears_dist) / 2, 0]) {
  123. nema17_holes_face(3, motor_mount_height + 5, nema17_hole_size + screw_gap);
  124. translate([nema17_size / 2, nema17_size / 2, -1])
  125. cylinder(d = nema17_center_size + 2, h = gearbox_wall + 2);
  126. }
  127. for (i = [-1, 1])
  128. translate([0, i * gears_dist / 2, -bearing_height])
  129. outer_bearings();
  130. }
  131. }
  132. module gearbox() {
  133. gb_back_wall();
  134. gb_front_wall();
  135. %color("yellow")
  136. translate([0, (gear_stages % 2) ? 0 : gears_dist, 0])
  137. translate([-gearbox_width / 2, -gearbox_height / 2, gear_stage_height * gear_stages + gear_stages_dist * (gear_stages - 1)])
  138. translate([0, nema17_size, nema17_len + gearbox_wall])
  139. translate([(gearbox_width - nema17_size) / 2, -nema17_size / 2 + (gearbox_height - gears_dist) / 2, 0])
  140. rotate([180, 0, 0])
  141. nema17(nema17_len);
  142. for (i = [0 : gear_stages - 1])
  143. translate([0, 0, i * (gear_stage_height + gear_stages_dist)])
  144. rotate([0, 0, i * 180]) {
  145. %gear_stage();
  146. color("cyan")
  147. if (i < (gear_stages - 1))
  148. translate([-gearbox_width / 2, -gearbox_height / 2, gear_stage_height])
  149. center_plate();
  150. }
  151. }
  152. module outer_bearings() {
  153. cylinder(d = bearing_outer, h = bearing_height + 0.1);
  154. translate([0, 0, -gearbox_wall + bearing_height - 1])
  155. cylinder(d = axis_hole_diameter, h = gear_stages * gear_stage_height + gearbox_wall * 2 + gear_stages_dist * (gear_stages - 1) + 2);
  156. translate([0, 0, gear_stage_height * gear_stages + gear_stages_dist * (gear_stages - 1) + bearing_height - 0.1])
  157. cylinder(d = bearing_outer, h = bearing_height + 0.1);
  158. }
  159. module linear_bearing_mount(w = linear_mount_width) {
  160. %color("magenta")
  161. linear_bearing();
  162. difference() {
  163. color("green")
  164. hull() {
  165. cylinder(d = linear_mount_outer, h = linear_mount_height);
  166. translate([-w / 2, -(linear_mount_wall + linear_mount_outer) / 2, 0])
  167. cube([w, linear_mount_wall, linear_mount_height]);
  168. }
  169. translate([0, 0, -1])
  170. cylinder(d = linear_mount_inner, h = linear_mount_height + 2);
  171. translate([-linear_mount_cut / 2, 0, -1])
  172. cube([linear_mount_cut, linear_mount_outer, linear_mount_height + 2]);
  173. }
  174. for (i = [1, -1])
  175. scale([i, 1, 1])
  176. translate([linear_mount_cut / 2, linear_mount_outer / 2 - linear_mount_tab_off, 0])
  177. difference() {
  178. color("green")
  179. cube([linear_mount_wall, linear_mount_tab_width + linear_mount_tab_off, linear_mount_height]);
  180. for (i = [1, 3])
  181. translate([-1, linear_mount_tab_off * 3 / 4 + linear_mount_tab_width / 2, linear_mount_height / 4 * i])
  182. rotate([0, 90, 0])
  183. cylinder(d = extruder_wall_hole_screw, h = linear_mount_wall + 2);
  184. }
  185. }
  186. module top_cover_holes(h, nuts = 0) {
  187. for (i = [0, gearbox_width - gearbox_wall])
  188. for (j = [gearbox_wall / 2, gearbox_depth - gearbox_wall / 2])
  189. translate([gearbox_wall / 2 + i, -1, j])
  190. rotate([-90, 0, 0])
  191. if (nuts)
  192. rotate([0, 0, 360 / 12])
  193. cylinder(d = extruder_real_nut_dia, h = h + 2, $fn = 6);
  194. else
  195. cylinder(d = extruder_wall_hole_screw, h = h + 2);
  196. for (i = [0, gearbox_width - gear_stages_dist])
  197. if (gear_stages > 1)
  198. for (j = [1 : gear_stages - 1])
  199. translate([gear_stages_dist / 2 + i, -1, j * (gear_stage_height + gear_stages_dist) + gear_stages_dist / 2])
  200. rotate([-90, 0, 0])
  201. cylinder(d = extruder_wall_hole_screw, h = h + 2);
  202. }
  203. module top_cover_plate(variant = 0) {
  204. difference() {
  205. if (variant == 0) {
  206. color("green")
  207. translate([0, 0, -linear_mount_add_width])
  208. cube([gearbox_width, gearbox_wall, gearbox_depth + linear_mount_add_width]);
  209. } else if (variant == 1) {
  210. color("green")
  211. cube([gearbox_width, gearbox_wall, gearbox_depth]);
  212. } else if (variant == 2) {
  213. color("red")
  214. cube([gearbox_width, gearbox_spacer, gearbox_depth]);
  215. } else {
  216. color("red")
  217. translate([-endstop_mount_slot_depth, 0, 0])
  218. cube([gearbox_width + endstop_mount_slot_depth, gearbox_spacer, gearbox_depth]);
  219. }
  220. if (variant == 1) {
  221. top_cover_holes(gearbox_wall + actuator_bearing_off);
  222. } else {
  223. top_cover_holes(gearbox_wall);
  224. }
  225. }
  226. }
  227. module top_cover(variant) {
  228. top_cover_plate(variant);
  229. if (variant == 0) {
  230. translate([gearbox_width / 2, gearbox_wall + actuator_bearing_off, -actuator_bearing_dist])
  231. rotate([-90, 0, 0])
  232. linear_bearing_mount();
  233. } else if (variant == 1) {
  234. for (i = [-1, 1])
  235. translate([gearbox_width / 2 + i * gearbox_width / 4, gearbox_wall + actuator_bearing_off, -actuator_bearing_dist])
  236. rotate([-90, 0, 0])
  237. linear_bearing_mount(gearbox_width / 2);
  238. }
  239. color("green")
  240. difference() {
  241. hull() {
  242. if (variant == 0) {
  243. translate([(gearbox_width - linear_mount_width) / 2, gearbox_wall + actuator_bearing_off, (linear_mount_wall + linear_mount_outer) / 2 - linear_mount_wall - actuator_bearing_dist])
  244. cube([linear_mount_width, linear_mount_height, linear_mount_wall]);
  245. } else if (variant == 1) {
  246. translate([0, gearbox_wall + actuator_bearing_off, (linear_mount_wall + linear_mount_outer) / 2 - linear_mount_wall - actuator_bearing_dist])
  247. cube([gearbox_width, linear_mount_height, linear_mount_wall]);
  248. }
  249. if (variant == 0) {
  250. translate([0, gearbox_wall, -linear_mount_add_width])
  251. cube([gearbox_width, linear_mount_add_height, linear_mount_add_width]);
  252. } else if (variant == 1) {
  253. translate([0, gearbox_wall - 1, 0])
  254. cube([gearbox_width, extruder_add_nut_height + 1, gearbox_depth]);
  255. }
  256. }
  257. if (variant == 1) {
  258. translate([0, gearbox_wall - 2, 0])
  259. top_cover_holes(actuator_bearing_off + linear_mount_height, 1);
  260. }
  261. }
  262. if (variant == 3) {
  263. difference() {
  264. union() {
  265. translate([-endstop_pcb_depth - endstop_mount_slot_depth, gb_endstop_off, 0])
  266. rotate([180, 0, 90]) {
  267. %color("yellow")
  268. endstop_pcb();
  269. color("red")
  270. hull()
  271. for (i = [0, 1])
  272. translate([0, endstop_pcb_depth, endstop_pcb_height - endstop_pcb_hole_dist_y - i * endstop_pcb_hole_dist - endstop_mount_slot_width / 2])
  273. cube([endstop_mount_slot_length, endstop_mount_slot_depth, endstop_mount_slot_width]);
  274. }
  275. color("red")
  276. hull() {
  277. translate([-endstop_mount_slot_depth, 0, 0])
  278. cube([endstop_mount_slot_depth, gearbox_spacer * 2, gearbox_depth]);
  279. translate([-endstop_mount_slot_depth, gb_endstop_off, -endstop_pcb_height + endstop_pcb_hole_dist_y + endstop_pcb_hole_dist])
  280. cube([endstop_mount_slot_depth, endstop_mount_slot_length, endstop_pcb_height - endstop_pcb_hole_dist_y - endstop_pcb_hole_dist]);
  281. }
  282. }
  283. // hole slots for endstop pcb
  284. translate([-endstop_pcb_depth - endstop_mount_slot_depth, gb_endstop_off, 0])
  285. rotate([180, 0, 90])
  286. for (i = [0, 1])
  287. translate([endstop_pcb_hole_dist_x, 1, endstop_pcb_height - endstop_pcb_hole_dist_y - i * endstop_pcb_hole_dist])
  288. rotate([-90, 0, 0]) {
  289. for (j = [-1, 1])
  290. translate([-j * gb_endstop_slit_len, 0, 0])
  291. cylinder(d = endstop_pcb_hole, h = endstop_mount_slot_depth + 1);
  292. translate([-gb_endstop_slit_len, -endstop_pcb_hole / 2, 0])
  293. cube([2 * gb_endstop_slit_len, endstop_pcb_hole, endstop_mount_slot_depth + 1]);
  294. }
  295. }
  296. }
  297. }
  298. module gearbox_assembly() {
  299. gearbox();
  300. // spacers
  301. for (i = [0, 1])
  302. translate([-gearbox_width / 2, gearbox_height / 2 - i * (gearbox_height + gearbox_spacer), -gearbox_wall])
  303. top_cover(-i + 3);
  304. // top and bottom covers
  305. for (i = [0, 1])
  306. translate([-gearbox_width / 2, gearbox_height / 2 - i * (gearbox_height + gearbox_wall) - (i * 2 - 1) * gearbox_spacer, -gearbox_wall])
  307. top_cover(-i + 1);
  308. %color("grey")
  309. for (i = [-1, 1])
  310. translate([0, i * gears_dist / 2, -gearbox_wall + 1])
  311. cylinder(d = axis_diameter, h = gear_stages * gear_stage_height + gearbox_wall * 2 + gear_stages_dist * (gear_stages - 1) - 2);
  312. }
  313. module bearing() {
  314. difference() {
  315. cylinder(d = bearing_outer, h = bearing_height);
  316. translate([0, 0, -1])
  317. cylinder(d = bearing_inner, h = bearing_height + 2);
  318. }
  319. }
  320. module extruder_arm() {
  321. difference() {
  322. color("blue")
  323. union() {
  324. // post for axis
  325. cylinder(d = extruder_arm_axis_dia, h = extruder_arm_axis_h);
  326. // lever body
  327. translate([-extruder_arm_width / 2, 0, 0])
  328. cube([extruder_arm_width, extruder_arm_dia / 2, extruder_arm_axis_h]);
  329. translate([0, extruder_arm_dia / 2, 0]) {
  330. // lever body
  331. cylinder(d = extruder_arm_width, h = extruder_arm_axis_h);
  332. // post for bearing
  333. translate([0, 0, extruder_arm_axis_h])
  334. cylinder(d1 = extruder_arm_width, d2 = extruder_arm_post_dia, h = extruder_arm_post_h - extruder_arm_axis_h - extruder_arm_flare_off);
  335. translate([0, 0, extruder_arm_axis_h + (extruder_arm_post_h - extruder_arm_axis_h - extruder_arm_flare_off)])
  336. cylinder(d = extruder_arm_post_dia, h = extruder_arm_flare_off);
  337. }
  338. }
  339. // holes for axis, bearing post
  340. for (i = [0, 1])
  341. translate([0, i * extruder_arm_dia / 2, -1])
  342. cylinder(d = axis_hole_diameter, h = extruder_arm_post_h + 2);
  343. // holes for grub screws
  344. for(i = [-90, 90])
  345. translate([0, 0, extruder_arm_axis_h / 2])
  346. rotate([90, 0, i])
  347. cylinder(d = belt_pulley_fix_dia, h = extruder_arm_axis_dia);
  348. }
  349. // bearing
  350. %color("yellow")
  351. translate([0, extruder_arm_dia / 2, extruder_arm_post_h + 1])
  352. bearing();
  353. // axis
  354. %color("grey")
  355. translate([0, 0, -extruder_arm_off])
  356. cylinder(d = axis_diameter, h = extruder_arm_off + extruder_arm_axis_h);
  357. }
  358. module extruder_actuator() {
  359. difference() {
  360. color("orange")
  361. union() {
  362. cube([actuator_width, actuator_wall, actuator_height]);
  363. for (i = [0, 1])
  364. for (j = [1, -1])
  365. translate([i * actuator_width, 0, i * actuator_height])
  366. rotate([0, i * 180, 0])
  367. hull() {
  368. //union() {
  369. cube([actuator_width, actuator_wall, (actuator_height - actuator_slot_h) / 2]);
  370. translate([(actuator_width - actuator_rod_width) / 2 + i * gearbox_width / 4 * j, actuator_wall - actuator_rod_width, -actuator_rod_h])
  371. cube([actuator_rod_width, actuator_rod_width, actuator_rod_h]);
  372. }
  373. }
  374. // slot for bearing
  375. translate([(actuator_width - actuator_slot_w) / 2, -1, (actuator_height - actuator_slot_h) / 2])
  376. cube([actuator_slot_w, actuator_wall + actuator_rod_width + 2, actuator_slot_h]);
  377. // holes for rod
  378. for (i = [0, 1])
  379. for (j = [1, -1])
  380. translate([actuator_width / 2 + i * gearbox_width / 4 * j, actuator_wall - actuator_rod_width / 2, -actuator_rod_h - 1 + i * (actuator_height + actuator_rod_h / 2 + 1)])
  381. cylinder(d = actuator_rod, h = actuator_rod_h + actuator_rod_inset + 1);
  382. // holes for rod grub screws
  383. for (i = [0, 1])
  384. for (j = [1, -1])
  385. for (r = [-45, 45, 180])
  386. translate([actuator_width / 2 + i * gearbox_width / 4 * j, actuator_wall - actuator_rod_width / 2, -actuator_rod_h / 2 + i * (actuator_height + actuator_rod_h)])
  387. rotate([90, 0, r])
  388. cylinder(d = belt_pulley_fix_dia, h = actuator_rod_width);
  389. }
  390. // rods
  391. %color("yellow")
  392. for (i = [0, 1])
  393. for (j = [1, -1])
  394. translate([actuator_width / 2 + (-i + 1) * gearbox_width / 4 * j, actuator_rod_width / 2 + actuator_wall - actuator_rod_width, actuator_height + i * (-actuator_height - actuator_rod_len - actuator_rod_len_add_bottom) + (i - 1) * actuator_rod_inset])
  395. cylinder(d = actuator_rod, h = actuator_rod_len + i * actuator_rod_len_add_bottom + actuator_rod_inset);
  396. }
  397. module extruder() {
  398. translate([0, gearbox_depth - gearbox_wall, gearbox_height / 2 + gearbox_wall])
  399. rotate([90, 0, 0])
  400. translate([0, 0, gearbox_depth - gearbox_wall * 2])
  401. rotate([0, 180, 0])
  402. gearbox_assembly();
  403. translate([0, -extruder_arm_off, gearbox_wall + gearbox_height / 2 + gears_dist / 2])
  404. rotate([90, 0, 0])
  405. if (show_extruder_maximum_positions) {
  406. for (i = [0 : 360 / extruder_maximum_positions : 360])
  407. rotate([0, 0, i])
  408. extruder_arm();
  409. } else {
  410. rotate([0, 0, use_anim ? ($t * -360) : (extruder_axis_position * -180)])
  411. extruder_arm();
  412. }
  413. translate([-actuator_width / 2, -actuator_wall - extruder_arm_post_h - extruder_arm_off + 1, -actuator_height / 2 + gearbox_wall + gearbox_height / 2 + gears_dist / 2 + extruder_arm_dia / 2])
  414. if (show_extruder_maximum_positions) {
  415. for (i = [0 : 2 / extruder_maximum_positions : 1])
  416. translate([0, 0, -i * extruder_arm_dia])
  417. extruder_actuator();
  418. } else {
  419. translate([0, 0, -anim_pos_extruder * extruder_arm_dia])
  420. extruder_actuator();
  421. }
  422. }
  423. //gb_back_wall();
  424. //gb_front_wall();
  425. //center_plate();
  426. //top_cover(0);
  427. //top_cover(1);
  428. //top_cover(2);
  429. //top_cover(3);
  430. //gearbox_assembly();
  431. //extruder_arm();
  432. //extruder_actuator();
  433. extruder();