Guest User

start g code

a guest
Mar 31st, 2026
596
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.71 KB | None | 0 0
  1. ;M1002 set_flag extrude_cali_flag=1
  2. ;M1002 set_flag g29_before_print_flag=1
  3. ;M1002 set_flag auto_cali_toolhead_offset_flag=1
  4. ;M1002 set_flag build_plate_detect_flag=1
  5.  
  6. ;======== P2S start gcode==========
  7. ;===== 2026/02/26 =====
  8.  
  9. M140 S[bed_temperature_initial_layer_single] ; heat heatbed first
  10. M993 A0 B0 C0 ; nozzle cam detection not allowed.
  11. M400
  12.  
  13. ;=====printer start sound ===================
  14. M17
  15. M400 S1
  16. M1006 S1
  17. M1006 A53 B9 L50 C53 D9 M50 E53 F9 N50
  18. M1006 A56 B9 L50 C56 D9 M50 E56 F9 N50
  19. M1006 A61 B9 L50 C61 D9 M50 E61 F9 N50
  20. M1006 A53 B9 L50 C53 D9 M50 E53 F9 N50
  21. M1006 A56 B9 L50 C56 D9 M50 E56 F9 N50
  22. M1006 A61 B18 L50 C61 D18 M50 E61 F18 N50
  23. M1006 W
  24. ;=====printer start sound ===================
  25.  
  26. M620 M ;enable remap
  27. G389
  28.  
  29. ;===== avoid end stop =================
  30. G91
  31. G380 S2 Z22 F1200
  32. G380 S2 Z-12 F1200
  33. G90
  34. ;===== avoid end stop =================
  35.  
  36. ;===== reset machine status =================
  37. M204 S10000
  38. M630 S0 P1
  39. G90
  40. M17 D ; reset motor current to default
  41. M960 S5 P1 ; turn on logo lamp
  42. G90
  43. M220 S100 ;Reset Feedrate
  44. M1002 set_gcode_claim_speed_level: 5
  45. M221 S100 ;Reset Flowrate
  46. M73.2 R1.0 ;Reset left time magnitude
  47. G29.1 Z{+0.0} ; clear z-trim value first
  48. M983.1 M1
  49. M982.2 S1 ; turn on cog noise reduction
  50. M983.4 S0
  51. ;===== reset machine status =================
  52.  
  53. ;==== set airduct mode ====
  54. ;==== if Chamber Cooling is necessary ====
  55. {if (overall_chamber_temperature >= 40)}
  56. M145 P1 ; set airduct mode to heating mode for heating
  57. M106 P2 S26 ; turn on filter fan 10%
  58. M622.1 S0
  59. M1002 judge_flag ventobox_replace_aux1_fan_flag
  60. M622 J0
  61. M106 P10 S0 ; turn off left aux fan
  62. M623
  63. {else}
  64. {if (min_vitrification_temperature <= 50)}
  65. M145 P0 ; set airduct mode to cooling mode for cooling
  66. M106 P2 S255 ; turn on auxiliary fan for cooling
  67. M106 P3 S127 ; turn on chamber fan for cooling
  68. M1002 gcode_claim_action : 29
  69. M191 S0 ; wait for chamber temp
  70. M106 P2 S26 ; turn on filter fan 10%
  71. M622.1 S0
  72. M1002 judge_flag ventobox_replace_aux1_fan_flag
  73. M622 J0
  74. M106 P10 S0 ; turn off left aux fan
  75. M623
  76. M142 P6 R30 S40 U0.3 V0.8 ; set PETG exhaust chamber autocooling
  77. {else}
  78. M145 P1 ; set airduct mode to heating mode for heating
  79. M106 P2 S127 ; turn on 50% filter fan
  80. M142 P6 R30 S40 U0.3 V0.8 ; set PLA/TPU exhaust chamber autocooling
  81. {endif}
  82. {endif}
  83. ;==== set airduct mode ====
  84.  
  85. ;===== start to heat heatbed & hotend==========
  86. M1002 gcode_claim_action : 2
  87. M1002 set_filament_type:{filament_type[initial_no_support_extruder]}
  88. M104 S140 A
  89.  
  90. G29.2 S0 ; avoid invalid abl data
  91.  
  92. ;===== detect ABS/ASA ======
  93. {if filament_type[current_extruder] == "ASA" || filament_type[current_extruder] == "ABS"}
  94. M140 S110 ; set bed temp for ASA/ABS
  95. M104 S200 ; preheat nozzle (optional, adjust as needed)
  96. M400 S2700 ; wait for 45 min (preheat delay)
  97. {endif}
  98.  
  99. ;===== first homing start =====
  100. M1002 gcode_claim_action : 13
  101. G28 X T300
  102. G150.1 F8000 ; wipe mouth to avoid filament stick to heatbed
  103. G150.3
  104. M972 S24 P0
  105. M972 S26 P0 C0
  106. M972 S42 P0 T5000
  107. G150.1 F8000 ; wipe mouth to avoid filament stick to heatbed
  108. G90
  109. G1 X128 Y128 F30000
  110. G28 Z P0 T400
  111. M400
  112. ;===== first homign end =====
  113.  
  114. ;===== detection start =====
  115. M1002 gcode_claim_action : 11
  116. M104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-80} A ; rise temp in advance
  117. M972 S19 P0 T5000 ;plate type detection
  118.  
  119. {if max_print_z >= 145}
  120. M1002 gcode_claim_action : 75 ; Detect obstacles at the botton of the heated bed
  121. G150.3
  122. M104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; rise temp in advance
  123. G3811 Z{max_print_z} ; Detect obstacles at the bottom of the heated bed
  124. {endif}
  125. ;===== detection end =====
  126.  
  127. ;===== prepare print temperature and material ==========
  128. M400
  129. M211 X0 Y0 Z0 ;turn off soft endstop
  130. M975 S1 ; turn on input shaping
  131.  
  132. G29.2 S0 ; avoid invalid abl data
  133. G150.3
  134. {if ((filament_type[initial_no_support_extruder] == "PLA") || (filament_type[initial_no_support_extruder] == "PLA-CF") || (filament_type[initial_no_support_extruder] == "PETG")) && (nozzle_diameter[initial_no_support_extruder] == 0.2)}
  135. M620.10 A0 F74.8347 H{nozzle_diameter[initial_no_support_extruder]} T{flush_temperatures[initial_no_support_extruder]} P{nozzle_temperature_initial_layer[initial_no_support_extruder]} S1
  136. M620.10 A1 F74.8347 H{nozzle_diameter[initial_no_support_extruder]} T{flush_temperatures[initial_no_support_extruder]} P{nozzle_temperature_initial_layer[initial_no_support_extruder]} S1
  137. {else}
  138. M620.10 A0 F{flush_volumetric_speeds[initial_no_support_extruder]/2.4053*60} H{nozzle_diameter[initial_no_support_extruder]} T{flush_temperatures[initial_no_support_extruder]} P{nozzle_temperature_initial_layer[initial_no_support_extruder]} S1
  139. M620.10 A1 F{flush_volumetric_speeds[initial_no_support_extruder]/2.4053*60} H{nozzle_diameter[initial_no_support_extruder]} T{flush_temperatures[initial_no_support_extruder]} P{nozzle_temperature_initial_layer[initial_no_support_extruder]} S1
  140. {endif}
  141.  
  142. M620.11 P0 L0 I[initial_no_support_extruder] E0
  143. M620.11 K0 I[initial_no_support_extruder] R0
  144.  
  145. M620 S[initial_no_support_extruder]A ; switch material if AMS exist
  146. M1002 gcode_claim_action : 4
  147. M1002 set_filament_type:UNKNOWN
  148. M400
  149. T[initial_no_support_extruder]
  150. M400
  151. M628 S0
  152. M629
  153. M400
  154. M1002 set_filament_type:{filament_type[initial_no_support_extruder]}
  155. M621 S[initial_no_support_extruder]A
  156. M104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}
  157. M400
  158. M106 P1 S0
  159. M400
  160. G29.2 S1
  161. ;===== prepare print temperature and material ==========
  162.  
  163.  
  164. ;===== auto extrude cali start =========================
  165. M975 S1
  166. M1002 judge_flag extrude_cali_flag
  167. M622 J0
  168. M983.3 F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4} A0.4 ; cali dynamic extrusion compensation
  169. M623
  170.  
  171. M622 J1
  172. M1002 set_filament_type:{filament_type[initial_no_support_extruder]}
  173. M1002 gcode_claim_action : 8
  174. M109 S{nozzle_temperature[initial_no_support_extruder]}
  175. G90
  176. M83
  177. M983.3 F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4} A0.4 ; cali dynamic extrusion compensation
  178. M400
  179. M106 P1 S255
  180. M400 S5
  181. M106 P1 S0
  182. G150.3
  183. M623
  184.  
  185. M622 J2
  186. M1002 set_filament_type:{filament_type[initial_no_support_extruder]}
  187. M1002 gcode_claim_action : 8
  188. M109 S{nozzle_temperature[initial_no_support_extruder]}
  189. G90
  190. M83
  191. M983.3 F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4} A0.4 ; cali dynamic extrusion compensation
  192. M400
  193. M106 P1 S255
  194. M400 S5
  195. M106 P1 S0
  196. G150.3
  197. M623
  198. ;===== auto extrude cali end =========================
  199.  
  200. {if hold_chamber_temp_for_flat_print}
  201. M1002 gcode_claim_action : 58
  202. M104 S{first_layer_temperature[initial_no_support_extruder]}
  203. {if bed_temperature_initial_layer_single > 89}
  204. M1030 S1800
  205. SYNC R0 T1800
  206. {else}
  207. M1030 S300
  208. SYNC R0 T300
  209. {endif}
  210. M1030 C
  211. {endif}
  212.  
  213. {if filament_type[current_extruder] == "TPU" || filament_type[current_extruder] == "PVA"}
  214. {else}
  215. M83
  216. G1 E-3 F1800
  217. M400 P500
  218. {endif}
  219. G150.2
  220. G150.1 F8000
  221. G150.2
  222. G150.1 F8000
  223.  
  224. G91
  225. G1 Y-16 F12000 ; move away from the trash bin
  226. G90
  227. M400
  228.  
  229. M104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-80} A
  230.  
  231. ;===== wipe right nozzle start =====
  232. M1002 gcode_claim_action : 14
  233. G150 T{nozzle_temperature_initial_layer[initial_no_support_extruder]}
  234. M400
  235.  
  236. {if filament_type[current_extruder] == "PC"}
  237. M109 S170 A
  238. {else}
  239. M109 S140 A
  240. {endif}
  241. G91
  242. G1 Z5 F1200
  243. G90
  244. M400
  245. G150.1
  246. ;===== wipe left nozzle end =====
  247.  
  248.  
  249. ;===== mech mode sweep start =====
  250. M1002 gcode_claim_action : 3
  251. G90
  252. G1 X128 Y128 F20000
  253. G1 Z5 F1200
  254. M400 P200
  255. M970.3 Q1 A5 K0 O1
  256. M970.2 Q1 K1 W74 Z0.01
  257. M974 Q1 S2 P0
  258. M970.3 Q0 A7 K0 O1
  259. M970.2 Q0 K1 W74 Z0.01
  260. M974 Q0 S2 P0
  261. M975 S1
  262. M400
  263. ;===== mech mode sweep end =====
  264.  
  265. ;===== bed leveling ==================================
  266. M1002 gcode_claim_action : 54
  267. M190 S[bed_temperature_initial_layer_single]; ensure bed temp
  268. M109 S140 A
  269. M106 S0 ; turn off fan , too noisy
  270. M1002 judge_flag g29_before_print_flag
  271. M622 J1
  272. M1002 gcode_claim_action : 1
  273. {if hold_chamber_temp_for_flat_print}
  274. G29 H
  275. {else}
  276. G29 A1 X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}
  277. {endif}
  278. M400
  279. M500 ; save cali data
  280. M623
  281.  
  282. M622 J2
  283. M1002 gcode_claim_action : 1
  284. {if hold_chamber_temp_for_flat_print}
  285. G29 H
  286. {else}
  287. G29 A2 X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}
  288. {endif}
  289. M400
  290. M500 ; save cali data
  291. M623
  292.  
  293. M622 J0
  294. G28
  295. M623
  296. G29.2 S1
  297. G28
  298. ;===== bed leveling end ================================
  299.  
  300. M985.1 U0 E2
  301. M985.1 U1 E2
  302.  
  303. M104 S[nozzle_temperature_initial_layer] A
  304. G150.3 ; move to garbage can to wait for temp
  305.  
  306. ;===== wait temperature reaching the reference value =======
  307. M190 S[bed_temperature_initial_layer_single]
  308.  
  309. ;========turn off light and fans =============
  310. M960 S1 P0 ; turn off laser
  311. M960 S2 P0 ; turn off laser
  312. M106 S0 ; turn off cooling fan
  313.  
  314. ;===== wait temperature reaching the reference value =======
  315.  
  316. M1002 gcode_claim_action : 255
  317. M400
  318. M975 S1 ; turn on mech mode supression
  319.  
  320. ;============switch again==================
  321. M211 X0 Y0 Z0 ;turn off soft endstop
  322. G91
  323. G1 Z6 F1200
  324. G90
  325. M1002 set_filament_type:{filament_type[initial_no_support_extruder]}
  326. M620 S[initial_no_support_extruder]A
  327. M400
  328. T[initial_no_support_extruder]
  329. M400
  330. M628 S0
  331. M629
  332. M400
  333. M621 S[initial_no_support_extruder]A
  334. ;============switch again==================
  335.  
  336. ;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==
  337. {if bed_temperature_initial_layer_single > 89}
  338. {if curr_bed_type=="Textured PEI Plate"}
  339. G29.1 Z{-0.02} ; for Textured PEI Plate
  340. {else}
  341. G29.1 Z{0.0}
  342. {endif}
  343. {else}
  344. {if curr_bed_type=="Textured PEI Plate"}
  345. G29.1 Z{0.01} ; for Textured PEI Plate
  346. {else}
  347. G29.1 Z{0.03}
  348. {endif}
  349. {endif}
  350.  
  351. M500
  352.  
  353. ;===== nozzle load line ===============================
  354. M1002 gcode_claim_action : 51
  355. G29.2 S1 ; ensure z comp turn on
  356. G90
  357. M83
  358. M109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}
  359. G0 X100 Y0 F24000
  360. M400
  361. ;G130 O0 X100 Y-0.4 Z0.8 F{filament_max_volumetric_speed[initial_no_support_extruder]/2/2.4053} L40 E20 D5
  362. G130 O0 X100 Y-0.2 Z0.6 F{filament_max_volumetric_speed[initial_no_support_extruder]/2/2.4053} L40 E12 D4
  363. G90
  364. M83
  365. G1 Z0.5
  366. M400
  367. ;===== noozle load line end ===========================
  368. M1002 gcode_claim_action : 0
  369. G29.99
  370.  
  371. {if (filament_type[initial_no_support_extruder] == "TPU") ||
  372. (filament_type[initial_no_support_extruder] == "PLA") || (filament_type[initial_no_support_extruder] == "PETG")}
  373. M1015.3 S1 H[nozzle_diameter];enable tpu, pla and petg clog detect
  374. {else}
  375. M1015.3 S0;disable clog detect
  376. {endif}
  377.  
  378. {if (filament_type[initial_no_support_extruder] == "PLA") || (filament_type[initial_no_support_extruder] == "PETG")
  379. || (filament_type[initial_no_support_extruder] == "PLA-CF") || (filament_type[initial_no_support_extruder] == "PETG-CF")}
  380. M1015.4 S1 K1 H[nozzle_diameter] ;enable E air printing detect
  381. {else}
  382. M1015.4 S0 K0 H[nozzle_diameter] ;disable E air printing detect
  383. {endif}
  384.  
  385. M620.6 I[initial_no_support_extruder] W1 ;enable ams air printing detect
  386.  
  387. M1010 Q0 B0.023 S0.01
  388. M1010 Q1 B0.005 S0.01
  389. M1010.1 S1
Advertisement
Add Comment
Please, Sign In to add comment