Advertisement
Guest User

filamentchange.gcode

a guest
Feb 7th, 2025
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.94 KB | Help | 0 0
  1. ;===== Filament Change Code ===============
  2. M620 S[next_extruder]A
  3. M204 S9000
  4. {if toolchange_count > 1 && (z_hop_types[current_extruder] == 0 || z_hop_types[current_extruder] == 3)}
  5. G17
  6. G2 Z{z_after_toolchange + 0.4} I0.86 J0.86 P1 F10000 ; spiral lift a little from second lift
  7. {endif}
  8. G1 Z{max_layer_z + 3.0} F1200
  9.  
  10. G1 X70 F21000
  11. G1 Y245
  12. G1 Y265 F3000
  13. M400
  14. M106 P1 S0
  15. M106 P2 S0
  16. {if old_filament_temp > 142 && next_extruder < 255}
  17. M104 S[old_filament_temp]
  18. {endif}
  19. {if long_retractions_when_cut[previous_extruder]}
  20. M620.11 S1 I[previous_extruder] E-{retraction_distances_when_cut[previous_extruder]} F{old_filament_e_feedrate}
  21. {else}
  22. M620.11 S0
  23. {endif}
  24. M400
  25. G1 X90 F3000
  26. G1 Y255 F4000
  27. G1 X100 F5000
  28. G1 X120 F15000
  29. G1 X20 Y50 F21000
  30. G1 Y-3
  31. {if toolchange_count == 2}
  32. ; get travel path for change filament
  33. M620.1 X[travel_point_1_x] Y[travel_point_1_y] F21000 P0
  34. M620.1 X[travel_point_2_x] Y[travel_point_2_y] F21000 P1
  35. M620.1 X[travel_point_3_x] Y[travel_point_3_y] F21000 P2
  36. {endif}
  37. M620.1 E F[old_filament_e_feedrate] T{nozzle_temperature_range_high[previous_extruder]}
  38. T[next_extruder]
  39. M620.1 E F[new_filament_e_feedrate] T{nozzle_temperature_range_high[next_extruder]}
  40.  
  41. {if next_extruder < 255}
  42. {if long_retractions_when_cut[previous_extruder]}
  43. M620.11 S1 I[previous_extruder] E{retraction_distances_when_cut[previous_extruder]} F{old_filament_e_feedrate}
  44. M628 S1
  45. G92 E0
  46. G1 E{retraction_distances_when_cut[previous_extruder]} F[old_filament_e_feedrate]
  47. M400
  48. M629 S1
  49. {else}
  50. M620.11 S0
  51. {endif}
  52. G92 E0
  53. {if flush_length_1 > 1}
  54. M83
  55. ; FLUSH_START
  56. ; always use highest temperature to flush
  57. M400
  58. {if filament_type[next_extruder] == "PETG"}
  59. M109 S260
  60. {elsif filament_type[next_extruder] == "PVA"}
  61. M109 S210
  62. {else}
  63. M109 S[nozzle_temperature_range_high]
  64. {endif}
  65. {if flush_length_1 > 23.7}
  66. G1 E23.7 F{old_filament_e_feedrate} ; do not need pulsatile flushing for start part
  67. G1 E{(flush_length_1 - 23.7) * 0.02} F50
  68. G1 E{(flush_length_1 - 23.7) * 0.23} F{old_filament_e_feedrate}
  69. G1 E{(flush_length_1 - 23.7) * 0.02} F50
  70. G1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}
  71. G1 E{(flush_length_1 - 23.7) * 0.02} F50
  72. G1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}
  73. G1 E{(flush_length_1 - 23.7) * 0.02} F50
  74. G1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}
  75. {else}
  76. G1 E{flush_length_1} F{old_filament_e_feedrate}
  77. {endif}
  78. ; FLUSH_END
  79. G1 E-[old_retract_length_toolchange] F1800
  80. G1 E[old_retract_length_toolchange] F300
  81. {endif}
  82.  
  83. {if flush_length_2 > 1}
  84.  
  85. G91
  86. G1 X3 F12000; move aside to extrude
  87. G90
  88. M83
  89.  
  90. ; FLUSH_START
  91. G1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}
  92. G1 E{flush_length_2 * 0.02} F50
  93. G1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}
  94. G1 E{flush_length_2 * 0.02} F50
  95. G1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}
  96. G1 E{flush_length_2 * 0.02} F50
  97. G1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}
  98. G1 E{flush_length_2 * 0.02} F50
  99. G1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}
  100. G1 E{flush_length_2 * 0.02} F50
  101. ; FLUSH_END
  102. G1 E-[new_retract_length_toolchange] F1800
  103. G1 E[new_retract_length_toolchange] F300
  104. {endif}
  105.  
  106. {if flush_length_3 > 1}
  107.  
  108. G91
  109. G1 X3 F12000; move aside to extrude
  110. G90
  111. M83
  112.  
  113. ; FLUSH_START
  114. G1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}
  115. G1 E{flush_length_3 * 0.02} F50
  116. G1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}
  117. G1 E{flush_length_3 * 0.02} F50
  118. G1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}
  119. G1 E{flush_length_3 * 0.02} F50
  120. G1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}
  121. G1 E{flush_length_3 * 0.02} F50
  122. G1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}
  123. G1 E{flush_length_3 * 0.02} F50
  124. ; FLUSH_END
  125. G1 E-[new_retract_length_toolchange] F1800
  126. G1 E[new_retract_length_toolchange] F300
  127. {endif}
  128.  
  129. {if flush_length_4 > 1}
  130.  
  131. G91
  132. G1 X3 F12000; move aside to extrude
  133. G90
  134. M83
  135.  
  136. ; FLUSH_START
  137. G1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}
  138. G1 E{flush_length_4 * 0.02} F50
  139. G1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}
  140. G1 E{flush_length_4 * 0.02} F50
  141. G1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}
  142. G1 E{flush_length_4 * 0.02} F50
  143. G1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}
  144. G1 E{flush_length_4 * 0.02} F50
  145. G1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}
  146. G1 E{flush_length_4 * 0.02} F50
  147. ; FLUSH_END
  148. {endif}
  149. ; FLUSH_START
  150. M400
  151. M109 S[new_filament_temp]
  152. G1 E2 F{new_filament_e_feedrate} ;Compensate for filament spillage during waiting temperature
  153. ; FLUSH_END
  154. M400
  155. G92 E0
  156. G1 E-[new_retract_length_toolchange] F1800
  157. M106 P1 S255
  158. M400 S3
  159.  
  160. G1 X70 F5000
  161. G1 X90 F3000
  162. G1 Y255 F4000
  163. G1 X105 F5000
  164. G1 Y265 F5000
  165. G1 X70 F10000
  166. G1 X100 F5000
  167. G1 X70 F10000
  168. G1 X100 F5000
  169.  
  170. G1 X70 F10000
  171. G1 X80 F15000
  172. G1 X60
  173. G1 X80
  174. G1 X60
  175. G1 X80 ; shake to put down garbage
  176. G1 X100 F5000
  177. G1 X165 F15000; wipe and shake
  178. G1 Y256 ; move Y to aside, prevent collision
  179. M400
  180.  
  181. ;================================================================
  182. ;===== Custom Gcode for P1S =====================================
  183. ;===== Scrubbler nozzle wipe start ==============================
  184. ;================================================================
  185. G90 ; absolute mode
  186. G1 X105 Y265 F30000; start position for wipe
  187. G91 ; relative mode
  188. ; run snake pattern at max accelleration
  189. G1 X-25 F30000
  190. G1 Y-0.5
  191. G1 X25
  192. G1 Y-0.5
  193. G1 X-25
  194. G1 Y-0.5
  195. G1 X25
  196. G1 Y-0.5
  197. G1 X-25
  198. G1 Y-0.5
  199. G1 X25
  200. G90 ; absolute mode
  201. G1 X165 Y265 ; return to start position
  202. M400
  203. G1 F3000 ; restore previous accelleration
  204. ;================================================================
  205. ;===== Scrubbler nozzle wipe end ================================
  206. ;================================================================
  207.  
  208.  
  209. G1 Z{max_layer_z + 3.0} F3000
  210. {if layer_z <= (initial_layer_print_height + 0.001)}
  211. M204 S[initial_layer_acceleration]
  212. {else}
  213. M204 S[default_acceleration]
  214. {endif}
  215. {else}
  216. G1 X[x_after_toolchange] Y[y_after_toolchange] Z[z_after_toolchange] F12000
  217. {endif}
  218. M621 S[next_extruder]A
  219.  
Tags: p1s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement