Bez popisu
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.

gearbox.scad 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. include <config.scad>;
  2. use <gt2_pulley.scad>;
  3. use <common.scad>
  4. $fn = 42;
  5. echo("extruder gear factor", pow(large_teeth / small_teeth, gear_stages));
  6. module gear_pulley(dia, teeth) {
  7. if (draw_pulleys) {
  8. gt2_2mm_pulley(teeth, pulley_teeth_height);
  9. } else {
  10. cylinder(d = dia, h = pulley_teeth_height);
  11. }
  12. translate([0, 0, pulley_teeth_height])
  13. cylinder(d = pulley_mount_dia, h = pulley_mount_height);
  14. }
  15. module gear_stage() {
  16. translate([0, gears_dist / 2, (gear_stage_height - pulley_height) / 2]) {
  17. %color("yellow")
  18. rotate([0, 0, -acos(anim_pos_extruder * -2 + 1)])
  19. gear_pulley(large_dia, large_teeth);
  20. %color("yellow")
  21. translate([0, -gears_dist, 0])
  22. rotate([0, 0, -acos(anim_pos_extruder * -2 + 1)])
  23. gear_pulley(small_dia, small_teeth);
  24. }
  25. }
  26. module center_plate() {
  27. difference() {
  28. cube([gearbox_width, gearbox_height, gear_stages_dist]);
  29. for(i = [-1, 1])
  30. translate([gearbox_width / 2, gearbox_height / 2 + i * gears_dist / 2, 0]) {
  31. for(j = [-1, gear_stages_dist - bearing_height])
  32. translate([0, 0, j])
  33. cylinder(d = bearing_outer, h = bearing_height + 1);
  34. translate([0, 0, -1])
  35. cylinder(d = axis_hole_diameter, h = gear_stages_dist + 2);
  36. }
  37. for (i = [0, gearbox_width - gear_stages_dist])
  38. for (j = [-1, gearbox_height - extruder_wall_hole_depth])
  39. translate([gear_stages_dist / 2 + i, j, gear_stages_dist / 2])
  40. rotate([-90, 0, 0])
  41. cylinder(d = extruder_wall_hole_nut, h = extruder_wall_hole_depth + 1);
  42. }
  43. }
  44. module outer_plate() {
  45. difference() {
  46. cube([gearbox_width, gearbox_height, gearbox_wall]);
  47. for (i = [0, gearbox_width - gearbox_wall])
  48. for (j = [-1, gearbox_height - extruder_wall_hole_depth])
  49. translate([gearbox_wall / 2 + i, j, gearbox_wall / 2])
  50. rotate([-90, 0, 0])
  51. cylinder(d = extruder_wall_hole_nut, h = extruder_wall_hole_depth + 1);
  52. }
  53. }
  54. module gearbox() {
  55. // back wall
  56. color("cyan")
  57. translate([-gearbox_width / 2, -gearbox_height / 2, -gearbox_wall])
  58. outer_plate();
  59. // front wall
  60. color("cyan")
  61. translate([-gearbox_width / 2, -gearbox_height / 2, gear_stage_height * gear_stages + gear_stages_dist * (gear_stages - 1)])
  62. difference() {
  63. outer_plate();
  64. translate([0, (gear_stages % 2) ? 0 : gears_dist, 0])
  65. translate([(gearbox_width - nema17_size) / 2, -nema17_size / 2 + (gearbox_height - gears_dist) / 2, 0]) {
  66. nema17_holes_face(3, motor_mount_height + 5, nema17_hole_size + screw_gap);
  67. translate([nema17_size / 2, nema17_size / 2, -1])
  68. cylinder(d = nema17_center_size + 2, h = gearbox_wall + 2);
  69. }
  70. }
  71. %color("yellow")
  72. translate([0, (gear_stages % 2) ? 0 : gears_dist, 0])
  73. translate([-gearbox_width / 2, -gearbox_height / 2, gear_stage_height * gear_stages + gear_stages_dist * (gear_stages - 1)])
  74. translate([0, nema17_size, nema17_len + gearbox_wall])
  75. translate([(gearbox_width - nema17_size) / 2, -nema17_size / 2 + (gearbox_height - gears_dist) / 2, 0])
  76. rotate([180, 0, 0])
  77. nema17(nema17_len);
  78. for (i = [0 : gear_stages - 1])
  79. translate([0, 0, i * (gear_stage_height + gear_stages_dist)])
  80. rotate([0, 0, i * 180]) {
  81. gear_stage();
  82. color("cyan")
  83. if (i < (gear_stages - 1))
  84. translate([-gearbox_width / 2, -gearbox_height / 2, gear_stage_height])
  85. center_plate();
  86. }
  87. }
  88. module outer_bearings() {
  89. cylinder(d = bearing_outer, h = bearing_height + 0.1);
  90. translate([0, 0, -gearbox_wall + bearing_height - 1])
  91. cylinder(d = axis_hole_diameter, h = gear_stages * gear_stage_height + gearbox_wall * 2 + gear_stages_dist * (gear_stages - 1) + 2);
  92. translate([0, 0, gear_stage_height * gear_stages + gear_stages_dist * (gear_stages - 1) + bearing_height - 0.1])
  93. cylinder(d = bearing_outer, h = bearing_height + 0.1);
  94. }
  95. module top_cover() {
  96. difference() {
  97. cube([gearbox_width, gearbox_wall, gearbox_depth]);
  98. for (i = [0, gearbox_width - gearbox_wall])
  99. for (j = [gearbox_wall / 2, gearbox_depth - gearbox_wall / 2])
  100. translate([gearbox_wall / 2 + i, -1, j])
  101. rotate([-90, 0, 0])
  102. cylinder(d = extruder_wall_hole_screw, h = gearbox_wall + 2);
  103. for (i = [0, gearbox_width - gear_stages_dist])
  104. if (gear_stages > 1)
  105. for (j = [1 : gear_stages - 1])
  106. translate([gear_stages_dist / 2 + i, -1, j * (gear_stage_height + gear_stages_dist) + gear_stages_dist / 2])
  107. rotate([-90, 0, 0])
  108. cylinder(d = extruder_wall_hole_screw, h = gearbox_wall + 2);
  109. }
  110. }
  111. module gearbox_assembly() {
  112. difference() {
  113. gearbox();
  114. for (i = [-1, 1])
  115. translate([0, i * gears_dist / 2, -bearing_height])
  116. outer_bearings();
  117. }
  118. color("green")
  119. for (i = [-1, 1])
  120. scale([1, i, 1])
  121. translate([-gearbox_width / 2, gearbox_height / 2, -gearbox_wall])
  122. top_cover();
  123. %color("grey")
  124. for (i = [-1, 1])
  125. translate([0, i * gears_dist / 2, -gearbox_wall - 1])
  126. cylinder(d = axis_diameter, h = gear_stages * gear_stage_height + gearbox_wall * 2 + gear_stages_dist * (gear_stages - 1) + 2);
  127. }
  128. module piston() {
  129. //cylinder(d = piston_dia, h = piston_height);
  130. roundedcylinder(piston_dia, piston_height, piston_radius, true);
  131. }
  132. module piston_cyl() {
  133. difference() {
  134. cylinder(d = cylinder_dia, h = cylinder_height);
  135. translate([0, 0, piston_wall])
  136. cylinder(d = piston_dia + 2 * piston_gap, h = cylinder_height + 2);
  137. }
  138. }
  139. module piston_visual() {
  140. color("blue")
  141. difference() {
  142. piston_cyl();
  143. translate([-cylinder_dia / 2, -cylinder_dia / 2 - 1, -1])
  144. cube([cylinder_dia, cylinder_dia / 2 + 1, cylinder_height + 2]);
  145. }
  146. translate([0, 0, piston_bottom_gap])
  147. translate([0, 0, extruder_axis_anim_position]) {
  148. color("green")
  149. piston();
  150. %color("orange")
  151. translate([0, 0, -actuator_length])
  152. cylinder(d = 8, h = actuator_length);
  153. }
  154. }
  155. module extruder_lever() {
  156. translate([-extruder_lever_width / 2, 0, -extruder_lever_length + (extruder_lever_length - extruder_lever_hole_dist) / 2])
  157. difference() {
  158. cube([extruder_lever_width, extruder_lever_depth, extruder_lever_length]);
  159. translate([extruder_lever_width / 2, -1, (extruder_lever_length - extruder_lever_hole_dist) / 2])
  160. rotate([-90, 0, 0]) {
  161. for (i = [0, extruder_lever_hole_dist])
  162. translate([0, -i, 0])
  163. cylinder(d = extruder_lever_holes, h = extruder_lever_depth + 2);
  164. }
  165. }
  166. }
  167. module extruder() {
  168. translate([0, gearbox_depth - gearbox_wall, -gears_dist / 2])
  169. rotate([90, 0, 0])
  170. translate([0, 0, gearbox_depth - gearbox_wall * 2])
  171. rotate([0, 180, 0])
  172. gearbox_assembly();
  173. translate([0, -cylinder_dia / 2, -cylinder_height - extruder_travel / 2]) {
  174. translate([0, 0, -additional_piston_offset])
  175. piston_visual();
  176. color("red")
  177. translate([0, 0, cylinder_height + extruder_travel / 2])
  178. rotate([0, -acos(anim_pos_extruder * -2 + 1), 0])
  179. extruder_lever();
  180. }
  181. }
  182. module whole_extruder() {
  183. translate([0, 0, cylinder_height + extruder_travel / 2 + additional_piston_offset])
  184. extruder();
  185. }
  186. //gearbox_assembly();
  187. //piston();
  188. //piston_cyl();
  189. //extruder_lever();
  190. //center_plate();
  191. //outer_plate();
  192. //top_cover();
  193. //piston_visual();
  194. whole_extruder();