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.

common.scad 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. include <config.scad>;
  2. $fn = 42;
  3. module prism(l, w, h) {
  4. polyhedron(
  5. points = [[0,0,0], [l,0,0], [l,w,0], [0,w,0], [0,w,h], [l,w,h]],
  6. faces = [[0,1,2,3],[5,4,3,2],[0,4,5,1],[0,3,4],[5,2,1]]
  7. );
  8. }
  9. module roundedcylinder(d, h, r, top = false) {
  10. hull() // needed, otherwise rendering fails
  11. rotate_extrude(convexity = 10)
  12. translate([d / 2, 0, 0])
  13. rotate([0, 180, 0]) {
  14. if (top) {
  15. translate([0, r])
  16. square([d / 2, h - r * 2]);
  17. } else {
  18. translate([0, r])
  19. square([d / 2, h - r]);
  20. }
  21. //translate([r, 0])
  22. //square([d / 2 - r, r]);
  23. translate([r, r])
  24. circle(r = r);
  25. if (top) {
  26. translate([r, h - r])
  27. circle(r = r);
  28. //translate([r, h - r])
  29. //square([d / 2 - r, r]);
  30. }
  31. }
  32. }
  33. module rail_2020(l, n = "") {
  34. translate([0, 10, 10])
  35. difference() {
  36. translate([0, -10, -10])
  37. cube([l, 20, 20]);
  38. translate([-1, 0, 0])
  39. rotate([0, 90, 0])
  40. cylinder(d = 4.2, h = l + 2);
  41. for (i = [0, 90, 180, 270])
  42. rotate([i, 0, 0]) {
  43. translate([-1, -6.25 / 2, 10 - 4.3 - 1.8])
  44. cube([l + 2, 6.25, 4.3 + 1.8 + 1]);
  45. for (j = [-1, 1])
  46. scale([1, j, 1])
  47. translate([-1, -6.25 / 2, 10 - 1.8])
  48. rotate([45, 0, 0])
  49. cube([l + 2, 6.25, 4.3 + 1.8 + 1]);
  50. }
  51. }
  52. }
  53. module rail_2020_x(l, n = "") {
  54. echo("2020 rail", n, str(l));
  55. rail_2020(l, n);
  56. }
  57. module rail_2020_y(l, n = "") {
  58. translate([20, 0, 0])
  59. rotate([0, 0, 90])
  60. rail_2020_x(l, n);
  61. }
  62. module rail_2040_x(l, n = "") {
  63. echo("2040 rail", n, str(l));
  64. rail_2020(l, n);
  65. translate([0, 0, -20])
  66. rail_2020(l, n);
  67. }
  68. module rail_2040_y(l, n = "") {
  69. translate([20, 0, 0])
  70. rotate([0, 0, 90])
  71. rail_2040_x(l, n);
  72. }
  73. module rail_wheel() {
  74. difference() {
  75. union() {
  76. cylinder(d1 = rail_wheel_mid, d2 = rail_wheel_outer, h = (rail_wheel_height - rail_wheel_center_height) / 2);
  77. translate([0, 0, (rail_wheel_height - rail_wheel_center_height) / 2])
  78. cylinder(d = rail_wheel_outer, h = rail_wheel_center_height);
  79. translate([0, 0, (rail_wheel_height - rail_wheel_center_height) / 2 + rail_wheel_center_height])
  80. cylinder(d1 = rail_wheel_outer, d2 = rail_wheel_mid, h = (rail_wheel_height - rail_wheel_center_height) / 2);
  81. }
  82. translate([0, 0, -1])
  83. cylinder(d = rail_wheel_inner, rail_wheel_height + 2);
  84. }
  85. }
  86. module nema17_holes_face(height, length, hole) {
  87. translate([nema17_size / 2, nema17_size / 2, height - 4.5])
  88. for (i = [1, -1])
  89. for (j = [1, -1])
  90. translate([i * nema17_hole_off, j * nema17_hole_off, 0])
  91. cylinder(d = hole, h = length);
  92. }
  93. module nema17(length) {
  94. difference() {
  95. cube([nema17_size, nema17_size, length]);
  96. nema17_holes_face(length, 5.0, nema17_hole_size);
  97. }
  98. translate([nema17_size / 2, nema17_size / 2, length]) {
  99. cylinder(d = nema17_center_size, h = nema17_center_height);
  100. cylinder(d = nema17_shaft_size, h = nema17_shaft_length);
  101. }
  102. }
  103. module dispenser_arm() {
  104. translate([0, dispenser_arm_tab_off, dispenser_arm_tab_hole_off])
  105. rotate([90, 0, 0])
  106. cylinder(d = dispenser_arm_dia, h = dispenser_arm_len);
  107. translate([0, dispenser_arm_tab_off, dispenser_arm_tab_hole_off - dispenser_arm_height])
  108. cylinder(d = dispenser_arm_dia, h = dispenser_arm_height);
  109. translate([-dispenser_arm_handle_width / 2, dispenser_arm_tab_off - dispenser_arm_len - dispenser_arm_handle_len + dispenser_arm_handle_overlap, dispenser_arm_tab_hole_off + dispenser_arm_dia / 2])
  110. cube([dispenser_arm_handle_width, dispenser_arm_handle_len, dispenser_arm_handle_height]);
  111. }
  112. module dispenser() {
  113. difference() {
  114. cylinder(d1 = dispenser_nozzle_end_dia_1, d2 = dispenser_nozzle_end_dia_2, h = dispenser_nozzle_end_length);
  115. translate([0, 0, -0.01])
  116. cylinder(d1 = dispenser_nozzle_end_dia_1 - dispenser_wall * 2, d2 = dispenser_nozzle_end_dia_2 - dispenser_wall * 2, h = dispenser_nozzle_end_length + 0.02);
  117. }
  118. translate([0, 0, dispenser_nozzle_end_length])
  119. difference() {
  120. cylinder(d1 = dispenser_nozzle_cap_dia_1, d2 = dispenser_nozzle_cap_dia_2, h = dispenser_nozzle_cap_height);
  121. translate([0, 0, -0.01])
  122. cylinder(d1 = dispenser_nozzle_cap_dia_1 - dispenser_wall * 2, d2 = dispenser_nozzle_cap_dia_2 - dispenser_wall * 2, h = dispenser_nozzle_cap_height + 0.02);
  123. }
  124. translate([0, 0, dispenser_nozzle_end_length + dispenser_nozzle_cap_height])
  125. difference() {
  126. cylinder(d = dispenser_nozzle_mid_dia, h = dispenser_nozzle_mid_height);
  127. translate([0, 0, -0.01])
  128. cylinder(d = dispenser_nozzle_mid_dia - dispenser_wall * 2, h = dispenser_nozzle_mid_height + 0.02);
  129. }
  130. translate([0, 0, dispenser_nozzle_end_length + dispenser_nozzle_cap_height + dispenser_nozzle_mid_height])
  131. difference() {
  132. cylinder(d = dispenser_nozzle_top_dia, h = dispenser_nozzle_top_height);
  133. translate([0, 0, -0.01])
  134. cylinder(d = dispenser_nozzle_top_dia - dispenser_wall * 2, h = dispenser_nozzle_top_height + 0.02);
  135. }
  136. translate([0, 0, dispenser_nozzle_end_length + dispenser_nozzle_cap_height + dispenser_nozzle_mid_height + dispenser_nozzle_top_height])
  137. difference() {
  138. cylinder(d1 = dispenser_mid_dia, d2 = dispenser_top_dia, h = dispenser_top_height);
  139. translate([0, 0, -0.01])
  140. cylinder(d1 = dispenser_mid_dia - dispenser_wall * 2, d2 = dispenser_top_dia - dispenser_wall * 2, h = dispenser_top_height + 0.02);
  141. }
  142. translate([0, -dispenser_top_dia / 2, dispenser_nozzle_end_length + dispenser_nozzle_cap_height + dispenser_nozzle_mid_height + dispenser_nozzle_top_height + dispenser_top_height])
  143. rotate([dispenser_handle_angle, 0, 0])
  144. translate([0, 0, -dispenser_handle_dia / 2])
  145. rotate([90, 0, 0])
  146. cylinder(d = dispenser_handle_dia, h = dispenser_handle_length);
  147. translate([0, dispenser_top_dia / 2 + dispenser_arm_handle_y, dispenser_nozzle_end_length + dispenser_nozzle_cap_height + dispenser_nozzle_mid_height + dispenser_nozzle_top_height + dispenser_top_height + dispenser_arm_handle_z])
  148. rotate([dispenser_arm_angle_bottom + anim_pos_extruder * (dispenser_arm_angle_top - dispenser_arm_angle_bottom), 0, 0])
  149. dispenser_arm();
  150. }
  151. dispenser_arm_angle_top = -5;
  152. dispenser_arm_angle_bottom = 6;
  153. dispenser();