diff --git a/resources/images/fd_pattern_manual_device.png b/resources/images/fd_pattern_manual_device.png new file mode 100644 index 0000000000..a5d5b90bc1 Binary files /dev/null and b/resources/images/fd_pattern_manual_device.png differ diff --git a/resources/images/hum_level1_dark.svg b/resources/images/hum_level1_dark.svg new file mode 100644 index 0000000000..16511f4f53 --- /dev/null +++ b/resources/images/hum_level1_dark.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/images/hum_level1_light.svg b/resources/images/hum_level1_light.svg new file mode 100644 index 0000000000..37870888f9 --- /dev/null +++ b/resources/images/hum_level1_light.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/images/hum_level2_dark.svg b/resources/images/hum_level2_dark.svg new file mode 100644 index 0000000000..66951ad474 --- /dev/null +++ b/resources/images/hum_level2_dark.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/images/hum_level2_light.svg b/resources/images/hum_level2_light.svg new file mode 100644 index 0000000000..4d62440ae4 --- /dev/null +++ b/resources/images/hum_level2_light.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/images/hum_level3_dark.svg b/resources/images/hum_level3_dark.svg new file mode 100644 index 0000000000..be9f85965d --- /dev/null +++ b/resources/images/hum_level3_dark.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/images/hum_level3_light.svg b/resources/images/hum_level3_light.svg new file mode 100644 index 0000000000..2c0334ee35 --- /dev/null +++ b/resources/images/hum_level3_light.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/images/hum_level4_dark.svg b/resources/images/hum_level4_dark.svg new file mode 100644 index 0000000000..4dc749ccb9 --- /dev/null +++ b/resources/images/hum_level4_dark.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/images/hum_level4_light.svg b/resources/images/hum_level4_light.svg new file mode 100644 index 0000000000..299c1506c8 --- /dev/null +++ b/resources/images/hum_level4_light.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/images/hum_level5_dark.svg b/resources/images/hum_level5_dark.svg new file mode 100644 index 0000000000..d7ef458e09 --- /dev/null +++ b/resources/images/hum_level5_dark.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/images/hum_level5_light.svg b/resources/images/hum_level5_light.svg new file mode 100644 index 0000000000..4121832f98 --- /dev/null +++ b/resources/images/hum_level5_light.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/images/hum_popup_close.svg b/resources/images/hum_popup_close.svg new file mode 100644 index 0000000000..cf48700ee1 --- /dev/null +++ b/resources/images/hum_popup_close.svg @@ -0,0 +1,4 @@ + + + + diff --git a/resources/images/humidity_list_background.png b/resources/images/humidity_list_background.png new file mode 100644 index 0000000000..d482fb1b32 Binary files /dev/null and b/resources/images/humidity_list_background.png differ diff --git a/resources/images/monitor_hms_new.svg b/resources/images/monitor_hms_new.svg new file mode 100644 index 0000000000..eb8d6a1474 --- /dev/null +++ b/resources/images/monitor_hms_new.svg @@ -0,0 +1,3 @@ + + + diff --git a/resources/printers/N1.json b/resources/printers/N1.json index 85da862315..8bcd035a5e 100644 --- a/resources/printers/N1.json +++ b/resources/printers/N1.json @@ -28,7 +28,6 @@ "support_print_all":false, "support_print_without_sd":false, "support_flow_calibration":true, - "support_build_plate_marker_detect":false, "support_lidar_calibration":false, "support_ai_monitoring":false, "support_first_layer_inspect":false, diff --git a/resources/printers/N2S.json b/resources/printers/N2S.json index e287cd1fab..2857bb17eb 100644 --- a/resources/printers/N2S.json +++ b/resources/printers/N2S.json @@ -28,7 +28,6 @@ "support_print_all":false, "support_print_without_sd":false, "support_flow_calibration":true, - "support_build_plate_marker_detect":false, "support_lidar_calibration":false, "support_ai_monitoring":false, "support_first_layer_inspect":false, diff --git a/resources/profiles/BBL.json b/resources/profiles/BBL.json index 4c70999b14..2afe0897df 100644 --- a/resources/profiles/BBL.json +++ b/resources/profiles/BBL.json @@ -1,7 +1,7 @@ { "name": "Bambulab", "url": "http://www.bambulab.com/Parameters/vendor/BBL.json", - "version": "01.08.00.25", + "version": "01.09.00.04", "force_update": "0", "description": "the initial version of BBL configurations", "machine_model_list": [ @@ -649,6 +649,26 @@ "name": "fdm_filament_ppa", "sub_path": "filament/fdm_filament_ppa.json" }, + { + "name": "fdm_filament_pe", + "sub_path": "filament/fdm_filament_pe.json" + }, + { + "name": "fdm_filament_pp", + "sub_path": "filament/fdm_filament_pp.json" + }, + { + "name": "fdm_filament_eva", + "sub_path": "filament/fdm_filament_eva.json" + }, + { + "name": "fdm_filament_pha", + "sub_path": "filament/fdm_filament_pha.json" + }, + { + "name": "fdm_filament_bvoh", + "sub_path": "filament/fdm_filament_bvoh.json" + }, { "name": "Bambu PLA Matte @base", "sub_path": "filament/Bambu PLA Matte @base.json" @@ -745,6 +765,10 @@ "name": "Bambu PLA Galaxy @base", "sub_path": "filament/Bambu PLA Galaxy @base.json" }, + { + "name": "Bambu Support For PLA/PETG @base", + "sub_path": "filament/Bambu Support For PLA-PETG @base.json" + }, { "name": "Bambu TPU 95A @base", "sub_path": "filament/Bambu TPU 95A @base.json" @@ -789,6 +813,10 @@ "name": "Bambu PETG Translucent @base", "sub_path": "filament/Bambu PETG Translucent @base.json" }, + { + "name": "Generic PCTG @base", + "sub_path": "filament/Generic PCTG @base.json" + }, { "name": "Bambu ABS @base", "sub_path": "filament/Bambu ABS @base.json" @@ -801,6 +829,10 @@ "name": "PolyLite ABS @base", "sub_path": "filament/PolyLite ABS @base.json" }, + { + "name": "Bambu ABS-GF @base", + "sub_path": "filament/Bambu ABS-GF @base.json" + }, { "name": "Bambu PC @base", "sub_path": "filament/Bambu PC @base.json" @@ -821,6 +853,10 @@ "name": "PolyLite ASA @base", "sub_path": "filament/PolyLite ASA @base.json" }, + { + "name": "Bambu ASA-Aero @base", + "sub_path": "filament/Bambu ASA-Aero @base.json" + }, { "name": "Generic PVA @base", "sub_path": "filament/Generic PVA @base.json" @@ -865,6 +901,10 @@ "name": "Bambu PA6-CF @base", "sub_path": "filament/Bambu PA6-CF @base.json" }, + { + "name": "Bambu PA6-GF @base", + "sub_path": "filament/Bambu PA6-GF @base.json" + }, { "name": "Generic HIPS @base", "sub_path": "filament/Generic HIPS @base.json" @@ -885,6 +925,38 @@ "name": "Generic PPA-GF @base", "sub_path": "filament/Generic PPA-GF @base.json" }, + { + "name": "Generic PE @base", + "sub_path": "filament/Generic PE @base.json" + }, + { + "name": "Generic PE-CF @base", + "sub_path": "filament/Generic PE-CF @base.json" + }, + { + "name": "Generic PP @base", + "sub_path": "filament/Generic PP @base.json" + }, + { + "name": "Generic PP-CF @base", + "sub_path": "filament/Generic PP-CF @base.json" + }, + { + "name": "Generic PP-GF @base", + "sub_path": "filament/Generic PP-GF @base.json" + }, + { + "name": "Generic EVA @base", + "sub_path": "filament/Generic EVA @base.json" + }, + { + "name": "Generic PHA @base", + "sub_path": "filament/Generic PHA @base.json" + }, + { + "name": "Generic BVOH @base", + "sub_path": "filament/Generic BVOH @base.json" + }, { "name": "Bambu PLA Matte @BBL X1C", "sub_path": "filament/Bambu PLA Matte @BBL X1C.json" @@ -1553,6 +1625,38 @@ "name": "Bambu PLA Galaxy @BBL A1M 0.2 nozzle", "sub_path": "filament/Bambu PLA Galaxy @BBL A1M 0.2 nozzle.json" }, + { + "name": "Bambu Support For PLA/PETG @BBL X1C", + "sub_path": "filament/Bambu Support For PLA-PETG @BBL X1C.json" + }, + { + "name": "Bambu Support For PLA/PETG @BBL X1C 0.2 nozzle", + "sub_path": "filament/Bambu Support For PLA-PETG @BBL X1C 0.2 nozzle.json" + }, + { + "name": "Bambu Support For PLA/PETG @BBL P1P", + "sub_path": "filament/Bambu Support For PLA-PETG @BBL P1P.json" + }, + { + "name": "Bambu Support For PLA/PETG @BBL P1P 0.2 nozzle", + "sub_path": "filament/Bambu Support For PLA-PETG @BBL P1P 0.2 nozzle.json" + }, + { + "name": "Bambu Support For PLA/PETG @BBL A1M", + "sub_path": "filament/Bambu Support For PLA-PETG @BBL A1M.json" + }, + { + "name": "Bambu Support For PLA/PETG @BBL A1M 0.2 nozzle", + "sub_path": "filament/Bambu Support For PLA-PETG @BBL A1M 0.2 nozzle.json" + }, + { + "name": "Bambu Support For PLA/PETG @BBL A1", + "sub_path": "filament/Bambu Support For PLA-PETG @BBL A1.json" + }, + { + "name": "Bambu Support For PLA/PETG @BBL A1 0.2 nozzle", + "sub_path": "filament/Bambu Support For PLA-PETG @BBL A1 0.2 nozzle.json" + }, { "name": "Bambu TPU 95A @BBL X1C", "sub_path": "filament/Bambu TPU 95A @BBL X1C.json" @@ -1761,6 +1865,18 @@ "name": "Bambu PETG Translucent @BBL A1", "sub_path": "filament/Bambu PETG Translucent @BBL A1.json" }, + { + "name": "Generic PCTG @BBL X1C", + "sub_path": "filament/Generic PCTG @BBL X1C.json" + }, + { + "name": "Generic PCTG @BBL A1", + "sub_path": "filament/Generic PCTG @BBL A1.json" + }, + { + "name": "Generic PCTG @BBL A1M", + "sub_path": "filament/Generic PCTG @BBL A1M.json" + }, { "name": "Bambu ABS @BBL X1C", "sub_path": "filament/Bambu ABS @BBL X1C.json" @@ -1829,6 +1945,18 @@ "name": "PolyLite ABS @BBL A1 0.2 nozzle", "sub_path": "filament/PolyLite ABS @BBL A1 0.2 nozzle.json" }, + { + "name": "Bambu ABS-GF @BBL X1C", + "sub_path": "filament/Bambu ABS-GF @BBL X1C.json" + }, + { + "name": "Bambu ABS-GF @BBL P1P", + "sub_path": "filament/Bambu ABS-GF @BBL P1P.json" + }, + { + "name": "Bambu ABS-GF @BBL A1", + "sub_path": "filament/Bambu ABS-GF @BBL A1.json" + }, { "name": "Bambu PC @BBL X1C", "sub_path": "filament/Bambu PC @BBL X1C.json" @@ -1957,6 +2085,18 @@ "name": "PolyLite ASA @BBL A1", "sub_path": "filament/PolyLite ASA @BBL A1.json" }, + { + "name": "Bambu ASA-Aero @BBL X1C", + "sub_path": "filament/Bambu ASA-Aero @BBL X1C.json" + }, + { + "name": "Bambu ASA-Aero @BBL P1P", + "sub_path": "filament/Bambu ASA-Aero @BBL P1P.json" + }, + { + "name": "Bambu ASA-Aero @BBL A1", + "sub_path": "filament/Bambu ASA-Aero @BBL A1.json" + }, { "name": "Generic PVA @0.2 nozzle", "sub_path": "filament/Generic PVA @0.2 nozzle.json" @@ -2093,6 +2233,18 @@ "name": "Bambu PA6-CF @BBL A1", "sub_path": "filament/Bambu PA6-CF @BBL A1.json" }, + { + "name": "Bambu PA6-GF @BBL X1C", + "sub_path": "filament/Bambu PA6-GF @BBL X1C.json" + }, + { + "name": "Bambu PA6-GF @BBL P1P", + "sub_path": "filament/Bambu PA6-GF @BBL P1P.json" + }, + { + "name": "Bambu PA6-GF @BBL A1", + "sub_path": "filament/Bambu PA6-GF @BBL A1.json" + }, { "name": "Generic HIPS @BBL X1C", "sub_path": "filament/Generic HIPS @BBL X1C.json" @@ -2141,6 +2293,94 @@ "name": "Generic PPA-GF @BBL X1E", "sub_path": "filament/Generic PPA-GF @BBL X1E.json" }, + { + "name": "Generic PE @BBL X1C", + "sub_path": "filament/Generic PE @BBL X1C.json" + }, + { + "name": "Generic PE @BBL A1", + "sub_path": "filament/Generic PE @BBL A1.json" + }, + { + "name": "Generic PE @BBL A1M", + "sub_path": "filament/Generic PE @BBL A1M.json" + }, + { + "name": "Generic PE-CF @BBL X1C", + "sub_path": "filament/Generic PE-CF @BBL X1C.json" + }, + { + "name": "Generic PE-CF @BBL A1", + "sub_path": "filament/Generic PE-CF @BBL A1.json" + }, + { + "name": "Generic PE-CF @BBL A1M", + "sub_path": "filament/Generic PE-CF @BBL A1M.json" + }, + { + "name": "Generic PP @BBL X1C", + "sub_path": "filament/Generic PP @BBL X1C.json" + }, + { + "name": "Generic PP @BBL A1", + "sub_path": "filament/Generic PP @BBL A1.json" + }, + { + "name": "Generic PP @BBL A1M", + "sub_path": "filament/Generic PP @BBL A1M.json" + }, + { + "name": "Generic PP-CF @BBL X1C", + "sub_path": "filament/Generic PP-CF @BBL X1C.json" + }, + { + "name": "Generic PP-CF @BBL A1", + "sub_path": "filament/Generic PP-CF @BBL A1.json" + }, + { + "name": "Generic PP-GF @BBL X1C", + "sub_path": "filament/Generic PP-GF @BBL X1C.json" + }, + { + "name": "Generic PP-GF @BBL A1", + "sub_path": "filament/Generic PP-GF @BBL A1.json" + }, + { + "name": "Generic EVA @BBL X1C", + "sub_path": "filament/Generic EVA @BBL X1C.json" + }, + { + "name": "Generic EVA @BBL A1", + "sub_path": "filament/Generic EVA @BBL A1.json" + }, + { + "name": "Generic EVA @BBL A1M", + "sub_path": "filament/Generic EVA @BBL A1M.json" + }, + { + "name": "Generic PHA @BBL X1C", + "sub_path": "filament/Generic PHA @BBL X1C.json" + }, + { + "name": "Generic PHA @BBL A1M", + "sub_path": "filament/Generic PHA @BBL A1M.json" + }, + { + "name": "Generic PHA @BBL A1", + "sub_path": "filament/Generic PHA @BBL A1.json" + }, + { + "name": "Generic BVOH @BBL X1C", + "sub_path": "filament/Generic BVOH @BBL X1C.json" + }, + { + "name": "Generic BVOH @BBL A1M", + "sub_path": "filament/Generic BVOH @BBL A1M.json" + }, + { + "name": "Generic BVOH @BBL A1", + "sub_path": "filament/Generic BVOH @BBL A1.json" + }, { "name": "PolyTerra PLA @BBL X1C 0.2 nozzle", "sub_path": "filament/PolyTerra PLA @BBL X1C 0.2 nozzle.json" diff --git a/resources/profiles/BBL/filament/Bambu ABS @BBL A1 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu ABS @BBL A1 0.2 nozzle.json index 352292b1ea..413d8ce795 100644 --- a/resources/profiles/BBL/filament/Bambu ABS @BBL A1 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu ABS @BBL A1 0.2 nozzle.json @@ -20,6 +20,9 @@ "reduce_fan_stop_start_freq": [ "0" ], + "slow_down_layer_time": [ + "12" + ], "textured_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/Bambu ABS @BBL A1.json b/resources/profiles/BBL/filament/Bambu ABS @BBL A1.json index 3358a7fc74..f85009c07b 100644 --- a/resources/profiles/BBL/filament/Bambu ABS @BBL A1.json +++ b/resources/profiles/BBL/filament/Bambu ABS @BBL A1.json @@ -20,6 +20,9 @@ "reduce_fan_stop_start_freq": [ "0" ], + "slow_down_layer_time": [ + "12" + ], "textured_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/Bambu ABS @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu ABS @BBL X1C 0.2 nozzle.json index 3949e18511..f21efe7f80 100644 --- a/resources/profiles/BBL/filament/Bambu ABS @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu ABS @BBL X1C 0.2 nozzle.json @@ -5,9 +5,15 @@ "from": "system", "setting_id": "GFSB00_00", "instantiation": "true", + "fan_max_speed": [ + "60" + ], "filament_max_volumetric_speed": [ "2" ], + "slow_down_layer_time": [ + "12" + ], "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", diff --git a/resources/profiles/BBL/filament/Bambu ABS @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/filament/Bambu ABS @BBL X1C 0.8 nozzle.json index 10bfd2565a..6145a910b6 100644 --- a/resources/profiles/BBL/filament/Bambu ABS @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu ABS @BBL X1C 0.8 nozzle.json @@ -5,12 +5,18 @@ "from": "system", "setting_id": "GFSB00_01", "instantiation": "true", + "fan_max_speed": [ + "60" + ], "filament_max_volumetric_speed": [ "18" ], "nozzle_temperature": [ "260" ], + "slow_down_layer_time": [ + "12" + ], "slow_down_min_speed": [ "10" ], diff --git a/resources/profiles/BBL/filament/Bambu ABS @BBL X1C.json b/resources/profiles/BBL/filament/Bambu ABS @BBL X1C.json index 80f4f7c920..88ad1a408f 100644 --- a/resources/profiles/BBL/filament/Bambu ABS @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu ABS @BBL X1C.json @@ -5,9 +5,15 @@ "from": "system", "setting_id": "GFSB00", "instantiation": "true", + "fan_max_speed": [ + "60" + ], "filament_max_volumetric_speed": [ "16" ], + "slow_down_layer_time": [ + "12" + ], "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/filament/Bambu ABS-GF @BBL A1.json b/resources/profiles/BBL/filament/Bambu ABS-GF @BBL A1.json new file mode 100644 index 0000000000..ff5f41cae7 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu ABS-GF @BBL A1.json @@ -0,0 +1,13 @@ +{ + "type": "filament", + "name": "Bambu ABS-GF @BBL A1", + "inherits": "Bambu ABS-GF @base", + "from": "system", + "setting_id": "GFSB50_02", + "instantiation": "true", + "compatible_printers": [ + "Bambu Lab A1 0.4 nozzle", + "Bambu Lab A1 0.6 nozzle", + "Bambu Lab A1 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu ABS-GF @BBL P1P.json b/resources/profiles/BBL/filament/Bambu ABS-GF @BBL P1P.json new file mode 100644 index 0000000000..37acd12522 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu ABS-GF @BBL P1P.json @@ -0,0 +1,13 @@ +{ + "type": "filament", + "name": "Bambu ABS-GF @BBL P1P", + "inherits": "Bambu ABS-GF @base", + "from": "system", + "setting_id": "GFSB50_01", + "instantiation": "true", + "compatible_printers": [ + "Bambu Lab P1P 0.8 nozzle", + "Bambu Lab P1P 0.6 nozzle", + "Bambu Lab P1P 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu ABS-GF @BBL X1C.json b/resources/profiles/BBL/filament/Bambu ABS-GF @BBL X1C.json new file mode 100644 index 0000000000..89916b17b3 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu ABS-GF @BBL X1C.json @@ -0,0 +1,22 @@ +{ + "type": "filament", + "name": "Bambu ABS-GF @BBL X1C", + "inherits": "Bambu ABS-GF @base", + "from": "system", + "setting_id": "GFSB50_00", + "instantiation": "true", + "compatible_printers": [ + "Bambu Lab P1S 0.4 nozzle", + "Bambu Lab P1S 0.6 nozzle", + "Bambu Lab P1S 0.8 nozzle", + "Bambu Lab X1 0.4 nozzle", + "Bambu Lab X1 0.6 nozzle", + "Bambu Lab X1 0.8 nozzle", + "Bambu Lab X1 Carbon 0.4 nozzle", + "Bambu Lab X1 Carbon 0.6 nozzle", + "Bambu Lab X1 Carbon 0.8 nozzle", + "Bambu Lab X1E 0.4 nozzle", + "Bambu Lab X1E 0.6 nozzle", + "Bambu Lab X1E 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu ABS-GF @base.json b/resources/profiles/BBL/filament/Bambu ABS-GF @base.json new file mode 100644 index 0000000000..777cf85080 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu ABS-GF @base.json @@ -0,0 +1,41 @@ +{ + "type": "filament", + "name": "Bambu ABS-GF @base", + "inherits": "fdm_filament_abs", + "from": "system", + "filament_id": "GFB50", + "instantiation": "false", + "fan_cooling_layer_time": [ + "12" + ], + "fan_max_speed": [ + "30" + ], + "filament_cost": [ + "29.99" + ], + "filament_density": [ + "1.08" + ], + "filament_type": [ + "ABS-GF" + ], + "filament_flow_ratio": [ + "0.95" + ], + "filament_max_volumetric_speed": [ + "12" + ], + "filament_vendor": [ + "Bambu Lab" + ], + "overhang_fan_speed": [ + "30" + ], + "overhang_fan_threshold": [ + "10%" + ], + "slow_down_layer_time": [ + "4" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu ASA @BBL A1 0.6 nozzle.json b/resources/profiles/BBL/filament/Bambu ASA @BBL A1 0.6 nozzle.json index a934418ec1..916abbfbe3 100644 --- a/resources/profiles/BBL/filament/Bambu ASA @BBL A1 0.6 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu ASA @BBL A1 0.6 nozzle.json @@ -5,9 +5,6 @@ "from": "system", "setting_id": "GFSB01_08", "instantiation": "true", - "fan_max_speed": [ - "90" - ], "fan_min_speed": [ "25" ], diff --git a/resources/profiles/BBL/filament/Bambu ASA @BBL X1 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu ASA @BBL X1 0.2 nozzle.json index abaa62c35e..90b80ac8dc 100644 --- a/resources/profiles/BBL/filament/Bambu ASA @BBL X1 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu ASA @BBL X1 0.2 nozzle.json @@ -5,9 +5,6 @@ "from": "system", "setting_id": "GFSB01_03", "instantiation": "true", - "fan_max_speed": [ - "80" - ], "filament_max_volumetric_speed": [ "2" ], diff --git a/resources/profiles/BBL/filament/Bambu ASA @BBL X1 0.6 nozzle.json b/resources/profiles/BBL/filament/Bambu ASA @BBL X1 0.6 nozzle.json index e98e02789d..5e6a6788c3 100644 --- a/resources/profiles/BBL/filament/Bambu ASA @BBL X1 0.6 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu ASA @BBL X1 0.6 nozzle.json @@ -5,9 +5,6 @@ "from": "system", "setting_id": "GFSB01_04", "instantiation": "true", - "fan_max_speed": [ - "90" - ], "fan_min_speed": [ "25" ], diff --git a/resources/profiles/BBL/filament/Bambu ASA @BBL X1C.json b/resources/profiles/BBL/filament/Bambu ASA @BBL X1C.json index 5693a2c1d0..4c9c47f1a3 100644 --- a/resources/profiles/BBL/filament/Bambu ASA @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu ASA @BBL X1C.json @@ -8,9 +8,6 @@ "fan_min_speed": [ "25" ], - "fan_max_speed": [ - "90" - ], "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", "Bambu Lab X1 Carbon 0.8 nozzle", diff --git a/resources/profiles/BBL/filament/Bambu ASA @base.json b/resources/profiles/BBL/filament/Bambu ASA @base.json index 4eb57181d1..7ae30500d9 100644 --- a/resources/profiles/BBL/filament/Bambu ASA @base.json +++ b/resources/profiles/BBL/filament/Bambu ASA @base.json @@ -5,28 +5,31 @@ "from": "system", "filament_id": "GFB01", "instantiation": "false", - "filament_density": [ - "1.05" + "fan_max_speed": [ + "35" ], "filament_cost": [ "31.99" ], - "nozzle_temperature_initial_layer": [ - "270" - ], - "nozzle_temperature": [ - "270" + "filament_density": [ + "1.05" ], "filament_flow_ratio": [ "0.95" ], - "fan_max_speed": [ - "50" - ], "filament_max_volumetric_speed": [ "18" ], "filament_vendor": [ "Bambu Lab" + ], + "nozzle_temperature": [ + "270" + ], + "nozzle_temperature_initial_layer": [ + "270" + ], + "slow_down_layer_time": [ + "12" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu ASA-Aero @BBL A1.json b/resources/profiles/BBL/filament/Bambu ASA-Aero @BBL A1.json new file mode 100644 index 0000000000..ceca584ce1 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu ASA-Aero @BBL A1.json @@ -0,0 +1,13 @@ +{ + "type": "filament", + "name": "Bambu ASA-Aero @BBL A1", + "inherits": "Bambu ASA-Aero @base", + "from": "system", + "setting_id": "GFSB02_02", + "instantiation": "true", + "compatible_printers": [ + "Bambu Lab A1 0.4 nozzle", + "Bambu Lab A1 0.6 nozzle", + "Bambu Lab A1 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu ASA-Aero @BBL P1P.json b/resources/profiles/BBL/filament/Bambu ASA-Aero @BBL P1P.json new file mode 100644 index 0000000000..03be549c97 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu ASA-Aero @BBL P1P.json @@ -0,0 +1,13 @@ +{ + "type": "filament", + "name": "Bambu ASA-Aero @BBL P1P", + "inherits": "Bambu ASA-Aero @base", + "from": "system", + "setting_id": "GFSB02_01", + "instantiation": "true", + "compatible_printers": [ + "Bambu Lab P1P 0.4 nozzle", + "Bambu Lab P1P 0.6 nozzle", + "Bambu Lab P1P 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu ASA-Aero @BBL X1C.json b/resources/profiles/BBL/filament/Bambu ASA-Aero @BBL X1C.json new file mode 100644 index 0000000000..2a0eaaa792 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu ASA-Aero @BBL X1C.json @@ -0,0 +1,22 @@ +{ + "type": "filament", + "name": "Bambu ASA-Aero @BBL X1C", + "inherits": "Bambu ASA-Aero @base", + "from": "system", + "setting_id": "GFSB02_00", + "instantiation": "true", + "compatible_printers": [ + "Bambu Lab P1S 0.4 nozzle", + "Bambu Lab P1S 0.6 nozzle", + "Bambu Lab P1S 0.8 nozzle", + "Bambu Lab X1 0.4 nozzle", + "Bambu Lab X1 0.6 nozzle", + "Bambu Lab X1 0.8 nozzle", + "Bambu Lab X1 Carbon 0.4 nozzle", + "Bambu Lab X1 Carbon 0.6 nozzle", + "Bambu Lab X1 Carbon 0.8 nozzle", + "Bambu Lab X1E 0.4 nozzle", + "Bambu Lab X1E 0.6 nozzle", + "Bambu Lab X1E 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu ASA-Aero @base.json b/resources/profiles/BBL/filament/Bambu ASA-Aero @base.json new file mode 100644 index 0000000000..f469aeebc6 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu ASA-Aero @base.json @@ -0,0 +1,62 @@ +{ + "type": "filament", + "name": "Bambu ASA-Aero @base", + "inherits": "fdm_filament_asa", + "from": "system", + "filament_id": "GFB02", + "instantiation": "false", + "fan_cooling_layer_time": [ + "30" + ], + "fan_max_speed": [ + "50" + ], + "fan_min_speed": [ + "30" + ], + "filament_cost": [ + "49.99" + ], + "filament_density": [ + "0.99" + ], + "filament_flow_ratio": [ + "0.52" + ], + "filament_max_volumetric_speed": [ + "12" + ], + "filament_retract_before_wipe": [ + "nil" + ], + "filament_retraction_length": [ + "1.5" + ], + "filament_type": [ + "ASA-Aero" + ], + "filament_vendor": [ + "Bambu Lab" + ], + "filament_wipe_distance": [ + "5" + ], + "filament_z_hop_types": [ + "Normal Lift" + ], + "nozzle_temperature": [ + "270" + ], + "nozzle_temperature_initial_layer": [ + "270" + ], + "overhang_fan_speed": [ + "50" + ], + "reduce_fan_stop_start_freq": [ + "0" + ], + "slow_down_layer_time": [ + "5" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PA6-GF @BBL A1.json b/resources/profiles/BBL/filament/Bambu PA6-GF @BBL A1.json new file mode 100644 index 0000000000..76b7da4332 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PA6-GF @BBL A1.json @@ -0,0 +1,22 @@ +{ + "type": "filament", + "name": "Bambu PA6-GF @BBL A1", + "inherits": "Bambu PA6-GF @base", + "from": "system", + "setting_id": "GFSN08_02", + "instantiation": "true", + "filament_max_volumetric_speed": [ + "10.5" + ], + "nozzle_temperature": [ + "265" + ], + "nozzle_temperature_initial_layer": [ + "265" + ], + "compatible_printers": [ + "Bambu Lab A1 0.4 nozzle", + "Bambu Lab A1 0.6 nozzle", + "Bambu Lab A1 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PA6-GF @BBL P1P.json b/resources/profiles/BBL/filament/Bambu PA6-GF @BBL P1P.json new file mode 100644 index 0000000000..d0ff9e318a --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PA6-GF @BBL P1P.json @@ -0,0 +1,22 @@ +{ + "type": "filament", + "name": "Bambu PA6-GF @BBL P1P", + "inherits": "Bambu PA6-GF @base", + "from": "system", + "setting_id": "GFSN08_01", + "instantiation": "true", + "filament_max_volumetric_speed": [ + "10.5" + ], + "nozzle_temperature": [ + "265" + ], + "nozzle_temperature_initial_layer": [ + "265" + ], + "compatible_printers": [ + "Bambu Lab P1P 0.4 nozzle", + "Bambu Lab P1P 0.6 nozzle", + "Bambu Lab P1P 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PA6-GF @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PA6-GF @BBL X1C.json new file mode 100644 index 0000000000..cf166026aa --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PA6-GF @BBL X1C.json @@ -0,0 +1,34 @@ +{ + "type": "filament", + "name": "Bambu PA6-GF @BBL X1C", + "inherits": "Bambu PA6-GF @base", + "from": "system", + "setting_id": "GFSN08_00", + "instantiation": "true", + "chamber_temperatures": [ + "60" + ], + "filament_max_volumetric_speed": [ + "10.5" + ], + "nozzle_temperature": [ + "265" + ], + "nozzle_temperature_initial_layer": [ + "265" + ], + "compatible_printers": [ + "Bambu Lab X1 Carbon 0.4 nozzle", + "Bambu Lab X1 Carbon 0.6 nozzle", + "Bambu Lab X1 Carbon 0.8 nozzle", + "Bambu Lab X1 0.4 nozzle", + "Bambu Lab X1 0.6 nozzle", + "Bambu Lab X1 0.8 nozzle", + "Bambu Lab P1S 0.4 nozzle", + "Bambu Lab P1S 0.6 nozzle", + "Bambu Lab P1S 0.8 nozzle", + "Bambu Lab X1E 0.4 nozzle", + "Bambu Lab X1E 0.6 nozzle", + "Bambu Lab X1E 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PA6-GF @base.json b/resources/profiles/BBL/filament/Bambu PA6-GF @base.json new file mode 100644 index 0000000000..24a6fa15b0 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PA6-GF @base.json @@ -0,0 +1,44 @@ +{ + "type": "filament", + "name": "Bambu PA6-GF @base", + "inherits": "fdm_filament_pa", + "from": "system", + "filament_id": "GFN08", + "instantiation": "false", + "fan_cooling_layer_time": [ + "5" + ], + "fan_max_speed": [ + "30" + ], + "fan_min_speed": [ + "10" + ], + "filament_cost": [ + "59.99" + ], + "filament_density": [ + "1.14" + ], + "filament_flow_ratio": [ + "0.96" + ], + "filament_type": [ + "PA-GF" + ], + "filament_vendor": [ + "Bambu Lab" + ], + "full_fan_speed_layer": [ + "2" + ], + "overhang_fan_speed": [ + "40" + ], + "overhang_fan_threshold": [ + "0%" + ], + "temperature_vitrification": [ + "180" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PC @BBL A1 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PC @BBL A1 0.2 nozzle.json index 3a65f1d44c..790ddb7c4a 100644 --- a/resources/profiles/BBL/filament/Bambu PC @BBL A1 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PC @BBL A1 0.2 nozzle.json @@ -29,6 +29,9 @@ "reduce_fan_stop_start_freq": [ "0" ], + "slow_down_layer_time": [ + "12" + ], "textured_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/Bambu PC @BBL A1.json b/resources/profiles/BBL/filament/Bambu PC @BBL A1.json index 5d291b7b7c..fa10655ee8 100644 --- a/resources/profiles/BBL/filament/Bambu PC @BBL A1.json +++ b/resources/profiles/BBL/filament/Bambu PC @BBL A1.json @@ -23,6 +23,9 @@ "reduce_fan_stop_start_freq": [ "0" ], + "slow_down_layer_time": [ + "12" + ], "textured_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.2 nozzle.json index 31d13f48e8..fd33b77786 100644 --- a/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.2 nozzle.json @@ -5,12 +5,18 @@ "from": "system", "setting_id": "GFSC00_02", "instantiation": "true", + "fan_max_speed": [ + "40" + ], "filament_max_volumetric_speed": [ "1" ], "nozzle_temperature": [ "260" ], + "slow_down_layer_time": [ + "12" + ], "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle" diff --git a/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.6 nozzle.json b/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.6 nozzle.json index 3b5399efa2..ec8d95d22f 100644 --- a/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.6 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.6 nozzle.json @@ -5,9 +5,15 @@ "from": "system", "setting_id": "GFSC00_01", "instantiation": "true", + "fan_max_speed": [ + "40" + ], "nozzle_temperature": [ "260" ], + "slow_down_layer_time": [ + "12" + ], "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", "Bambu Lab X1 0.6 nozzle" diff --git a/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.8 nozzle.json index b1cc742c2c..6cd58cc061 100644 --- a/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.8 nozzle.json @@ -5,9 +5,15 @@ "from": "system", "setting_id": "GFSC00_00", "instantiation": "true", + "fan_max_speed": [ + "40" + ], "nozzle_temperature": [ "260" ], + "slow_down_layer_time": [ + "12" + ], "compatible_printers": [ "Bambu Lab X1 Carbon 0.8 nozzle", "Bambu Lab X1 0.8 nozzle" diff --git a/resources/profiles/BBL/filament/Bambu PC @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PC @BBL X1C.json index 7ee2131465..cccf6aad59 100644 --- a/resources/profiles/BBL/filament/Bambu PC @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PC @BBL X1C.json @@ -5,6 +5,12 @@ "from": "system", "setting_id": "GFSC00", "instantiation": "true", + "fan_max_speed": [ + "40" + ], + "slow_down_layer_time": [ + "12" + ], "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle" diff --git a/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C 0.2 nozzle.json index c7dd9923cd..24857fa2e0 100644 --- a/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C 0.2 nozzle.json @@ -8,6 +8,12 @@ "filament_max_volumetric_speed": [ "1" ], + "filament_long_retractions_when_cut": [ + "1" + ], + "filament_retraction_distances_when_cut": [ + "18" + ], "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", diff --git a/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C 0.8 nozzle.json index 0a24cb5a1a..73d7aab022 100644 --- a/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C 0.8 nozzle.json @@ -11,6 +11,12 @@ "fan_min_speed": [ "20" ], + "filament_long_retractions_when_cut": [ + "1" + ], + "filament_retraction_distances_when_cut": [ + "18" + ], "filament_max_volumetric_speed": [ "16" ], diff --git a/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C.json index d68745bb17..18b87c5879 100644 --- a/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C.json @@ -8,6 +8,12 @@ "filament_max_volumetric_speed": [ "13" ], + "filament_long_retractions_when_cut": [ + "1" + ], + "filament_retraction_distances_when_cut": [ + "18" + ], "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/filament/Bambu PLA Aero @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA Aero @BBL X1C.json index f3160585a6..fd83a7dfdf 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Aero @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA Aero @BBL X1C.json @@ -21,5 +21,8 @@ "Bambu Lab X1E 0.4 nozzle", "Bambu Lab X1E 0.6 nozzle", "Bambu Lab X1E 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1.json b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1.json index 3a70c808a4..6f016020a4 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1.json +++ b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1.json @@ -8,6 +8,12 @@ "filament_max_volumetric_speed": [ "21" ], + "filament_long_retractions_when_cut": [ + "1" + ], + "filament_retraction_distances_when_cut": [ + "18" + ], "slow_down_layer_time": [ "8" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C 0.2 nozzle.json index ddaeb7a616..0ef0264d43 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C 0.2 nozzle.json @@ -5,6 +5,12 @@ "from": "system", "setting_id": "GFSA00_00", "instantiation": "true", + "filament_long_retractions_when_cut": [ + "1" + ], + "filament_retraction_distances_when_cut": [ + "18" + ], "filament_max_volumetric_speed": [ "2" ], @@ -13,5 +19,8 @@ "Bambu Lab X1 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle", "Bambu Lab X1E 0.2 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C 0.8 nozzle.json index d8d8307fc0..671e010328 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C 0.8 nozzle.json @@ -8,9 +8,18 @@ "filament_max_volumetric_speed": [ "21" ], + "filament_long_retractions_when_cut": [ + "1" + ], + "filament_retraction_distances_when_cut": [ + "18" + ], "compatible_printers": [ "Bambu Lab X1 Carbon 0.8 nozzle", "Bambu Lab P1S 0.8 nozzle", "Bambu Lab X1E 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C.json index 2cb005d6f5..8619d452d7 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C.json @@ -8,6 +8,12 @@ "filament_max_volumetric_speed": [ "21" ], + "filament_long_retractions_when_cut": [ + "1" + ], + "filament_retraction_distances_when_cut": [ + "18" + ], "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 Carbon 0.6 nozzle", @@ -15,5 +21,8 @@ "Bambu Lab P1S 0.6 nozzle", "Bambu Lab X1E 0.4 nozzle", "Bambu Lab X1E 0.6 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Dynamic @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Dynamic @BBL X1C 0.2 nozzle.json index 68496df697..fb09d370f5 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Dynamic @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA Dynamic @BBL X1C 0.2 nozzle.json @@ -19,5 +19,8 @@ "Bambu Lab X1 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle", "Bambu Lab X1E 0.2 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Dynamic @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Dynamic @BBL X1C 0.8 nozzle.json index 3a18c1f6f0..029cc864be 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Dynamic @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA Dynamic @BBL X1C 0.8 nozzle.json @@ -19,5 +19,8 @@ "Bambu Lab P1S 0.8 nozzle", "Bambu Lab X1E 0.8 nozzle", "Bambu Lab X1 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Dynamic @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA Dynamic @BBL X1C.json index 608465d6d6..ff52a275ee 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Dynamic @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA Dynamic @BBL X1C.json @@ -23,5 +23,8 @@ "Bambu Lab X1E 0.6 nozzle", "Bambu Lab X1 0.4 nozzle", "Bambu Lab X1 0.6 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Galaxy @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Galaxy @BBL X1C 0.2 nozzle.json index 9251208bdf..7bb8e8f94b 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Galaxy @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA Galaxy @BBL X1C 0.2 nozzle.json @@ -13,5 +13,8 @@ "Bambu Lab X1 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle", "Bambu Lab X1E 0.2 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Galaxy @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Galaxy @BBL X1C 0.8 nozzle.json index b3e250b6eb..43457c192d 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Galaxy @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA Galaxy @BBL X1C 0.8 nozzle.json @@ -10,5 +10,8 @@ "Bambu Lab P1S 0.8 nozzle", "Bambu Lab X1E 0.8 nozzle", "Bambu Lab X1 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Galaxy @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA Galaxy @BBL X1C.json index cf3e399b37..d95ffa6a6d 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Galaxy @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA Galaxy @BBL X1C.json @@ -14,5 +14,8 @@ "Bambu Lab X1E 0.6 nozzle", "Bambu Lab X1 0.4 nozzle", "Bambu Lab X1 0.6 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Glow @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA Glow @BBL X1C.json index 115adb144a..5d0c2705a7 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Glow @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA Glow @BBL X1C.json @@ -12,5 +12,8 @@ "Bambu Lab P1S 0.8 nozzle", "Bambu Lab P1S 0.6 nozzle", "Bambu Lab P1S 0.4 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Glow @BBL X1E.json b/resources/profiles/BBL/filament/Bambu PLA Glow @BBL X1E.json index 51137bdeec..30c339132c 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Glow @BBL X1E.json +++ b/resources/profiles/BBL/filament/Bambu PLA Glow @BBL X1E.json @@ -9,5 +9,8 @@ "Bambu Lab X1E 0.4 nozzle", "Bambu Lab X1E 0.6 nozzle", "Bambu Lab X1E 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Impact @base.json b/resources/profiles/BBL/filament/Bambu PLA Impact @base.json index 7cdc6f3e42..029a5f66a3 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Impact @base.json +++ b/resources/profiles/BBL/filament/Bambu PLA Impact @base.json @@ -5,13 +5,16 @@ "from": "system", "filament_id": "GFA03", "instantiation": "false", - "filament_vendor": [ - "Bambu Lab" - ], "filament_cost": [ "25.4" ], "filament_flow_ratio": [ "0.95" + ], + "filament_vendor": [ + "Bambu Lab" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Marble @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA Marble @BBL X1C.json index 4199fd943d..29592f9b4f 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Marble @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA Marble @BBL X1C.json @@ -15,5 +15,8 @@ "Bambu Lab X1E 0.4 nozzle", "Bambu Lab X1E 0.6 nozzle", "Bambu Lab X1E 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1.json b/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1.json index 7721eacbc8..c0b3df5555 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1.json +++ b/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1.json @@ -15,5 +15,8 @@ "Bambu Lab X1 0.4 nozzle", "Bambu Lab X1 0.6 nozzle", "Bambu Lab X1 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C 0.2 nozzle.json index 824e96a5e3..04b51f8104 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C 0.2 nozzle.json @@ -13,5 +13,8 @@ "Bambu Lab X1 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle", "Bambu Lab X1E 0.2 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C 0.8 nozzle.json index 7e2d1f4fc9..fc0962cd0e 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C 0.8 nozzle.json @@ -12,5 +12,8 @@ "Bambu Lab X1 Carbon 0.8 nozzle", "Bambu Lab P1S 0.8 nozzle", "Bambu Lab X1E 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C.json index a7e1e76634..0987393ec6 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C.json @@ -15,5 +15,8 @@ "Bambu Lab P1S 0.6 nozzle", "Bambu Lab X1E 0.4 nozzle", "Bambu Lab X1E 0.6 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Metal @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Metal @BBL X1C 0.2 nozzle.json index 7ed6ab8f3e..8a1934d52a 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Metal @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA Metal @BBL X1C 0.2 nozzle.json @@ -13,5 +13,8 @@ "Bambu Lab X1 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle", "Bambu Lab X1E 0.2 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Metal @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA Metal @BBL X1C.json index 91995ef069..81e5b51d60 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Metal @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA Metal @BBL X1C.json @@ -18,5 +18,8 @@ "Bambu Lab X1E 0.4 nozzle", "Bambu Lab X1E 0.6 nozzle", "Bambu Lab X1E 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Silk @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Silk @BBL X1C 0.2 nozzle.json index 85c560fcdb..31478a9988 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Silk @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA Silk @BBL X1C 0.2 nozzle.json @@ -13,5 +13,8 @@ "Bambu Lab X1 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle", "Bambu Lab X1E 0.2 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Silk @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA Silk @BBL X1C.json index 5d75934310..33d9312ab2 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Silk @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA Silk @BBL X1C.json @@ -15,5 +15,8 @@ "Bambu Lab X1E 0.4 nozzle", "Bambu Lab X1E 0.6 nozzle", "Bambu Lab X1E 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Sparkle @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA Sparkle @BBL X1C.json index fdc02d06c5..40ef931764 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Sparkle @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA Sparkle @BBL X1C.json @@ -15,5 +15,8 @@ "Bambu Lab X1E 0.4 nozzle", "Bambu Lab X1E 0.6 nozzle", "Bambu Lab X1E 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Tough @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Tough @BBL X1C 0.2 nozzle.json index eb6f63a2f3..ea19cfcc5e 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Tough @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA Tough @BBL X1C 0.2 nozzle.json @@ -13,5 +13,8 @@ "Bambu Lab X1 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle", "Bambu Lab X1E 0.2 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Tough @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA Tough @BBL X1C.json index 418cc8f9ca..d2b9a46030 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Tough @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA Tough @BBL X1C.json @@ -18,5 +18,8 @@ "Bambu Lab X1E 0.4 nozzle", "Bambu Lab X1E 0.6 nozzle", "Bambu Lab X1E 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA-CF @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA-CF @BBL X1C 0.8 nozzle.json index 3b5c25a41f..204237570b 100644 --- a/resources/profiles/BBL/filament/Bambu PLA-CF @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA-CF @BBL X1C 0.8 nozzle.json @@ -23,5 +23,8 @@ "Bambu Lab P1S 0.8 nozzle", "Bambu Lab X1E 0.6 nozzle", "Bambu Lab X1E 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA-CF @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA-CF @BBL X1C.json index c917e0745a..2e4aa2e93c 100644 --- a/resources/profiles/BBL/filament/Bambu PLA-CF @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA-CF @BBL X1C.json @@ -19,5 +19,8 @@ "Bambu Lab X1 0.4 nozzle", "Bambu Lab P1S 0.4 nozzle", "Bambu Lab X1E 0.4 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\nM142 P1 R35 S40\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL A1 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL A1 0.2 nozzle.json new file mode 100644 index 0000000000..52f12d83ed --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL A1 0.2 nozzle.json @@ -0,0 +1,32 @@ +{ + "type": "filament", + "name": "Bambu Support For PLA/PETG @BBL A1 0.2 nozzle", + "inherits": "Bambu Support For PLA/PETG @base", + "from": "system", + "setting_id": "GFSS05_07", + "instantiation": "true", + "eng_plate_temp": [ + "65" + ], + "eng_plate_temp_initial_layer": [ + "65" + ], + "filament_max_volumetric_speed": [ + "0.5" + ], + "hot_plate_temp": [ + "65" + ], + "hot_plate_temp_initial_layer": [ + "65" + ], + "textured_plate_temp": [ + "65" + ], + "textured_plate_temp_initial_layer": [ + "65" + ], + "compatible_printers": [ + "Bambu Lab A1 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL A1.json b/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL A1.json new file mode 100644 index 0000000000..cc081f215f --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL A1.json @@ -0,0 +1,31 @@ +{ + "type": "filament", + "name": "Bambu Support For PLA/PETG @BBL A1", + "inherits": "Bambu Support For PLA/PETG @base", + "from": "system", + "setting_id": "GFSS05_06", + "instantiation": "true", + "eng_plate_temp": [ + "65" + ], + "eng_plate_temp_initial_layer": [ + "65" + ], + "hot_plate_temp": [ + "65" + ], + "hot_plate_temp_initial_layer": [ + "65" + ], + "textured_plate_temp": [ + "65" + ], + "textured_plate_temp_initial_layer": [ + "65" + ], + "compatible_printers": [ + "Bambu Lab A1 0.4 nozzle", + "Bambu Lab A1 0.6 nozzle", + "Bambu Lab A1 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL A1M 0.2 nozzle.json new file mode 100644 index 0000000000..e896919e4e --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL A1M 0.2 nozzle.json @@ -0,0 +1,32 @@ +{ + "type": "filament", + "name": "Bambu Support For PLA/PETG @BBL A1M 0.2 nozzle", + "inherits": "Bambu Support For PLA/PETG @base", + "from": "system", + "setting_id": "GFSS05_05", + "instantiation": "true", + "eng_plate_temp": [ + "65" + ], + "eng_plate_temp_initial_layer": [ + "65" + ], + "filament_max_volumetric_speed": [ + "0.5" + ], + "hot_plate_temp": [ + "65" + ], + "hot_plate_temp_initial_layer": [ + "65" + ], + "textured_plate_temp": [ + "65" + ], + "textured_plate_temp_initial_layer": [ + "65" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL A1M.json b/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL A1M.json new file mode 100644 index 0000000000..ad2bc888ac --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL A1M.json @@ -0,0 +1,31 @@ +{ + "type": "filament", + "name": "Bambu Support For PLA/PETG @BBL A1M", + "inherits": "Bambu Support For PLA/PETG @base", + "from": "system", + "setting_id": "GFSS05_04", + "instantiation": "true", + "eng_plate_temp": [ + "65" + ], + "eng_plate_temp_initial_layer": [ + "65" + ], + "hot_plate_temp": [ + "65" + ], + "hot_plate_temp_initial_layer": [ + "65" + ], + "textured_plate_temp": [ + "65" + ], + "textured_plate_temp_initial_layer": [ + "65" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL P1P 0.2 nozzle.json new file mode 100644 index 0000000000..0352dc891a --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL P1P 0.2 nozzle.json @@ -0,0 +1,32 @@ +{ + "type": "filament", + "name": "Bambu Support For PLA/PETG @BBL P1P 0.2 nozzle", + "inherits": "Bambu Support For PLA/PETG @base", + "from": "system", + "setting_id": "GFSS05_03", + "instantiation": "true", + "eng_plate_temp": [ + "65" + ], + "eng_plate_temp_initial_layer": [ + "65" + ], + "filament_max_volumetric_speed": [ + "0.5" + ], + "hot_plate_temp": [ + "65" + ], + "hot_plate_temp_initial_layer": [ + "65" + ], + "textured_plate_temp": [ + "65" + ], + "textured_plate_temp_initial_layer": [ + "65" + ], + "compatible_printers": [ + "Bambu Lab P1P 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL P1P.json b/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL P1P.json new file mode 100644 index 0000000000..1f47df1ec9 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL P1P.json @@ -0,0 +1,31 @@ +{ + "type": "filament", + "name": "Bambu Support For PLA/PETG @BBL P1P", + "inherits": "Bambu Support For PLA/PETG @base", + "from": "system", + "setting_id": "GFSS05_02", + "instantiation": "true", + "eng_plate_temp": [ + "65" + ], + "eng_plate_temp_initial_layer": [ + "65" + ], + "hot_plate_temp": [ + "65" + ], + "hot_plate_temp_initial_layer": [ + "65" + ], + "textured_plate_temp": [ + "65" + ], + "textured_plate_temp_initial_layer": [ + "65" + ], + "compatible_printers": [ + "Bambu Lab P1P 0.4 nozzle", + "Bambu Lab P1P 0.6 nozzle", + "Bambu Lab P1P 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL X1C 0.2 nozzle.json new file mode 100644 index 0000000000..fa58a048a7 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL X1C 0.2 nozzle.json @@ -0,0 +1,23 @@ +{ + "type": "filament", + "name": "Bambu Support For PLA/PETG @BBL X1C 0.2 nozzle", + "inherits": "Bambu Support For PLA/PETG @base", + "from": "system", + "setting_id": "GFSS05_01", + "instantiation": "true", + "eng_plate_temp": [ + "60" + ], + "eng_plate_temp_initial_layer": [ + "60" + ], + "filament_max_volumetric_speed": [ + "0.5" + ], + "compatible_printers": [ + "Bambu Lab P1S 0.2 nozzle", + "Bambu Lab X1 0.2 nozzle", + "Bambu Lab X1 Carbon 0.2 nozzle", + "Bambu Lab X1E 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL X1C.json b/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL X1C.json new file mode 100644 index 0000000000..8672833ea7 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @BBL X1C.json @@ -0,0 +1,28 @@ +{ + "type": "filament", + "name": "Bambu Support For PLA/PETG @BBL X1C", + "inherits": "Bambu Support For PLA/PETG @base", + "from": "system", + "setting_id": "GFSS05_00", + "instantiation": "true", + "eng_plate_temp": [ + "60" + ], + "eng_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab P1S 0.4 nozzle", + "Bambu Lab P1S 0.6 nozzle", + "Bambu Lab P1S 0.8 nozzle", + "Bambu Lab X1 0.4 nozzle", + "Bambu Lab X1 0.6 nozzle", + "Bambu Lab X1 0.8 nozzle", + "Bambu Lab X1 Carbon 0.4 nozzle", + "Bambu Lab X1 Carbon 0.6 nozzle", + "Bambu Lab X1 Carbon 0.8 nozzle", + "Bambu Lab X1E 0.4 nozzle", + "Bambu Lab X1E 0.6 nozzle", + "Bambu Lab X1E 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @base.json b/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @base.json new file mode 100644 index 0000000000..4e62835862 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu Support For PLA-PETG @base.json @@ -0,0 +1,53 @@ +{ + "type": "filament", + "name": "Bambu Support For PLA/PETG @base", + "inherits": "fdm_filament_pla", + "from": "system", + "filament_id": "GFS05", + "instantiation": "false", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "30" + ], + "fan_min_speed": [ + "20" + ], + "filament_cost": [ + "69.98" + ], + "filament_density": [ + "1.19" + ], + "filament_is_support": [ + "1" + ], + "filament_max_volumetric_speed": [ + "6" + ], + "filament_vendor": [ + "Bambu Lab" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "nozzle_temperature": [ + "210" + ], + "nozzle_temperature_initial_layer": [ + "210" + ], + "slow_down_layer_time": [ + "8" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic BVOH @BBL A1.json b/resources/profiles/BBL/filament/Generic BVOH @BBL A1.json new file mode 100644 index 0000000000..c719bc4f8d --- /dev/null +++ b/resources/profiles/BBL/filament/Generic BVOH @BBL A1.json @@ -0,0 +1,13 @@ +{ + "type": "filament", + "name": "Generic BVOH @BBL A1", + "inherits": "Generic BVOH @base", + "from": "system", + "setting_id": "GFSS97_02", + "instantiation": "true", + "compatible_printers": [ + "Bambu Lab A1 0.4 nozzle", + "Bambu Lab A1 0.6 nozzle", + "Bambu Lab A1 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic BVOH @BBL A1M.json b/resources/profiles/BBL/filament/Generic BVOH @BBL A1M.json new file mode 100644 index 0000000000..c7c2bb1fbc --- /dev/null +++ b/resources/profiles/BBL/filament/Generic BVOH @BBL A1M.json @@ -0,0 +1,13 @@ +{ + "type": "filament", + "name": "Generic BVOH @BBL A1M", + "inherits": "Generic BVOH @base", + "from": "system", + "setting_id": "GFSS97_01", + "instantiation": "true", + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic BVOH @BBL X1C.json b/resources/profiles/BBL/filament/Generic BVOH @BBL X1C.json new file mode 100644 index 0000000000..12205f9c9a --- /dev/null +++ b/resources/profiles/BBL/filament/Generic BVOH @BBL X1C.json @@ -0,0 +1,25 @@ +{ + "type": "filament", + "name": "Generic BVOH @BBL X1C", + "inherits": "Generic BVOH @base", + "from": "system", + "setting_id": "GFSS97_00", + "instantiation": "true", + "compatible_printers": [ + "Bambu Lab X1 Carbon 0.4 nozzle", + "Bambu Lab X1 Carbon 0.6 nozzle", + "Bambu Lab X1 Carbon 0.8 nozzle", + "Bambu Lab X1E 0.4 nozzle", + "Bambu Lab X1E 0.6 nozzle", + "Bambu Lab X1E 0.8 nozzle", + "Bambu Lab X1 0.4 nozzle", + "Bambu Lab X1 0.6 nozzle", + "Bambu Lab X1 0.8 nozzle", + "Bambu Lab P1S 0.4 nozzle", + "Bambu Lab P1S 0.6 nozzle", + "Bambu Lab P1S 0.8 nozzle", + "Bambu Lab P1P 0.4 nozzle", + "Bambu Lab P1P 0.6 nozzle", + "Bambu Lab P1P 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic BVOH @base.json b/resources/profiles/BBL/filament/Generic BVOH @base.json new file mode 100644 index 0000000000..34b3d72d1a --- /dev/null +++ b/resources/profiles/BBL/filament/Generic BVOH @base.json @@ -0,0 +1,8 @@ +{ + "type": "filament", + "name": "Generic BVOH @base", + "inherits": "fdm_filament_bvoh", + "from": "system", + "filament_id": "GFS97", + "instantiation": "false" +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic EVA @BBL A1.json b/resources/profiles/BBL/filament/Generic EVA @BBL A1.json new file mode 100644 index 0000000000..1090e57594 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic EVA @BBL A1.json @@ -0,0 +1,14 @@ +{ + "type": "filament", + "name": "Generic EVA @BBL A1", + "inherits": "Generic EVA @base", + "from": "system", + "setting_id": "GFSR99_01", + "instantiation": "true", + "description": "This is neither a commonly used filament, nor one of Bambu filaments, and it varies a lot from brand to brand. So, it's highly recommended to ask its vendor for suitable profile before printing and adjust some parameters according to its performances.", + "compatible_printers": [ + "Bambu Lab A1 0.4 nozzle", + "Bambu Lab A1 0.6 nozzle", + "Bambu Lab A1 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic EVA @BBL A1M.json b/resources/profiles/BBL/filament/Generic EVA @BBL A1M.json new file mode 100644 index 0000000000..9d903da18d --- /dev/null +++ b/resources/profiles/BBL/filament/Generic EVA @BBL A1M.json @@ -0,0 +1,14 @@ +{ + "type": "filament", + "name": "Generic EVA @BBL A1M", + "inherits": "Generic EVA @base", + "from": "system", + "setting_id": "GFSR99_02", + "instantiation": "true", + "description": "This is neither a commonly used filament, nor one of Bambu filaments, and it varies a lot from brand to brand. So, it's highly recommended to ask its vendor for suitable profile before printing and adjust some parameters according to its performances.", + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.8 nozzle", + "Bambu Lab A1 mini 0.6 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic EVA @BBL X1C.json b/resources/profiles/BBL/filament/Generic EVA @BBL X1C.json new file mode 100644 index 0000000000..c10fe78b5e --- /dev/null +++ b/resources/profiles/BBL/filament/Generic EVA @BBL X1C.json @@ -0,0 +1,26 @@ +{ + "type": "filament", + "name": "Generic EVA @BBL X1C", + "inherits": "Generic EVA @base", + "from": "system", + "setting_id": "GFSR99_00", + "instantiation": "true", + "description": "This is neither a commonly used filament, nor one of Bambu filaments, and it varies a lot from brand to brand. So, it's highly recommended to ask its vendor for suitable profile before printing and adjust some parameters according to its performances.", + "compatible_printers": [ + "Bambu Lab P1P 0.4 nozzle", + "Bambu Lab P1P 0.6 nozzle", + "Bambu Lab P1P 0.8 nozzle", + "Bambu Lab P1S 0.4 nozzle", + "Bambu Lab P1S 0.6 nozzle", + "Bambu Lab P1S 0.8 nozzle", + "Bambu Lab X1 0.4 nozzle", + "Bambu Lab X1 0.6 nozzle", + "Bambu Lab X1 0.8 nozzle", + "Bambu Lab X1 Carbon 0.4 nozzle", + "Bambu Lab X1 Carbon 0.6 nozzle", + "Bambu Lab X1 Carbon 0.8 nozzle", + "Bambu Lab X1E 0.4 nozzle", + "Bambu Lab X1E 0.6 nozzle", + "Bambu Lab X1E 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic EVA @base.json b/resources/profiles/BBL/filament/Generic EVA @base.json new file mode 100644 index 0000000000..6a24cfdba5 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic EVA @base.json @@ -0,0 +1,86 @@ +{ + "type": "filament", + "name": "Generic EVA @base", + "inherits": "fdm_filament_eva", + "from": "system", + "filament_id": "GFR99", + "instantiation": "false", + "additional_cooling_fan_speed": [ + "70" + ], + "close_fan_the_first_x_layers": [ + "1" + ], + "cool_plate_temp": [ + "35" + ], + "cool_plate_temp_initial_layer": [ + "35" + ], + "eng_plate_temp": [ + "0" + ], + "eng_plate_temp_initial_layer": [ + "0" + ], + "fan_cooling_layer_time": [ + "100" + ], + "fan_min_speed": [ + "100" + ], + "filament_cost": [ + "21.99" + ], + "filament_density": [ + "0.94" + ], + "filament_max_volumetric_speed": [ + "12" + ], + "filament_type": [ + "EVA" + ], + "hot_plate_temp": [ + "55" + ], + "hot_plate_temp_initial_layer": [ + "55" + ], + "nozzle_temperature": [ + "210" + ], + "nozzle_temperature_initial_layer": [ + "210" + ], + "nozzle_temperature_range_high": [ + "220" + ], + "nozzle_temperature_range_low": [ + "175" + ], + "overhang_fan_threshold": [ + "50%" + ], + "reduce_fan_stop_start_freq": [ + "1" + ], + "slow_down_layer_time": [ + "4" + ], + "slow_down_min_speed": [ + "20" + ], + "temperature_vitrification": [ + "70" + ], + "textured_plate_temp": [ + "55" + ], + "textured_plate_temp_initial_layer": [ + "55" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PCTG @BBL A1.json b/resources/profiles/BBL/filament/Generic PCTG @BBL A1.json new file mode 100644 index 0000000000..0d7ddda1cb --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PCTG @BBL A1.json @@ -0,0 +1,13 @@ +{ + "type": "filament", + "name": "Generic PCTG @BBL A1", + "inherits": "Generic PCTG @base", + "from": "system", + "setting_id": "GFSG97_01", + "instantiation": "true", + "compatible_printers": [ + "Bambu Lab A1 0.4 nozzle", + "Bambu Lab A1 0.6 nozzle", + "Bambu Lab A1 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PCTG @BBL A1M.json b/resources/profiles/BBL/filament/Generic PCTG @BBL A1M.json new file mode 100644 index 0000000000..3f02a3a3e8 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PCTG @BBL A1M.json @@ -0,0 +1,13 @@ +{ + "type": "filament", + "name": "Generic PCTG @BBL A1M", + "inherits": "Generic PCTG @base", + "from": "system", + "setting_id": "GFSG97_02", + "instantiation": "true", + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PCTG @BBL X1C.json b/resources/profiles/BBL/filament/Generic PCTG @BBL X1C.json new file mode 100644 index 0000000000..e7802ed3d7 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PCTG @BBL X1C.json @@ -0,0 +1,25 @@ +{ + "type": "filament", + "name": "Generic PCTG @BBL X1C", + "inherits": "Generic PCTG @base", + "from": "system", + "setting_id": "GFSG97_00", + "instantiation": "true", + "compatible_printers": [ + "Bambu Lab P1P 0.4 nozzle", + "Bambu Lab P1P 0.6 nozzle", + "Bambu Lab P1P 0.8 nozzle", + "Bambu Lab P1S 0.4 nozzle", + "Bambu Lab P1S 0.6 nozzle", + "Bambu Lab P1S 0.8 nozzle", + "Bambu Lab X1 0.4 nozzle", + "Bambu Lab X1 0.6 nozzle", + "Bambu Lab X1 0.8 nozzle", + "Bambu Lab X1 Carbon 0.4 nozzle", + "Bambu Lab X1 Carbon 0.6 nozzle", + "Bambu Lab X1 Carbon 0.8 nozzle", + "Bambu Lab X1E 0.4 nozzle", + "Bambu Lab X1E 0.6 nozzle", + "Bambu Lab X1E 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PCTG @base.json b/resources/profiles/BBL/filament/Generic PCTG @base.json new file mode 100644 index 0000000000..ca51974e25 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PCTG @base.json @@ -0,0 +1,74 @@ +{ + "type": "filament", + "name": "Generic PCTG @base", + "inherits": "fdm_filament_pet", + "from": "system", + "filament_id": "GFG97", + "instantiation": "false", + "cool_plate_temp": [ + "0" + ], + "cool_plate_temp_initial_layer": [ + "0" + ], + "eng_plate_temp": [ + "70" + ], + "eng_plate_temp_initial_layer": [ + "70" + ], + "fan_cooling_layer_time": [ + "30" + ], + "fan_max_speed": [ + "40" + ], + "fan_min_speed": [ + "10" + ], + "filament_cost": [ + "28.99" + ], + "filament_density": [ + "1.29" + ], + "filament_flow_ratio": [ + "0.95" + ], + "filament_max_volumetric_speed": [ + "6" + ], + "hot_plate_temp": [ + "70" + ], + "hot_plate_temp_initial_layer": [ + "70" + ], + "nozzle_temperature_range_high": [ + "270" + ], + "nozzle_temperature_range_low": [ + "240" + ], + "overhang_fan_speed": [ + "90" + ], + "overhang_fan_threshold": [ + "10%" + ], + "slow_down_layer_time": [ + "12" + ], + "temperature_vitrification": [ + "90" + ], + "textured_plate_temp": [ + "70" + ], + "textured_plate_temp_initial_layer": [ + "70" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >80)||(bed_temperature_initial_layer[current_extruder] >80)}M106 P3 S255\n{elsif (bed_temperature[current_extruder] >60)||(bed_temperature_initial_layer[current_extruder] >60)}M106 P3 S180\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PE @BBL A1.json b/resources/profiles/BBL/filament/Generic PE @BBL A1.json new file mode 100644 index 0000000000..39e2445109 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PE @BBL A1.json @@ -0,0 +1,14 @@ +{ + "type": "filament", + "name": "Generic PE @BBL A1", + "inherits": "Generic PE @base", + "from": "system", + "setting_id": "GFSP99_01", + "instantiation": "true", + "description": "This is neither a commonly used filament, nor one of Bambu filaments, and it varies a lot from brand to brand. So, it's highly recommended to ask its vendor for suitable profile before printing and adjust some parameters according to its performances.", + "compatible_printers": [ + "Bambu Lab A1 0.4 nozzle", + "Bambu Lab A1 0.6 nozzle", + "Bambu Lab A1 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PE @BBL A1M.json b/resources/profiles/BBL/filament/Generic PE @BBL A1M.json new file mode 100644 index 0000000000..c1127d4123 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PE @BBL A1M.json @@ -0,0 +1,14 @@ +{ + "type": "filament", + "name": "Generic PE @BBL A1M", + "inherits": "Generic PE @base", + "from": "system", + "setting_id": "GFSP99_02", + "instantiation": "true", + "description": "This is neither a commonly used filament, nor one of Bambu filaments, and it varies a lot from brand to brand. So, it's highly recommended to ask its vendor for suitable profile before printing and adjust some parameters according to its performances.", + "compatible_printers": [ + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PE @BBL X1C.json b/resources/profiles/BBL/filament/Generic PE @BBL X1C.json new file mode 100644 index 0000000000..da34e44a63 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PE @BBL X1C.json @@ -0,0 +1,26 @@ +{ + "type": "filament", + "name": "Generic PE @BBL X1C", + "inherits": "Generic PE @base", + "from": "system", + "setting_id": "GFSP99_00", + "instantiation": "true", + "description": "This is neither a commonly used filament, nor one of Bambu filaments, and it varies a lot from brand to brand. So, it's highly recommended to ask its vendor for suitable profile before printing and adjust some parameters according to its performances.", + "compatible_printers": [ + "Bambu Lab P1P 0.4 nozzle", + "Bambu Lab P1P 0.6 nozzle", + "Bambu Lab P1P 0.8 nozzle", + "Bambu Lab P1S 0.4 nozzle", + "Bambu Lab P1S 0.6 nozzle", + "Bambu Lab P1S 0.8 nozzle", + "Bambu Lab X1 0.4 nozzle", + "Bambu Lab X1 0.6 nozzle", + "Bambu Lab X1 0.8 nozzle", + "Bambu Lab X1 Carbon 0.4 nozzle", + "Bambu Lab X1 Carbon 0.6 nozzle", + "Bambu Lab X1 Carbon 0.8 nozzle", + "Bambu Lab X1E 0.4 nozzle", + "Bambu Lab X1E 0.6 nozzle", + "Bambu Lab X1E 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PE @base.json b/resources/profiles/BBL/filament/Generic PE @base.json new file mode 100644 index 0000000000..c93659062f --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PE @base.json @@ -0,0 +1,35 @@ +{ + "type": "filament", + "name": "Generic PE @base", + "inherits": "fdm_filament_pe", + "from": "system", + "filament_id": "GFP99", + "instantiation": "false", + "filament_cost": [ + "40.99" + ], + "filament_density": [ + "0.95" + ], + "filament_max_volumetric_speed": [ + "8" + ], + "nozzle_temperature": [ + "210" + ], + "nozzle_temperature_initial_layer": [ + "210" + ], + "nozzle_temperature_range_high": [ + "220" + ], + "nozzle_temperature_range_low": [ + "175" + ], + "temperature_vitrification": [ + "70" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PE-CF @BBL A1.json b/resources/profiles/BBL/filament/Generic PE-CF @BBL A1.json new file mode 100644 index 0000000000..50584fff90 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PE-CF @BBL A1.json @@ -0,0 +1,14 @@ +{ + "type": "filament", + "name": "Generic PE-CF @BBL A1", + "inherits": "Generic PE-CF @base", + "from": "system", + "setting_id": "GFSP98_01", + "instantiation": "true", + "description": "This is neither a commonly used filament, nor one of Bambu filaments, and it varies a lot from brand to brand. So, it's highly recommended to ask its vendor for suitable profile before printing and adjust some parameters according to its performances.", + "compatible_printers": [ + "Bambu Lab A1 0.4 nozzle", + "Bambu Lab A1 0.6 nozzle", + "Bambu Lab A1 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PE-CF @BBL A1M.json b/resources/profiles/BBL/filament/Generic PE-CF @BBL A1M.json new file mode 100644 index 0000000000..2e3b4b4bf4 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PE-CF @BBL A1M.json @@ -0,0 +1,14 @@ +{ + "type": "filament", + "name": "Generic PE-CF @BBL A1M", + "inherits": "Generic PE-CF @base", + "from": "system", + "setting_id": "GFSP98_02", + "instantiation": "true", + "description": "This is neither a commonly used filament, nor one of Bambu filaments, and it varies a lot from brand to brand. So, it's highly recommended to ask its vendor for suitable profile before printing and adjust some parameters according to its performances.", + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PE-CF @BBL X1C.json b/resources/profiles/BBL/filament/Generic PE-CF @BBL X1C.json new file mode 100644 index 0000000000..bf95029646 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PE-CF @BBL X1C.json @@ -0,0 +1,25 @@ +{ + "type": "filament", + "name": "Generic PE-CF @BBL X1C", + "inherits": "Generic PE-CF @base", + "from": "system", + "setting_id": "GFSP98_00", + "instantiation": "true", + "compatible_printers": [ + "Bambu Lab P1P 0.4 nozzle", + "Bambu Lab P1P 0.6 nozzle", + "Bambu Lab P1P 0.8 nozzle", + "Bambu Lab P1S 0.4 nozzle", + "Bambu Lab P1S 0.6 nozzle", + "Bambu Lab P1S 0.8 nozzle", + "Bambu Lab X1 0.4 nozzle", + "Bambu Lab X1 0.6 nozzle", + "Bambu Lab X1 0.8 nozzle", + "Bambu Lab X1 Carbon 0.4 nozzle", + "Bambu Lab X1 Carbon 0.6 nozzle", + "Bambu Lab X1 Carbon 0.8 nozzle", + "Bambu Lab X1E 0.4 nozzle", + "Bambu Lab X1E 0.6 nozzle", + "Bambu Lab X1E 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PE-CF @base.json b/resources/profiles/BBL/filament/Generic PE-CF @base.json new file mode 100644 index 0000000000..929d738ffc --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PE-CF @base.json @@ -0,0 +1,38 @@ +{ + "type": "filament", + "name": "Generic PE-CF @base", + "inherits": "fdm_filament_pe", + "from": "system", + "filament_id": "GFP98", + "instantiation": "false", + "filament_cost": [ + "65.99" + ], + "filament_density": [ + "0.95" + ], + "filament_max_volumetric_speed": [ + "6" + ], + "filament_type": [ + "PE-CF" + ], + "nozzle_temperature": [ + "210" + ], + "nozzle_temperature_initial_layer": [ + "210" + ], + "nozzle_temperature_range_high": [ + "220" + ], + "nozzle_temperature_range_low": [ + "175" + ], + "temperature_vitrification": [ + "70" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PHA @BBL A1.json b/resources/profiles/BBL/filament/Generic PHA @BBL A1.json new file mode 100644 index 0000000000..32f3fd84a9 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PHA @BBL A1.json @@ -0,0 +1,14 @@ +{ + "type": "filament", + "name": "Generic PHA @BBL A1", + "inherits": "Generic PHA @base", + "from": "system", + "setting_id": "GFSR98_02", + "instantiation": "true", + "description": "This is neither a commonly used filament, nor one of Bambu filaments, and it varies a lot from brand to brand. So, it's highly recommended to ask its vendor for suitable profile before printing and adjust some parameters according to its performances.", + "compatible_printers": [ + "Bambu Lab A1 0.6 nozzle", + "Bambu Lab A1 0.8 nozzle", + "Bambu Lab A1 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PHA @BBL A1M.json b/resources/profiles/BBL/filament/Generic PHA @BBL A1M.json new file mode 100644 index 0000000000..a3c6158000 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PHA @BBL A1M.json @@ -0,0 +1,14 @@ +{ + "type": "filament", + "name": "Generic PHA @BBL A1M", + "inherits": "Generic PHA @base", + "from": "system", + "setting_id": "GFSR98_01", + "instantiation": "true", + "description": "This is neither a commonly used filament, nor one of Bambu filaments, and it varies a lot from brand to brand. So, it's highly recommended to ask its vendor for suitable profile before printing and adjust some parameters according to its performances.", + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PHA @BBL X1C.json b/resources/profiles/BBL/filament/Generic PHA @BBL X1C.json new file mode 100644 index 0000000000..0305af0ee6 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PHA @BBL X1C.json @@ -0,0 +1,26 @@ +{ + "type": "filament", + "name": "Generic PHA @BBL X1C", + "inherits": "Generic PHA @base", + "from": "system", + "setting_id": "GFSR98_00", + "instantiation": "true", + "description": "This is neither a commonly used filament, nor one of Bambu filaments, and it varies a lot from brand to brand. So, it's highly recommended to ask its vendor for suitable profile before printing and adjust some parameters according to its performances.", + "compatible_printers": [ + "Bambu Lab X1 Carbon 0.4 nozzle", + "Bambu Lab X1 Carbon 0.6 nozzle", + "Bambu Lab X1 Carbon 0.8 nozzle", + "Bambu Lab X1E 0.4 nozzle", + "Bambu Lab X1E 0.6 nozzle", + "Bambu Lab X1E 0.8 nozzle", + "Bambu Lab X1 0.8 nozzle", + "Bambu Lab X1 0.6 nozzle", + "Bambu Lab X1 0.4 nozzle", + "Bambu Lab P1S 0.8 nozzle", + "Bambu Lab P1S 0.6 nozzle", + "Bambu Lab P1S 0.4 nozzle", + "Bambu Lab P1P 0.6 nozzle", + "Bambu Lab P1P 0.8 nozzle", + "Bambu Lab P1P 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PHA @base.json b/resources/profiles/BBL/filament/Generic PHA @base.json new file mode 100644 index 0000000000..f91285ad49 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PHA @base.json @@ -0,0 +1,8 @@ +{ + "type": "filament", + "name": "Generic PHA @base", + "inherits": "fdm_filament_pha", + "from": "system", + "filament_id": "GFR98", + "instantiation": "false" +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PLA High Speed @BBL X1C.json b/resources/profiles/BBL/filament/Generic PLA High Speed @BBL X1C.json index f2e682804f..7263d42f85 100644 --- a/resources/profiles/BBL/filament/Generic PLA High Speed @BBL X1C.json +++ b/resources/profiles/BBL/filament/Generic PLA High Speed @BBL X1C.json @@ -21,5 +21,8 @@ "Bambu Lab P1S 0.8 nozzle", "Bambu Lab X1E 0.6 nozzle", "Bambu Lab X1E 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PLA Silk.json b/resources/profiles/BBL/filament/Generic PLA Silk.json index c1011d708b..40fa7b252c 100644 --- a/resources/profiles/BBL/filament/Generic PLA Silk.json +++ b/resources/profiles/BBL/filament/Generic PLA Silk.json @@ -24,5 +24,8 @@ "Bambu Lab X1E 0.4 nozzle", "Bambu Lab X1E 0.6 nozzle", "Bambu Lab X1E 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PP @BBL A1.json b/resources/profiles/BBL/filament/Generic PP @BBL A1.json new file mode 100644 index 0000000000..4c4b6c1710 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PP @BBL A1.json @@ -0,0 +1,14 @@ +{ + "type": "filament", + "name": "Generic PP @BBL A1", + "inherits": "Generic PP @base", + "from": "system", + "setting_id": "GFSP97_01", + "instantiation": "true", + "description": "This is neither a commonly used filament, nor one of Bambu filaments, and it varies a lot from brand to brand. So, it's highly recommended to ask its vendor for suitable profile before printing and adjust some parameters according to its performances.", + "compatible_printers": [ + "Bambu Lab A1 0.4 nozzle", + "Bambu Lab A1 0.6 nozzle", + "Bambu Lab A1 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PP @BBL A1M.json b/resources/profiles/BBL/filament/Generic PP @BBL A1M.json new file mode 100644 index 0000000000..3c4907f8c9 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PP @BBL A1M.json @@ -0,0 +1,14 @@ +{ + "type": "filament", + "name": "Generic PP @BBL A1M", + "inherits": "Generic PP @base", + "from": "system", + "setting_id": "GFSP97_02", + "instantiation": "true", + "description": "This is neither a commonly used filament, nor one of Bambu filaments, and it varies a lot from brand to brand. So, it's highly recommended to ask its vendor for suitable profile before printing and adjust some parameters according to its performances.", + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PP @BBL X1C.json b/resources/profiles/BBL/filament/Generic PP @BBL X1C.json new file mode 100644 index 0000000000..664b7be27f --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PP @BBL X1C.json @@ -0,0 +1,26 @@ +{ + "type": "filament", + "name": "Generic PP @BBL X1C", + "inherits": "Generic PP @base", + "from": "system", + "setting_id": "GFSP97_00", + "instantiation": "true", + "description": "This is neither a commonly used filament, nor one of Bambu filaments, and it varies a lot from brand to brand. So, it's highly recommended to ask its vendor for suitable profile before printing and adjust some parameters according to its performances.", + "compatible_printers": [ + "Bambu Lab P1P 0.4 nozzle", + "Bambu Lab P1P 0.6 nozzle", + "Bambu Lab P1P 0.8 nozzle", + "Bambu Lab P1S 0.4 nozzle", + "Bambu Lab P1S 0.6 nozzle", + "Bambu Lab P1S 0.8 nozzle", + "Bambu Lab X1 0.4 nozzle", + "Bambu Lab X1 0.6 nozzle", + "Bambu Lab X1 0.8 nozzle", + "Bambu Lab X1 Carbon 0.4 nozzle", + "Bambu Lab X1 Carbon 0.6 nozzle", + "Bambu Lab X1 Carbon 0.8 nozzle", + "Bambu Lab X1E 0.4 nozzle", + "Bambu Lab X1E 0.6 nozzle", + "Bambu Lab X1E 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PP @base.json b/resources/profiles/BBL/filament/Generic PP @base.json new file mode 100644 index 0000000000..faf0a211fa --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PP @base.json @@ -0,0 +1,8 @@ +{ + "type": "filament", + "name": "Generic PP @base", + "inherits": "fdm_filament_pp", + "from": "system", + "filament_id": "GFP97", + "instantiation": "false" +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PP-CF @BBL A1.json b/resources/profiles/BBL/filament/Generic PP-CF @BBL A1.json new file mode 100644 index 0000000000..3c3ad6cfd1 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PP-CF @BBL A1.json @@ -0,0 +1,14 @@ +{ + "type": "filament", + "name": "Generic PP-CF @BBL A1", + "inherits": "Generic PP-CF @base", + "from": "system", + "setting_id": "GFSP96_01", + "instantiation": "true", + "description": "This is neither a commonly used filament, nor one of Bambu filaments, and it varies a lot from brand to brand. So, it's highly recommended to ask its vendor for suitable profile before printing and adjust some parameters according to its performances.", + "compatible_printers": [ + "Bambu Lab A1 0.4 nozzle", + "Bambu Lab A1 0.6 nozzle", + "Bambu Lab A1 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PP-CF @BBL X1C.json b/resources/profiles/BBL/filament/Generic PP-CF @BBL X1C.json new file mode 100644 index 0000000000..2653f7acc8 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PP-CF @BBL X1C.json @@ -0,0 +1,26 @@ +{ + "type": "filament", + "name": "Generic PP-CF @BBL X1C", + "inherits": "Generic PP-CF @base", + "from": "system", + "setting_id": "GFSP96_00", + "instantiation": "true", + "description": "This is neither a commonly used filament, nor one of Bambu filaments, and it varies a lot from brand to brand. So, it's highly recommended to ask its vendor for suitable profile before printing and adjust some parameters according to its performances.", + "compatible_printers": [ + "Bambu Lab P1P 0.4 nozzle", + "Bambu Lab P1P 0.6 nozzle", + "Bambu Lab P1P 0.8 nozzle", + "Bambu Lab P1S 0.4 nozzle", + "Bambu Lab P1S 0.6 nozzle", + "Bambu Lab P1S 0.8 nozzle", + "Bambu Lab X1 0.4 nozzle", + "Bambu Lab X1 0.6 nozzle", + "Bambu Lab X1 0.8 nozzle", + "Bambu Lab X1 Carbon 0.4 nozzle", + "Bambu Lab X1 Carbon 0.6 nozzle", + "Bambu Lab X1 Carbon 0.8 nozzle", + "Bambu Lab X1E 0.4 nozzle", + "Bambu Lab X1E 0.6 nozzle", + "Bambu Lab X1E 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PP-CF @base.json b/resources/profiles/BBL/filament/Generic PP-CF @base.json new file mode 100644 index 0000000000..c131f95878 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PP-CF @base.json @@ -0,0 +1,20 @@ +{ + "type": "filament", + "name": "Generic PP-CF @base", + "inherits": "fdm_filament_pp", + "from": "system", + "filament_id": "GFP96", + "instantiation": "false", + "filament_cost": [ + "77.99" + ], + "filament_density": [ + "1.01" + ], + "filament_max_volumetric_speed": [ + "6" + ], + "filament_type": [ + "PP-CF" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PP-GF @BBL A1.json b/resources/profiles/BBL/filament/Generic PP-GF @BBL A1.json new file mode 100644 index 0000000000..b8d3231f45 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PP-GF @BBL A1.json @@ -0,0 +1,14 @@ +{ + "type": "filament", + "name": "Generic PP-GF @BBL A1", + "inherits": "Generic PP-GF @base", + "from": "system", + "setting_id": "GFSP95_00", + "instantiation": "true", + "description": "This is neither a commonly used filament, nor one of Bambu filaments, and it varies a lot from brand to brand. So, it's highly recommended to ask its vendor for suitable profile before printing and adjust some parameters according to its performances.", + "compatible_printers": [ + "Bambu Lab A1 0.4 nozzle", + "Bambu Lab A1 0.6 nozzle", + "Bambu Lab A1 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PP-GF @BBL X1C.json b/resources/profiles/BBL/filament/Generic PP-GF @BBL X1C.json new file mode 100644 index 0000000000..7a94c1ad98 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PP-GF @BBL X1C.json @@ -0,0 +1,26 @@ +{ + "type": "filament", + "name": "Generic PP-GF @BBL X1C", + "inherits": "Generic PP-GF @base", + "from": "system", + "setting_id": "GFSP97_03", + "instantiation": "true", + "description": "This is neither a commonly used filament, nor one of Bambu filaments, and it varies a lot from brand to brand. So, it's highly recommended to ask its vendor for suitable profile before printing and adjust some parameters according to its performances.", + "compatible_printers": [ + "Bambu Lab P1P 0.4 nozzle", + "Bambu Lab P1P 0.6 nozzle", + "Bambu Lab P1P 0.8 nozzle", + "Bambu Lab P1S 0.4 nozzle", + "Bambu Lab P1S 0.6 nozzle", + "Bambu Lab P1S 0.8 nozzle", + "Bambu Lab X1 0.4 nozzle", + "Bambu Lab X1 0.6 nozzle", + "Bambu Lab X1 0.8 nozzle", + "Bambu Lab X1 Carbon 0.4 nozzle", + "Bambu Lab X1 Carbon 0.6 nozzle", + "Bambu Lab X1 Carbon 0.8 nozzle", + "Bambu Lab X1E 0.4 nozzle", + "Bambu Lab X1E 0.6 nozzle", + "Bambu Lab X1E 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PP-GF @base.json b/resources/profiles/BBL/filament/Generic PP-GF @base.json new file mode 100644 index 0000000000..b58eace53c --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PP-GF @base.json @@ -0,0 +1,20 @@ +{ + "type": "filament", + "name": "Generic PP-GF @base", + "inherits": "fdm_filament_pp", + "from": "system", + "filament_id": "GFP95", + "instantiation": "false", + "filament_cost": [ + "59.99" + ], + "filament_density": [ + "1.05" + ], + "filament_max_volumetric_speed": [ + "6" + ], + "filament_type": [ + "PP-GF" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Overture Matte PLA @BBL X1.json b/resources/profiles/BBL/filament/Overture Matte PLA @BBL X1.json index cedb6ba843..ba16728a53 100644 --- a/resources/profiles/BBL/filament/Overture Matte PLA @BBL X1.json +++ b/resources/profiles/BBL/filament/Overture Matte PLA @BBL X1.json @@ -12,5 +12,8 @@ "Bambu Lab X1 0.6 nozzle", "Bambu Lab X1 0.8 nozzle", "Bambu Lab X1 0.4 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Overture Matte PLA @BBL X1C.json b/resources/profiles/BBL/filament/Overture Matte PLA @BBL X1C.json index 7d5a7ecd57..bdfcdeef90 100644 --- a/resources/profiles/BBL/filament/Overture Matte PLA @BBL X1C.json +++ b/resources/profiles/BBL/filament/Overture Matte PLA @BBL X1C.json @@ -15,5 +15,8 @@ "Bambu Lab X1E 0.4 nozzle", "Bambu Lab X1E 0.6 nozzle", "Bambu Lab X1E 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Overture PLA @BBL X1.json b/resources/profiles/BBL/filament/Overture PLA @BBL X1.json index c36384a9e7..28b917ca5f 100644 --- a/resources/profiles/BBL/filament/Overture PLA @BBL X1.json +++ b/resources/profiles/BBL/filament/Overture PLA @BBL X1.json @@ -12,5 +12,8 @@ "Bambu Lab X1 0.4 nozzle", "Bambu Lab X1 0.8 nozzle", "Bambu Lab X1 0.6 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Overture PLA @BBL X1C.json b/resources/profiles/BBL/filament/Overture PLA @BBL X1C.json index 15c06a2ca6..62a0d4d9e8 100644 --- a/resources/profiles/BBL/filament/Overture PLA @BBL X1C.json +++ b/resources/profiles/BBL/filament/Overture PLA @BBL X1C.json @@ -15,5 +15,8 @@ "Bambu Lab X1E 0.4 nozzle", "Bambu Lab X1E 0.6 nozzle", "Bambu Lab X1E 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/P1P/Bambu ABS @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/P1P/Bambu ABS @BBL P1P 0.2 nozzle.json index e703e3d6a6..f99a91cfb0 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu ABS @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/Bambu ABS @BBL P1P 0.2 nozzle.json @@ -20,6 +20,9 @@ "reduce_fan_stop_start_freq": [ "0" ], + "slow_down_layer_time": [ + "12" + ], "textured_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/P1P/Bambu ABS @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu ABS @BBL P1P.json index b1206b169d..63d6bb3f21 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu ABS @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu ABS @BBL P1P.json @@ -20,6 +20,9 @@ "reduce_fan_stop_start_freq": [ "0" ], + "slow_down_layer_time": [ + "12" + ], "textured_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/P1P/Bambu PC @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/P1P/Bambu PC @BBL P1P 0.2 nozzle.json index b4bcf75507..bbf4b7ee51 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PC @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PC @BBL P1P 0.2 nozzle.json @@ -29,6 +29,9 @@ "reduce_fan_stop_start_freq": [ "0" ], + "slow_down_layer_time": [ + "12" + ], "textured_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/P1P/Bambu PC @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu PC @BBL P1P.json index a34eef36af..2a5769421e 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PC @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PC @BBL P1P.json @@ -23,6 +23,9 @@ "reduce_fan_stop_start_freq": [ "0" ], + "slow_down_layer_time": [ + "12" + ], "textured_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/P1P/PolyTerra PLA @BBL P1P.json b/resources/profiles/BBL/filament/P1P/PolyTerra PLA @BBL P1P.json index 7504020d8f..5728ac0c5a 100644 --- a/resources/profiles/BBL/filament/P1P/PolyTerra PLA @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/PolyTerra PLA @BBL P1P.json @@ -33,5 +33,8 @@ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", "Bambu Lab P1P 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyLite PLA @BBL X1.json b/resources/profiles/BBL/filament/PolyLite PLA @BBL X1.json index 4ed5821921..77a037efd8 100644 --- a/resources/profiles/BBL/filament/PolyLite PLA @BBL X1.json +++ b/resources/profiles/BBL/filament/PolyLite PLA @BBL X1.json @@ -15,5 +15,8 @@ "Bambu Lab X1 0.4 nozzle", "Bambu Lab X1 0.6 nozzle", "Bambu Lab X1 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyLite PLA @BBL X1C.json b/resources/profiles/BBL/filament/PolyLite PLA @BBL X1C.json index c9c27d9143..a24021705e 100644 --- a/resources/profiles/BBL/filament/PolyLite PLA @BBL X1C.json +++ b/resources/profiles/BBL/filament/PolyLite PLA @BBL X1C.json @@ -18,5 +18,8 @@ "Bambu Lab X1E 0.4 nozzle", "Bambu Lab X1E 0.6 nozzle", "Bambu Lab X1E 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyTerra PLA @BBL X1.json b/resources/profiles/BBL/filament/PolyTerra PLA @BBL X1.json index d3fd2251c3..46e2144b4e 100644 --- a/resources/profiles/BBL/filament/PolyTerra PLA @BBL X1.json +++ b/resources/profiles/BBL/filament/PolyTerra PLA @BBL X1.json @@ -15,5 +15,8 @@ "Bambu Lab X1 0.4 nozzle", "Bambu Lab X1 0.6 nozzle", "Bambu Lab X1 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyTerra PLA @BBL X1C.json b/resources/profiles/BBL/filament/PolyTerra PLA @BBL X1C.json index c3444436a2..72378493df 100644 --- a/resources/profiles/BBL/filament/PolyTerra PLA @BBL X1C.json +++ b/resources/profiles/BBL/filament/PolyTerra PLA @BBL X1C.json @@ -18,5 +18,8 @@ "Bambu Lab X1E 0.4 nozzle", "Bambu Lab X1E 0.6 nozzle", "Bambu Lab X1E 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/fdm_filament_bvoh.json b/resources/profiles/BBL/filament/fdm_filament_bvoh.json new file mode 100644 index 0000000000..2b481e35d8 --- /dev/null +++ b/resources/profiles/BBL/filament/fdm_filament_bvoh.json @@ -0,0 +1,85 @@ +{ + "type": "filament", + "name": "fdm_filament_bvoh", + "inherits": "fdm_filament_common", + "from": "system", + "instantiation": "false", + "additional_cooling_fan_speed": [ + "70" + ], + "close_fan_the_first_x_layers": [ + "1" + ], + "cool_plate_temp": [ + "40" + ], + "cool_plate_temp_initial_layer": [ + "40" + ], + "eng_plate_temp": [ + "0" + ], + "eng_plate_temp_initial_layer": [ + "0" + ], + "fan_cooling_layer_time": [ + "100" + ], + "fan_min_speed": [ + "100" + ], + "filament_cost": [ + "69.99" + ], + "filament_density": [ + "1.13" + ], + "filament_is_support": [ + "1" + ], + "filament_max_volumetric_speed": [ + "8" + ], + "filament_type": [ + "BVOH" + ], + "hot_plate_temp": [ + "55" + ], + "hot_plate_temp_initial_layer": [ + "55" + ], + "nozzle_temperature": [ + "220" + ], + "nozzle_temperature_initial_layer": [ + "220" + ], + "nozzle_temperature_range_high": [ + "240" + ], + "nozzle_temperature_range_low": [ + "190" + ], + "overhang_fan_threshold": [ + "50%" + ], + "reduce_fan_stop_start_freq": [ + "1" + ], + "slow_down_min_speed": [ + "20" + ], + "temperature_vitrification": [ + "45" + ], + "textured_plate_temp": [ + "55" + ], + "textured_plate_temp_initial_layer": [ + "55" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/fdm_filament_common.json b/resources/profiles/BBL/filament/fdm_filament_common.json index 6f1291c6ec..6ec95db4a8 100644 --- a/resources/profiles/BBL/filament/fdm_filament_common.json +++ b/resources/profiles/BBL/filament/fdm_filament_common.json @@ -57,6 +57,9 @@ "filament_is_support": [ "0" ], + "filament_long_retractions_when_cut": [ + "nil" + ], "filament_max_volumetric_speed": [ "0" ], @@ -72,6 +75,9 @@ "filament_retract_when_changing_layer": [ "nil" ], + "filament_retraction_distances_when_cut": [ + "nil" + ], "filament_retraction_length": [ "nil" ], diff --git a/resources/profiles/BBL/filament/fdm_filament_eva.json b/resources/profiles/BBL/filament/fdm_filament_eva.json new file mode 100644 index 0000000000..1b2efe2999 --- /dev/null +++ b/resources/profiles/BBL/filament/fdm_filament_eva.json @@ -0,0 +1,10 @@ +{ + "type": "filament", + "name": "fdm_filament_eva", + "inherits": "fdm_filament_common", + "from": "system", + "instantiation": "false", + "filament_type": [ + "EVA" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/fdm_filament_pc.json b/resources/profiles/BBL/filament/fdm_filament_pc.json index 5729114297..03bc9e5663 100644 --- a/resources/profiles/BBL/filament/fdm_filament_pc.json +++ b/resources/profiles/BBL/filament/fdm_filament_pc.json @@ -7,76 +7,76 @@ "cool_plate_temp": [ "0" ], - "eng_plate_temp": [ - "110" - ], - "hot_plate_temp": [ - "110" - ], - "textured_plate_temp": [ - "110" - ], "cool_plate_temp_initial_layer": [ "0" ], + "eng_plate_temp": [ + "110" + ], "eng_plate_temp_initial_layer": [ "110" ], - "hot_plate_temp_initial_layer": [ - "110" - ], - "textured_plate_temp_initial_layer": [ - "110" - ], "fan_cooling_layer_time": [ "30" ], - "filament_max_volumetric_speed": [ - "23.2" - ], - "filament_type": [ - "PC" - ], - "filament_density": [ - "1.04" - ], - "filament_cost": [ - "20" - ], - "nozzle_temperature_initial_layer": [ - "270" - ], - "reduce_fan_stop_start_freq": [ - "1" - ], "fan_max_speed": [ "60" ], "fan_min_speed": [ "10" ], - "overhang_fan_threshold": [ - "25%" + "filament_cost": [ + "20" ], - "overhang_fan_speed": [ - "60" + "filament_density": [ + "1.04" + ], + "filament_max_volumetric_speed": [ + "18" + ], + "filament_type": [ + "PC" + ], + "hot_plate_temp": [ + "110" + ], + "hot_plate_temp_initial_layer": [ + "110" ], "nozzle_temperature": [ "280" ], - "temperature_vitrification": [ - "120" - ], - "nozzle_temperature_range_low": [ - "260" + "nozzle_temperature_initial_layer": [ + "270" ], "nozzle_temperature_range_high": [ "290" ], - "slow_down_min_speed": [ - "20" + "nozzle_temperature_range_low": [ + "260" + ], + "overhang_fan_speed": [ + "60" + ], + "overhang_fan_threshold": [ + "25%" + ], + "reduce_fan_stop_start_freq": [ + "1" ], "slow_down_layer_time": [ "2" + ], + "slow_down_min_speed": [ + "20" + ], + "temperature_vitrification": [ + "120" + ], + "textured_plate_temp": [ + "110" + ], + "textured_plate_temp_initial_layer": [ + "110" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/fdm_filament_pe.json b/resources/profiles/BBL/filament/fdm_filament_pe.json new file mode 100644 index 0000000000..8ce20df68a --- /dev/null +++ b/resources/profiles/BBL/filament/fdm_filament_pe.json @@ -0,0 +1,85 @@ +{ + "type": "filament", + "name": "fdm_filament_pe", + "inherits": "fdm_filament_common", + "from": "system", + "instantiation": "false", + "additional_cooling_fan_speed": [ + "70" + ], + "close_fan_the_first_x_layers": [ + "1" + ], + "cool_plate_temp": [ + "35" + ], + "cool_plate_temp_initial_layer": [ + "35" + ], + "eng_plate_temp": [ + "0" + ], + "eng_plate_temp_initial_layer": [ + "0" + ], + "fan_cooling_layer_time": [ + "100" + ], + "fan_min_speed": [ + "100" + ], + "filament_cost": [ + "20" + ], + "filament_density": [ + "1.24" + ], + "filament_max_volumetric_speed": [ + "12" + ], + "filament_type": [ + "PE" + ], + "hot_plate_temp": [ + "55" + ], + "hot_plate_temp_initial_layer": [ + "55" + ], + "nozzle_temperature": [ + "220" + ], + "nozzle_temperature_initial_layer": [ + "220" + ], + "nozzle_temperature_range_high": [ + "240" + ], + "nozzle_temperature_range_low": [ + "190" + ], + "overhang_fan_threshold": [ + "50%" + ], + "reduce_fan_stop_start_freq": [ + "1" + ], + "slow_down_layer_time": [ + "4" + ], + "slow_down_min_speed": [ + "20" + ], + "temperature_vitrification": [ + "45" + ], + "textured_plate_temp": [ + "55" + ], + "textured_plate_temp_initial_layer": [ + "55" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S255\n{elsif(bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S180\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/fdm_filament_pha.json b/resources/profiles/BBL/filament/fdm_filament_pha.json new file mode 100644 index 0000000000..82519f1b2e --- /dev/null +++ b/resources/profiles/BBL/filament/fdm_filament_pha.json @@ -0,0 +1,85 @@ +{ + "type": "filament", + "name": "fdm_filament_pha", + "inherits": "fdm_filament_common", + "from": "system", + "instantiation": "false", + "additional_cooling_fan_speed": [ + "70" + ], + "close_fan_the_first_x_layers": [ + "1" + ], + "cool_plate_temp": [ + "35" + ], + "cool_plate_temp_initial_layer": [ + "35" + ], + "eng_plate_temp": [ + "0" + ], + "eng_plate_temp_initial_layer": [ + "0" + ], + "fan_cooling_layer_time": [ + "100" + ], + "fan_min_speed": [ + "100" + ], + "filament_cost": [ + "27.99" + ], + "filament_density": [ + "1.24" + ], + "filament_max_volumetric_speed": [ + "6" + ], + "filament_type": [ + "PHA" + ], + "hot_plate_temp": [ + "55" + ], + "hot_plate_temp_initial_layer": [ + "55" + ], + "nozzle_temperature": [ + "220" + ], + "nozzle_temperature_initial_layer": [ + "220" + ], + "nozzle_temperature_range_high": [ + "240" + ], + "nozzle_temperature_range_low": [ + "190" + ], + "overhang_fan_threshold": [ + "50%" + ], + "reduce_fan_stop_start_freq": [ + "1" + ], + "slow_down_layer_time": [ + "4" + ], + "slow_down_min_speed": [ + "20" + ], + "temperature_vitrification": [ + "120" + ], + "textured_plate_temp": [ + "55" + ], + "textured_plate_temp_initial_layer": [ + "55" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S255\n{elsif(bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S180\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/fdm_filament_pp.json b/resources/profiles/BBL/filament/fdm_filament_pp.json new file mode 100644 index 0000000000..83a4278250 --- /dev/null +++ b/resources/profiles/BBL/filament/fdm_filament_pp.json @@ -0,0 +1,85 @@ +{ + "type": "filament", + "name": "fdm_filament_pp", + "inherits": "fdm_filament_common", + "from": "system", + "instantiation": "false", + "additional_cooling_fan_speed": [ + "70" + ], + "close_fan_the_first_x_layers": [ + "1" + ], + "cool_plate_temp": [ + "35" + ], + "cool_plate_temp_initial_layer": [ + "35" + ], + "eng_plate_temp": [ + "0" + ], + "eng_plate_temp_initial_layer": [ + "0" + ], + "fan_cooling_layer_time": [ + "100" + ], + "fan_min_speed": [ + "100" + ], + "filament_cost": [ + "34.99" + ], + "filament_density": [ + "0.93" + ], + "filament_max_volumetric_speed": [ + "12" + ], + "filament_type": [ + "PP" + ], + "hot_plate_temp": [ + "55" + ], + "hot_plate_temp_initial_layer": [ + "55" + ], + "nozzle_temperature": [ + "235" + ], + "nozzle_temperature_initial_layer": [ + "235" + ], + "nozzle_temperature_range_high": [ + "250" + ], + "nozzle_temperature_range_low": [ + "220" + ], + "overhang_fan_threshold": [ + "50%" + ], + "reduce_fan_stop_start_freq": [ + "1" + ], + "slow_down_layer_time": [ + "4" + ], + "slow_down_min_speed": [ + "20" + ], + "temperature_vitrification": [ + "110" + ], + "textured_plate_temp": [ + "55" + ], + "textured_plate_temp_initial_layer": [ + "55" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S255\n{elsif(bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S180\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab A1 0.2 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab A1 0.2 nozzle.json index 700b24df85..3e0225bb70 100644 --- a/resources/profiles/BBL/machine/Bambu Lab A1 0.2 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab A1 0.2 nozzle.json @@ -13,6 +13,12 @@ "default_filament_profile": [ "Bambu PLA Basic @BBL A1 0.2 nozzle" ], + "max_layer_height": [ + "0.14" + ], + "min_layer_height": [ + "0.04" + ], "default_print_profile": "0.10mm Standard @BBL A1 0.2 nozzle", "upward_compatible_machine": [] } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab A1 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab A1 0.4 nozzle.json index 7feaa0a6a3..078e12ae45 100644 --- a/resources/profiles/BBL/machine/Bambu Lab A1 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab A1 0.4 nozzle.json @@ -52,17 +52,18 @@ "30" ], "machine_unload_filament_time": "29", + "nozzle_height": "4.76", "nozzle_type": "stainless_steel", - "nozzle_volume": "117", + "nozzle_volume": "92", "printable_height": "256", "printer_structure": "i3", "retract_lift_below": [ "255" ], "scan_first_layer": "0", - "machine_start_gcode": ";===== machine: A1 =========================\n;===== date: 20240104 =====================\nG392 S0\n;M400\n;M73 P1.717\n\n;===== start to heat heatbead&hotend==========\nM1002 gcode_claim_action : 2\nM1002 set_filament_type:{filament_type[initial_no_support_extruder]}\nM104 S140\nM140 S[bed_temperature_initial_layer_single]\n\n;=====start printer sound ===================\nM17\nM400 S1\nM1006 S1\nM1006 A0 B10 L100 C37 D10 M60 E37 F10 N60\nM1006 A0 B10 L100 C41 D10 M60 E41 F10 N60\nM1006 A0 B10 L100 C44 D10 M60 E44 F10 N60\nM1006 A0 B10 L100 C0 D10 M60 E0 F10 N60\nM1006 A43 B10 L100 C46 D10 M70 E39 F10 N80\nM1006 A0 B10 L100 C0 D10 M60 E0 F10 N80\nM1006 A0 B10 L100 C43 D10 M60 E39 F10 N80\nM1006 A0 B10 L100 C0 D10 M60 E0 F10 N80\nM1006 A0 B10 L100 C41 D10 M80 E41 F10 N80\nM1006 A0 B10 L100 C44 D10 M80 E44 F10 N80\nM1006 A0 B10 L100 C49 D10 M80 E49 F10 N80\nM1006 A0 B10 L100 C0 D10 M80 E0 F10 N80\nM1006 A44 B10 L100 C48 D10 M60 E39 F10 N80\nM1006 A0 B10 L100 C0 D10 M60 E0 F10 N80\nM1006 A0 B10 L100 C44 D10 M80 E39 F10 N80\nM1006 A0 B10 L100 C0 D10 M60 E0 F10 N80\nM1006 A43 B10 L100 C46 D10 M60 E39 F10 N80\nM1006 W\nM18\n;=====start printer sound ===================\n\n;=====avoid end stop =================\nG91\nG380 S2 Z40 F1200\nG380 S2 Z-15 F1200\nG90\n\n;===== reset machine status =================\n;M290 X39 Y39 Z8\nM204 S6000\n\nM630 S0 P0\nG91\nM17 Z0.3 ; lower the z-motor current\n\nG90\nM17 X0.65 Y1.2 Z0.6 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\n;M211 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\n\n;====== cog noise reduction=================\nM982.2 S1 ; turn on cog noise reduction\n\nM1002 gcode_claim_action : 13\n\nG28 X\nG91\nG1 Z5 F1200\nG90\nG0 X128 F30000\nG0 Y254 F3000\nG91\nG1 Z-5 F1200\n\nM109 S10 H140\n\nM17 E0.3\nM83\nG1 E10 F1200\nG1 E-0.5 F30\nM17 D\n\nG28 Z P0 T140; home z with low precision,permit 300deg temperature\nM104 S{nozzle_temperature_initial_layer[initial_extruder]}\n\nM1002 judge_flag build_plate_detect_flag\nM622 S1\n G39.4\n G90\n G1 Z5 F1200\nM623\n\n;M400\n;M73 P1.717\n\n;===== prepare print temperature and material ==========\nM1002 gcode_claim_action : 24\n\nM400\n;G392 S1\nM211 X0 Y0 Z0 ;turn off soft endstop\nM975 S1 ; turn on\n\nG90\nG1 X-28.5 F30000\nG1 X-48.2 F3000\n\nM620 M ;enable remap\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M1002 gcode_claim_action : 4\n M400\n M1002 set_filament_type:UNKNOWN\n M109 S[nozzle_temperature_initial_layer]\n M104 S250\n M400\n T[initial_no_support_extruder]\n G1 X-48.2 F3000\n M400\n\n M620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n M109 S250 ;set nozzle to common flush temp\n M106 P1 S0\n G92 E0\n G1 E50 F200\n M400\n M1002 set_filament_type:{filament_type[initial_no_support_extruder]}\nM621 S[initial_no_support_extruder]A\n\nM109 S{nozzle_temperature_range_high[initial_no_support_extruder]} H300\nG92 E0\nG1 E50 F200 ; lower extrusion speed to avoid clog\nM400\nM106 P1 S178\nG92 E0\nG1 E5 F200\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG92 E0\nG1 E-0.5 F300\n\nG1 X-28.5 F30000\nG1 X-48.2 F3000\nG1 X-28.5 F30000 ;wipe and shake\nG1 X-48.2 F3000\nG1 X-28.5 F30000 ;wipe and shake\nG1 X-48.2 F3000\n\n;G392 S0\n\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n;M400\n;M73 P1.717\n\n;===== auto extrude cali start =========================\nM975 S1\n;G392 S1\n\nG90\nM83\nT1000\nG1 X-48.2 Y0 Z10 F10000\nM400\nM1002 set_filament_type:UNKNOWN\n\nM412 S1 ; ===turn on filament runout detection===\nM400 P10\nM620.3 W1; === turn on filament tangle detection===\nM400 S2\n\nM1002 set_filament_type:{filament_type[initial_no_support_extruder]}\n\n;M1002 set_flag extrude_cali_flag=1\nM1002 judge_flag extrude_cali_flag\n\nM622 J1\n M1002 gcode_claim_action : 8\n\n M109 S{nozzle_temperature[initial_extruder]}\n G1 E10 F{outer_wall_volumetric_speed/2.4*60}\n M983 F{outer_wall_volumetric_speed/2.4} A0.3 H[nozzle_diameter]; cali dynamic extrusion compensation\n\n M106 P1 S255\n M400 S5\n G1 X-28.5 F18000\n G1 X-48.2 F3000\n G1 X-28.5 F18000 ;wipe and shake\n G1 X-48.2 F3000\n G1 X-28.5 F12000 ;wipe and shake\n G1 X-48.2 F3000\n M400\n M106 P1 S0\n\n M1002 judge_last_extrude_cali_success\n M622 J0\n M983 F{outer_wall_volumetric_speed/2.4} A0.3 H[nozzle_diameter]; cali dynamic extrusion compensation\n M106 P1 S255\n M400 S5\n G1 X-28.5 F18000\n G1 X-48.2 F3000\n G1 X-28.5 F18000 ;wipe and shake\n G1 X-48.2 F3000\n G1 X-28.5 F12000 ;wipe and shake\n M400\n M106 P1 S0\n M623\n \n G1 X-48.2 F3000\n M400\n M984 A0.1 E1 S1 F{outer_wall_volumetric_speed/2.4}\n M106 P1 S178\n M400 S5\n G1 X-28.5 F18000\n G1 X-48.2 F3000\n G1 X-28.5 F18000\n G1 X-48.2 F3000\n G1 X-28.5 F18000\n M400\n M106 P1 S0\nM623 ; end of \"draw extrinsic para cali paint\"\n\n;G392 S0\n;===== auto extrude cali end ========================\n\n;M400\n;M73 P1.717\n\nM104 S170 ; prepare to wipe nozzle\nM106 S255 ; turn on fan\n\n;===== mech mode fast check start =====================\nM1002 gcode_claim_action : 3\n\nG1 X128 Y128 F20000\nG1 Z5 F1200\nM400 P200\nM970.3 Q1 A5 K0 O3\nM974 Q1 S2 P0\n\nM970.2 Q1 K1 W58 Z0.11\nM974 S2\n\nG1 X128 Y128 F20000\nG1 Z5 F1200\nM400 P200\nM970.3 Q0 A10 K0 O1\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X0 Y5\nG28 X ; re-home XY\n\n;===== mech mode fast check end =======================\n\n;M400\n;M73 P1.717\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\n\nM975 S1\nM106 S255 ; turn on fan (G28 has turn off fan)\nM211 S; push soft endstop status\nM211 X0 Y0 Z0 ;turn off Z axis endstop\n\n;===== remove waste by touching start =====\n\nM104 S170 ; set temp down to heatbed acceptable\n\nM83\nG1 E-1 F500\nG90\nM83\n\nM109 S170\nG0 X108 Y-0.5 F30000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X110 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X112 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X114 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X116 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X118 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X120 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X122 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X124 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X126 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X128 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X130 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X132 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X134 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X136 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X138 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X140 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X142 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X144 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X146 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X148 F10000\nG380 S3 Z-5 F1200\n\nG1 Z5 F30000\n;===== remove waste by touching end =====\n\nG1 Z10 F1200\nG0 X118 Y261 F30000\nG1 Z5 F1200\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-50}\n\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nM104 S140 ; prepare to abl\nG0 Z5 F20000\n\nG0 X128 Y261 F20000 ; move to exposed steel surface\nG0 Z-1.01 F1200 ; stop the nozzle\n\nG91\nG2 I1 J0 X2 Y0 F2000.1\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\n\nG90\nG1 Z10 F1200\n\n;===== brush material wipe nozzle =====\n\nG90\nG1 Y250 F30000\nG1 X55\nG1 Z1.300 F1200\nG1 Y262.5 F6000\nG91\nG1 X-35 F30000\nG1 Y-0.5\nG1 X45\nG1 Y-0.5\nG1 X-45\nG1 Y-0.5\nG1 X45\nG1 Y-0.5\nG1 X-45\nG1 Y-0.5\nG1 X45\nG1 Z5.000 F1200\n\nG90\nG1 X30 Y250.000 F30000\nG1 Z1.300 F1200\nG1 Y262.5 F6000\nG91\nG1 X35 F30000\nG1 Y-0.5\nG1 X-45\nG1 Y-0.5\nG1 X45\nG1 Y-0.5\nG1 X-45\nG1 Y-0.5\nG1 X45\nG1 Y-0.5\nG1 X-45\nG1 Z10.000 F1200\n\n;===== brush material wipe nozzle end =====\n\nG90\n;G0 X128 Y261 F20000 ; move to exposed steel surface\nG1 Y250 F30000\nG1 X138\nG1 Y261\nG0 Z-1.01 F1200 ; stop the nozzle\n\nG91\nG2 I1 J0 X2 Y0 F2000.1\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\n\nM109 S140\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM211 R; pop softend status\n\n;===== wipe nozzle end ================================\n\n;M400\n;M73 P1.717\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\n\nG90\nG1 Z5 F1200\nG1 X0 Y0 F30000\nG29.2 S1 ; turn on ABL\n\nM190 S[bed_temperature_initial_layer_single]; ensure bed temp\nM109 S140\nM106 S0 ; turn off fan , too noisy\n\nM622 J1\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n\n;===== home after wipe mouth end =======================\n\n;M400\n;M73 P1.717\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; prepare to print\n\n;===== nozzle load line ===============================\n;G90\n;M83\n;G1 Z5 F1200\n;G1 X88 Y-0.5 F20000\n;G1 Z0.3 F1200\n\n;M109 S{nozzle_temperature_initial_layer[initial_extruder]}\n\n;G1 E2 F300\n;G1 X168 E4.989 F6000\n;G1 Z1 F1200\n;===== noozle load line end ===========================\n\n;===== extrude cali test ===============================\n\nM400\n M900 S\n\n M900 C\n G90\n M83\n G1 X78.000 Y-0.500 F30000\n G1 Z0.300 F1200\n\n M109 S{nozzle_temperature_initial_layer[initial_extruder]}\n G1 E3 F300\n\n G1 X83.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X88.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X93.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X98.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X103.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X108.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X113.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X118.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X123.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X128.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X133.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X138.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X143.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X148.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X153.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X158.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X163.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X168.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X173.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X178.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X179 Z0\n G1 X183\n G1 Z1\n M400\n\n M900 R\n G90\n M83\n G1 X78.000 Y4.500 F30000\n G1 Z0.300 F1200\n G1 E0.5 F300\n G1 X83.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X88.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X93.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X98.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X103.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X108.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X113.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X118.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X123.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X128.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X133.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X138.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X143.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X148.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X153.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X158.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X163.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X168.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X173.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X178.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X179 Z0\n G1 X183\n G1 Z1\n M400\n\nG1 Z0.2\n\n;M400\n;M73 P1.717\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.02} ; for Textured PEI Plate\n{endif}\n\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\n\nM211 X0 Y0 Z0 ;turn off soft endstop\n;G392 S1 ; turn on clog detection\nM1007 S1 ; turn on mass estimation\nG29.4\n", + "machine_start_gcode": ";===== machine: A1 =========================\n;===== date: 20240311 =====================\nG392 S0\n;M400\n;M73 P1.717\n\n;===== start to heat heatbead&hotend==========\nM1002 gcode_claim_action : 2\nM1002 set_filament_type:{filament_type[initial_no_support_extruder]}\nM104 S140\nM140 S[bed_temperature_initial_layer_single]\n\n;=====start printer sound ===================\nM17\nM400 S1\nM1006 S1\nM1006 A0 B10 L100 C37 D10 M60 E37 F10 N60\nM1006 A0 B10 L100 C41 D10 M60 E41 F10 N60\nM1006 A0 B10 L100 C44 D10 M60 E44 F10 N60\nM1006 A0 B10 L100 C0 D10 M60 E0 F10 N60\nM1006 A43 B10 L100 C46 D10 M70 E39 F10 N80\nM1006 A0 B10 L100 C0 D10 M60 E0 F10 N80\nM1006 A0 B10 L100 C43 D10 M60 E39 F10 N80\nM1006 A0 B10 L100 C0 D10 M60 E0 F10 N80\nM1006 A0 B10 L100 C41 D10 M80 E41 F10 N80\nM1006 A0 B10 L100 C44 D10 M80 E44 F10 N80\nM1006 A0 B10 L100 C49 D10 M80 E49 F10 N80\nM1006 A0 B10 L100 C0 D10 M80 E0 F10 N80\nM1006 A44 B10 L100 C48 D10 M60 E39 F10 N80\nM1006 A0 B10 L100 C0 D10 M60 E0 F10 N80\nM1006 A0 B10 L100 C44 D10 M80 E39 F10 N80\nM1006 A0 B10 L100 C0 D10 M60 E0 F10 N80\nM1006 A43 B10 L100 C46 D10 M60 E39 F10 N80\nM1006 W\nM18 \n;=====start printer sound ===================\n\n;=====avoid end stop =================\nG91\nG380 S2 Z40 F1200\nG380 S3 Z-15 F1200\nG90\n\n;===== reset machine status =================\n;M290 X39 Y39 Z8\nM204 S6000\n\nM630 S0 P0\nG91\nM17 Z0.3 ; lower the z-motor current\n\nG90\nM17 X0.65 Y1.2 Z0.6 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\n;M211 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\n\n;====== cog noise reduction=================\nM982.2 S1 ; turn on cog noise reduction\n\nM1002 gcode_claim_action : 13\n\nG28 X\nG91\nG1 Z5 F1200\nG90\nG0 X128 F30000\nG0 Y254 F3000\nG91\nG1 Z-5 F1200\n\nM109 S25 H140\n\nM17 E0.3\nM83\nG1 E10 F1200\nG1 E-0.5 F30\nM17 D\n\nG28 Z P0 T140; home z with low precision,permit 300deg temperature\nM104 S{nozzle_temperature_initial_layer[initial_extruder]}\n\nM1002 judge_flag build_plate_detect_flag\nM622 S1\n G39.4\n G90\n G1 Z5 F1200\nM623\n\n;M400\n;M73 P1.717\n\n;===== prepare print temperature and material ==========\nM1002 gcode_claim_action : 24\n\nM400\n;G392 S1\nM211 X0 Y0 Z0 ;turn off soft endstop\nM975 S1 ; turn on\n\nG90\nG1 X-28.5 F30000\nG1 X-48.2 F3000\n\nM620 M ;enable remap\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M1002 gcode_claim_action : 4\n M400\n M1002 set_filament_type:UNKNOWN\n M109 S[nozzle_temperature_initial_layer]\n M104 S250\n M400\n T[initial_no_support_extruder]\n G1 X-48.2 F3000\n M400\n\n M620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n M109 S250 ;set nozzle to common flush temp\n M106 P1 S0\n G92 E0\n G1 E50 F200\n M400\n M1002 set_filament_type:{filament_type[initial_no_support_extruder]}\nM621 S[initial_no_support_extruder]A\n\nM109 S{nozzle_temperature_range_high[initial_no_support_extruder]} H300\nG92 E0\nG1 E50 F200 ; lower extrusion speed to avoid clog\nM400\nM106 P1 S178\nG92 E0\nG1 E5 F200\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG92 E0\nG1 E-0.5 F300\n\nG1 X-28.5 F30000\nG1 X-48.2 F3000\nG1 X-28.5 F30000 ;wipe and shake\nG1 X-48.2 F3000\nG1 X-28.5 F30000 ;wipe and shake\nG1 X-48.2 F3000\n\n;G392 S0\n\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n;M400\n;M73 P1.717\n\n;===== auto extrude cali start =========================\nM975 S1\n;G392 S1\n\nG90\nM83\nT1000\nG1 X-48.2 Y0 Z10 F10000\nM400\nM1002 set_filament_type:UNKNOWN\n\nM412 S1 ; ===turn on filament runout detection===\nM400 P10\nM620.3 W1; === turn on filament tangle detection===\nM400 S2\n\nM1002 set_filament_type:{filament_type[initial_no_support_extruder]}\n\n;M1002 set_flag extrude_cali_flag=1\nM1002 judge_flag extrude_cali_flag\n\nM622 J1\n M1002 gcode_claim_action : 8\n\n M109 S{nozzle_temperature[initial_extruder]}\n G1 E10 F{outer_wall_volumetric_speed/2.4*60}\n M983 F{outer_wall_volumetric_speed/2.4} A0.3 H[nozzle_diameter]; cali dynamic extrusion compensation\n\n M106 P1 S255\n M400 S5\n G1 X-28.5 F18000\n G1 X-48.2 F3000\n G1 X-28.5 F18000 ;wipe and shake\n G1 X-48.2 F3000\n G1 X-28.5 F12000 ;wipe and shake\n G1 X-48.2 F3000\n M400\n M106 P1 S0\n\n M1002 judge_last_extrude_cali_success\n M622 J0\n M983 F{outer_wall_volumetric_speed/2.4} A0.3 H[nozzle_diameter]; cali dynamic extrusion compensation\n M106 P1 S255\n M400 S5\n G1 X-28.5 F18000\n G1 X-48.2 F3000\n G1 X-28.5 F18000 ;wipe and shake\n G1 X-48.2 F3000\n G1 X-28.5 F12000 ;wipe and shake\n M400\n M106 P1 S0\n M623\n \n G1 X-48.2 F3000\n M400\n M984 A0.1 E1 S1 F{outer_wall_volumetric_speed/2.4}\n M106 P1 S178\n M400 S7\n G1 X-28.5 F18000\n G1 X-48.2 F3000\n G1 X-28.5 F18000 ;wipe and shake\n G1 X-48.2 F3000\n G1 X-28.5 F12000 ;wipe and shake\n G1 X-48.2 F3000\n M400\n M106 P1 S0\nM623 ; end of \"draw extrinsic para cali paint\"\n\n;G392 S0\n;===== auto extrude cali end ========================\n\n;M400\n;M73 P1.717\n\nM104 S170 ; prepare to wipe nozzle\nM106 S255 ; turn on fan\n\n;===== mech mode fast check start =====================\nM1002 gcode_claim_action : 3\n\nG1 X128 Y128 F20000\nG1 Z5 F1200\nM400 P200\nM970.3 Q1 A5 K0 O3\nM974 Q1 S2 P0\n\nM970.2 Q1 K1 W58 Z0.11\nM974 S2\n\nG1 X128 Y128 F20000\nG1 Z5 F1200\nM400 P200\nM970.3 Q0 A10 K0 O1\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X0 Y5\nG28 X ; re-home XY\n\nG1 Z4 F1200\n\n;===== mech mode fast check end =======================\n\n;M400\n;M73 P1.717\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\n\nM975 S1\nM106 S255 ; turn on fan (G28 has turn off fan)\nM211 S; push soft endstop status\nM211 X0 Y0 Z0 ;turn off Z axis endstop\n\n;===== remove waste by touching start =====\n\nM104 S170 ; set temp down to heatbed acceptable\n\nM83\nG1 E-1 F500\nG90\nM83\n\nM109 S170\nG0 X108 Y-0.5 F30000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X110 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X112 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X114 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X116 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X118 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X120 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X122 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X124 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X126 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X128 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X130 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X132 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X134 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X136 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X138 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X140 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X142 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X144 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X146 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X148 F10000\nG380 S3 Z-5 F1200\n\nG1 Z5 F30000\n;===== remove waste by touching end =====\n\nG1 Z10 F1200\nG0 X118 Y261 F30000\nG1 Z5 F1200\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-50}\n\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nM104 S140 ; prepare to abl\nG0 Z5 F20000\n\nG0 X128 Y261 F20000 ; move to exposed steel surface\nG0 Z-1.01 F1200 ; stop the nozzle\n\nG91\nG2 I1 J0 X2 Y0 F2000.1\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\n\nG90\nG1 Z10 F1200\n\n;===== brush material wipe nozzle =====\n\nG90\nG1 Y250 F30000\nG1 X55\nG1 Z1.300 F1200\nG1 Y262.5 F6000\nG91\nG1 X-35 F30000\nG1 Y-0.5\nG1 X45\nG1 Y-0.5\nG1 X-45\nG1 Y-0.5\nG1 X45\nG1 Y-0.5\nG1 X-45\nG1 Y-0.5\nG1 X45\nG1 Z5.000 F1200\n\nG90\nG1 X30 Y250.000 F30000\nG1 Z1.300 F1200\nG1 Y262.5 F6000\nG91\nG1 X35 F30000\nG1 Y-0.5\nG1 X-45\nG1 Y-0.5\nG1 X45\nG1 Y-0.5\nG1 X-45\nG1 Y-0.5\nG1 X45\nG1 Y-0.5\nG1 X-45\nG1 Z10.000 F1200\n\n;===== brush material wipe nozzle end =====\n\nG90\n;G0 X128 Y261 F20000 ; move to exposed steel surface\nG1 Y250 F30000\nG1 X138\nG1 Y261\nG0 Z-1.01 F1200 ; stop the nozzle\n\nG91\nG2 I1 J0 X2 Y0 F2000.1\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\n\nM109 S140\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM211 R; pop softend status\n\n;===== wipe nozzle end ================================\n\n;M400\n;M73 P1.717\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\n\nG90\nG1 Z5 F1200\nG1 X0 Y0 F30000\nG29.2 S1 ; turn on ABL\n\nM190 S[bed_temperature_initial_layer_single]; ensure bed temp\nM109 S140\nM106 S0 ; turn off fan , too noisy\n\nM622 J1\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n\n;===== home after wipe mouth end =======================\n\n;M400\n;M73 P1.717\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; prepare to print\n\n;===== nozzle load line ===============================\n;G90\n;M83\n;G1 Z5 F1200\n;G1 X88 Y-0.5 F20000\n;G1 Z0.3 F1200\n\n;M109 S{nozzle_temperature_initial_layer[initial_extruder]}\n\n;G1 E2 F300\n;G1 X168 E4.989 F6000\n;G1 Z1 F1200\n;===== nozzle load line end ===========================\n\n;===== extrude cali test ===============================\n\nM400\n M900 S\n\n M900 C\n G90\n M83\n G1 X78.000 Y-0.500 F30000\n G1 Z0.300 F1200\n\n M109 S{nozzle_temperature_initial_layer[initial_extruder]}\n G1 E3 F300\n\n G1 X83.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X88.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X93.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X98.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X103.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X108.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X113.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X118.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X123.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X128.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X133.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X138.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X143.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X148.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X153.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X158.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X163.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X168.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X173.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X178.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X179 Z0\n G1 X183\n G1 Z1\n M400\n\n M900 R\n G90\n M83\n G1 X78.000 Y1.000 F30000\n G1 Z0.300 F1200\n G1 E0.5 F300\n G1 X83.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X88.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X93.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X98.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X103.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X108.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X113.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X118.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X123.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X128.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X133.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X138.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X143.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X148.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X153.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X158.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X163.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X168.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X173.000 E0.3118 F{outer_wall_volumetric_speed*0.4 /(0.3*0.5) * 60}\n G1 X178.000 E0.3118 F{outer_wall_volumetric_speed*1.0 /(0.3*0.5) * 60}\n G1 X179 Z0\n G1 X183\n G1 Z1\n M400\n\nG1 Z0.2\n\n;M400\n;M73 P1.717\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.02} ; for Textured PEI Plate\n{endif}\n\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\n\nM211 X0 Y0 Z0 ;turn off soft endstop\n;G392 S1 ; turn on clog detection\nM1007 S1 ; turn on mass estimation\nG29.4\n", "machine_end_gcode": ";===== date: 20231229 =====================\nG392 S0 ;turn off nozzle clog detect\n\nM400 ; wait for buffer to clear\nG92 E0 ; zero the extruder\nG1 E-0.8 F1800 ; retract\nG1 Z{max_layer_z + 0.5} F900 ; lower z a little\nG1 X0 Y{first_layer_center_no_wipe_tower[1]} F18000 ; move to safe pos\nG1 X-13.0 F3000 ; move to safe pos\n{if !spiral_mode && print_sequence != \"by object\"}\nM1002 judge_flag timelapse_record_flag\nM622 J1\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM991 S0 P-1 ;end timelapse at safe pos\nM623\n{endif}\n\nM140 S0 ; turn off bed\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off remote part cooling fan\nM106 P3 S0 ; turn off chamber cooling fan\n\n;G1 X27 F15000 ; wipe\n\n; pull back filament to AMS\nM620 S255\nG1 X267 F15000\nT255\nG1 X-28.5 F18000\nG1 X-48.2 F3000\nG1 X-28.5 F18000\nG1 X-48.2 F3000\nM621 S255\n\nM104 S0 ; turn off hotend\n\nM400 ; wait all motion done\nM17 S\nM17 Z0.4 ; lower z motor current to reduce impact if there is something in the bottom\n{if (max_layer_z + 100.0) < 256}\n G1 Z{max_layer_z + 100.0} F600\n G1 Z{max_layer_z +98.0}\n{else}\n G1 Z256 F600\n G1 Z256\n{endif}\nM400 P100\nM17 R ; restore z current\n\nG90\nG1 X-48 Y180 F3600\n\nM220 S100 ; Reset feedrate magnitude\nM201.2 K1.0 ; Reset acc magnitude\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 0\n\n;=====printer finish sound=========\nM17\nM400 S1\nM1006 S1\nM1006 A0 B20 L100 C37 D20 M40 E42 F20 N60\nM1006 A0 B10 L100 C44 D10 M60 E44 F10 N60\nM1006 A0 B10 L100 C46 D10 M80 E46 F10 N80\nM1006 A44 B20 L100 C39 D20 M60 E48 F20 N60\nM1006 A0 B10 L100 C44 D10 M60 E44 F10 N60\nM1006 A0 B10 L100 C0 D10 M60 E0 F10 N60\nM1006 A0 B10 L100 C39 D10 M60 E39 F10 N60\nM1006 A0 B10 L100 C0 D10 M60 E0 F10 N60\nM1006 A0 B10 L100 C44 D10 M60 E44 F10 N60\nM1006 A0 B10 L100 C0 D10 M60 E0 F10 N60\nM1006 A0 B10 L100 C39 D10 M60 E39 F10 N60\nM1006 A0 B10 L100 C0 D10 M60 E0 F10 N60\nM1006 A0 B10 L100 C48 D10 M60 E44 F10 N80\nM1006 A0 B10 L100 C0 D10 M60 E0 F10 N80\nM1006 A44 B20 L100 C49 D20 M80 E41 F20 N80\nM1006 A0 B20 L100 C0 D20 M60 E0 F20 N80\nM1006 A0 B20 L100 C37 D20 M30 E37 F20 N60\nM1006 W\n;=====printer finish sound=========\n\n;M17 X0.8 Y0.8 Z0.5 ; lower motor current to 45% power\nM400\nM18 X Y Z\n\n", "layer_change_gcode": "; layer num/total_layer_count: {layer_num+1}/[total_layer_count]\n; update layer progress\nM73 L{layer_num+1}\nM991 S0 P{layer_num} ;notify layer change", - "time_lapse_gcode": ";===================== date: 20231107 =====================\n{if !spiral_mode && print_sequence != \"by object\"}\n; don't support timelapse gcode in spiral_mode and by object sequence for I3 structure printer\nM622.1 S1 ; for prev firware, default turned on\nM1002 judge_flag timelapse_record_flag\nM622 J1\nG92 E0\nG17\nG2 Z{layer_z + 0.4} I0.86 J0.86 P1 F20000 ; spiral lift a little\nG1 Z{max_layer_z + 0.4}\nG1 X0 Y{first_layer_center_no_wipe_tower[1]} F18000 ; move to safe pos\nG1 X-48.2 F3000 ; move to safe pos\nM400 P300\nM971 S11 C11 O0\nG92 E0\nG1 X0 F18000\nM623\n\n; enable nozzle clog detect at 3rd layer\n{if layer_num == 2}\n M400\n G90\n M83\n M204 S5000\n G0 Z2 F4000\n G0 X-4.2 Y240 F20000\n M400 P200\n G39 S1\n G0 Z2 F4000\n G0 X128 Y128 F30000\n{endif}\n{endif}", + "time_lapse_gcode": ";===================== date: 20231215 =====================\n{if !spiral_mode && print_sequence != \"by object\"}\n; don't support timelapse gcode in spiral_mode and by object sequence for I3 structure printer\nM622.1 S1 ; for prev firware, default turned on\nM1002 judge_flag timelapse_record_flag\nM622 J1\nG92 E0\nG17\nG2 Z{layer_z + 0.4} I0.86 J0.86 P1 F20000 ; spiral lift a little\nG1 Z{max_layer_z + 0.4}\nG1 X0 Y{first_layer_center_no_wipe_tower[1]} F18000 ; move to safe pos\nG1 X-48.2 F3000 ; move to safe pos\nM400 P300\nM971 S11 C11 O0\nG92 E0\nG1 X0 F18000\nM623\n\nM622.1 S1\nM1002 judge_flag g39_detection_flag\nM622 J1 \n ; enable nozzle clog detect at 3rd layer\n {if layer_num == 2}\n M400\n G90\n M83\n M204 S5000\n G0 Z2 F4000\n G0 X261 Y250 F20000\n M400 P200\n G39 S1\n G0 Z2 F4000\n {endif}\n\n {if !in_head_wrap_detect_zone}\n M622.1 S0\n M1002 judge_flag g39_mass_exceed_flag\n M622 J1\n {if layer_num > 2}\n G392 S0\n M400\n G90\n M83\n M204 S5000\n G0 Z{max_layer_z + 0.4} F4000\n G39.3 S1\n G0 Z{max_layer_z + 0.4} F4000\n G392 S0\n {endif}\n M623\n {endif}\nM623\n{endif}\n", "change_filament_gcode": ";===== machine: A1 =========================\n;===== date: 20231225 =======================\nM1007 S0 ; turn off mass estimation\nG392 S0\nM620 S[next_extruder]A\nM204 S9000\n{if toolchange_count > 1}\nG17\nG2 Z{max_layer_z + 0.4} I0.86 J0.86 P1 F10000 ; spiral lift a little from second lift\n{endif}\nG1 Z{max_layer_z + 3.0} F1200\n\nM400\nM106 P1 S0\nM106 P2 S0\n{if old_filament_temp > 142 && next_extruder < 255}\nM104 S[old_filament_temp]\n{endif}\n\nG1 X267 F18000\nM620.1 E F[old_filament_e_feedrate] T{nozzle_temperature_range_high[previous_extruder]}\nM620.10 A0 F[old_filament_e_feedrate]\nT[next_extruder]\nM620.1 E F[new_filament_e_feedrate] T{nozzle_temperature_range_high[next_extruder]}\nM620.10 A1 F[new_filament_e_feedrate] L[flush_length] H[nozzle_diameter] T[nozzle_temperature_range_high]\n\nG1 Y128 F9000\n\n{if next_extruder < 255}\nM400\n\nG92 E0\nM628 S0\n\n{if flush_length_1 > 1}\n; FLUSH_START\n; always use highest temperature to flush\nM400\nM1002 set_filament_type:UNKNOWN\nM109 S[nozzle_temperature_range_high]\nM106 P1 S60\n{if flush_length_1 > 23.7}\nG1 E23.7 F{old_filament_e_feedrate} ; do not need pulsatile flushing for start part\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{old_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\n{else}\nG1 E{flush_length_1} F{old_filament_e_feedrate}\n{endif}\n; FLUSH_END\nG1 E-[old_retract_length_toolchange] F1800\nG1 E[old_retract_length_toolchange] F300\nM400\nM1002 set_filament_type:{filament_type[next_extruder]}\n{endif}\n\n{if flush_length_1 > 45 && flush_length_2 > 1}\n; WIPE\nM400\nM106 P1 S178\nM400 S3\nG1 X-38.2 F18000\nG1 X-48.2 F3000\nG1 X-38.2 F18000\nG1 X-48.2 F3000\nG1 X-38.2 F18000\nG1 X-48.2 F3000\nM400\nM106 P1 S0\n{endif}\n\n{if flush_length_2 > 1}\nM106 P1 S60\n; FLUSH_START\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_2 > 45 && flush_length_3 > 1}\n; WIPE\nM400\nM106 P1 S178\nM400 S3\nG1 X-38.2 F18000\nG1 X-48.2 F3000\nG1 X-38.2 F18000\nG1 X-48.2 F3000\nG1 X-38.2 F18000\nG1 X-48.2 F3000\nM400\nM106 P1 S0\n{endif}\n\n{if flush_length_3 > 1}\nM106 P1 S60\n; FLUSH_START\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_3 > 45 && flush_length_4 > 1}\n; WIPE\nM400\nM106 P1 S178\nM400 S3\nG1 X-38.2 F18000\nG1 X-48.2 F3000\nG1 X-38.2 F18000\nG1 X-48.2 F3000\nG1 X-38.2 F18000\nG1 X-48.2 F3000\nM400\nM106 P1 S0\n{endif}\n\n{if flush_length_4 > 1}\nM106 P1 S60\n; FLUSH_START\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\n; FLUSH_END\n{endif}\n\nM629\n\nM400\nM106 P1 S60\nM109 S[new_filament_temp]\nG1 E6 F{new_filament_e_feedrate} ;Compensate for filament spillage during waiting temperature\nM400\nG92 E0\nG1 E-[new_retract_length_toolchange] F1800\nM400\nM106 P1 S178\nM400 S3\nG1 X-38.2 F18000\nG1 X-48.2 F3000\nG1 X-38.2 F18000\nG1 X-48.2 F3000\nG1 X-38.2 F18000\nG1 X-48.2 F3000\nG1 X-38.2 F18000\nM400\nG1 Z{max_layer_z + 3.0} F3000\nM106 P1 S0\n{if layer_z <= (initial_layer_print_height + 0.001)}\nM204 S[initial_layer_acceleration]\n{else}\nM204 S[default_acceleration]\n{endif}\n{else}\nG1 X[x_after_toolchange] Y[y_after_toolchange] Z[z_after_toolchange] F12000\n{endif}\nM621 S[next_extruder]A\nG392 S0\n\nM1007 S1\n" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.4 nozzle.json index 5673773267..8478b5c818 100644 --- a/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.4 nozzle.json @@ -44,8 +44,9 @@ "30" ], "machine_unload_filament_time": "34", + "nozzle_height": "4.76", "nozzle_type": "stainless_steel", - "nozzle_volume": "32", + "nozzle_volume": "92", "printable_area": [ "0x0", "180x0", @@ -66,7 +67,7 @@ "Bambu Lab X1E 0.4 nozzle", "Bambu Lab A1 0.4 nozzle" ], - "machine_start_gcode": ";===== machine: A1 mini =========================\n;===== date: 20231226 =====================\n\n;===== start to heat heatbead&hotend==========\nM1002 gcode_claim_action : 2\nM1002 set_filament_type:{filament_type[initial_no_support_extruder]}\nM104 S170\nM140 S[bed_temperature_initial_layer_single]\nG392 S0 ;turn off clog detect\n;=====start printer sound ===================\nM17\nM400 S1\nM1006 S1\nM1006 A0 B0 L100 C37 D10 M100 E37 F10 N100\nM1006 A0 B0 L100 C41 D10 M100 E41 F10 N100\nM1006 A0 B0 L100 C44 D10 M100 E44 F10 N100\nM1006 A0 B10 L100 C0 D10 M100 E0 F10 N100\nM1006 A43 B10 L100 C39 D10 M100 E46 F10 N100\nM1006 A0 B0 L100 C0 D10 M100 E0 F10 N100\nM1006 A0 B0 L100 C39 D10 M100 E43 F10 N100\nM1006 A0 B0 L100 C0 D10 M100 E0 F10 N100\nM1006 A0 B0 L100 C41 D10 M100 E41 F10 N100\nM1006 A0 B0 L100 C44 D10 M100 E44 F10 N100\nM1006 A0 B0 L100 C49 D10 M100 E49 F10 N100\nM1006 A0 B0 L100 C0 D10 M100 E0 F10 N100\nM1006 A44 B10 L100 C39 D10 M100 E48 F10 N100\nM1006 A0 B0 L100 C0 D10 M100 E0 F10 N100\nM1006 A0 B0 L100 C39 D10 M100 E44 F10 N100\nM1006 A0 B0 L100 C0 D10 M100 E0 F10 N100\nM1006 A43 B10 L100 C39 D10 M100 E46 F10 N100\nM1006 W\nM18\n;=====avoid end stop =================\nG91\nG380 S2 Z30 F1200\nG380 S2 Z-20 F1200\nG1 Z5 F1200\nG90\n\n;===== reset machine status =================\nM290 X39 Y39 Z8\nM204 S6000\n\nM630 S0 P0\nG91\nM17 Z0.3 ; lower the z-motor current\n\nG90\nM17 X0.7 Y0.9 Z0.5 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM83\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\n;====== cog noise reduction=================\nM982.2 S1 ; turn on cog noise reduction\n\n;===== prepare print temperature and material ==========\nM400\nM18\nM109 S100 H170\nM104 S170\nM400\nM17\nM400\nG28 X\n\nM211 X0 Y0 Z0 ;turn off soft endstop ; turn off soft endstop to prevent protential logic problem\n\nM975 S1 ; turn on\n\nG1 X0.0 F30000\nG1 X-13.5 F3000\n\nM620 M ;enable remap\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n G392 S0 ;turn on clog detect\n M1002 gcode_claim_action : 4\n M400\n M1002 set_filament_type:UNKNOWN\n M109 S[nozzle_temperature_initial_layer]\n M104 S250\n M400\n T[initial_no_support_extruder]\n G1 X-13.5 F3000\n M400\n M620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n M109 S250 ;set nozzle to common flush temp\n M106 P1 S0\n G92 E0\n G1 E50 F200\n M400\n M1002 set_filament_type:{filament_type[initial_no_support_extruder]}\n M104 S{nozzle_temperature_range_high[initial_no_support_extruder]}\n G92 E0\n G1 E50 F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60}\n M400\n M106 P1 S178\n G92 E0\n G1 E5 F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60}\n M109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\n M104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-40}\n G92 E0\n G1 E-0.5 F300\n\n G1 X0 F30000\n G1 X-13.5 F3000\n G1 X0 F30000 ;wipe and shake\n G1 X-13.5 F3000\n G1 X0 F12000 ;wipe and shake\n G1 X0 F30000\n G1 X-13.5 F3000\n M109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-40}\n G392 S0 ;turn off clog detect\nM621 S[initial_no_support_extruder]A\n\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== mech mode fast check============================\nM1002 gcode_claim_action : 3\nG0 X25 Y175 F20000 ; find a soft place to home\n;M104 S0\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nM104 S170\n\n; build plate detect\nM1002 judge_flag build_plate_detect_flag\nM622 S1\n G39.4\n M400\nM623\n\nG1 Z5 F3000\nG1 X90 Y-1 F30000\nM400 P200\nM970.3 Q1 A7 K0 O2\nM974 Q1 S2 P0\n\nG1 X90 Y0 Z5 F30000\nM400 P200\nM970 Q0 A10 B50 C90 H15 K0 M20 O3\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X-1 Y10\nG28 X ; re-home XY\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\n\nM104 S170 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\nM211 S; push soft endstop status\nM211 X0 Y0 Z0 ;turn off Z axis endstop\n\nM83\nG1 E-1 F500\nG90\nM83\n\nM109 S170\nM104 S140\nG0 X90 Y-4 F30000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X91 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X92 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X93 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X94 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X95 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X96 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X97 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X98 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X99 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X99 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X99 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X99 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X99 F10000\nG380 S3 Z-5 F1200\n\nG1 Z5 F30000\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\nG1 X25 Y175 F30000.1 ;Brush material\nG1 Z0.2 F30000.1\nG1 Y185\nG91\nG1 X-30 F30000\nG1 Y-2\nG1 X27\nG1 Y1.5\nG1 X-28\nG1 Y-2\nG1 X30\nG1 Y1.5\nG1 X-30\nG90\nM83\n\nG1 Z5 F3000\nG0 X50 Y175 F20000 ; find a soft place to home\nG28 Z P0 T300; home z with low precision, permit 300deg temperature\nG29.2 S0 ; turn off ABL\n\nG0 X85 Y185 F10000 ;move to exposed steel surface and stop the nozzle\nG0 Z-1.01 F10000\nG91\n\nG2 I1 J0 X2 Y0 F2000.1\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\n\nG90\nG1 Z5 F30000\nG1 X25 Y175 F30000.1 ;Brush material\nG1 Z0.2 F30000.1\nG1 Y185\nG91\nG1 X-30 F30000\nG1 Y-2\nG1 X27\nG1 Y1.5\nG1 X-28\nG1 Y-2\nG1 X30\nG1 Y1.5\nG1 X-30\nG90\nM83\n\nG1 Z5\nG0 X55 Y175 F20000 ; find a soft place to home\nG28 Z P0 T300; home z with low precision, permit 300deg temperature\nG29.2 S0 ; turn off ABL\n\nG1 Z10\nG1 X85 Y185\nG1 Z-1.01\nG1 X95\nG1 X90\n\nM211 R; pop softend status\n\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== wait heatbed ====================\nM1002 gcode_claim_action : 2\nM104 S0\nM190 S[bed_temperature_initial_layer_single];set bed temp\nM109 S140\n\nG1 Z5 F3000\nG29.2 S1\nG1 X10 Y10 F20000\n\n;===== bed leveling ==================================\n;M1002 set_flag g29_before_print_flag=1\nM1002 judge_flag g29_before_print_flag\nM622 J1\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28 T145\n\nM623\n\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\n\nG1 X-13.5 Y0 Z10 F10000\nG1 E1.2 F500\nM400\nM1002 set_filament_type:UNKNOWN\nM109 S{nozzle_temperature[initial_extruder]}\nM400\n\nM412 S1 ; ===turn on filament runout detection===\nM400 P10\n\nG392 S0 ;turn on clog detect\n\nM620.3 W1; === turn on filament tangle detection===\nM400 S2\n\nM1002 set_filament_type:{filament_type[initial_no_support_extruder]}\n;M1002 set_flag extrude_cali_flag=1\nM1002 judge_flag extrude_cali_flag\nM622 J1\n M1002 gcode_claim_action : 8\n \n M400\n M900 K0.0 L1000.0 M1.0\n G90\n M83\n G0 X68 Y-4 F30000\n G0 Z0.2 F18000 ;Move to start position\n M400\n G0 X88 E10 F{outer_wall_volumetric_speed/(24/20) * 60}\n G0 X93 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\n G0 X98 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X103 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\n G0 X108 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X113 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\n G0 Y0 Z0 F20000\n M400\n \n G1 X-13.5 Y0 Z10 F10000\n M400\n \n G1 E10 F{outer_wall_volumetric_speed/2.4*60}\n M983 F{outer_wall_volumetric_speed/2.4} A0.3 H[nozzle_diameter]; cali dynamic extrusion compensation\n M106 P1 S178\n M400 S7\n G1 X0 F18000\n G1 X-13.5 F3000\n G1 X0 F18000 ;wipe and shake\n G1 X-13.5 F3000\n G1 X0 F12000 ;wipe and shake\n G1 X-13.5 F3000\n M400\n M106 P1 S0\n\n M1002 judge_last_extrude_cali_success\n M622 J0\n M983 F{outer_wall_volumetric_speed/2.4} A0.3 H[nozzle_diameter]; cali dynamic extrusion compensation\n M106 P1 S178\n M400 S7\n G1 X0 F18000\n G1 X-13.5 F3000\n G1 X0 F18000 ;wipe and shake\n G1 X-13.5 F3000\n G1 X0 F12000 ;wipe and shake\n M400\n M106 P1 S0\n M623\n \n G1 X-13.5 F3000\n M400\n M984 A0.1 E1 S1 F{outer_wall_volumetric_speed/2.4}\n M106 P1 S178\n M400 S7\n G1 X0 F18000\n G1 X-13.5 F3000\n G1 X0 F18000 ;wipe and shake\n G1 X-13.5 F3000\n G1 X0 F12000 ;wipe and shake\n G1 X-13.5 F3000\n M400\n M106 P1 S0\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\n;===== extrude cali test ===============================\nM104 S{nozzle_temperature_initial_layer[initial_extruder]}\nG90\nM83\nG0 X68 Y-2.5 F30000\nG0 Z0.2 F18000 ;Move to start position\nG0 X88 E10 F{outer_wall_volumetric_speed/(24/20) * 60}\nG0 X93 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\nG0 X98 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 X103 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\nG0 X108 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 X113 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\nG0 X115 Z0 F20000\nG0 Z5\nM400\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\n\nM400 ; wait all motion done before implement the emprical L parameters\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.02} ; for Textured PEI Plate\n{endif}\n\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\n\nM211 X0 Y0 Z0 ;turn off soft endstop\nM1007 S1\n", + "machine_start_gcode": ";===== machine: A1 mini =========================\n;===== date: 20240204 =====================\n\n;===== start to heat heatbead&hotend==========\nM1002 gcode_claim_action : 2\nM1002 set_filament_type:{filament_type[initial_no_support_extruder]}\nM104 S170\nM140 S[bed_temperature_initial_layer_single]\nG392 S0 ;turn off clog detect\n;=====start printer sound ===================\nM17\nM400 S1\nM1006 S1\nM1006 A0 B0 L100 C37 D10 M100 E37 F10 N100\nM1006 A0 B0 L100 C41 D10 M100 E41 F10 N100\nM1006 A0 B0 L100 C44 D10 M100 E44 F10 N100\nM1006 A0 B10 L100 C0 D10 M100 E0 F10 N100\nM1006 A43 B10 L100 C39 D10 M100 E46 F10 N100\nM1006 A0 B0 L100 C0 D10 M100 E0 F10 N100\nM1006 A0 B0 L100 C39 D10 M100 E43 F10 N100\nM1006 A0 B0 L100 C0 D10 M100 E0 F10 N100\nM1006 A0 B0 L100 C41 D10 M100 E41 F10 N100\nM1006 A0 B0 L100 C44 D10 M100 E44 F10 N100\nM1006 A0 B0 L100 C49 D10 M100 E49 F10 N100\nM1006 A0 B0 L100 C0 D10 M100 E0 F10 N100\nM1006 A44 B10 L100 C39 D10 M100 E48 F10 N100\nM1006 A0 B0 L100 C0 D10 M100 E0 F10 N100\nM1006 A0 B0 L100 C39 D10 M100 E44 F10 N100\nM1006 A0 B0 L100 C0 D10 M100 E0 F10 N100\nM1006 A43 B10 L100 C39 D10 M100 E46 F10 N100\nM1006 W\nM18\n;=====avoid end stop =================\nG91\nG380 S2 Z30 F1200\nG380 S3 Z-20 F1200\nG1 Z5 F1200\nG90\n\n;===== reset machine status =================\nM204 S6000\n\nM630 S0 P0\nG91\nM17 Z0.3 ; lower the z-motor current\n\nG90\nM17 X0.7 Y0.9 Z0.5 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM83\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\n;====== cog noise reduction=================\nM982.2 S1 ; turn on cog noise reduction\n\n;===== prepare print temperature and material ==========\nM400\nM18\nM109 S100 H170\nM104 S170\nM400\nM17\nM400\nG28 X\n\nM211 X0 Y0 Z0 ;turn off soft endstop ; turn off soft endstop to prevent protential logic problem\n\nM975 S1 ; turn on\n\nG1 X0.0 F30000\nG1 X-13.5 F3000\n\nM620 M ;enable remap\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n G392 S0 ;turn on clog detect\n M1002 gcode_claim_action : 4\n M400\n M1002 set_filament_type:UNKNOWN\n M109 S[nozzle_temperature_initial_layer]\n M104 S250\n M400\n T[initial_no_support_extruder]\n G1 X-13.5 F3000\n M400\n M620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n M109 S250 ;set nozzle to common flush temp\n M106 P1 S0\n G92 E0\n G1 E50 F200\n M400\n M1002 set_filament_type:{filament_type[initial_no_support_extruder]}\n M104 S{nozzle_temperature_range_high[initial_no_support_extruder]}\n G92 E0\n G1 E50 F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60}\n M400\n M106 P1 S178\n G92 E0\n G1 E5 F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60}\n M109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\n M104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-40}\n G92 E0\n G1 E-0.5 F300\n\n G1 X0 F30000\n G1 X-13.5 F3000\n G1 X0 F30000 ;wipe and shake\n G1 X-13.5 F3000\n G1 X0 F12000 ;wipe and shake\n G1 X0 F30000\n G1 X-13.5 F3000\n M109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-40}\n G392 S0 ;turn off clog detect\nM621 S[initial_no_support_extruder]A\n\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== mech mode fast check============================\nM1002 gcode_claim_action : 3\nG0 X25 Y175 F20000 ; find a soft place to home\n;M104 S0\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nM104 S170\n\n; build plate detect\nM1002 judge_flag build_plate_detect_flag\nM622 S1\n G39.4\n M400\nM623\n\nG1 Z5 F3000\nG1 X90 Y-1 F30000\nM400 P200\nM970.3 Q1 A7 K0 O2\nM974 Q1 S2 P0\n\nG1 X90 Y0 Z5 F30000\nM400 P200\nM970 Q0 A10 B50 C90 H15 K0 M20 O3\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X-1 Y10\nG28 X ; re-home XY\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\n\nM104 S170 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\nM211 S; push soft endstop status\nM211 X0 Y0 Z0 ;turn off Z axis endstop\n\nM83\nG1 E-1 F500\nG90\nM83\n\nM109 S170\nM104 S140\nG0 X90 Y-4 F30000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X91 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X92 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X93 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X94 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X95 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X96 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X97 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X98 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X99 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X99 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X99 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X99 F10000\nG380 S3 Z-5 F1200\nG1 Z2 F1200\nG1 X99 F10000\nG380 S3 Z-5 F1200\n\nG1 Z5 F30000\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\nG1 X25 Y175 F30000.1 ;Brush material\nG1 Z0.2 F30000.1\nG1 Y185\nG91\nG1 X-30 F30000\nG1 Y-2\nG1 X27\nG1 Y1.5\nG1 X-28\nG1 Y-2\nG1 X30\nG1 Y1.5\nG1 X-30\nG90\nM83\n\nG1 Z5 F3000\nG0 X50 Y175 F20000 ; find a soft place to home\nG28 Z P0 T300; home z with low precision, permit 300deg temperature\nG29.2 S0 ; turn off ABL\n\nG0 X85 Y185 F10000 ;move to exposed steel surface and stop the nozzle\nG0 Z-1.01 F10000\nG91\n\nG2 I1 J0 X2 Y0 F2000.1\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\n\nG90\nG1 Z5 F30000\nG1 X25 Y175 F30000.1 ;Brush material\nG1 Z0.2 F30000.1\nG1 Y185\nG91\nG1 X-30 F30000\nG1 Y-2\nG1 X27\nG1 Y1.5\nG1 X-28\nG1 Y-2\nG1 X30\nG1 Y1.5\nG1 X-30\nG90\nM83\n\nG1 Z5\nG0 X55 Y175 F20000 ; find a soft place to home\nG28 Z P0 T300; home z with low precision, permit 300deg temperature\nG29.2 S0 ; turn off ABL\n\nG1 Z10\nG1 X85 Y185\nG1 Z-1.01\nG1 X95\nG1 X90\n\nM211 R; pop softend status\n\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== wait heatbed ====================\nM1002 gcode_claim_action : 2\nM104 S0\nM190 S[bed_temperature_initial_layer_single];set bed temp\nM109 S140\n\nG1 Z5 F3000\nG29.2 S1\nG1 X10 Y10 F20000\n\n;===== bed leveling ==================================\n;M1002 set_flag g29_before_print_flag=1\nM1002 judge_flag g29_before_print_flag\nM622 J1\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28 T145\n\nM623\n\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n;===== nozzle load line ===============================\nM975 S1\nG90\nM83\nT1000\n\nG1 X-13.5 Y0 Z10 F10000\nG1 E1.2 F500\nM400\nM1002 set_filament_type:UNKNOWN\nM109 S{nozzle_temperature[initial_extruder]}\nM400\n\nM412 S1 ; ===turn on filament runout detection===\nM400 P10\n\nG392 S0 ;turn on clog detect\n\nM620.3 W1; === turn on filament tangle detection===\nM400 S2\n\nM1002 set_filament_type:{filament_type[initial_no_support_extruder]}\n;M1002 set_flag extrude_cali_flag=1\nM1002 judge_flag extrude_cali_flag\nM622 J1\n M1002 gcode_claim_action : 8\n \n M400\n M900 K0.0 L1000.0 M1.0\n G90\n M83\n G0 X68 Y-4 F30000\n G0 Z0.2 F18000 ;Move to start position\n M400\n G0 X88 E10 F{outer_wall_volumetric_speed/(24/20) * 60}\n G0 X93 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\n G0 X98 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X103 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\n G0 X108 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X113 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\n G0 Y0 Z0 F20000\n M400\n \n G1 X-13.5 Y0 Z10 F10000\n M400\n \n G1 E10 F{outer_wall_volumetric_speed/2.4*60}\n M983 F{outer_wall_volumetric_speed/2.4} A0.3 H[nozzle_diameter]; cali dynamic extrusion compensation\n M106 P1 S178\n M400 S7\n G1 X0 F18000\n G1 X-13.5 F3000\n G1 X0 F18000 ;wipe and shake\n G1 X-13.5 F3000\n G1 X0 F12000 ;wipe and shake\n G1 X-13.5 F3000\n M400\n M106 P1 S0\n\n M1002 judge_last_extrude_cali_success\n M622 J0\n M983 F{outer_wall_volumetric_speed/2.4} A0.3 H[nozzle_diameter]; cali dynamic extrusion compensation\n M106 P1 S178\n M400 S7\n G1 X0 F18000\n G1 X-13.5 F3000\n G1 X0 F18000 ;wipe and shake\n G1 X-13.5 F3000\n G1 X0 F12000 ;wipe and shake\n M400\n M106 P1 S0\n M623\n \n G1 X-13.5 F3000\n M400\n M984 A0.1 E1 S1 F{outer_wall_volumetric_speed/2.4}\n M106 P1 S178\n M400 S7\n G1 X0 F18000\n G1 X-13.5 F3000\n G1 X0 F18000 ;wipe and shake\n G1 X-13.5 F3000\n G1 X0 F12000 ;wipe and shake\n G1 X-13.5 F3000\n M400\n M106 P1 S0\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\n;===== extrude cali test ===============================\nM104 S{nozzle_temperature_initial_layer[initial_extruder]}\nG90\nM83\nG0 X68 Y-2.5 F30000\nG0 Z0.2 F18000 ;Move to start position\nG0 X88 E10 F{outer_wall_volumetric_speed/(24/20) * 60}\nG0 X93 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\nG0 X98 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 X103 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\nG0 X108 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 X113 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\nG0 X115 Z0 F20000\nG0 Z5\nM400\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\n\nM400 ; wait all motion done before implement the emprical L parameters\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.02} ; for Textured PEI Plate\n{endif}\n\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\n\nM211 X0 Y0 Z0 ;turn off soft endstop\nM1007 S1\n\n\n\n", "machine_end_gcode": ";===== date: 20231229 =====================\n;turn off nozzle clog detect\nG392 S0\n\nM400 ; wait for buffer to clear\nG92 E0 ; zero the extruder\nG1 E-0.8 F1800 ; retract\nG1 Z{max_layer_z + 0.5} F900 ; lower z a little\nG1 X0 Y{first_layer_center_no_wipe_tower[1]} F18000 ; move to safe pos\nG1 X-13.0 F3000 ; move to safe pos\n{if !spiral_mode && print_sequence != \"by object\"}\nM1002 judge_flag timelapse_record_flag\nM622 J1\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM400 P100\nM971 S11 C11 O0\nM991 S0 P-1 ;end timelapse at safe pos\nM623\n{endif}\n\nM140 S0 ; turn off bed\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off remote part cooling fan\nM106 P3 S0 ; turn off chamber cooling fan\n\n;G1 X27 F15000 ; wipe\n\n; pull back filament to AMS\nM620 S255\nG1 X181 F12000\nT255\nG1 X0 F18000\nG1 X-13.0 F3000\nG1 X0 F18000 ; wipe\nM621 S255\n\nM104 S0 ; turn off hotend\n\nM400 ; wait all motion done\nM17 S\nM17 Z0.4 ; lower z motor current to reduce impact if there is something in the bottom\n{if (max_layer_z + 100.0) < 180}\n G1 Z{max_layer_z + 100.0} F600\n G1 Z{max_layer_z +98.0}\n{else}\n G1 Z180 F600\n G1 Z180\n{endif}\nM400 P100\nM17 R ; restore z current\n\nG90\nG1 X-13 Y180 F3600\n\nG91\nG1 Z-1 F600\nG90\nM83\n\nM220 S100 ; Reset feedrate magnitude\nM201.2 K1.0 ; Reset acc magnitude\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 0\n\n;=====printer finish sound=========\nM17\nM400 S1\nM1006 S1\nM1006 A0 B20 L100 C37 D20 M100 E42 F20 N100\nM1006 A0 B10 L100 C44 D10 M100 E44 F10 N100\nM1006 A0 B10 L100 C46 D10 M100 E46 F10 N100\nM1006 A44 B20 L100 C39 D20 M100 E48 F20 N100\nM1006 A0 B10 L100 C44 D10 M100 E44 F10 N100\nM1006 A0 B10 L100 C0 D10 M100 E0 F10 N100\nM1006 A0 B10 L100 C39 D10 M100 E39 F10 N100\nM1006 A0 B10 L100 C0 D10 M100 E0 F10 N100\nM1006 A0 B10 L100 C44 D10 M100 E44 F10 N100\nM1006 A0 B10 L100 C0 D10 M100 E0 F10 N100\nM1006 A0 B10 L100 C39 D10 M100 E39 F10 N100\nM1006 A0 B10 L100 C0 D10 M100 E0 F10 N100\nM1006 A44 B10 L100 C0 D10 M100 E48 F10 N100\nM1006 A0 B10 L100 C0 D10 M100 E0 F10 N100\nM1006 A44 B20 L100 C41 D20 M100 E49 F20 N100\nM1006 A0 B20 L100 C0 D20 M100 E0 F20 N100\nM1006 A0 B20 L100 C37 D20 M100 E37 F20 N100\nM1006 W\n;=====printer finish sound=========\nM400 S1\nM18 X Y Z\n", "layer_change_gcode": "; layer num/total_layer_count: {layer_num+1}/[total_layer_count]\n; update layer progress\nM73 L{layer_num+1}\nM991 S0 P{layer_num} ;notify layer change\n", "time_lapse_gcode": ";===================== date: 202312028 =====================\n{if !spiral_mode && print_sequence != \"by object\"}\n; don't support timelapse gcode in spiral_mode and by object sequence for I3 structure printer\nM622.1 S1 ; for prev firware, default turned on\nM1002 judge_flag timelapse_record_flag\nM622 J1\nG92 E0\nG17\nG2 Z{layer_z + 0.4} I0.86 J0.86 P1 F20000 ; spiral lift a little\nG1 Z{max_layer_z + 0.4}\nG1 X0 Y{first_layer_center_no_wipe_tower[1]} F18000 ; move to safe pos\nG1 X-13.0 F3000 ; move to safe pos\nM400 P300\nM971 S11 C11 O0\nG92 E0\nG1 X0 F18000\nM623\n\nM622.1 S1\nM1002 judge_flag g39_detection_flag\nM622 J1\n ; enable nozzle clog detect at 3rd layer\n {if layer_num == 2}\n M400\n G90\n M83\n M204 S5000\n G0 Z2 F4000\n G0 X-6 Y170 F20000\n G39 S1 X-6 Y170\n G0 Z2 F4000\n G0 X90 Y90 F30000\n {endif}\n\n\n {if !in_head_wrap_detect_zone}\n M622.1 S0\n M1002 judge_flag g39_mass_exceed_flag\n M622 J1\n {if layer_num > 2}\n G392 S0\n M400\n G90\n M83\n M204 S5000\n G0 Z{max_layer_z + 0.4} F4000\n G39.3 S1\n G0 Z{max_layer_z + 0.4} F4000\n G392 S0\n {endif}\n M623\n {endif}\nM623\n{endif}\n", diff --git a/resources/profiles/BBL/machine/Bambu Lab P1P 0.2 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab P1P 0.2 nozzle.json index 62526620ef..b1219b59df 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1P 0.2 nozzle.json @@ -30,5 +30,5 @@ "Bambu Lab X1E 0.2 nozzle", "Bambu Lab A1 0.2 nozzle" ], - "machine_start_gcode": ";===== machine: P1P ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z-0.04 ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression" + "machine_start_gcode": ";===== machine: P1P ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== nozzle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z-0.04 ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json index d7e4726a40..b39a7e0250 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json @@ -21,11 +21,13 @@ "Bambu PLA Basic @BBL X1" ], "default_print_profile": "0.20mm Standard @BBL P1P", + "enable_long_retraction_when_cut" : "1", "extruder_offset": [ "0x2" ], "machine_load_filament_time": "29", "machine_unload_filament_time": "28", + "nozzle_height": "4.2", "nozzle_type": "stainless_steel", "scan_first_layer": "0", "upward_compatible_machine": [ @@ -35,7 +37,8 @@ "Bambu Lab X1E 0.4 nozzle", "Bambu Lab A1 0.4 nozzle" ], - "machine_start_gcode": ";===== machine: P1P ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression", + "machine_start_gcode": ";===== machine: P1P ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== nozzle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression", + "machine_end_gcode": ";===== date: 20230428 =====================\nM400 ; wait for buffer to clear\nG92 E0 ; zero the extruder\nG1 E-0.8 F1800 ; retract\nG1 Z{max_layer_z + 0.5} F900 ; lower z a little\nG1 X65 Y245 F12000 ; move to safe pos \nG1 Y265 F3000\n\nG1 X65 Y245 F12000\nG1 Y265 F3000\nM140 S0 ; turn off bed\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off remote part cooling fan\nM106 P3 S0 ; turn off chamber cooling fan\n\nG1 X100 F12000 ; wipe\n; pull back filament to AMS\nM620 S255\nG1 X20 Y50 F12000\nG1 Y-3\nT255\nG1 X65 F12000\nG1 Y265\nG1 X100 F12000 ; wipe\nM621 S255\nM104 S0 ; turn off hotend\n\nM622.1 S1 ; for prev firware, default turned on\nM1002 judge_flag timelapse_record_flag\nM622 J1\n M400 ; wait all motion done\n M991 S0 P-1 ;end smooth timelapse at safe pos\n M400 S3 ;wait for last picture to be taken\nM623; end of \"timelapse_record_flag\"\n\nM400 ; wait all motion done\nM17 S\nM17 Z0.4 ; lower z motor current to reduce impact if there is something in the bottom\n{if (max_layer_z + 100.0) < 250}\n G1 Z{max_layer_z + 100.0} F600\n G1 Z{max_layer_z +98.0}\n{else}\n G1 Z250 F600\n G1 Z248\n{endif}\nM400 P100\nM17 R ; restore z current\n\nM220 S100 ; Reset feedrate magnitude\nM201.2 K1.0 ; Reset acc magnitude\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 0\n\nM17 X0.8 Y0.8 Z0.5 ; lower motor current to 45% power\n", "layer_change_gcode": "; layer num/total_layer_count: {layer_num+1}/[total_layer_count]\nM622.1 S1 ; for prev firware, default turned on\nM1002 judge_flag timelapse_record_flag\nM622 J1\n{if timelapse_type == 0} ; timelapse without wipe tower\nM971 S11 C10 O0\n{elsif timelapse_type == 1} ; timelapse with wipe tower\nG92 E0\nG1 E-[retraction_length] F1800\nG17\nG2 Z{layer_z + 0.4} I0.86 J0.86 P1 F20000 ; spiral lift a little\nG1 X65 Y245 F20000 ; move to safe pos\nG17\nG2 Z{layer_z} I0.86 J0.86 P1 F20000\nG1 Y265 F3000\nM400 P300\nM971 S11 C11 O0\nG92 E0\nG1 E[retraction_length] F300\nG1 X100 F5000\nG1 Y255 F20000\n{endif}\nM623\n; update layer progress\nM73 L{layer_num+1}\nM991 S0 P{layer_num} ;notify layer change", - "change_filament_gcode": "M620 S[next_extruder]A\nM204 S9000\n{if toolchange_count > 1 && (z_hop_types[current_extruder] == 0 || z_hop_types[current_extruder] == 3)}\nG17\nG2 Z{z_after_toolchange + 0.4} I0.86 J0.86 P1 F10000 ; spiral lift a little from second lift\n{endif}\nG1 Z{max_layer_z + 3.0} F1200\n\nG1 X70 F21000\nG1 Y245\nG1 Y265 F3000\nM400\nM106 P1 S0\nM106 P2 S0\n{if old_filament_temp > 142 && next_extruder < 255}\nM104 S[old_filament_temp]\n{endif}\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 X120 F15000\n\nG1 X20 Y50 F21000\nG1 Y-3\n{if toolchange_count == 2}\n; get travel path for change filament\nM620.1 X[travel_point_1_x] Y[travel_point_1_y] F21000 P0\nM620.1 X[travel_point_2_x] Y[travel_point_2_y] F21000 P1\nM620.1 X[travel_point_3_x] Y[travel_point_3_y] F21000 P2\n{endif}\nM620.1 E F[old_filament_e_feedrate] T{nozzle_temperature_range_high[previous_extruder]}\nT[next_extruder]\nM620.1 E F[new_filament_e_feedrate] T{nozzle_temperature_range_high[next_extruder]}\n\n{if next_extruder < 255}\nM400\n\nG92 E0\n{if flush_length_1 > 1}\n; FLUSH_START\n; always use highest temperature to flush\nM400\n{if filament_type[next_extruder] == \"PETG\"}\nM109 S220\n{else}\nM109 S[nozzle_temperature_range_high]\n{endif}\n{if flush_length_1 > 23.7}\nG1 E23.7 F{old_filament_e_feedrate} ; do not need pulsatile flushing for start part\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{old_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\n{else}\nG1 E{flush_length_1} F{old_filament_e_feedrate}\n{endif}\n; FLUSH_END\nG1 E-[old_retract_length_toolchange] F1800\n{if (flush_length_2 > 1) && (filament_type[next_extruder]==\"PLA-CF\" || filament_type[next_extruder]==\"PETG\")}\nM106 P1 S255\nM400 S3\nM106 P1 S0\nG1 X80 F15000\nG1 X60 F15000\nG1 X80 F15000\nG1 X60 F15000; shake to put down garbage\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y245 F21000\nG1 X65 \nG1 Y265 F3000\n{endif}\nG1 E[old_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_2 > 1}\n; FLUSH_START\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\n{if (flush_length_3 > 1) && (filament_type[next_extruder]==\"PLA-CF\" || filament_type[next_extruder]==\"PETG\")}\nM106 P1 S255\nM400 S3\nM106 P1 S0\nG1 X80 F15000\nG1 X60 F15000\nG1 X80 F15000\nG1 X60 F15000; shake to put down garbage\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y245 F21000\nG1 X65 \nG1 Y265 F3000\n{endif}\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_3 > 1}\n; FLUSH_START\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\n{if (flush_length_4 > 1) && (filament_type[next_extruder]==\"PLA-CF\" || filament_type[next_extruder]==\"PETG\")}\nM106 P1 S255\nM400 S3\nM106 P1 S0\nG1 X80 F15000\nG1 X60 F15000\nG1 X80 F15000\nG1 X60 F15000; shake to put down garbage\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y245 F21000\nG1 X65 \nG1 Y265 F3000\n{endif}\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_4 > 1}\n; FLUSH_START\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\n; FLUSH_END\n{endif}\n; FLUSH_START\nM400\nM109 S[new_filament_temp]\nG1 E2 F{new_filament_e_feedrate} ;Compensate for filament spillage during waiting temperature\n; FLUSH_END\nM400\nG92 E0\nG1 E-[new_retract_length_toolchange] F1800\nM106 P1 S255\nM400 S3\nG1 X80 F15000\nG1 X60 F15000\nG1 X80 F15000\nG1 X60 F15000; shake to put down garbage\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y256 ; move Y to aside, prevent collision\nM400\nG1 Z{max_layer_z + 3.0} F3000\n{if layer_z <= (initial_layer_print_height + 0.001)}\nM204 S[initial_layer_acceleration]\n{else}\nM204 S[default_acceleration]\n{endif}\n{else}\nG1 X[x_after_toolchange] Y[y_after_toolchange] Z[z_after_toolchange] F12000\n{endif}\nM621 S[next_extruder]A\n" + "change_filament_gcode": "M620 S[next_extruder]A\nM204 S9000\n{if toolchange_count > 1 && (z_hop_types[current_extruder] == 0 || z_hop_types[current_extruder] == 3)}\nG17\nG2 Z{z_after_toolchange + 0.4} I0.86 J0.86 P1 F10000 ; spiral lift a little from second lift\n{endif}\nG1 Z{max_layer_z + 3.0} F1200\n\nG1 X70 F21000\nG1 Y245\nG1 Y265 F3000\nM400\nM106 P1 S0\nM106 P2 S0\n{if old_filament_temp > 142 && next_extruder < 255}\nM104 S[old_filament_temp]\n{endif}\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 X120 F15000\n{if long_retraction_when_cut && retraction_distance_when_cut > 2}\nG1 E-[retraction_distance_when_cut] F200\nM400\n{endif}\nG1 X20 Y50 F21000\nG1 Y-3\n{if toolchange_count == 2}\n; get travel path for change filament\nM620.1 X[travel_point_1_x] Y[travel_point_1_y] F21000 P0\nM620.1 X[travel_point_2_x] Y[travel_point_2_y] F21000 P1\nM620.1 X[travel_point_3_x] Y[travel_point_3_y] F21000 P2\n{endif}\nM620.1 E F[old_filament_e_feedrate] T{nozzle_temperature_range_high[previous_extruder]}\nT[next_extruder]\nM620.1 E F[new_filament_e_feedrate] T{nozzle_temperature_range_high[next_extruder]}\n\n{if next_extruder < 255}\nM400\n{if long_retraction_when_cut && retraction_distance_when_cut > 2}\nG1 E{retraction_distance_when_cut - 2} F200\nG1 E2 F20\nM400\n{endif}\nG92 E0\n{if flush_length_1 > 1}\nM83\n; FLUSH_START\n; always use highest temperature to flush\nM400\n{if filament_type[next_extruder] == \"PETG\"}\nM109 S260\n{elsif filament_type[next_extruder] == \"PVA\"}\nM109 S210\n{else}\nM109 S[nozzle_temperature_range_high]\n{endif}\n{if flush_length_1 > 23.7}\nG1 E23.7 F{old_filament_e_feedrate} ; do not need pulsatile flushing for start part\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{old_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\n{else}\nG1 E{flush_length_1} F{old_filament_e_feedrate}\n{endif}\n; FLUSH_END\nG1 E-[old_retract_length_toolchange] F1800\nG1 E[old_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_2 > 1}\n\nG91\nG1 X3 F12000; move aside to extrude\nG90\nM83\n\n; FLUSH_START\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_3 > 1}\n\nG91\nG1 X3 F12000; move aside to extrude\nG90\nM83\n\n; FLUSH_START\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_4 > 1}\n\nG91\nG1 X3 F12000; move aside to extrude\nG90\nM83\n\n; FLUSH_START\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\n; FLUSH_END\n{endif}\n; FLUSH_START\nM400\nM109 S[new_filament_temp]\nG1 E2 F{new_filament_e_feedrate} ;Compensate for filament spillage during waiting temperature\n; FLUSH_END\nM400\nG92 E0\nG1 E-[new_retract_length_toolchange] F1800\nM106 P1 S255\nM400 S3\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X105 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\n\nG1 X70 F10000\nG1 X80 F15000\nG1 X60\nG1 X80\nG1 X60\nG1 X80 ; shake to put down garbage\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y256 ; move Y to aside, prevent collision\nM400\nG1 Z{max_layer_z + 3.0} F3000\n{if layer_z <= (initial_layer_print_height + 0.001)}\nM204 S[initial_layer_acceleration]\n{else}\nM204 S[default_acceleration]\n{endif}\n{else}\nG1 X[x_after_toolchange] Y[y_after_toolchange] Z[z_after_toolchange] F12000\n{endif}\nM621 S[next_extruder]A\n" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab P1P 0.6 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab P1P 0.6 nozzle.json index 528dcad10f..e3952a891e 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1P 0.6 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1P 0.6 nozzle.json @@ -34,5 +34,5 @@ "Bambu Lab X1E 0.6 nozzle", "Bambu Lab A1 0.6 nozzle" ], - "machine_start_gcode": ";===== machine: P1P ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y15 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E1.166\nG0 X18 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression" + "machine_start_gcode": ";===== machine: P1P ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== nozzle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y15 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E1.166\nG0 X18 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab P1P 0.8 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab P1P 0.8 nozzle.json index 1ae5c22b3a..3364e0744f 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1P 0.8 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1P 0.8 nozzle.json @@ -34,5 +34,5 @@ "Bambu Lab X1E 0.8 nozzle", "Bambu Lab A1 0.8 nozzle" ], - "machine_start_gcode": ";===== machine: P1P ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y0.5 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X240 E15\nG0 Y15 E1.500 F{outer_wall_volumetric_speed/(0.3*1.0)/ 4 * 60}\nG0 X239.5\nG0 E0.3\nG0 Y1.5 E1.500\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X18 E15\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression" + "machine_start_gcode": ";===== machine: P1P ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== nozzle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y0.5 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X240 E15\nG0 Y15 E1.500 F{outer_wall_volumetric_speed/(0.3*1.0)/ 4 * 60}\nG0 X239.5\nG0 E0.3\nG0 Y1.5 E1.500\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X18 E15\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab P1S 0.2 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab P1S 0.2 nozzle.json index 8e021245c2..45ce15c990 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1S 0.2 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1S 0.2 nozzle.json @@ -30,5 +30,5 @@ "Bambu Lab X1E 0.2 nozzle", "Bambu Lab A1 0.2 nozzle" ], - "machine_start_gcode": ";===== machine: P1S ========================\n;===== date: 20231107 =====================\n;===== turn on the HB fan & MC board fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\nM710 A1 S255 ;turn on MC fan by default(P1S)\n;===== reset machine status =================\nM290 X40 Y40 Z2.6666666\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z-0.04 ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\n" + "machine_start_gcode": ";===== machine: P1S ========================\n;===== date: 20231107 =====================\n;===== turn on the HB fan & MC board fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\nM710 A1 S255 ;turn on MC fan by default(P1S)\n;===== reset machine status =================\nM290 X40 Y40 Z2.6666666\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== nozzle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z-0.04 ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\n" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab P1S 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab P1S 0.4 nozzle.json index 8da15f1add..a5a55c74ed 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1S 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1S 0.4 nozzle.json @@ -20,11 +20,13 @@ "Bambu PLA Basic @BBL X1C" ], "default_print_profile": "0.20mm Standard @BBL X1C", + "enable_long_retraction_when_cut" : "1", "extruder_offset": [ "0x2" ], "machine_load_filament_time": "29", "machine_unload_filament_time": "28", + "nozzle_height": "4.2", "nozzle_type": "stainless_steel", "scan_first_layer": "0", "upward_compatible_machine": [ @@ -34,7 +36,8 @@ "Bambu Lab X1E 0.4 nozzle", "Bambu Lab A1 0.4 nozzle" ], - "machine_start_gcode": ";===== machine: P1S ========================\n;===== date: 20231107 =====================\n;===== turn on the HB fan & MC board fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\nM710 A1 S255 ;turn on MC fan by default(P1S)\n;===== reset machine status =================\nM290 X40 Y40 Z2.6666666\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\n", + "machine_start_gcode": ";===== machine: P1S ========================\n;===== date: 20231107 =====================\n;===== turn on the HB fan & MC board fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\nM710 A1 S255 ;turn on MC fan by default(P1S)\n;===== reset machine status =================\nM290 X40 Y40 Z2.6666666\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== nozzle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\n", + "machine_end_gcode": ";===== date: 20230428 =====================\nM400 ; wait for buffer to clear\nG92 E0 ; zero the extruder\nG1 E-0.8 F1800 ; retract\nG1 Z{max_layer_z + 0.5} F900 ; lower z a little\nG1 X65 Y245 F12000 ; move to safe pos \nG1 Y265 F3000\n\nG1 X65 Y245 F12000\nG1 Y265 F3000\nM140 S0 ; turn off bed\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off remote part cooling fan\nM106 P3 S0 ; turn off chamber cooling fan\n\nG1 X100 F12000 ; wipe\n; pull back filament to AMS\nM620 S255\nG1 X20 Y50 F12000\nG1 Y-3\nT255\nG1 X65 F12000\nG1 Y265\nG1 X100 F12000 ; wipe\nM621 S255\nM104 S0 ; turn off hotend\n\nM622.1 S1 ; for prev firware, default turned on\nM1002 judge_flag timelapse_record_flag\nM622 J1\n M400 ; wait all motion done\n M991 S0 P-1 ;end smooth timelapse at safe pos\n M400 S3 ;wait for last picture to be taken\nM623; end of \"timelapse_record_flag\"\n\nM400 ; wait all motion done\nM17 S\nM17 Z0.4 ; lower z motor current to reduce impact if there is something in the bottom\n{if (max_layer_z + 100.0) < 250}\n G1 Z{max_layer_z + 100.0} F600\n G1 Z{max_layer_z +98.0}\n{else}\n G1 Z250 F600\n G1 Z248\n{endif}\nM400 P100\nM17 R ; restore z current\n\nM220 S100 ; Reset feedrate magnitude\nM201.2 K1.0 ; Reset acc magnitude\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 0\n\nM17 X0.8 Y0.8 Z0.5 ; lower motor current to 45% power\n", "layer_change_gcode": "; layer num/total_layer_count: {layer_num+1}/[total_layer_count]\nM622.1 S1 ; for prev firware, default turned on\nM1002 judge_flag timelapse_record_flag\nM622 J1\n{if timelapse_type == 0} ; timelapse without wipe tower\nM971 S11 C10 O0\n{elsif timelapse_type == 1} ; timelapse with wipe tower\nG92 E0\nG1 E-[retraction_length] F1800\nG17\nG2 Z{layer_z + 0.4} I0.86 J0.86 P1 F20000 ; spiral lift a little\nG1 X65 Y245 F20000 ; move to safe pos\nG17\nG2 Z{layer_z} I0.86 J0.86 P1 F20000\nG1 Y265 F3000\nM400 P300\nM971 S11 C11 O0\nG92 E0\nG1 E[retraction_length] F300\nG1 X100 F5000\nG1 Y255 F20000\n{endif}\nM623\n; update layer progress\nM73 L{layer_num+1}\nM991 S0 P{layer_num} ;notify layer change", - "change_filament_gcode": "M620 S[next_extruder]A\nM204 S9000\n{if toolchange_count > 1 && (z_hop_types[current_extruder] == 0 || z_hop_types[current_extruder] == 3)}\nG17\nG2 Z{z_after_toolchange + 0.4} I0.86 J0.86 P1 F10000 ; spiral lift a little from second lift\n{endif}\nG1 Z{max_layer_z + 3.0} F1200\n\nG1 X70 F21000\nG1 Y245\nG1 Y265 F3000\nM400\nM106 P1 S0\nM106 P2 S0\n{if old_filament_temp > 142 && next_extruder < 255}\nM104 S[old_filament_temp]\n{endif}\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 X120 F15000\n\nG1 X20 Y50 F21000\nG1 Y-3\n{if toolchange_count == 2}\n; get travel path for change filament\nM620.1 X[travel_point_1_x] Y[travel_point_1_y] F21000 P0\nM620.1 X[travel_point_2_x] Y[travel_point_2_y] F21000 P1\nM620.1 X[travel_point_3_x] Y[travel_point_3_y] F21000 P2\n{endif}\nM620.1 E F[old_filament_e_feedrate] T{nozzle_temperature_range_high[previous_extruder]}\nT[next_extruder]\nM620.1 E F[new_filament_e_feedrate] T{nozzle_temperature_range_high[next_extruder]}\n\n{if next_extruder < 255}\nM400\n\nG92 E0\n{if flush_length_1 > 1}\n; FLUSH_START\n; always use highest temperature to flush\nM400\n{if filament_type[next_extruder] == \"PETG\"}\nM109 S220\n{else}\nM109 S[nozzle_temperature_range_high]\n{endif}\n{if flush_length_1 > 23.7}\nG1 E23.7 F{old_filament_e_feedrate} ; do not need pulsatile flushing for start part\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{old_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\n{else}\nG1 E{flush_length_1} F{old_filament_e_feedrate}\n{endif}\n; FLUSH_END\nG1 E-[old_retract_length_toolchange] F1800\n{if (flush_length_2 > 1) && (filament_type[next_extruder]==\"PLA-CF\" || filament_type[next_extruder]==\"PETG\")}\nM106 P1 S255\nM400 S3\nM106 P1 S0\nG1 X80 F15000\nG1 X60 F15000\nG1 X80 F15000\nG1 X60 F15000; shake to put down garbage\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y245 F21000\nG1 X65 \nG1 Y265 F3000\n{endif}\nG1 E[old_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_2 > 1}\n; FLUSH_START\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\n{if (flush_length_3 > 1) && (filament_type[next_extruder]==\"PLA-CF\" || filament_type[next_extruder]==\"PETG\")}\nM106 P1 S255\nM400 S3\nM106 P1 S0\nG1 X80 F15000\nG1 X60 F15000\nG1 X80 F15000\nG1 X60 F15000; shake to put down garbage\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y245 F21000\nG1 X65 \nG1 Y265 F3000\n{endif}\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_3 > 1}\n; FLUSH_START\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\n{if (flush_length_4 > 1) && (filament_type[next_extruder]==\"PLA-CF\" || filament_type[next_extruder]==\"PETG\")}\nM106 P1 S255\nM400 S3\nM106 P1 S0\nG1 X80 F15000\nG1 X60 F15000\nG1 X80 F15000\nG1 X60 F15000; shake to put down garbage\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y245 F21000\nG1 X65 \nG1 Y265 F3000\n{endif}\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_4 > 1}\n; FLUSH_START\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\n; FLUSH_END\n{endif}\n; FLUSH_START\nM400\nM109 S[new_filament_temp]\nG1 E2 F{new_filament_e_feedrate} ;Compensate for filament spillage during waiting temperature\n; FLUSH_END\nM400\nG92 E0\nG1 E-[new_retract_length_toolchange] F1800\nM106 P1 S255\nM400 S3\nG1 X80 F15000\nG1 X60 F15000\nG1 X80 F15000\nG1 X60 F15000; shake to put down garbage\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y256 ; move Y to aside, prevent collision\nM400\nG1 Z{max_layer_z + 3.0} F3000\n{if layer_z <= (initial_layer_print_height + 0.001)}\nM204 S[initial_layer_acceleration]\n{else}\nM204 S[default_acceleration]\n{endif}\n{else}\nG1 X[x_after_toolchange] Y[y_after_toolchange] Z[z_after_toolchange] F12000\n{endif}\nM621 S[next_extruder]A\n" + "change_filament_gcode": "M620 S[next_extruder]A\nM204 S9000\n{if toolchange_count > 1 && (z_hop_types[current_extruder] == 0 || z_hop_types[current_extruder] == 3)}\nG17\nG2 Z{z_after_toolchange + 0.4} I0.86 J0.86 P1 F10000 ; spiral lift a little from second lift\n{endif}\nG1 Z{max_layer_z + 3.0} F1200\n\nG1 X70 F21000\nG1 Y245\nG1 Y265 F3000\nM400\nM106 P1 S0\nM106 P2 S0\n{if old_filament_temp > 142 && next_extruder < 255}\nM104 S[old_filament_temp]\n{endif}\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 X120 F15000\n{if long_retraction_when_cut && retraction_distance_when_cut > 2}\nG1 E-[retraction_distance_when_cut] F200\nM400\n{endif}\nG1 X20 Y50 F21000\nG1 Y-3\n{if toolchange_count == 2}\n; get travel path for change filament\nM620.1 X[travel_point_1_x] Y[travel_point_1_y] F21000 P0\nM620.1 X[travel_point_2_x] Y[travel_point_2_y] F21000 P1\nM620.1 X[travel_point_3_x] Y[travel_point_3_y] F21000 P2\n{endif}\nM620.1 E F[old_filament_e_feedrate] T{nozzle_temperature_range_high[previous_extruder]}\nT[next_extruder]\nM620.1 E F[new_filament_e_feedrate] T{nozzle_temperature_range_high[next_extruder]}\n\n{if next_extruder < 255}\nM400\n{if long_retraction_when_cut && retraction_distance_when_cut > 2}\nG1 E{retraction_distance_when_cut - 2} F200\nG1 E2 F20\nM400\n{endif}\nG92 E0\n{if flush_length_1 > 1}\nM83\n; FLUSH_START\n; always use highest temperature to flush\nM400\n{if filament_type[next_extruder] == \"PETG\"}\nM109 S260\n{elsif filament_type[next_extruder] == \"PVA\"}\nM109 S210\n{else}\nM109 S[nozzle_temperature_range_high]\n{endif}\n{if flush_length_1 > 23.7}\nG1 E23.7 F{old_filament_e_feedrate} ; do not need pulsatile flushing for start part\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{old_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\n{else}\nG1 E{flush_length_1} F{old_filament_e_feedrate}\n{endif}\n; FLUSH_END\nG1 E-[old_retract_length_toolchange] F1800\nG1 E[old_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_2 > 1}\n\nG91\nG1 X3 F12000; move aside to extrude\nG90\nM83\n\n; FLUSH_START\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_3 > 1}\n\nG91\nG1 X3 F12000; move aside to extrude\nG90\nM83\n\n; FLUSH_START\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_4 > 1}\n\nG91\nG1 X3 F12000; move aside to extrude\nG90\nM83\n\n; FLUSH_START\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\n; FLUSH_END\n{endif}\n; FLUSH_START\nM400\nM109 S[new_filament_temp]\nG1 E2 F{new_filament_e_feedrate} ;Compensate for filament spillage during waiting temperature\n; FLUSH_END\nM400\nG92 E0\nG1 E-[new_retract_length_toolchange] F1800\nM106 P1 S255\nM400 S3\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X105 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\n\nG1 X70 F10000\nG1 X80 F15000\nG1 X60\nG1 X80\nG1 X60\nG1 X80 ; shake to put down garbage\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y256 ; move Y to aside, prevent collision\nM400\nG1 Z{max_layer_z + 3.0} F3000\n{if layer_z <= (initial_layer_print_height + 0.001)}\nM204 S[initial_layer_acceleration]\n{else}\nM204 S[default_acceleration]\n{endif}\n{else}\nG1 X[x_after_toolchange] Y[y_after_toolchange] Z[z_after_toolchange] F12000\n{endif}\nM621 S[next_extruder]A\n" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab P1S 0.6 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab P1S 0.6 nozzle.json index 058eae33f2..195857d3ee 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1S 0.6 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1S 0.6 nozzle.json @@ -34,5 +34,5 @@ "Bambu Lab X1E 0.6 nozzle", "Bambu Lab A1 0.6 nozzle" ], - "machine_start_gcode": ";===== machine: P1S ========================\n;===== date: 20231107 =====================\n;===== turn on the HB fan & MC board fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\nM710 A1 S255 ;turn on MC fan by default(P1S)\n;===== reset machine status =================\nM290 X40 Y40 Z2.6666666\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y15 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E1.166\nG0 X18 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\n" + "machine_start_gcode": ";===== machine: P1S ========================\n;===== date: 20231107 =====================\n;===== turn on the HB fan & MC board fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\nM710 A1 S255 ;turn on MC fan by default(P1S)\n;===== reset machine status =================\nM290 X40 Y40 Z2.6666666\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== nozzle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y15 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E1.166\nG0 X18 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\n" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab P1S 0.8 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab P1S 0.8 nozzle.json index ae628412cd..0db7e015bb 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1S 0.8 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1S 0.8 nozzle.json @@ -34,5 +34,5 @@ "Bambu Lab X1E 0.8 nozzle", "Bambu Lab A1 0.8 nozzle" ], - "machine_start_gcode": ";===== machine: P1S ========================\n;===== date: 20231107 =====================\n;===== turn on the HB fan & MC board fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\nM710 A1 S255 ; turn on MC fan by default(P1S)\n;===== reset machine status =================\nM290 X40 Y40 Z2.6666666\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y0.5 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X240 E15\nG0 Y15 E1.500 F{outer_wall_volumetric_speed/(0.3*1.0)/ 4 * 60}\nG0 X239.5\nG0 E0.3\nG0 Y1.5 E1.500\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X18 E15\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\n" + "machine_start_gcode": ";===== machine: P1S ========================\n;===== date: 20231107 =====================\n;===== turn on the HB fan & MC board fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\nM710 A1 S255 ; turn on MC fan by default(P1S)\n;===== reset machine status =================\nM290 X40 Y40 Z2.6666666\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== nozzle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y0.5 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X240 E15\nG0 Y15 E1.500 F{outer_wall_volumetric_speed/(0.3*1.0)/ 4 * 60}\nG0 X239.5\nG0 E0.3\nG0 Y1.5 E1.500\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X18 E15\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\n" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 0.2 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1 0.2 nozzle.json index af54617e2d..a5196e5c75 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 0.2 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 0.2 nozzle.json @@ -30,5 +30,5 @@ "Bambu Lab X1E 0.2 nozzle", "Bambu Lab A1 0.2 nozzle" ], - "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X231 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n T1000\n\n G0 F1200.0 X231 Y15 Z0.2 E0.741\n G0 F1200.0 X226 Y15 Z0.2 E0.275\n G0 F1200.0 X226 Y8 Z0.2 E0.384\n G0 F1200.0 X216 Y8 Z0.2 E0.549\n G0 F1200.0 X216 Y1.5 Z0.2 E0.357\n\n G0 X48.0 E12.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E0.92 F1200.0\n G0 X35.0 Y6.0 E1.03 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n\t{if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E9.35441 F4800\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.160\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.080\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E14.3 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.080 K0.160\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.08 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.08}\n M623\n\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" + "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== nozzle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X231 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n T1000\n\n G0 F1200.0 X231 Y15 Z0.2 E0.741\n G0 F1200.0 X226 Y15 Z0.2 E0.275\n G0 F1200.0 X226 Y8 Z0.2 E0.384\n G0 F1200.0 X216 Y8 Z0.2 E0.549\n G0 F1200.0 X216 Y1.5 Z0.2 E0.357\n\n G0 X48.0 E12.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E0.92 F1200.0\n G0 X35.0 Y6.0 E1.03 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n\t{if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E9.35441 F4800\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.160\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.080\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E14.3 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.080 K0.160\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.08 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.08}\n M623\n\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1 0.4 nozzle.json index 22c7cf476d..4b96419d2f 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 0.4 nozzle.json @@ -21,11 +21,13 @@ "Bambu PLA Basic @BBL X1" ], "default_print_profile": "0.20mm Standard @BBL X1C", + "enable_long_retraction_when_cut": "2", "extruder_offset": [ "0x2" ], "machine_load_filament_time": "29", "machine_unload_filament_time": "28", + "nozzle_height": "4.2", "nozzle_type": "stainless_steel", "scan_first_layer": "1", "upward_compatible_machine": [ @@ -35,6 +37,7 @@ "Bambu Lab X1E 0.4 nozzle", "Bambu Lab A1 0.4 nozzle" ], - "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X231 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n T1000\n\n G0 F1200.0 X231 Y15 Z0.2 E0.741\n G0 F1200.0 X226 Y15 Z0.2 E0.275\n G0 F1200.0 X226 Y8 Z0.2 E0.384\n G0 F1200.0 X216 Y8 Z0.2 E0.549\n G0 F1200.0 X216 Y1.5 Z0.2 E0.357\n\n G0 X48.0 E12.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E0.92 F1200.0\n G0 X35.0 Y6.0 E1.03 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E9.35441 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.040\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.020\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E14.3 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.020 K0.040\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.02 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.02}\n M623\n\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4", - "change_filament_gcode": "M620 S[next_extruder]A\nM204 S9000\n{if toolchange_count > 1 && (z_hop_types[current_extruder] == 0 || z_hop_types[current_extruder] == 3)}\nG17\nG2 Z{z_after_toolchange + 0.4} I0.86 J0.86 P1 F10000 ; spiral lift a little from second lift\n{endif}\nG1 Z{max_layer_z + 3.0} F1200\n\nG1 X70 F21000\nG1 Y245\nG1 Y265 F3000\nM400\nM106 P1 S0\nM106 P2 S0\n{if old_filament_temp > 142 && next_extruder < 255}\nM104 S[old_filament_temp]\n{endif}\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 X120 F15000\n\nG1 X20 Y50 F21000\nG1 Y-3\n{if toolchange_count == 2}\n; get travel path for change filament\nM620.1 X[travel_point_1_x] Y[travel_point_1_y] F21000 P0\nM620.1 X[travel_point_2_x] Y[travel_point_2_y] F21000 P1\nM620.1 X[travel_point_3_x] Y[travel_point_3_y] F21000 P2\n{endif}\nM620.1 E F[old_filament_e_feedrate] T{nozzle_temperature_range_high[previous_extruder]}\nT[next_extruder]\nM620.1 E F[new_filament_e_feedrate] T{nozzle_temperature_range_high[next_extruder]}\n\n{if next_extruder < 255}\nM400\n\nG92 E0\n{if flush_length_1 > 1}\n; FLUSH_START\n; always use highest temperature to flush\nM400\n{if filament_type[next_extruder] == \"PETG\"}\nM109 S220\n{else}\nM109 S[nozzle_temperature_range_high]\n{endif}\n{if flush_length_1 > 23.7}\nG1 E23.7 F{old_filament_e_feedrate} ; do not need pulsatile flushing for start part\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{old_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\n{else}\nG1 E{flush_length_1} F{old_filament_e_feedrate}\n{endif}\n; FLUSH_END\nG1 E-[old_retract_length_toolchange] F1800\n{if (flush_length_2 > 1) && (filament_type[next_extruder]==\"PLA-CF\" || filament_type[next_extruder]==\"PETG\")}\nM106 P1 S255\nM400 S3\nM106 P1 S0\nG1 X80 F15000\nG1 X60 F15000\nG1 X80 F15000\nG1 X60 F15000; shake to put down garbage\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y245 F21000\nG1 X65 \nG1 Y265 F3000\n{endif}\nG1 E[old_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_2 > 1}\n; FLUSH_START\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\n{if (flush_length_3 > 1) && (filament_type[next_extruder]==\"PLA-CF\" || filament_type[next_extruder]==\"PETG\")}\nM106 P1 S255\nM400 S3\nM106 P1 S0\nG1 X80 F15000\nG1 X60 F15000\nG1 X80 F15000\nG1 X60 F15000; shake to put down garbage\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y245 F21000\nG1 X65 \nG1 Y265 F3000\n{endif}\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_3 > 1}\n; FLUSH_START\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\n{if (flush_length_4 > 1) && (filament_type[next_extruder]==\"PLA-CF\" || filament_type[next_extruder]==\"PETG\")}\nM106 P1 S255\nM400 S3\nM106 P1 S0\nG1 X80 F15000\nG1 X60 F15000\nG1 X80 F15000\nG1 X60 F15000; shake to put down garbage\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y245 F21000\nG1 X65 \nG1 Y265 F3000\n{endif}\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_4 > 1}\n; FLUSH_START\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\n; FLUSH_END\n{endif}\n; FLUSH_START\nM400\nM109 S[new_filament_temp]\nG1 E2 F{new_filament_e_feedrate} ;Compensate for filament spillage during waiting temperature\n; FLUSH_END\nM400\nG92 E0\nG1 E-[new_retract_length_toolchange] F1800\nM106 P1 S255\nM400 S3\nG1 X80 F15000\nG1 X60 F15000\nG1 X80 F15000\nG1 X60 F15000; shake to put down garbage\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y256 ; move Y to aside, prevent collision\nM400\nG1 Z{max_layer_z + 3.0} F3000\n{if layer_z <= (initial_layer_print_height + 0.001)}\nM204 S[initial_layer_acceleration]\n{else}\nM204 S[default_acceleration]\n{endif}\n{else}\nG1 X[x_after_toolchange] Y[y_after_toolchange] Z[z_after_toolchange] F12000\n{endif}\nM621 S[next_extruder]A\n" + "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== nozzle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X231 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n T1000\n\n G0 F1200.0 X231 Y15 Z0.2 E0.741\n G0 F1200.0 X226 Y15 Z0.2 E0.275\n G0 F1200.0 X226 Y8 Z0.2 E0.384\n G0 F1200.0 X216 Y8 Z0.2 E0.549\n G0 F1200.0 X216 Y1.5 Z0.2 E0.357\n\n G0 X48.0 E12.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E0.92 F1200.0\n G0 X35.0 Y6.0 E1.03 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E9.35441 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.040\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.020\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E14.3 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.020 K0.040\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.02 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.02}\n M623\n\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4", + "machine_end_gcode": ";===== date: 20240402 =====================\nM400 ; wait for buffer to clear\nG92 E0 ; zero the extruder\nG1 E-0.8 F1800 ; retract\nG1 Z{max_layer_z + 0.5} F900 ; lower z a little\nG1 X65 Y245 F12000 ; move to safe pos \nG1 Y265 F3000\n\nG1 X65 Y245 F12000\nG1 Y265 F3000\nM140 S0 ; turn off bed\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off remote part cooling fan\nM106 P3 S0 ; turn off chamber cooling fan\n\nG1 X100 F12000 ; wipe\n; pull back filament to AMS\nM620 S255\nG1 X20 Y50 F12000\nG1 Y-3\nT255\nG1 X65 F12000\nG1 Y265\nG1 X100 F12000 ; wipe\nM621 S255\nM104 S0 ; turn off hotend\n\nM622.1 S1 ; for prev firware, default turned on\nM1002 judge_flag timelapse_record_flag\nM622 J1\n M400 ; wait all motion done\n M991 S0 P-1 ;end smooth timelapse at safe pos\n M400 S3 ;wait for last picture to be taken\nM623; end of \"timelapse_record_flag\"\n\nM400 ; wait all motion done\nM17 S\nM17 Z0.4 ; lower z motor current to reduce impact if there is something in the bottom\n{if (max_layer_z + 100.0) < 250}\n G1 Z{max_layer_z + 100.0} F600\n G1 Z{max_layer_z +98.0}\n{else}\n G1 Z250 F600\n G1 Z248\n{endif}\nM400 P100\nM17 R ; restore z current\n\nM220 S100 ; Reset feedrate magnitude\nM201.2 K1.0 ; Reset acc magnitude\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 0\n\nM17 X0.8 Y0.8 Z0.5 ; lower motor current to 45% power\nM960 S5 P0 ; turn off logo lamp\n\n", + "change_filament_gcode": "M620 S[next_extruder]A\nM204 S9000\n{if toolchange_count > 1 && (z_hop_types[current_extruder] == 0 || z_hop_types[current_extruder] == 3)}\nG17\nG2 Z{z_after_toolchange + 0.4} I0.86 J0.86 P1 F10000 ; spiral lift a little from second lift\n{endif}\nG1 Z{max_layer_z + 3.0} F1200\n\nG1 X70 F21000\nG1 Y245\nG1 Y265 F3000\nM400\nM106 P1 S0\nM106 P2 S0\n{if old_filament_temp > 142 && next_extruder < 255}\nM104 S[old_filament_temp]\n{endif}\n{if long_retractions_when_cut[previous_extruder]}\nM620.11 S1 I[previous_extruder] E-{retraction_distances_when_cut[previous_extruder]} F{old_filament_e_feedrate}\n{else}\nM620.11 S0\n{endif}\nM400\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 X120 F15000\nG1 X20 Y50 F21000\nG1 Y-3\n{if toolchange_count == 2}\n; get travel path for change filament\nM620.1 X[travel_point_1_x] Y[travel_point_1_y] F21000 P0\nM620.1 X[travel_point_2_x] Y[travel_point_2_y] F21000 P1\nM620.1 X[travel_point_3_x] Y[travel_point_3_y] F21000 P2\n{endif}\nM620.1 E F[old_filament_e_feedrate] T{nozzle_temperature_range_high[previous_extruder]}\nT[next_extruder]\nM620.1 E F[new_filament_e_feedrate] T{nozzle_temperature_range_high[next_extruder]}\n\n{if next_extruder < 255}\n{if long_retractions_when_cut[previous_extruder]}\nM620.11 S1 I[previous_extruder] E{retraction_distances_when_cut[previous_extruder]} F{old_filament_e_feedrate}\nM628 S1\nG92 E0\nG1 E{retraction_distances_when_cut[previous_extruder]} F[old_filament_e_feedrate]\nM400\nM629 S1\n{else}\nM620.11 S0\n{endif}\nG92 E0\n{if flush_length_1 > 1}\nM83\n; FLUSH_START\n; always use highest temperature to flush\nM400\n{if filament_type[next_extruder] == \"PETG\"}\nM109 S260\n{elsif filament_type[next_extruder] == \"PVA\"}\nM109 S210\n{else}\nM109 S[nozzle_temperature_range_high]\n{endif}\n{if flush_length_1 > 23.7}\nG1 E23.7 F{old_filament_e_feedrate} ; do not need pulsatile flushing for start part\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{old_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\n{else}\nG1 E{flush_length_1} F{old_filament_e_feedrate}\n{endif}\n; FLUSH_END\nG1 E-[old_retract_length_toolchange] F1800\nG1 E[old_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_2 > 1}\n\nG91\nG1 X3 F12000; move aside to extrude\nG90\nM83\n\n; FLUSH_START\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_3 > 1}\n\nG91\nG1 X3 F12000; move aside to extrude\nG90\nM83\n\n; FLUSH_START\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_4 > 1}\n\nG91\nG1 X3 F12000; move aside to extrude\nG90\nM83\n\n; FLUSH_START\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\n; FLUSH_END\n{endif}\n; FLUSH_START\nM400\nM109 S[new_filament_temp]\nG1 E2 F{new_filament_e_feedrate} ;Compensate for filament spillage during waiting temperature\n; FLUSH_END\nM400\nG92 E0\nG1 E-[new_retract_length_toolchange] F1800\nM106 P1 S255\nM400 S3\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X105 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\n\nG1 X70 F10000\nG1 X80 F15000\nG1 X60\nG1 X80\nG1 X60\nG1 X80 ; shake to put down garbage\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y256 ; move Y to aside, prevent collision\nM400\nG1 Z{max_layer_z + 3.0} F3000\n{if layer_z <= (initial_layer_print_height + 0.001)}\nM204 S[initial_layer_acceleration]\n{else}\nM204 S[default_acceleration]\n{endif}\n{else}\nG1 X[x_after_toolchange] Y[y_after_toolchange] Z[z_after_toolchange] F12000\n{endif}\nM621 S[next_extruder]A\n" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 0.6 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1 0.6 nozzle.json index 34b6e1894c..74f5b0e3b9 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 0.6 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 0.6 nozzle.json @@ -34,5 +34,5 @@ "Bambu Lab X1E 0.6 nozzle", "Bambu Lab A1 0.6 nozzle" ], - "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y15 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E1.166\nG0 X231 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n G0 F1200.0 X231 Y15 Z0.2 E1.333\n G0 F1200.0 X226 Y15 Z0.2 E0.495\n G0 F1200.0 X226 Y8 Z0.2 E0.691\n G0 F1200.0 X216 Y8 Z0.2 E0.988\n G0 F1200.0 X216 Y1.5 Z0.2 E0.642\n\n G0 X48.0 E20.56 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E1.56 F1200.0\n G0 X35.0 Y6.0 E1.75 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E16.9 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.030\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.015\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E23.9 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.015 K0.030\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.015 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.015}\n M623\n\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" + "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== nozzle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y15 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E1.166\nG0 X231 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n G0 F1200.0 X231 Y15 Z0.2 E1.333\n G0 F1200.0 X226 Y15 Z0.2 E0.495\n G0 F1200.0 X226 Y8 Z0.2 E0.691\n G0 F1200.0 X216 Y8 Z0.2 E0.988\n G0 F1200.0 X216 Y1.5 Z0.2 E0.642\n\n G0 X48.0 E20.56 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E1.56 F1200.0\n G0 X35.0 Y6.0 E1.75 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E16.9 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.030\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.015\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E23.9 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.015 K0.030\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.015 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.015}\n M623\n\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 0.8 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1 0.8 nozzle.json index 06b1cdc2a1..9741939bda 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 0.8 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 0.8 nozzle.json @@ -34,5 +34,5 @@ "Bambu Lab X1E 0.8 nozzle", "Bambu Lab A1 0.8 nozzle" ], - "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y0.5 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X240 E15\nG0 Y11 E1.364 F{outer_wall_volumetric_speed/(0.3*1.0)/ 4 * 60}\nG0 X239.5\nG0 E0.3\nG0 Y1.5 E1.300\nG0 X231 E1.160 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n G0 F1200.0 X231 Y15 Z0.2 E1.482\n G0 F1200.0 X226 Y15 Z0.2 E0.550\n G0 F1200.0 X226 Y8 Z0.2 E0.768\n G0 F1200.0 X216 Y8 Z0.2 E1.098\n G0 F1200.0 X216 Y1.5 Z0.2 E0.714\n\n G0 X48.0 E25.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E1.70 F1200.0\n G0 X35.0 Y6.0 E1.90 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X110.000 E9.35441 F4800\n G0 X185.000 E9.35441 F4800\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.020\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.010\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X129 E14 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.010 K0.020\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.01 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14) *0.01}\n M623\n\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X185.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X190.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X195.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X200.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X205.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X210.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X215.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X220.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X225.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" + "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== nozzle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y0.5 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X240 E15\nG0 Y11 E1.364 F{outer_wall_volumetric_speed/(0.3*1.0)/ 4 * 60}\nG0 X239.5\nG0 E0.3\nG0 Y1.5 E1.300\nG0 X231 E1.160 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n G0 F1200.0 X231 Y15 Z0.2 E1.482\n G0 F1200.0 X226 Y15 Z0.2 E0.550\n G0 F1200.0 X226 Y8 Z0.2 E0.768\n G0 F1200.0 X216 Y8 Z0.2 E1.098\n G0 F1200.0 X216 Y1.5 Z0.2 E0.714\n\n G0 X48.0 E25.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E1.70 F1200.0\n G0 X35.0 Y6.0 E1.90 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X110.000 E9.35441 F4800\n G0 X185.000 E9.35441 F4800\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.020\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.010\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X129 E14 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.010 K0.020\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.01 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14) *0.01}\n M623\n\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X185.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X190.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X195.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X200.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X205.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X210.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X215.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X220.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X225.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.2 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.2 nozzle.json index 61bdacbbdf..115fab918a 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.2 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.2 nozzle.json @@ -31,5 +31,5 @@ "Bambu Lab X1E 0.2 nozzle", "Bambu Lab A1 0.2 nozzle" ], - "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X231 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n T1000\n\n G0 F1200.0 X231 Y15 Z0.2 E0.741\n G0 F1200.0 X226 Y15 Z0.2 E0.275\n G0 F1200.0 X226 Y8 Z0.2 E0.384\n G0 F1200.0 X216 Y8 Z0.2 E0.549\n G0 F1200.0 X216 Y1.5 Z0.2 E0.357\n\n G0 X48.0 E12.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E0.92 F1200.0\n G0 X35.0 Y6.0 E1.03 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n\t{if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E9.35441 F4800\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.160\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.080\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E14.3 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.080 K0.160\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.08 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.08}\n M623\n\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" + "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230824 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nM290 X40 Y40 Z2.6666666\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM142 P1 R35 S40\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM142 P1 R35 S40\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X231 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n T1000\n\n G0 F1200.0 X231 Y15 Z0.2 E0.741\n G0 F1200.0 X226 Y15 Z0.2 E0.275\n G0 F1200.0 X226 Y8 Z0.2 E0.384\n G0 F1200.0 X216 Y8 Z0.2 E0.549\n G0 F1200.0 X216 Y1.5 Z0.2 E0.357\n\n G0 X48.0 E12.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E0.92 F1200.0\n G0 X35.0 Y6.0 E1.03 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n\t{if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E9.35441 F4800\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.160\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.080\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E14.3 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.080 K0.160\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.08 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.08}\n M623\n\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.4 nozzle.json index 5b13c5adba..d64d979208 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.4 nozzle.json @@ -20,11 +20,13 @@ "Bambu PLA Basic @BBL X1C" ], "default_print_profile": "0.20mm Standard @BBL X1C", + "enable_long_retraction_when_cut": "2", "extruder_offset": [ "0x2" ], "machine_load_filament_time": "29", "machine_unload_filament_time": "28", + "nozzle_height": "4.2", "scan_first_layer": "1", "upward_compatible_machine": [ "Bambu Lab P1S 0.4 nozzle", @@ -33,6 +35,7 @@ "Bambu Lab X1E 0.4 nozzle", "Bambu Lab A1 0.4 nozzle" ], - "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X231 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n T1000\n\n G0 F1200.0 X231 Y15 Z0.2 E0.741\n G0 F1200.0 X226 Y15 Z0.2 E0.275\n G0 F1200.0 X226 Y8 Z0.2 E0.384\n G0 F1200.0 X216 Y8 Z0.2 E0.549\n G0 F1200.0 X216 Y1.5 Z0.2 E0.357\n\n G0 X48.0 E12.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E0.92 F1200.0\n G0 X35.0 Y6.0 E1.03 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E9.35441 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.040\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.020\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E14.3 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.020 K0.040\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.02 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.02}\n M623\n\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4", - "change_filament_gcode": "M620 S[next_extruder]A\nM204 S9000\n{if toolchange_count > 1 && (z_hop_types[current_extruder] == 0 || z_hop_types[current_extruder] == 3)}\nG17\nG2 Z{z_after_toolchange + 0.4} I0.86 J0.86 P1 F10000 ; spiral lift a little from second lift\n{endif}\nG1 Z{max_layer_z + 3.0} F1200\n\nG1 X70 F21000\nG1 Y245\nG1 Y265 F3000\nM400\nM106 P1 S0\nM106 P2 S0\n{if old_filament_temp > 142 && next_extruder < 255}\nM104 S[old_filament_temp]\n{endif}\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 X120 F15000\n\nG1 X20 Y50 F21000\nG1 Y-3\n{if toolchange_count == 2}\n; get travel path for change filament\nM620.1 X[travel_point_1_x] Y[travel_point_1_y] F21000 P0\nM620.1 X[travel_point_2_x] Y[travel_point_2_y] F21000 P1\nM620.1 X[travel_point_3_x] Y[travel_point_3_y] F21000 P2\n{endif}\nM620.1 E F[old_filament_e_feedrate] T{nozzle_temperature_range_high[previous_extruder]}\nT[next_extruder]\nM620.1 E F[new_filament_e_feedrate] T{nozzle_temperature_range_high[next_extruder]}\n\n{if next_extruder < 255}\nM400\n\nG92 E0\n{if flush_length_1 > 1}\n; FLUSH_START\n; always use highest temperature to flush\nM400\n{if filament_type[next_extruder] == \"PETG\"}\nM109 S220\n{else}\nM109 S[nozzle_temperature_range_high]\n{endif}\n{if flush_length_1 > 23.7}\nG1 E23.7 F{old_filament_e_feedrate} ; do not need pulsatile flushing for start part\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{old_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\n{else}\nG1 E{flush_length_1} F{old_filament_e_feedrate}\n{endif}\n; FLUSH_END\nG1 E-[old_retract_length_toolchange] F1800\n{if (flush_length_2 > 1) && (filament_type[next_extruder]==\"PLA-CF\" || filament_type[next_extruder]==\"PETG\")}\nM106 P1 S255\nM400 S3\nM106 P1 S0\nG1 X80 F15000\nG1 X60 F15000\nG1 X80 F15000\nG1 X60 F15000; shake to put down garbage\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y245 F21000\nG1 X65 \nG1 Y265 F3000\n{endif}\nG1 E[old_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_2 > 1}\n; FLUSH_START\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\n{if (flush_length_3 > 1) && (filament_type[next_extruder]==\"PLA-CF\" || filament_type[next_extruder]==\"PETG\")}\nM106 P1 S255\nM400 S3\nM106 P1 S0\nG1 X80 F15000\nG1 X60 F15000\nG1 X80 F15000\nG1 X60 F15000; shake to put down garbage\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y245 F21000\nG1 X65 \nG1 Y265 F3000\n{endif}\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_3 > 1}\n; FLUSH_START\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\n{if (flush_length_4 > 1) && (filament_type[next_extruder]==\"PLA-CF\" || filament_type[next_extruder]==\"PETG\")}\nM106 P1 S255\nM400 S3\nM106 P1 S0\nG1 X80 F15000\nG1 X60 F15000\nG1 X80 F15000\nG1 X60 F15000; shake to put down garbage\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y245 F21000\nG1 X65 \nG1 Y265 F3000\n{endif}\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_4 > 1}\n; FLUSH_START\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\n; FLUSH_END\n{endif}\n; FLUSH_START\nM400\nM109 S[new_filament_temp]\nG1 E2 F{new_filament_e_feedrate} ;Compensate for filament spillage during waiting temperature\n; FLUSH_END\nM400\nG92 E0\nG1 E-[new_retract_length_toolchange] F1800\nM106 P1 S255\nM400 S3\nG1 X80 F15000\nG1 X60 F15000\nG1 X80 F15000\nG1 X60 F15000; shake to put down garbage\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y256 ; move Y to aside, prevent collision\nM400\nG1 Z{max_layer_z + 3.0} F3000\n{if layer_z <= (initial_layer_print_height + 0.001)}\nM204 S[initial_layer_acceleration]\n{else}\nM204 S[default_acceleration]\n{endif}\n{else}\nG1 X[x_after_toolchange] Y[y_after_toolchange] Z[z_after_toolchange] F12000\n{endif}\nM621 S[next_extruder]A\n" + "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230824 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nM290 X40 Y40 Z2.6666666\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM142 P1 R35 S40\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM142 P1 R35 S40\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X231 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n T1000\n\n G0 F1200.0 X231 Y15 Z0.2 E0.741\n G0 F1200.0 X226 Y15 Z0.2 E0.275\n G0 F1200.0 X226 Y8 Z0.2 E0.384\n G0 F1200.0 X216 Y8 Z0.2 E0.549\n G0 F1200.0 X216 Y1.5 Z0.2 E0.357\n\n G0 X48.0 E12.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E0.92 F1200.0\n G0 X35.0 Y6.0 E1.03 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E9.35441 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.040\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.020\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E14.3 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.020 K0.040\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.02 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.02}\n M623\n\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4", + "machine_end_gcode": ";===== date: 20240402 =====================\nM400 ; wait for buffer to clear\nG92 E0 ; zero the extruder\nG1 E-0.8 F1800 ; retract\nG1 Z{max_layer_z + 0.5} F900 ; lower z a little\nG1 X65 Y245 F12000 ; move to safe pos \nG1 Y265 F3000\n\nG1 X65 Y245 F12000\nG1 Y265 F3000\nM140 S0 ; turn off bed\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off remote part cooling fan\nM106 P3 S0 ; turn off chamber cooling fan\n\nG1 X100 F12000 ; wipe\n; pull back filament to AMS\nM620 S255\nG1 X20 Y50 F12000\nG1 Y-3\nT255\nG1 X65 F12000\nG1 Y265\nG1 X100 F12000 ; wipe\nM621 S255\nM104 S0 ; turn off hotend\n\nM622.1 S1 ; for prev firware, default turned on\nM1002 judge_flag timelapse_record_flag\nM622 J1\n M400 ; wait all motion done\n M991 S0 P-1 ;end smooth timelapse at safe pos\n M400 S3 ;wait for last picture to be taken\nM623; end of \"timelapse_record_flag\"\n\nM400 ; wait all motion done\nM17 S\nM17 Z0.4 ; lower z motor current to reduce impact if there is something in the bottom\n{if (max_layer_z + 100.0) < 250}\n G1 Z{max_layer_z + 100.0} F600\n G1 Z{max_layer_z +98.0}\n{else}\n G1 Z250 F600\n G1 Z248\n{endif}\nM400 P100\nM17 R ; restore z current\n\nM220 S100 ; Reset feedrate magnitude\nM201.2 K1.0 ; Reset acc magnitude\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 0\n\nM17 X0.8 Y0.8 Z0.5 ; lower motor current to 45% power\nM960 S5 P0 ; turn off logo lamp\n\n", + "change_filament_gcode": "M620 S[next_extruder]A\nM204 S9000\n{if toolchange_count > 1 && (z_hop_types[current_extruder] == 0 || z_hop_types[current_extruder] == 3)}\nG17\nG2 Z{z_after_toolchange + 0.4} I0.86 J0.86 P1 F10000 ; spiral lift a little from second lift\n{endif}\nG1 Z{max_layer_z + 3.0} F1200\n\nG1 X70 F21000\nG1 Y245\nG1 Y265 F3000\nM400\nM106 P1 S0\nM106 P2 S0\n{if old_filament_temp > 142 && next_extruder < 255}\nM104 S[old_filament_temp]\n{endif}\n{if long_retractions_when_cut[previous_extruder]}\nM620.11 S1 I[previous_extruder] E-{retraction_distances_when_cut[previous_extruder]} F{old_filament_e_feedrate}\n{else}\nM620.11 S0\n{endif}\nM400\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 X120 F15000\nG1 X20 Y50 F21000\nG1 Y-3\n{if toolchange_count == 2}\n; get travel path for change filament\nM620.1 X[travel_point_1_x] Y[travel_point_1_y] F21000 P0\nM620.1 X[travel_point_2_x] Y[travel_point_2_y] F21000 P1\nM620.1 X[travel_point_3_x] Y[travel_point_3_y] F21000 P2\n{endif}\nM620.1 E F[old_filament_e_feedrate] T{nozzle_temperature_range_high[previous_extruder]}\nT[next_extruder]\nM620.1 E F[new_filament_e_feedrate] T{nozzle_temperature_range_high[next_extruder]}\n\n{if next_extruder < 255}\n{if long_retractions_when_cut[previous_extruder]}\nM620.11 S1 I[previous_extruder] E{retraction_distances_when_cut[previous_extruder]} F{old_filament_e_feedrate}\nM628 S1\nG92 E0\nG1 E{retraction_distances_when_cut[previous_extruder]} F[old_filament_e_feedrate]\nM400\nM629 S1\n{else}\nM620.11 S0\n{endif}\nG92 E0\n{if flush_length_1 > 1}\nM83\n; FLUSH_START\n; always use highest temperature to flush\nM400\n{if filament_type[next_extruder] == \"PETG\"}\nM109 S260\n{elsif filament_type[next_extruder] == \"PVA\"}\nM109 S210\n{else}\nM109 S[nozzle_temperature_range_high]\n{endif}\n{if flush_length_1 > 23.7}\nG1 E23.7 F{old_filament_e_feedrate} ; do not need pulsatile flushing for start part\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{old_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\n{else}\nG1 E{flush_length_1} F{old_filament_e_feedrate}\n{endif}\n; FLUSH_END\nG1 E-[old_retract_length_toolchange] F1800\nG1 E[old_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_2 > 1}\n\nG91\nG1 X3 F12000; move aside to extrude\nG90\nM83\n\n; FLUSH_START\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_3 > 1}\n\nG91\nG1 X3 F12000; move aside to extrude\nG90\nM83\n\n; FLUSH_START\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_4 > 1}\n\nG91\nG1 X3 F12000; move aside to extrude\nG90\nM83\n\n; FLUSH_START\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\n; FLUSH_END\n{endif}\n; FLUSH_START\nM400\nM109 S[new_filament_temp]\nG1 E2 F{new_filament_e_feedrate} ;Compensate for filament spillage during waiting temperature\n; FLUSH_END\nM400\nG92 E0\nG1 E-[new_retract_length_toolchange] F1800\nM106 P1 S255\nM400 S3\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X105 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\n\nG1 X70 F10000\nG1 X80 F15000\nG1 X60\nG1 X80\nG1 X60\nG1 X80 ; shake to put down garbage\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y256 ; move Y to aside, prevent collision\nM400\nG1 Z{max_layer_z + 3.0} F3000\n{if layer_z <= (initial_layer_print_height + 0.001)}\nM204 S[initial_layer_acceleration]\n{else}\nM204 S[default_acceleration]\n{endif}\n{else}\nG1 X[x_after_toolchange] Y[y_after_toolchange] Z[z_after_toolchange] F12000\n{endif}\nM621 S[next_extruder]A\n" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.6 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.6 nozzle.json index eb4bd945b0..0ed084037f 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.6 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.6 nozzle.json @@ -33,5 +33,5 @@ "Bambu Lab X1E 0.6 nozzle", "Bambu Lab A1 0.6 nozzle" ], - "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y15 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E1.166\nG0 X231 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n G0 F1200.0 X231 Y15 Z0.2 E1.333\n G0 F1200.0 X226 Y15 Z0.2 E0.495\n G0 F1200.0 X226 Y8 Z0.2 E0.691\n G0 F1200.0 X216 Y8 Z0.2 E0.988\n G0 F1200.0 X216 Y1.5 Z0.2 E0.642\n\n G0 X48.0 E20.56 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E1.56 F1200.0\n G0 X35.0 Y6.0 E1.75 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E16.9 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.030\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.015\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E23.9 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.015 K0.030\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.015 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.015}\n M623\n\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" + "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230824 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nM290 X40 Y40 Z2.6666666\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM142 P1 R35 S40\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM142 P1 R35 S40\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y15 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E1.166\nG0 X231 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n G0 F1200.0 X231 Y15 Z0.2 E1.333\n G0 F1200.0 X226 Y15 Z0.2 E0.495\n G0 F1200.0 X226 Y8 Z0.2 E0.691\n G0 F1200.0 X216 Y8 Z0.2 E0.988\n G0 F1200.0 X216 Y1.5 Z0.2 E0.642\n\n G0 X48.0 E20.56 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E1.56 F1200.0\n G0 X35.0 Y6.0 E1.75 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E16.9 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.030\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.015\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E23.9 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.015 K0.030\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.015 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.015}\n M623\n\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.8 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.8 nozzle.json index 84fb5a17fd..46ab176b0d 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.8 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.8 nozzle.json @@ -33,5 +33,5 @@ "Bambu Lab X1E 0.8 nozzle", "Bambu Lab A1 0.8 nozzle" ], - "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y0.5 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X240 E15\nG0 Y11 E1.364 F{outer_wall_volumetric_speed/(0.3*1.0)/ 4 * 60}\nG0 X239.5\nG0 E0.3\nG0 Y1.5 E1.300\nG0 X231 E1.160 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n G0 F1200.0 X231 Y15 Z0.2 E1.482\n G0 F1200.0 X226 Y15 Z0.2 E0.550\n G0 F1200.0 X226 Y8 Z0.2 E0.768\n G0 F1200.0 X216 Y8 Z0.2 E1.098\n G0 F1200.0 X216 Y1.5 Z0.2 E0.714\n\n G0 X48.0 E25.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E1.70 F1200.0\n G0 X35.0 Y6.0 E1.90 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X110.000 E9.35441 F4800\n G0 X185.000 E9.35441 F4800\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.020\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.010\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X129 E14 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.010 K0.020\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.01 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14) *0.01}\n M623\n\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X185.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X190.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X195.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X200.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X205.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X210.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X215.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X220.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X225.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" + "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230824 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nM290 X40 Y40 Z2.6666666\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM142 P1 R35 S40\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM142 P1 R35 S40\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y0.5 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X240 E15\nG0 Y11 E1.364 F{outer_wall_volumetric_speed/(0.3*1.0)/ 4 * 60}\nG0 X239.5\nG0 E0.3\nG0 Y1.5 E1.300\nG0 X231 E1.160 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n G0 F1200.0 X231 Y15 Z0.2 E1.482\n G0 F1200.0 X226 Y15 Z0.2 E0.550\n G0 F1200.0 X226 Y8 Z0.2 E0.768\n G0 F1200.0 X216 Y8 Z0.2 E1.098\n G0 F1200.0 X216 Y1.5 Z0.2 E0.714\n\n G0 X48.0 E25.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E1.70 F1200.0\n G0 X35.0 Y6.0 E1.90 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X110.000 E9.35441 F4800\n G0 X185.000 E9.35441 F4800\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.020\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.010\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X129 E14 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.010 K0.020\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.01 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14) *0.01}\n M623\n\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X185.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X190.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X195.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X200.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X205.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X210.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X215.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X220.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X225.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon.json b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon.json index 8407b6e270..3b36361af0 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon.json @@ -4,7 +4,7 @@ "nozzle_diameter": "0.4;0.2;0.6;0.8", "bed_model": "bbl-3dp-X1.stl", "bed_texture": "bbl-3dp-logo.svg", - "default_bed_type": "Cool Plate", + "default_bed_type": "Textured PEI Plate", "family": "BBL-3DP", "machine_tech": "FFF", "model_id": "BL-P001", diff --git a/resources/profiles/BBL/machine/Bambu Lab X1.json b/resources/profiles/BBL/machine/Bambu Lab X1.json index aca4485aee..d8e4794eab 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1.json @@ -4,7 +4,7 @@ "nozzle_diameter": "0.4;0.2;0.6;0.8", "bed_model": "bbl-3dp-X1.stl", "bed_texture": "bbl-3dp-logo.svg", - "default_bed_type": "Cool Plate", + "default_bed_type": "Textured PEI Plate", "family": "BBL-3DP", "machine_tech": "FFF", "model_id": "BL-P002", diff --git a/resources/profiles/BBL/machine/Bambu Lab X1E 0.2 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1E 0.2 nozzle.json index a81d539114..1799d2773a 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1E 0.2 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1E 0.2 nozzle.json @@ -31,5 +31,5 @@ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab A1 0.2 nozzle" ], - "machine_start_gcode": ";===== machine: X1E =========================\n;===== date: 20230815 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;==== if Chamber Cooling is necessary ==== \n\n{if (filament_type[initial_no_support_extruder]==\"PLA\") || (filament_type[initial_no_support_extruder]==\"PETG\") || (filament_type[initial_no_support_extruder]==\"TPU\") || (filament_type[initial_no_support_extruder]==\"PVA\") || (filament_type[initial_no_support_extruder]==\"PLA-CF\") || (filament_type[initial_no_support_extruder]==\"PETG-CF\")}\nM1002 gcode_claim_action : 29\nG28\nG90\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nG1 Z200\nM140 S0 ; stop heatbed from heating\nM106 P2 S255 ; open auxiliary fan for cooling\nM106 P3 S255 ; open chamber fan for cooling\nM191 S0 ; wait for chamber temp\nM106 P3 S0 ; reset chamber fan cmd\nM106 P2 S0; reset auxiliary fan cmd\n{endif}\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S290 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n\n;===== set chamber temperature ==========\n{if (overall_chamber_temperature >= 40)}\nM106 P2 S255 ; open big fan to help heating\nM141 S[overall_chamber_temperature] ; Let Chamber begin to heat\n{endif}\n\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X231 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n T1000\n\n G0 F1200.0 X231 Y15 Z0.2 E0.741\n G0 F1200.0 X226 Y15 Z0.2 E0.275\n G0 F1200.0 X226 Y8 Z0.2 E0.384\n G0 F1200.0 X216 Y8 Z0.2 E0.549\n G0 F1200.0 X216 Y1.5 Z0.2 E0.357\n\n G0 X48.0 E12.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E0.92 F1200.0\n G0 X35.0 Y6.0 E1.03 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n\t{if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E9.35441 F4800\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.160\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.080\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E14.3 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.080 K0.160\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.08 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.08}\n M623\n\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;===== wait chamber temperature reaching the reference value =======\n{if (overall_chamber_temperature >= 40)}\nM191 S[overall_chamber_temperature] ; wait for chamber temp\nM106 P2 S0 ; reset chamber fan cmd\n{endif}\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" + "machine_start_gcode": ";===== machine: X1E =========================\n;===== date: 20230815 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;==== if Chamber Cooling is necessary ==== \n\n{if (filament_type[initial_no_support_extruder]==\"PLA\") || (filament_type[initial_no_support_extruder]==\"PETG\") || (filament_type[initial_no_support_extruder]==\"TPU\") || (filament_type[initial_no_support_extruder]==\"PVA\") || (filament_type[initial_no_support_extruder]==\"PLA-CF\") || (filament_type[initial_no_support_extruder]==\"PETG-CF\")}\nM1002 gcode_claim_action : 29\nG28\nG90\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nG1 Z75\nM140 S0 ; stop heatbed from heating\nM106 P2 S255 ; open auxiliary fan for cooling\nM106 P3 S255 ; open chamber fan for cooling\nM191 S0 ; wait for chamber temp\nM106 P3 S0 ; reset chamber fan cmd\nM106 P2 S0; reset auxiliary fan cmd\n{endif}\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM142 P1 R35 S40\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S290 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n\n;===== set chamber temperature ==========\n{if (overall_chamber_temperature >= 40)}\nM106 P2 S255 ; open big fan to help heating\nM141 S[overall_chamber_temperature] ; Let Chamber begin to heat\n{endif}\n\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM142 P1 R35 S40\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X231 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n T1000\n\n G0 F1200.0 X231 Y15 Z0.2 E0.741\n G0 F1200.0 X226 Y15 Z0.2 E0.275\n G0 F1200.0 X226 Y8 Z0.2 E0.384\n G0 F1200.0 X216 Y8 Z0.2 E0.549\n G0 F1200.0 X216 Y1.5 Z0.2 E0.357\n\n G0 X48.0 E12.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E0.92 F1200.0\n G0 X35.0 Y6.0 E1.03 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n\t{if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E9.35441 F4800\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.160\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.080\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E14.3 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.080 K0.160\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.08 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.08}\n M623\n\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;===== wait chamber temperature reaching the reference value =======\n{if (overall_chamber_temperature >= 40)}\nM191 S[overall_chamber_temperature] ; wait for chamber temp\nM106 P2 S0 ; reset chamber fan cmd\n{endif}\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1E 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1E 0.4 nozzle.json index bcbcca7a0f..99f878f4fc 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1E 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1E 0.4 nozzle.json @@ -20,11 +20,13 @@ "Bambu PLA Basic @BBL X1C" ], "default_print_profile": "0.20mm Standard @BBL X1C", + "enable_long_retraction_when_cut": "1", "extruder_offset": [ "0x2" ], "machine_load_filament_time": "29", "machine_unload_filament_time": "28", + "nozzle_height": "4.2", "scan_first_layer": "1", "support_air_filtration": "1", "support_chamber_temp_control": "1", @@ -35,6 +37,7 @@ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab A1 0.4 nozzle" ], - "machine_start_gcode": ";===== machine: X1E =========================\n;===== date: 20230815 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;==== if Chamber Cooling is necessary ==== \n\n{if (filament_type[initial_no_support_extruder]==\"PLA\") || (filament_type[initial_no_support_extruder]==\"PETG\") || (filament_type[initial_no_support_extruder]==\"TPU\") || (filament_type[initial_no_support_extruder]==\"PVA\") || (filament_type[initial_no_support_extruder]==\"PLA-CF\") || (filament_type[initial_no_support_extruder]==\"PETG-CF\")}\nM1002 gcode_claim_action : 29\nG28\nG90\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nG1 Z200\nM140 S0 ; stop heatbed from heating\nM106 P2 S255 ; open auxiliary fan for cooling\nM106 P3 S255 ; open chamber fan for cooling\nM191 S0 ; wait for chamber temp\nM106 P3 S0 ; reset chamber fan cmd\nM106 P2 S0; reset auxiliary fan cmd\n{endif}\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S290 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n\n;===== set chamber temperature ==========\n{if (overall_chamber_temperature >= 40)}\nM106 P2 S255 ; open big fan to help heating\nM141 S[overall_chamber_temperature] ; Let Chamber begin to heat\n{endif}\n\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X231 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n T1000\n\n G0 F1200.0 X231 Y15 Z0.2 E0.741\n G0 F1200.0 X226 Y15 Z0.2 E0.275\n G0 F1200.0 X226 Y8 Z0.2 E0.384\n G0 F1200.0 X216 Y8 Z0.2 E0.549\n G0 F1200.0 X216 Y1.5 Z0.2 E0.357\n\n G0 X48.0 E12.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E0.92 F1200.0\n G0 X35.0 Y6.0 E1.03 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E9.35441 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.040\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.020\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E14.3 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.020 K0.040\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.02 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.02}\n M623\n\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;===== wait chamber temperature reaching the reference value =======\n{if (overall_chamber_temperature >= 40)}\nM191 S[overall_chamber_temperature] ; wait for chamber temp\nM106 P2 S0 ; reset chamber fan cmd\n{endif}\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4\n\n", - "machine_end_gcode": ";===== date: 20230428 =====================\nM400 ; wait for buffer to clear\nG92 E0 ; zero the extruder\nG1 E-0.8 F1800 ; retract\nG1 Z{max_layer_z + 0.5} F900 ; lower z a little\nG1 X65 Y245 F12000 ; move to safe pos \nG1 Y265 F3000\n\nG1 X65 Y245 F12000\nG1 Y265 F3000\nM141 S0 ; turn off chamber \nM140 S0 ; turn off bed\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off remote part cooling fan\nM106 P3 S0 ; turn off chamber cooling fan\n\nG1 X100 F12000 ; wipe\n; pull back filament to AMS\nM620 S255\nG1 X20 Y50 F12000\nG1 Y-3\nT255\nG1 X65 F12000\nG1 Y265\nG1 X100 F12000 ; wipe\nM621 S255\nM104 S0 ; turn off hotend\n\nM622.1 S1 ; for prev firware, default turned on\nM1002 judge_flag timelapse_record_flag\nM622 J1\n M400 ; wait all motion done\n M991 S0 P-1 ;end smooth timelapse at safe pos\n M400 S3 ;wait for last picture to be taken\nM623; end of \"timelapse_record_flag\"\n\nM400 ; wait all motion done\nM17 S\nM17 Z0.4 ; lower z motor current to reduce impact if there is something in the bottom\n{if (max_layer_z + 100.0) < 250}\n G1 Z{max_layer_z + 100.0} F600\n G1 Z{max_layer_z +98.0}\n{else}\n G1 Z250 F600\n G1 Z248\n{endif}\nM400 P100\nM17 R ; restore z current\n\nG90\nG1 X128 Y250 F3600\n\nM220 S100 ; Reset feedrate magnitude\nM201.2 K1.0 ; Reset acc magnitude\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 0\n\nM17 X0.8 Y0.8 Z0.5 ; lower motor current to 45% power\n" + "machine_start_gcode": ";===== machine: X1E =========================\n;===== date: 20230815 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;==== if Chamber Cooling is necessary ==== \n\n{if (filament_type[initial_no_support_extruder]==\"PLA\") || (filament_type[initial_no_support_extruder]==\"PETG\") || (filament_type[initial_no_support_extruder]==\"TPU\") || (filament_type[initial_no_support_extruder]==\"PVA\") || (filament_type[initial_no_support_extruder]==\"PLA-CF\") || (filament_type[initial_no_support_extruder]==\"PETG-CF\")}\nM1002 gcode_claim_action : 29\nG28\nG90\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nG1 Z75\nM140 S0 ; stop heatbed from heating\nM106 P2 S255 ; open auxiliary fan for cooling\nM106 P3 S255 ; open chamber fan for cooling\nM191 S0 ; wait for chamber temp\nM106 P3 S0 ; reset chamber fan cmd\nM106 P2 S0; reset auxiliary fan cmd\n{endif}\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM142 P1 R35 S40\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S290 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n\n;===== set chamber temperature ==========\n{if (overall_chamber_temperature >= 40)}\nM106 P2 S255 ; open big fan to help heating\nM141 S[overall_chamber_temperature] ; Let Chamber begin to heat\n{endif}\n\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM142 P1 R35 S40\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X231 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n T1000\n\n G0 F1200.0 X231 Y15 Z0.2 E0.741\n G0 F1200.0 X226 Y15 Z0.2 E0.275\n G0 F1200.0 X226 Y8 Z0.2 E0.384\n G0 F1200.0 X216 Y8 Z0.2 E0.549\n G0 F1200.0 X216 Y1.5 Z0.2 E0.357\n\n G0 X48.0 E12.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E0.92 F1200.0\n G0 X35.0 Y6.0 E1.03 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E9.35441 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.040\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.020\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E14.3 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.020 K0.040\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.02 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.02}\n M623\n\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;===== wait chamber temperature reaching the reference value =======\n{if (overall_chamber_temperature >= 40)}\nM191 S[overall_chamber_temperature] ; wait for chamber temp\nM106 P2 S0 ; reset chamber fan cmd\n{endif}\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4\n\n", + "machine_end_gcode": ";===== date: 20240402 =====================\nM400 ; wait for buffer to clear\nG92 E0 ; zero the extruder\nG1 E-0.8 F1800 ; retract\nG1 Z{max_layer_z + 0.5} F900 ; lower z a little\nG1 X65 Y245 F12000 ; move to safe pos \nG1 Y265 F3000\n\nG1 X65 Y245 F12000\nG1 Y265 F3000\nM141 S0 ; turn off chamber \nM140 S0 ; turn off bed\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off remote part cooling fan\nM106 P3 S0 ; turn off chamber cooling fan\n\nG1 X100 F12000 ; wipe\n; pull back filament to AMS\nM620 S255\nG1 X20 Y50 F12000\nG1 Y-3\nT255\nG1 X65 F12000\nG1 Y265\nG1 X100 F12000 ; wipe\nM621 S255\nM104 S0 ; turn off hotend\n\nM622.1 S1 ; for prev firware, default turned on\nM1002 judge_flag timelapse_record_flag\nM622 J1\n M400 ; wait all motion done\n M991 S0 P-1 ;end smooth timelapse at safe pos\n M400 S3 ;wait for last picture to be taken\nM623; end of \"timelapse_record_flag\"\n\nM400 ; wait all motion done\nM17 S\nM17 Z0.4 ; lower z motor current to reduce impact if there is something in the bottom\n{if (max_layer_z + 100.0) < 250}\n G1 Z{max_layer_z + 100.0} F600\n G1 Z{max_layer_z +98.0}\n{else}\n G1 Z250 F600\n G1 Z248\n{endif}\nM400 P100\nM17 R ; restore z current\n\nM220 S100 ; Reset feedrate magnitude\nM201.2 K1.0 ; Reset acc magnitude\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 0\n\nM17 X0.8 Y0.8 Z0.5 ; lower motor current to 45% power\nM960 S5 P0 ; turn off logo lamp\n\n", + "change_filament_gcode": "M620 S[next_extruder]A\nM204 S9000\n{if toolchange_count > 1 && (z_hop_types[current_extruder] == 0 || z_hop_types[current_extruder] == 3)}\nG17\nG2 Z{z_after_toolchange + 0.4} I0.86 J0.86 P1 F10000 ; spiral lift a little from second lift\n{endif}\nG1 Z{max_layer_z + 3.0} F1200\n\nG1 X70 F21000\nG1 Y245\nG1 Y265 F3000\nM400\nM106 P1 S0\nM106 P2 S0\n{if old_filament_temp > 142 && next_extruder < 255}\nM104 S[old_filament_temp]\n{endif}\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 X120 F15000\n{if long_retraction_when_cut && retraction_distance_when_cut > 2}\nG1 E-[retraction_distance_when_cut] F200\nM400\n{endif}\nG1 X20 Y50 F21000\nG1 Y-3\n{if toolchange_count == 2}\n; get travel path for change filament\nM620.1 X[travel_point_1_x] Y[travel_point_1_y] F21000 P0\nM620.1 X[travel_point_2_x] Y[travel_point_2_y] F21000 P1\nM620.1 X[travel_point_3_x] Y[travel_point_3_y] F21000 P2\n{endif}\nM620.1 E F[old_filament_e_feedrate] T{nozzle_temperature_range_high[previous_extruder]}\nT[next_extruder]\nM620.1 E F[new_filament_e_feedrate] T{nozzle_temperature_range_high[next_extruder]}\n\n{if next_extruder < 255}\nM400\n{if long_retraction_when_cut && retraction_distance_when_cut > 2}\nG1 E{retraction_distance_when_cut - 2} F200\nG1 E2 F20\nM400\n{endif}\nG92 E0\n{if flush_length_1 > 1}\nM83\n; FLUSH_START\n; always use highest temperature to flush\nM400\n{if filament_type[next_extruder] == \"PETG\"}\nM109 S260\n{elsif filament_type[next_extruder] == \"PVA\"}\nM109 S210\n{else}\nM109 S[nozzle_temperature_range_high]\n{endif}\n{if flush_length_1 > 23.7}\nG1 E23.7 F{old_filament_e_feedrate} ; do not need pulsatile flushing for start part\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{old_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\n{else}\nG1 E{flush_length_1} F{old_filament_e_feedrate}\n{endif}\n; FLUSH_END\nG1 E-[old_retract_length_toolchange] F1800\nG1 E[old_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_2 > 1}\n\nG91\nG1 X3 F12000; move aside to extrude\nG90\nM83\n\n; FLUSH_START\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_3 > 1}\n\nG91\nG1 X3 F12000; move aside to extrude\nG90\nM83\n\n; FLUSH_START\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_4 > 1}\n\nG91\nG1 X3 F12000; move aside to extrude\nG90\nM83\n\n; FLUSH_START\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\n; FLUSH_END\n{endif}\n; FLUSH_START\nM400\nM109 S[new_filament_temp]\nG1 E2 F{new_filament_e_feedrate} ;Compensate for filament spillage during waiting temperature\n; FLUSH_END\nM400\nG92 E0\nG1 E-[new_retract_length_toolchange] F1800\nM106 P1 S255\nM400 S3\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X105 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\n\nG1 X70 F10000\nG1 X80 F15000\nG1 X60\nG1 X80\nG1 X60\nG1 X80 ; shake to put down garbage\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y256 ; move Y to aside, prevent collision\nM400\nG1 Z{max_layer_z + 3.0} F3000\n{if layer_z <= (initial_layer_print_height + 0.001)}\nM204 S[initial_layer_acceleration]\n{else}\nM204 S[default_acceleration]\n{endif}\n{else}\nG1 X[x_after_toolchange] Y[y_after_toolchange] Z[z_after_toolchange] F12000\n{endif}\nM621 S[next_extruder]A\n" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1E 0.6 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1E 0.6 nozzle.json index 4ccc2d081b..6e116866e5 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1E 0.6 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1E 0.6 nozzle.json @@ -33,5 +33,5 @@ "Bambu Lab X1 Carbon 0.6 nozzle", "Bambu Lab A1 0.6 nozzle" ], - "machine_start_gcode": ";===== machine: X1E =========================\n;===== date: 20230815 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;==== if Chamber Cooling is necessary ==== \n\n{if (filament_type[initial_no_support_extruder]==\"PLA\") || (filament_type[initial_no_support_extruder]==\"PETG\") || (filament_type[initial_no_support_extruder]==\"TPU\") || (filament_type[initial_no_support_extruder]==\"PVA\") || (filament_type[initial_no_support_extruder]==\"PLA-CF\") || (filament_type[initial_no_support_extruder]==\"PETG-CF\")}\nM1002 gcode_claim_action : 29\nG28\nG90\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nG1 Z200\nM140 S0 ; stop heatbed from heating\nM106 P2 S255 ; open auxiliary fan for cooling\nM106 P3 S255 ; open chamber fan for cooling\nM191 S0 ; wait for chamber temp\nM106 P3 S0 ; reset chamber fan cmd\nM106 P2 S0; reset auxiliary fan cmd\n{endif}\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S290 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n\n;===== set chamber temperature ==========\n{if (overall_chamber_temperature >= 40)}\nM106 P2 S255 ; open big fan to help heating\nM141 S[overall_chamber_temperature] ; Let Chamber begin to heat\n{endif}\n\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y15 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E1.166\nG0 X231 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n G0 F1200.0 X231 Y15 Z0.2 E1.333\n G0 F1200.0 X226 Y15 Z0.2 E0.495\n G0 F1200.0 X226 Y8 Z0.2 E0.691\n G0 F1200.0 X216 Y8 Z0.2 E0.988\n G0 F1200.0 X216 Y1.5 Z0.2 E0.642\n\n G0 X48.0 E20.56 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E1.56 F1200.0\n G0 X35.0 Y6.0 E1.75 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E16.9 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.030\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.015\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E23.9 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.015 K0.030\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.015 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.015}\n M623\n\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;===== wait chamber temperature reaching the reference value =======\n{if (overall_chamber_temperature >= 40)}\nM191 S[overall_chamber_temperature] ; wait for chamber temp\nM106 P2 S0 ; reset chamber fan cmd\n{endif}\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" + "machine_start_gcode": ";===== machine: X1E =========================\n;===== date: 20230815 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;==== if Chamber Cooling is necessary ==== \n\n{if (filament_type[initial_no_support_extruder]==\"PLA\") || (filament_type[initial_no_support_extruder]==\"PETG\") || (filament_type[initial_no_support_extruder]==\"TPU\") || (filament_type[initial_no_support_extruder]==\"PVA\") || (filament_type[initial_no_support_extruder]==\"PLA-CF\") || (filament_type[initial_no_support_extruder]==\"PETG-CF\")}\nM1002 gcode_claim_action : 29\nG28\nG90\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nG1 Z75\nM140 S0 ; stop heatbed from heating\nM106 P2 S255 ; open auxiliary fan for cooling\nM106 P3 S255 ; open chamber fan for cooling\nM191 S0 ; wait for chamber temp\nM106 P3 S0 ; reset chamber fan cmd\nM106 P2 S0; reset auxiliary fan cmd\n{endif}\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM142 P1 R35 S40\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S290 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n\n;===== set chamber temperature ==========\n{if (overall_chamber_temperature >= 40)}\nM106 P2 S255 ; open big fan to help heating\nM141 S[overall_chamber_temperature] ; Let Chamber begin to heat\n{endif}\n\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM142 P1 R35 S40\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y15 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E1.166\nG0 X231 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n G0 F1200.0 X231 Y15 Z0.2 E1.333\n G0 F1200.0 X226 Y15 Z0.2 E0.495\n G0 F1200.0 X226 Y8 Z0.2 E0.691\n G0 F1200.0 X216 Y8 Z0.2 E0.988\n G0 F1200.0 X216 Y1.5 Z0.2 E0.642\n\n G0 X48.0 E20.56 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E1.56 F1200.0\n G0 X35.0 Y6.0 E1.75 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E16.9 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.030\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.015\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E23.9 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.015 K0.030\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.015 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.015}\n M623\n\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;===== wait chamber temperature reaching the reference value =======\n{if (overall_chamber_temperature >= 40)}\nM191 S[overall_chamber_temperature] ; wait for chamber temp\nM106 P2 S0 ; reset chamber fan cmd\n{endif}\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1E 0.8 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1E 0.8 nozzle.json index 3d3a04e2a1..eea8eab1a0 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1E 0.8 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1E 0.8 nozzle.json @@ -33,5 +33,5 @@ "Bambu Lab X1 Carbon 0.8 nozzle", "Bambu Lab A1 0.8 nozzle" ], - "machine_start_gcode": ";===== machine: X1E =========================\n;===== date: 20230815 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nM290 X40 Y40 Z2.6666666\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;==== if Chamber Cooling is necessary ==== \n\n{if (filament_type[initial_no_support_extruder]==\"PLA\") || (filament_type[initial_no_support_extruder]==\"PETG\") || (filament_type[initial_no_support_extruder]==\"TPU\") || (filament_type[initial_no_support_extruder]==\"PVA\") || (filament_type[initial_no_support_extruder]==\"PLA-CF\") || (filament_type[initial_no_support_extruder]==\"PETG-CF\")}\nM1002 gcode_claim_action : 29\nG28\nG90\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nG1 Z200\nM140 S0 ; stop heatbed from heating\nM106 P2 S255 ; open auxiliary fan for cooling\nM106 P3 S255 ; open chamber fan for cooling\nM191 S0 ; wait for chamber temp\nM106 P3 S0 ; reset chamber fan cmd\nM106 P2 S0; reset auxiliary fan cmd\n{endif}\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S290 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n\n;===== set chamber temperature ==========\n{if (overall_chamber_temperature >= 40)}\nM106 P2 S255 ; open big fan to help heating\nM141 S[overall_chamber_temperature] ; Let Chamber begin to heat\n{endif}\n\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y0.5 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X240 E15\nG0 Y11 E1.364 F{outer_wall_volumetric_speed/(0.3*1.0)/ 4 * 60}\nG0 X239.5\nG0 E0.3\nG0 Y1.5 E1.300\nG0 X231 E1.160 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n G0 F1200.0 X231 Y15 Z0.2 E1.482\n G0 F1200.0 X226 Y15 Z0.2 E0.550\n G0 F1200.0 X226 Y8 Z0.2 E0.768\n G0 F1200.0 X216 Y8 Z0.2 E1.098\n G0 F1200.0 X216 Y1.5 Z0.2 E0.714\n\n G0 X48.0 E25.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E1.70 F1200.0\n G0 X35.0 Y6.0 E1.90 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X110.000 E9.35441 F4800\n G0 X185.000 E9.35441 F4800\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.020\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.010\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X129 E14 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.010 K0.020\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.01 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14) *0.01}\n M623\n\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X185.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X190.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X195.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X200.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X205.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X210.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X215.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X220.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X225.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n M973 S4\n\nM623\n\n;===== wait chamber temperature reaching the reference value =======\n{if (overall_chamber_temperature >= 40)}\nM191 S[overall_chamber_temperature] ; wait for chamber temp\nM106 P2 S0 ; reset chamber fan cmd\n{endif}\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" + "machine_start_gcode": ";===== machine: X1E =========================\n;===== date: 20230815 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nM290 X40 Y40 Z2.6666666\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;==== if Chamber Cooling is necessary ==== \n\n{if (filament_type[initial_no_support_extruder]==\"PLA\") || (filament_type[initial_no_support_extruder]==\"PETG\") || (filament_type[initial_no_support_extruder]==\"TPU\") || (filament_type[initial_no_support_extruder]==\"PVA\") || (filament_type[initial_no_support_extruder]==\"PLA-CF\") || (filament_type[initial_no_support_extruder]==\"PETG-CF\")}\nM1002 gcode_claim_action : 29\nG28\nG90\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nG1 Z75\nM140 S0 ; stop heatbed from heating\nM106 P2 S255 ; open auxiliary fan for cooling\nM106 P3 S255 ; open chamber fan for cooling\nM191 S0 ; wait for chamber temp\nM106 P3 S0 ; reset chamber fan cmd\nM106 P2 S0; reset auxiliary fan cmd\n{endif}\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM142 P1 R35 S40\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S290 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n\n;===== set chamber temperature ==========\n{if (overall_chamber_temperature >= 40)}\nM106 P2 S255 ; open big fan to help heating\nM141 S[overall_chamber_temperature] ; Let Chamber begin to heat\n{endif}\n\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM142 P1 R35 S40\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y0.5 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X240 E15\nG0 Y11 E1.364 F{outer_wall_volumetric_speed/(0.3*1.0)/ 4 * 60}\nG0 X239.5\nG0 E0.3\nG0 Y1.5 E1.300\nG0 X231 E1.160 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n G0 F1200.0 X231 Y15 Z0.2 E1.482\n G0 F1200.0 X226 Y15 Z0.2 E0.550\n G0 F1200.0 X226 Y8 Z0.2 E0.768\n G0 F1200.0 X216 Y8 Z0.2 E1.098\n G0 F1200.0 X216 Y1.5 Z0.2 E0.714\n\n G0 X48.0 E25.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E1.70 F1200.0\n G0 X35.0 Y6.0 E1.90 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X110.000 E9.35441 F4800\n G0 X185.000 E9.35441 F4800\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.020\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.010\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X129 E14 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.010 K0.020\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.01 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14) *0.01}\n M623\n\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X185.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X190.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X195.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X200.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X205.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X210.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X215.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X220.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X225.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n M973 S4\n\nM623\n\n;===== wait chamber temperature reaching the reference value =======\n{if (overall_chamber_temperature >= 40)}\nM191 S[overall_chamber_temperature] ; wait for chamber temp\nM106 P2 S0 ; reset chamber fan cmd\n{endif}\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/fdm_machine_common.json b/resources/profiles/BBL/machine/fdm_machine_common.json index 067e53b5d2..e736dc6662 100644 --- a/resources/profiles/BBL/machine/fdm_machine_common.json +++ b/resources/profiles/BBL/machine/fdm_machine_common.json @@ -76,7 +76,7 @@ ], "printable_height": "250", "extruder_clearance_radius": "65", - "extruder_clearance_height_to_rod": "36", + "extruder_clearance_height_to_rod": "34", "extruder_clearance_height_to_lid": "140", "printer_settings_id": "", "retraction_minimum_travel": [ @@ -106,7 +106,7 @@ "retraction_speed": [ "60" ], - "single_extruder_multi_material": "1", + "single_extruder_multi_material": "0", "support_air_filtration": "0", "wipe": [ "1" diff --git a/resources/profiles/BBL/process/0.06mm Fine @BBL A1 0.2 nozzle.json b/resources/profiles/BBL/process/0.06mm Fine @BBL A1 0.2 nozzle.json index 0b5df08973..a46163008e 100644 --- a/resources/profiles/BBL/process/0.06mm Fine @BBL A1 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.06mm Fine @BBL A1 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP084", "instantiation": "true", + "description": "Compared with the default profile of 0.2 mm nozzle, it has a smaller layer height, and results in minimal layer lines and higher printing quality, but shorter printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "initial_layer_infill_speed": "28", diff --git a/resources/profiles/BBL/process/0.06mm Fine @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/process/0.06mm Fine @BBL A1M 0.2 nozzle.json index 152b44e9ab..829e917675 100644 --- a/resources/profiles/BBL/process/0.06mm Fine @BBL A1M 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.06mm Fine @BBL A1M 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP050", "instantiation": "true", + "description": "Compared with the default profile of 0.2 mm nozzle, it has a smaller layer height, and results in minimal layer lines and higher printing quality, but shorter printing time.", "default_acceleration": "6000", "initial_layer_infill_speed": "28", "initial_layer_speed": "16", diff --git a/resources/profiles/BBL/process/0.06mm Fine @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/process/0.06mm Fine @BBL P1P 0.2 nozzle.json index deb52983a4..d05620a789 100644 --- a/resources/profiles/BBL/process/0.06mm Fine @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.06mm Fine @BBL P1P 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP063", "instantiation": "true", + "description": "Compared with the default profile of 0.2 mm nozzle, it has a smaller layer height, and results in minimal layer lines and higher printing quality, but shorter printing time.", "default_acceleration": "5000", "elefant_foot_compensation": "0.15", "outer_wall_acceleration": "2500", diff --git a/resources/profiles/BBL/process/0.06mm High Quality @BBL A1 0.2 nozzle.json b/resources/profiles/BBL/process/0.06mm High Quality @BBL A1 0.2 nozzle.json index 000a6d08d6..19c218e4e3 100644 --- a/resources/profiles/BBL/process/0.06mm High Quality @BBL A1 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.06mm High Quality @BBL A1 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP118", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has a smaller layer lines, lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in minimal layer lines and much higher printing quality, but much longer printing time.", "default_acceleration": "4000", "elefant_foot_compensation": "0.075", "initial_layer_infill_speed": "28", diff --git a/resources/profiles/BBL/process/0.06mm High Quality @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/process/0.06mm High Quality @BBL A1M 0.2 nozzle.json index 0ce2996347..15f97d190e 100644 --- a/resources/profiles/BBL/process/0.06mm High Quality @BBL A1M 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.06mm High Quality @BBL A1M 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP117", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has a smaller layer lines, lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in minimal layer lines and much higher printing quality, but much longer printing time.", "default_acceleration": "3000", "initial_layer_infill_speed": "28", "initial_layer_speed": "16", diff --git a/resources/profiles/BBL/process/0.06mm High Quality @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/process/0.06mm High Quality @BBL P1P 0.2 nozzle.json index 66e56802f2..da1f6a89c3 100644 --- a/resources/profiles/BBL/process/0.06mm High Quality @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.06mm High Quality @BBL P1P 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP116", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has a smaller layer lines, lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in minimal layer lines and much higher printing quality, but much longer printing time.", "default_acceleration": "4000", "elefant_foot_compensation": "0.15", "outer_wall_acceleration": "2000", diff --git a/resources/profiles/BBL/process/0.06mm High Quality @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.06mm High Quality @BBL X1C 0.2 nozzle.json index 502c4cdaef..70e54ac6c2 100644 --- a/resources/profiles/BBL/process/0.06mm High Quality @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.06mm High Quality @BBL X1C 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP115", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has a smaller layer lines, lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in minimal layer lines and much higher printing quality, but much longer printing time.", "default_acceleration": "4000", "elefant_foot_compensation": "0.15", "outer_wall_acceleration": "2000", diff --git a/resources/profiles/BBL/process/0.06mm Standard @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.06mm Standard @BBL X1C 0.2 nozzle.json index 06a7a9eecb..5ffde15e91 100644 --- a/resources/profiles/BBL/process/0.06mm Standard @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.06mm Standard @BBL X1C 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP024", "instantiation": "true", + "description": "Compared with the default profile of 0.2 mm nozzle, it has a smaller layer height, and results in minimal layer lines and higher printing quality, but shorter printing time.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", diff --git a/resources/profiles/BBL/process/0.08mm Extra Fine @BBL A1.json b/resources/profiles/BBL/process/0.08mm Extra Fine @BBL A1.json index 8e7e8cab90..a77c85e631 100644 --- a/resources/profiles/BBL/process/0.08mm Extra Fine @BBL A1.json +++ b/resources/profiles/BBL/process/0.08mm Extra Fine @BBL A1.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP076", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, and results in almost negligible layer lines and longer printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.08mm Extra Fine @BBL A1M.json b/resources/profiles/BBL/process/0.08mm Extra Fine @BBL A1M.json index 0a87af8bb3..b54ff1ac71 100644 --- a/resources/profiles/BBL/process/0.08mm Extra Fine @BBL A1M.json +++ b/resources/profiles/BBL/process/0.08mm Extra Fine @BBL A1M.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP049", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, and results in almost negligible layer lines and longer printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.08mm Extra Fine @BBL P1P.json b/resources/profiles/BBL/process/0.08mm Extra Fine @BBL P1P.json index bc9f93e282..080e4005ec 100644 --- a/resources/profiles/BBL/process/0.08mm Extra Fine @BBL P1P.json +++ b/resources/profiles/BBL/process/0.08mm Extra Fine @BBL P1P.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP018", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, and results in almost negligible layer lines and longer printing time.", "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle" ] diff --git a/resources/profiles/BBL/process/0.08mm Extra Fine @BBL X1C.json b/resources/profiles/BBL/process/0.08mm Extra Fine @BBL X1C.json index f591722386..ddb385860c 100644 --- a/resources/profiles/BBL/process/0.08mm Extra Fine @BBL X1C.json +++ b/resources/profiles/BBL/process/0.08mm Extra Fine @BBL X1C.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP001", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, and results in almost negligible layer lines and longer printing time.", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/process/0.08mm High Quality @BBL A1 0.2 nozzle.json b/resources/profiles/BBL/process/0.08mm High Quality @BBL A1 0.2 nozzle.json index 2cbd3c2c9d..7745977387 100644 --- a/resources/profiles/BBL/process/0.08mm High Quality @BBL A1 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.08mm High Quality @BBL A1 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP119", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has a smaller layer lines, lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in almost invisible layer lines and much higher printing quality, but much longer printing time.", "default_acceleration": "4000", "elefant_foot_compensation": "0.075", "initial_layer_infill_speed": "28", diff --git a/resources/profiles/BBL/process/0.08mm High Quality @BBL A1.json b/resources/profiles/BBL/process/0.08mm High Quality @BBL A1.json index 15c848b8b0..7d7f7be457 100644 --- a/resources/profiles/BBL/process/0.08mm High Quality @BBL A1.json +++ b/resources/profiles/BBL/process/0.08mm High Quality @BBL A1.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP102", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in almost negligible layer lines and much higher printing quality, but much longer printing time.", "default_acceleration": "4000", "elefant_foot_compensation": "0.075", "gap_infill_speed": "210", diff --git a/resources/profiles/BBL/process/0.08mm High Quality @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/process/0.08mm High Quality @BBL A1M 0.2 nozzle.json index 6865d2fed0..2d181eae1b 100644 --- a/resources/profiles/BBL/process/0.08mm High Quality @BBL A1M 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.08mm High Quality @BBL A1M 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP120", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has a smaller layer lines, lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in almost invisible layer lines and much higher printing quality, but much longer printing time.", "default_acceleration": "3000", "initial_layer_infill_speed": "28", "initial_layer_speed": "16", diff --git a/resources/profiles/BBL/process/0.08mm High Quality @BBL A1M.json b/resources/profiles/BBL/process/0.08mm High Quality @BBL A1M.json index 069a975b0d..71e2f43b7d 100644 --- a/resources/profiles/BBL/process/0.08mm High Quality @BBL A1M.json +++ b/resources/profiles/BBL/process/0.08mm High Quality @BBL A1M.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP101", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in almost negligible layer lines and much higher printing quality, but much longer printing time.", "default_acceleration": "3000", "elefant_foot_compensation": "0", "gap_infill_speed": "210", diff --git a/resources/profiles/BBL/process/0.08mm High Quality @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/process/0.08mm High Quality @BBL P1P 0.2 nozzle.json index c7d6188f2e..6424eae3c0 100644 --- a/resources/profiles/BBL/process/0.08mm High Quality @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.08mm High Quality @BBL P1P 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP121", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has a smaller layer lines, lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in almost invisible layer lines and much higher printing quality, but much longer printing time.", "default_acceleration": "4000", "elefant_foot_compensation": "0.15", "outer_wall_acceleration": "2000", diff --git a/resources/profiles/BBL/process/0.08mm High Quality @BBL P1P.json b/resources/profiles/BBL/process/0.08mm High Quality @BBL P1P.json index 454b86baf4..f135573cf2 100644 --- a/resources/profiles/BBL/process/0.08mm High Quality @BBL P1P.json +++ b/resources/profiles/BBL/process/0.08mm High Quality @BBL P1P.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP100", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in almost negligible layer lines and much higher printing quality, but much longer printing time.", "default_acceleration": "4000", "elefant_foot_compensation": "0.15", "gap_infill_speed": "210", diff --git a/resources/profiles/BBL/process/0.08mm High Quality @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.08mm High Quality @BBL X1C 0.2 nozzle.json index aeb1c1765e..5b04803ced 100644 --- a/resources/profiles/BBL/process/0.08mm High Quality @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.08mm High Quality @BBL X1C 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP122", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has a smaller layer lines, lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in almost invisible layer lines and much higher printing quality, but much longer printing time.", "default_acceleration": "4000", "elefant_foot_compensation": "0.15", "outer_wall_acceleration": "2000", diff --git a/resources/profiles/BBL/process/0.08mm High Quality @BBL X1C.json b/resources/profiles/BBL/process/0.08mm High Quality @BBL X1C.json index 777e9f4e44..1c7a15e91b 100644 --- a/resources/profiles/BBL/process/0.08mm High Quality @BBL X1C.json +++ b/resources/profiles/BBL/process/0.08mm High Quality @BBL X1C.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP099", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in almost negligible layer lines and much higher printing quality, but much longer printing time.", "default_acceleration": "4000", "gap_infill_speed": "210", "inner_wall_speed": "120", diff --git a/resources/profiles/BBL/process/0.08mm Optimal @BBL A1 0.2 nozzle.json b/resources/profiles/BBL/process/0.08mm Optimal @BBL A1 0.2 nozzle.json index ad2143b2c2..072bfd59b0 100644 --- a/resources/profiles/BBL/process/0.08mm Optimal @BBL A1 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.08mm Optimal @BBL A1 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP085", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has a smaller layer height, and results in almost invisible layer lines and higher printing quality, but shorter printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "initial_layer_infill_speed": "28", diff --git a/resources/profiles/BBL/process/0.08mm Optimal @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/process/0.08mm Optimal @BBL A1M 0.2 nozzle.json index 15a9dc636c..19f8577822 100644 --- a/resources/profiles/BBL/process/0.08mm Optimal @BBL A1M 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.08mm Optimal @BBL A1M 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP051", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has a smaller layer height, and results in almost invisible layer lines and higher printing quality, but shorter printing time.", "default_acceleration": "6000", "initial_layer_infill_speed": "28", "initial_layer_speed": "16", diff --git a/resources/profiles/BBL/process/0.08mm Optimal @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/process/0.08mm Optimal @BBL P1P 0.2 nozzle.json index b0ccea0029..9995057586 100644 --- a/resources/profiles/BBL/process/0.08mm Optimal @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.08mm Optimal @BBL P1P 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP064", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has a smaller layer height, and results in almost invisible layer lines and higher printing quality, but shorter printing time.", "default_acceleration": "5000", "elefant_foot_compensation": "0.15", "outer_wall_acceleration": "2500", diff --git a/resources/profiles/BBL/process/0.08mm Standard @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.08mm Standard @BBL X1C 0.2 nozzle.json index 7c8e7bbbef..4d1c9fa00e 100644 --- a/resources/profiles/BBL/process/0.08mm Standard @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.08mm Standard @BBL X1C 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP025", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has a smaller layer height, and results in almost invisible layer lines and higher printing quality, but shorter printing time.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", diff --git a/resources/profiles/BBL/process/0.10mm High Quality @BBL A1 0.2 nozzle.json b/resources/profiles/BBL/process/0.10mm High Quality @BBL A1 0.2 nozzle.json index c848de06cd..23393e37b9 100644 --- a/resources/profiles/BBL/process/0.10mm High Quality @BBL A1 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.10mm High Quality @BBL A1 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP114", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in much higher printing quality, but a much longer printing time.", "default_acceleration": "4000", "elefant_foot_compensation": "0.075", "initial_layer_infill_speed": "28", diff --git a/resources/profiles/BBL/process/0.10mm High Quality @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/process/0.10mm High Quality @BBL A1M 0.2 nozzle.json index 5eb21ef675..cb96b785af 100644 --- a/resources/profiles/BBL/process/0.10mm High Quality @BBL A1M 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.10mm High Quality @BBL A1M 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP113", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in much higher printing quality, but a much longer printing time.", "default_acceleration": "3000", "elefant_foot_compensation": "0", "initial_layer_infill_speed": "28", diff --git a/resources/profiles/BBL/process/0.10mm High Quality @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/process/0.10mm High Quality @BBL P1P 0.2 nozzle.json index 8167ee4df0..f463a9e060 100644 --- a/resources/profiles/BBL/process/0.10mm High Quality @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.10mm High Quality @BBL P1P 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP112", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in much higher printing quality, but a much longer printing time.", "default_acceleration": "4000", "elefant_foot_compensation": "0.15", "outer_wall_acceleration": "2000", diff --git a/resources/profiles/BBL/process/0.10mm High Quality @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.10mm High Quality @BBL X1C 0.2 nozzle.json index af661fd789..60f8e2686b 100644 --- a/resources/profiles/BBL/process/0.10mm High Quality @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.10mm High Quality @BBL X1C 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP111", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in much higher printing quality, but a much longer printing time.", "default_acceleration": "4000", "elefant_foot_compensation": "0.15", "outer_wall_acceleration": "2000", diff --git a/resources/profiles/BBL/process/0.10mm Standard @BBL A1 0.2 nozzle.json b/resources/profiles/BBL/process/0.10mm Standard @BBL A1 0.2 nozzle.json index 4b2576ef0b..56a9bfaced 100644 --- a/resources/profiles/BBL/process/0.10mm Standard @BBL A1 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.10mm Standard @BBL A1 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP083", "instantiation": "true", + "description": "It has a small layer height, and results in almost negligible layer lines and high printing quality. It is suitable for most general printing cases.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "initial_layer_infill_speed": "28", diff --git a/resources/profiles/BBL/process/0.10mm Standard @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/process/0.10mm Standard @BBL A1M 0.2 nozzle.json index 972961766e..9841209d7e 100644 --- a/resources/profiles/BBL/process/0.10mm Standard @BBL A1M 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.10mm Standard @BBL A1M 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP039", "instantiation": "true", + "description": "It has a small layer height, and results in almost negligible layer lines and high printing quality. It is suitable for most general printing cases.", "default_acceleration": "6000", "elefant_foot_compensation": "0", "initial_layer_infill_speed": "28", diff --git a/resources/profiles/BBL/process/0.10mm Standard @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/process/0.10mm Standard @BBL P1P 0.2 nozzle.json index 0b50342c13..37a2a12777 100644 --- a/resources/profiles/BBL/process/0.10mm Standard @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.10mm Standard @BBL P1P 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP014", "instantiation": "true", + "description": "It has a small layer height, and results in almost negligible layer lines and high printing quality. It is suitable for most general printing cases.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab P1P 0.2 nozzle" diff --git a/resources/profiles/BBL/process/0.10mm Standard @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.10mm Standard @BBL X1C 0.2 nozzle.json index 9b04506d03..241c0a358f 100644 --- a/resources/profiles/BBL/process/0.10mm Standard @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.10mm Standard @BBL X1C 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP007", "instantiation": "true", + "description": "It has a small layer height, and results in almost negligible layer lines and high printing quality. It is suitable for most general printing cases.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", diff --git a/resources/profiles/BBL/process/0.12mm Draft @BBL A1 0.2 nozzle.json b/resources/profiles/BBL/process/0.12mm Draft @BBL A1 0.2 nozzle.json index 3a711c372e..549a6d7fe5 100644 --- a/resources/profiles/BBL/process/0.12mm Draft @BBL A1 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.12mm Draft @BBL A1 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP086", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has a slightly bigger layer height, and results in almost negligible layer lines, and slightly shorter printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "initial_layer_infill_speed": "28", diff --git a/resources/profiles/BBL/process/0.12mm Draft @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/process/0.12mm Draft @BBL A1M 0.2 nozzle.json index 917812c462..66a9004da7 100644 --- a/resources/profiles/BBL/process/0.12mm Draft @BBL A1M 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.12mm Draft @BBL A1M 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP052", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has a slightly bigger layer height, and results in almost negligible layer lines, and slightly shorter printing time.", "default_acceleration": "6000", "initial_layer_infill_speed": "28", "initial_layer_speed": "16", diff --git a/resources/profiles/BBL/process/0.12mm Draft @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/process/0.12mm Draft @BBL P1P 0.2 nozzle.json index faef462ee4..675c21747d 100644 --- a/resources/profiles/BBL/process/0.12mm Draft @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.12mm Draft @BBL P1P 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP065", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has a slightly bigger layer height, and results in almost negligible layer lines, and slightly shorter printing time.", "default_acceleration": "5000", "elefant_foot_compensation": "0.15", "outer_wall_acceleration": "2500", diff --git a/resources/profiles/BBL/process/0.12mm Fine @BBL A1.json b/resources/profiles/BBL/process/0.12mm Fine @BBL A1.json index 4bf79151e2..6cb7369ad2 100644 --- a/resources/profiles/BBL/process/0.12mm Fine @BBL A1.json +++ b/resources/profiles/BBL/process/0.12mm Fine @BBL A1.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP077", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, and results in almost negligible layer lines and higher printing quality, but longer printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.12mm Fine @BBL A1M.json b/resources/profiles/BBL/process/0.12mm Fine @BBL A1M.json index 3fb96a9078..74d30722a0 100644 --- a/resources/profiles/BBL/process/0.12mm Fine @BBL A1M.json +++ b/resources/profiles/BBL/process/0.12mm Fine @BBL A1M.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP044", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, and results in almost negligible layer lines and higher printing quality, but longer printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.12mm Fine @BBL P1P.json b/resources/profiles/BBL/process/0.12mm Fine @BBL P1P.json index 03afc8bee0..172d506eca 100644 --- a/resources/profiles/BBL/process/0.12mm Fine @BBL P1P.json +++ b/resources/profiles/BBL/process/0.12mm Fine @BBL P1P.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP019", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, and results in almost negligible layer lines and higher printing quality, but longer printing time.", "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle" ] diff --git a/resources/profiles/BBL/process/0.12mm Fine @BBL X1C.json b/resources/profiles/BBL/process/0.12mm Fine @BBL X1C.json index 16c75d85ce..d42c4dcd66 100644 --- a/resources/profiles/BBL/process/0.12mm Fine @BBL X1C.json +++ b/resources/profiles/BBL/process/0.12mm Fine @BBL X1C.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP002", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, and results in almost negligible layer lines and higher printing quality, but longer printing time.", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/process/0.12mm High Quality @BBL A1.json b/resources/profiles/BBL/process/0.12mm High Quality @BBL A1.json index 131b39e8b2..0a1a283141 100644 --- a/resources/profiles/BBL/process/0.12mm High Quality @BBL A1.json +++ b/resources/profiles/BBL/process/0.12mm High Quality @BBL A1.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP106", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in almost negligible layer lines and much higher printing quality, but much longer printing time.", "default_acceleration": "4000", "elefant_foot_compensation": "0.075", "gap_infill_speed": "230", diff --git a/resources/profiles/BBL/process/0.12mm High Quality @BBL A1M.json b/resources/profiles/BBL/process/0.12mm High Quality @BBL A1M.json index 8305849949..dbe1743fbc 100644 --- a/resources/profiles/BBL/process/0.12mm High Quality @BBL A1M.json +++ b/resources/profiles/BBL/process/0.12mm High Quality @BBL A1M.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP105", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in almost negligible layer lines and much higher printing quality, but much longer printing time.", "default_acceleration": "3000", "elefant_foot_compensation": "0", "gap_infill_speed": "230", diff --git a/resources/profiles/BBL/process/0.12mm High Quality @BBL P1P.json b/resources/profiles/BBL/process/0.12mm High Quality @BBL P1P.json index da83aa8137..1acd431c12 100644 --- a/resources/profiles/BBL/process/0.12mm High Quality @BBL P1P.json +++ b/resources/profiles/BBL/process/0.12mm High Quality @BBL P1P.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP104", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in almost negligible layer lines and much higher printing quality, but much longer printing time.", "default_acceleration": "4000", "gap_infill_speed": "230", "inner_wall_speed": "150", diff --git a/resources/profiles/BBL/process/0.12mm High Quality @BBL X1C.json b/resources/profiles/BBL/process/0.12mm High Quality @BBL X1C.json index df9625b60b..f2e438994e 100644 --- a/resources/profiles/BBL/process/0.12mm High Quality @BBL X1C.json +++ b/resources/profiles/BBL/process/0.12mm High Quality @BBL X1C.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP103", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in almost negligible layer lines and much higher printing quality, but much longer printing time.", "default_acceleration": "4000", "gap_infill_speed": "230", "inner_wall_speed": "150", diff --git a/resources/profiles/BBL/process/0.12mm Standard @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.12mm Standard @BBL X1C 0.2 nozzle.json index 5d3d9b8d63..e909017319 100644 --- a/resources/profiles/BBL/process/0.12mm Standard @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.12mm Standard @BBL X1C 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP026", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has a slightly bigger layer height, and results in almost negligible layer lines, and slightly shorter printing time.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", diff --git a/resources/profiles/BBL/process/0.14mm Extra Draft @BBL A1 0.2 nozzle.json b/resources/profiles/BBL/process/0.14mm Extra Draft @BBL A1 0.2 nozzle.json index 342f481afe..c1ff7b34a3 100644 --- a/resources/profiles/BBL/process/0.14mm Extra Draft @BBL A1 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.14mm Extra Draft @BBL A1 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP087", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has a bigger layer height, and results in slightly visible layer lines, but shorter printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "initial_layer_infill_speed": "28", diff --git a/resources/profiles/BBL/process/0.14mm Extra Draft @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/process/0.14mm Extra Draft @BBL A1M 0.2 nozzle.json index 1c5b9def3f..c8b97600b7 100644 --- a/resources/profiles/BBL/process/0.14mm Extra Draft @BBL A1M 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.14mm Extra Draft @BBL A1M 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP053", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has a bigger layer height, and results in slightly visible layer lines, but shorter printing time.", "default_acceleration": "6000", "initial_layer_infill_speed": "28", "initial_layer_speed": "16", diff --git a/resources/profiles/BBL/process/0.14mm Extra Draft @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/process/0.14mm Extra Draft @BBL P1P 0.2 nozzle.json index 568f51d502..d19c428cd4 100644 --- a/resources/profiles/BBL/process/0.14mm Extra Draft @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.14mm Extra Draft @BBL P1P 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP066", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has a bigger layer height, and results in slightly visible layer lines, but shorter printing time.", "default_acceleration": "5000", "elefant_foot_compensation": "0.15", "outer_wall_acceleration": "2500", diff --git a/resources/profiles/BBL/process/0.14mm Standard @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.14mm Standard @BBL X1C 0.2 nozzle.json index 227940298d..b6d8ecc230 100644 --- a/resources/profiles/BBL/process/0.14mm Standard @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.14mm Standard @BBL X1C 0.2 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP027", "instantiation": "true", + "description": "Compared with the default profile of a 0.2 mm nozzle, it has a bigger layer height, and results in slightly visible layer lines, but shorter printing time.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", diff --git a/resources/profiles/BBL/process/0.16mm High Quality @BBL A1.json b/resources/profiles/BBL/process/0.16mm High Quality @BBL A1.json index 1f246929f8..5632bdbe26 100644 --- a/resources/profiles/BBL/process/0.16mm High Quality @BBL A1.json +++ b/resources/profiles/BBL/process/0.16mm High Quality @BBL A1.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP110", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in less apparent layer lines and much higher printing quality, but much longer printing time.", "default_acceleration": "4000", "elefant_foot_compensation": "0.075", "gap_infill_speed": "250", diff --git a/resources/profiles/BBL/process/0.16mm High Quality @BBL A1M.json b/resources/profiles/BBL/process/0.16mm High Quality @BBL A1M.json index 58ac77c4c5..fe51c4740f 100644 --- a/resources/profiles/BBL/process/0.16mm High Quality @BBL A1M.json +++ b/resources/profiles/BBL/process/0.16mm High Quality @BBL A1M.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP109", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in less apparent layer lines and much higher printing quality, but much longer printing time.", "default_acceleration": "3000", "elefant_foot_compensation": "0", "gap_infill_speed": "250", diff --git a/resources/profiles/BBL/process/0.16mm High Quality @BBL P1P.json b/resources/profiles/BBL/process/0.16mm High Quality @BBL P1P.json index d36e464f86..a3cd2eb87c 100644 --- a/resources/profiles/BBL/process/0.16mm High Quality @BBL P1P.json +++ b/resources/profiles/BBL/process/0.16mm High Quality @BBL P1P.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP108", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in less apparent layer lines and much higher printing quality, but much longer printing time.", "default_acceleration": "4000", "gap_infill_speed": "250", "inner_wall_speed": "150", diff --git a/resources/profiles/BBL/process/0.16mm High Quality @BBL X1C.json b/resources/profiles/BBL/process/0.16mm High Quality @BBL X1C.json index 32295f8e82..e5f73eab5b 100644 --- a/resources/profiles/BBL/process/0.16mm High Quality @BBL X1C.json +++ b/resources/profiles/BBL/process/0.16mm High Quality @BBL X1C.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP107", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, lower speeds and acceleration, and the sparse infill pattern is Gyroid. So, it results in less apparent layer lines and much higher printing quality, but much longer printing time.", "default_acceleration": "4000", "gap_infill_speed": "250", "inner_wall_speed": "150", diff --git a/resources/profiles/BBL/process/0.16mm Optimal @BBL A1.json b/resources/profiles/BBL/process/0.16mm Optimal @BBL A1.json index 1ec6906d6d..eedbf6577d 100644 --- a/resources/profiles/BBL/process/0.16mm Optimal @BBL A1.json +++ b/resources/profiles/BBL/process/0.16mm Optimal @BBL A1.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP078", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, and results in less apparent layer lines and higher printing quality, but longer printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.16mm Optimal @BBL A1M.json b/resources/profiles/BBL/process/0.16mm Optimal @BBL A1M.json index 88ef46e482..509404f9cd 100644 --- a/resources/profiles/BBL/process/0.16mm Optimal @BBL A1M.json +++ b/resources/profiles/BBL/process/0.16mm Optimal @BBL A1M.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP045", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, and results in less apparent layer lines and higher printing quality, but longer printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.16mm Optimal @BBL P1P.json b/resources/profiles/BBL/process/0.16mm Optimal @BBL P1P.json index 1e0462da79..6df7fae3f2 100644 --- a/resources/profiles/BBL/process/0.16mm Optimal @BBL P1P.json +++ b/resources/profiles/BBL/process/0.16mm Optimal @BBL P1P.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP020", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, and results in less apparent layer lines and higher printing quality, but longer printing time.", "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle" ] diff --git a/resources/profiles/BBL/process/0.16mm Optimal @BBL X1C.json b/resources/profiles/BBL/process/0.16mm Optimal @BBL X1C.json index 2465e38c1d..0d12d4ddb8 100644 --- a/resources/profiles/BBL/process/0.16mm Optimal @BBL X1C.json +++ b/resources/profiles/BBL/process/0.16mm Optimal @BBL X1C.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP003", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, and results in less apparent layer lines and higher printing quality, but longer printing time.", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/process/0.18mm Fine @BBL A1 0.6 nozzle.json b/resources/profiles/BBL/process/0.18mm Fine @BBL A1 0.6 nozzle.json index 447c7994aa..f19e70c25f 100644 --- a/resources/profiles/BBL/process/0.18mm Fine @BBL A1 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.18mm Fine @BBL A1 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP088", "instantiation": "true", + "description": "Compared with the default profile of a 0.6 mm nozzle, it has a smaller layer height, and results in less apparent layer lines and higher printing quality, but longer printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.18mm Fine @BBL A1M 0.6 nozzle.json b/resources/profiles/BBL/process/0.18mm Fine @BBL A1M 0.6 nozzle.json index 7bc6534c79..7b1612a79d 100644 --- a/resources/profiles/BBL/process/0.18mm Fine @BBL A1M 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.18mm Fine @BBL A1M 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP062", "instantiation": "true", + "description": "Compared with the default profile of a 0.6 mm nozzle, it has a smaller layer height, and results in less apparent layer lines and higher printing quality, but longer printing time.", "default_acceleration": "6000", "travel_speed": "700", "compatible_printers": [ diff --git a/resources/profiles/BBL/process/0.18mm Fine @BBL P1P 0.6 nozzle.json b/resources/profiles/BBL/process/0.18mm Fine @BBL P1P 0.6 nozzle.json index a1635bd9d6..53d29a785f 100644 --- a/resources/profiles/BBL/process/0.18mm Fine @BBL P1P 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.18mm Fine @BBL P1P 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP072", "instantiation": "true", + "description": "Compared with the default profile of a 0.6 mm nozzle, it has a smaller layer height, and results in less apparent layer lines and higher printing quality, but longer printing time.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab P1P 0.6 nozzle" diff --git a/resources/profiles/BBL/process/0.18mm Standard @BBL X1C 0.6 nozzle.json b/resources/profiles/BBL/process/0.18mm Standard @BBL X1C 0.6 nozzle.json index ae327ef129..15ebedb2ac 100644 --- a/resources/profiles/BBL/process/0.18mm Standard @BBL X1C 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.18mm Standard @BBL X1C 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP028", "instantiation": "true", + "description": "Compared with the default profile of a 0.6 mm nozzle, it has a smaller layer height, and results in less apparent layer lines and higher printing quality, but longer printing time.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", diff --git a/resources/profiles/BBL/process/0.20mm Standard @BBL A1.json b/resources/profiles/BBL/process/0.20mm Standard @BBL A1.json index e1c6f5ebd7..91feaa6774 100644 --- a/resources/profiles/BBL/process/0.20mm Standard @BBL A1.json +++ b/resources/profiles/BBL/process/0.20mm Standard @BBL A1.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP079", "instantiation": "true", + "description": "It has a general layer height, and results in general layer lines and printing quality. It is suitable for most general printing cases.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.20mm Standard @BBL A1M.json b/resources/profiles/BBL/process/0.20mm Standard @BBL A1M.json index 33edabab4d..78b09fc677 100644 --- a/resources/profiles/BBL/process/0.20mm Standard @BBL A1M.json +++ b/resources/profiles/BBL/process/0.20mm Standard @BBL A1M.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP000", "instantiation": "true", + "description": "It has a general layer height, and results in general layer lines and printing quality. It is suitable for most general printing cases.", "default_acceleration": "6000", "elefant_foot_compensation": "0", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.20mm Standard @BBL P1P.json b/resources/profiles/BBL/process/0.20mm Standard @BBL P1P.json index 1b60746efc..cea5a44b6d 100644 --- a/resources/profiles/BBL/process/0.20mm Standard @BBL P1P.json +++ b/resources/profiles/BBL/process/0.20mm Standard @BBL P1P.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP015", "instantiation": "true", + "description": "It has a general layer height, and results in general layer lines and printing quality. It is suitable for most general printing cases.", "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle" ] diff --git a/resources/profiles/BBL/process/0.20mm Standard @BBL X1C.json b/resources/profiles/BBL/process/0.20mm Standard @BBL X1C.json index 1d05bdfa6f..2f38b67fa7 100644 --- a/resources/profiles/BBL/process/0.20mm Standard @BBL X1C.json +++ b/resources/profiles/BBL/process/0.20mm Standard @BBL X1C.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP004", "instantiation": "true", + "description": "It has a general layer height, and results in general layer lines and printing quality. It is suitable for most general printing cases.", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/process/0.20mm Strength @BBL A1.json b/resources/profiles/BBL/process/0.20mm Strength @BBL A1.json index 17c882470b..30e9ca38ee 100644 --- a/resources/profiles/BBL/process/0.20mm Strength @BBL A1.json +++ b/resources/profiles/BBL/process/0.20mm Strength @BBL A1.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP080", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has more wall loops and a higher sparse infill density. So, it results in higher strength of the prints, but more filament consumption and longer printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "outer_wall_speed": "60", diff --git a/resources/profiles/BBL/process/0.20mm Strength @BBL A1M.json b/resources/profiles/BBL/process/0.20mm Strength @BBL A1M.json index 2c2595cc9a..3a261d636d 100644 --- a/resources/profiles/BBL/process/0.20mm Strength @BBL A1M.json +++ b/resources/profiles/BBL/process/0.20mm Strength @BBL A1M.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP046", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has more wall loops and a higher sparse infill density. So, it results in higher strength of the prints, but more filament consumption and longer printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.20mm Strength @BBL P1P.json b/resources/profiles/BBL/process/0.20mm Strength @BBL P1P.json index c38f5f7118..9edb0342ad 100644 --- a/resources/profiles/BBL/process/0.20mm Strength @BBL P1P.json +++ b/resources/profiles/BBL/process/0.20mm Strength @BBL P1P.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP021", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has more wall loops and a higher sparse infill density. So, it results in higher strength of the prints, but more filament consumption and longer printing time.", "outer_wall_speed": "60", "sparse_infill_density": "25%", "wall_loops": "6", diff --git a/resources/profiles/BBL/process/0.20mm Strength @BBL X1C.json b/resources/profiles/BBL/process/0.20mm Strength @BBL X1C.json index 27b9c03128..a621376300 100644 --- a/resources/profiles/BBL/process/0.20mm Strength @BBL X1C.json +++ b/resources/profiles/BBL/process/0.20mm Strength @BBL X1C.json @@ -5,9 +5,10 @@ "from": "system", "setting_id": "GP013", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has more wall loops and a higher sparse infill density. So, it results in higher strength of the prints, but more filament consumption and longer printing time.", "outer_wall_speed": "60", - "wall_loops": "6", "sparse_infill_density": "25%", + "wall_loops": "6", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/process/0.24mm Draft @BBL A1.json b/resources/profiles/BBL/process/0.24mm Draft @BBL A1.json index abdd58e9b9..20e452f19b 100644 --- a/resources/profiles/BBL/process/0.24mm Draft @BBL A1.json +++ b/resources/profiles/BBL/process/0.24mm Draft @BBL A1.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP081", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a bigger layer height, and results in more apparent layer lines and lower printing quality, but slightly shorter printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.24mm Draft @BBL A1M.json b/resources/profiles/BBL/process/0.24mm Draft @BBL A1M.json index 3915f80f48..4c791c4600 100644 --- a/resources/profiles/BBL/process/0.24mm Draft @BBL A1M.json +++ b/resources/profiles/BBL/process/0.24mm Draft @BBL A1M.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP047", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a bigger layer height, and results in more apparent layer lines and lower printing quality, but slightly shorter printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.24mm Draft @BBL P1P.json b/resources/profiles/BBL/process/0.24mm Draft @BBL P1P.json index 87866d4f72..ed3bd535f9 100644 --- a/resources/profiles/BBL/process/0.24mm Draft @BBL P1P.json +++ b/resources/profiles/BBL/process/0.24mm Draft @BBL P1P.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP022", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a bigger layer height, and results in more apparent layer lines and lower printing quality, but slightly shorter printing time.", "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle" ] diff --git a/resources/profiles/BBL/process/0.24mm Draft @BBL X1C.json b/resources/profiles/BBL/process/0.24mm Draft @BBL X1C.json index 4ef6dae40e..01505bf228 100644 --- a/resources/profiles/BBL/process/0.24mm Draft @BBL X1C.json +++ b/resources/profiles/BBL/process/0.24mm Draft @BBL X1C.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP005", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a bigger layer height, and results in more apparent layer lines and lower printing quality, but slightly shorter printing time.", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/process/0.24mm Fine @BBL A1 0.8 nozzle.json b/resources/profiles/BBL/process/0.24mm Fine @BBL A1 0.8 nozzle.json index af778978f4..629884dc7c 100644 --- a/resources/profiles/BBL/process/0.24mm Fine @BBL A1 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.24mm Fine @BBL A1 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP092", "instantiation": "true", + "description": "Compared with the default profile of a 0.8 mm nozzle, it has a smaller layer height, and results in less but still apparent layer lines and slightly higher printing quality, but longer printing time in some printing cases.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.24mm Fine @BBL A1M 0.8 nozzle.json b/resources/profiles/BBL/process/0.24mm Fine @BBL A1M 0.8 nozzle.json index 8a542171d2..ca2631fb71 100644 --- a/resources/profiles/BBL/process/0.24mm Fine @BBL A1M 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.24mm Fine @BBL A1M 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP057", "instantiation": "true", + "description": "Compared with the default profile of a 0.8 mm nozzle, it has a smaller layer height, and results in less but still apparent layer lines and slightly higher printing quality, but longer printing time in some printing cases.", "default_acceleration": "6000", "travel_speed": "700", "compatible_printers": [ diff --git a/resources/profiles/BBL/process/0.24mm Fine @BBL P1P 0.8 nozzle.json b/resources/profiles/BBL/process/0.24mm Fine @BBL P1P 0.8 nozzle.json index 5b02a41a12..7f7934ad5a 100644 --- a/resources/profiles/BBL/process/0.24mm Fine @BBL P1P 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.24mm Fine @BBL P1P 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP068", "instantiation": "true", + "description": "Compared with the default profile of a 0.8 mm nozzle, it has a smaller layer height, and results in less but still apparent layer lines and slightly higher printing quality, but longer printing time in some printing cases.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab P1P 0.8 nozzle" diff --git a/resources/profiles/BBL/process/0.24mm Optimal @BBL A1 0.6 nozzle.json b/resources/profiles/BBL/process/0.24mm Optimal @BBL A1 0.6 nozzle.json index f616ccd800..f8388f6262 100644 --- a/resources/profiles/BBL/process/0.24mm Optimal @BBL A1 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.24mm Optimal @BBL A1 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP089", "instantiation": "true", + "description": "Compared with the default profile of a 0.6 mm nozzle, it has a smaller layer height, and results in less apparent layer lines and slight higher printing quality, but longer printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.24mm Optimal @BBL A1M 0.6 nozzle.json b/resources/profiles/BBL/process/0.24mm Optimal @BBL A1M 0.6 nozzle.json index e5eaf7207b..28082afef5 100644 --- a/resources/profiles/BBL/process/0.24mm Optimal @BBL A1M 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.24mm Optimal @BBL A1M 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP054", "instantiation": "true", + "description": "Compared with the default profile of a 0.6 mm nozzle, it has a smaller layer height, and results in less apparent layer lines and slight higher printing quality, but longer printing time.", "default_acceleration": "6000", "travel_speed": "700", "compatible_printers": [ diff --git a/resources/profiles/BBL/process/0.24mm Optimal @BBL P1P 0.6 nozzle.json b/resources/profiles/BBL/process/0.24mm Optimal @BBL P1P 0.6 nozzle.json index 54941c5327..a143d7b635 100644 --- a/resources/profiles/BBL/process/0.24mm Optimal @BBL P1P 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.24mm Optimal @BBL P1P 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP069", "instantiation": "true", + "description": "Compared with the default profile of a 0.6 mm nozzle, it has a smaller layer height, and results in less apparent layer lines and slight higher printing quality, but longer printing time.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab P1P 0.6 nozzle" diff --git a/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.6 nozzle.json b/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.6 nozzle.json index 47ee33688a..992bb0f1c5 100644 --- a/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP029", "instantiation": "true", + "description": "Compared with the default profile of a 0.6 mm nozzle, it has a smaller layer height, and results in less apparent layer lines and slight higher printing quality, but longer printing time.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", diff --git a/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.8 nozzle.json index a45123964c..9be5eed988 100644 --- a/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP032", "instantiation": "true", + "description": "Compared with the default profile of a 0.8 mm nozzle, it has a smaller layer height, and results in less but still apparent layer lines and slightly higher printing quality, but longer printing time in some printing cases.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab X1 Carbon 0.8 nozzle", diff --git a/resources/profiles/BBL/process/0.28mm Extra Draft @BBL A1.json b/resources/profiles/BBL/process/0.28mm Extra Draft @BBL A1.json index 432bb9292b..490c0026cd 100644 --- a/resources/profiles/BBL/process/0.28mm Extra Draft @BBL A1.json +++ b/resources/profiles/BBL/process/0.28mm Extra Draft @BBL A1.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP082", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a bigger layer height, and results in more apparent layer lines and lower printing quality, but shorter printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.28mm Extra Draft @BBL A1M.json b/resources/profiles/BBL/process/0.28mm Extra Draft @BBL A1M.json index f2ea4704d8..f1923e0d69 100644 --- a/resources/profiles/BBL/process/0.28mm Extra Draft @BBL A1M.json +++ b/resources/profiles/BBL/process/0.28mm Extra Draft @BBL A1M.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP048", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a bigger layer height, and results in more apparent layer lines and lower printing quality, but shorter printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.28mm Extra Draft @BBL P1P.json b/resources/profiles/BBL/process/0.28mm Extra Draft @BBL P1P.json index ca64d1e316..4f9bb7b53e 100644 --- a/resources/profiles/BBL/process/0.28mm Extra Draft @BBL P1P.json +++ b/resources/profiles/BBL/process/0.28mm Extra Draft @BBL P1P.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP023", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a bigger layer height, and results in more apparent layer lines and lower printing quality, but shorter printing time.", "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle" ] diff --git a/resources/profiles/BBL/process/0.28mm Extra Draft @BBL X1C.json b/resources/profiles/BBL/process/0.28mm Extra Draft @BBL X1C.json index 211a43a31e..8c2e794dab 100644 --- a/resources/profiles/BBL/process/0.28mm Extra Draft @BBL X1C.json +++ b/resources/profiles/BBL/process/0.28mm Extra Draft @BBL X1C.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP006", "instantiation": "true", + "description": "Compared with the default profile of a 0.4 mm nozzle, it has a bigger layer height, and results in more apparent layer lines and lower printing quality, but shorter printing time.", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/process/0.30mm Standard @BBL A1 0.6 nozzle.json b/resources/profiles/BBL/process/0.30mm Standard @BBL A1 0.6 nozzle.json index b05e7cea1e..26ad6e5806 100644 --- a/resources/profiles/BBL/process/0.30mm Standard @BBL A1 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.30mm Standard @BBL A1 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP096", "instantiation": "true", + "description": "It has a big layer height, and results in apparent layer lines and ordinary printing quality and printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.30mm Standard @BBL A1M 0.6 nozzle.json b/resources/profiles/BBL/process/0.30mm Standard @BBL A1M 0.6 nozzle.json index ef0567d6d1..910c119ebd 100644 --- a/resources/profiles/BBL/process/0.30mm Standard @BBL A1M 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.30mm Standard @BBL A1M 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP038", "instantiation": "true", + "description": "It has a big layer height, and results in apparent layer lines and ordinary printing quality and printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.30mm Standard @BBL P1P 0.6 nozzle.json b/resources/profiles/BBL/process/0.30mm Standard @BBL P1P 0.6 nozzle.json index 37b7593e8d..164c03866f 100644 --- a/resources/profiles/BBL/process/0.30mm Standard @BBL P1P 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.30mm Standard @BBL P1P 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP016", "instantiation": "true", + "description": "It has a big layer height, and results in apparent layer lines and ordinary printing quality and printing time.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab P1P 0.6 nozzle" diff --git a/resources/profiles/BBL/process/0.30mm Standard @BBL X1 0.6 nozzle.json b/resources/profiles/BBL/process/0.30mm Standard @BBL X1 0.6 nozzle.json index f53720838f..e501731193 100644 --- a/resources/profiles/BBL/process/0.30mm Standard @BBL X1 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.30mm Standard @BBL X1 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP011", "instantiation": "true", + "description": "It has a big layer height, and results in apparent layer lines and ordinary printing quality and printing time.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab X1 0.6 nozzle" diff --git a/resources/profiles/BBL/process/0.30mm Standard @BBL X1C 0.6 nozzle.json b/resources/profiles/BBL/process/0.30mm Standard @BBL X1C 0.6 nozzle.json index c09f04e219..3f0a4dacbe 100644 --- a/resources/profiles/BBL/process/0.30mm Standard @BBL X1C 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.30mm Standard @BBL X1C 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP010", "instantiation": "true", + "description": "It has a big layer height, and results in apparent layer lines and ordinary printing quality and printing time.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", diff --git a/resources/profiles/BBL/process/0.30mm Strength @BBL A1 0.6 nozzle.json b/resources/profiles/BBL/process/0.30mm Strength @BBL A1 0.6 nozzle.json index f4978b869f..775523f0d6 100644 --- a/resources/profiles/BBL/process/0.30mm Strength @BBL A1 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.30mm Strength @BBL A1 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP097", "instantiation": "true", + "description": "Compared with the default profile of a 0.6 mm nozzle, it has more wall loops and a higher sparse infill density. So, it results in higher strength of the prints, but more filament consumption and longer printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "sparse_infill_density": "25%", diff --git a/resources/profiles/BBL/process/0.30mm Strength @BBL A1M 0.6 nozzle.json b/resources/profiles/BBL/process/0.30mm Strength @BBL A1M 0.6 nozzle.json index 5eac111e7e..044c7c24cb 100644 --- a/resources/profiles/BBL/process/0.30mm Strength @BBL A1M 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.30mm Strength @BBL A1M 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP061", "instantiation": "true", + "description": "Compared with the default profile of a 0.6 mm nozzle, it has more wall loops and a higher sparse infill density. So, it results in higher strength of the prints, but more filament consumption and longer printing time.", "default_acceleration": "6000", "travel_speed": "700", "compatible_printers": [ diff --git a/resources/profiles/BBL/process/0.30mm Strength @BBL P1P 0.6 nozzle.json b/resources/profiles/BBL/process/0.30mm Strength @BBL P1P 0.6 nozzle.json index c5bcdf6cd6..284206f4fa 100644 --- a/resources/profiles/BBL/process/0.30mm Strength @BBL P1P 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.30mm Strength @BBL P1P 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP067", "instantiation": "true", + "description": "Compared with the default profile of a 0.6 mm nozzle, it has more wall loops and a higher sparse infill density. So, it results in higher strength of the prints, but more filament consumption and longer printing time.", "elefant_foot_compensation": "0.15", "sparse_infill_density": "25%", "wall_loops": "4", diff --git a/resources/profiles/BBL/process/0.30mm Strength @BBL X1C 0.6 nozzle.json b/resources/profiles/BBL/process/0.30mm Strength @BBL X1C 0.6 nozzle.json index 08493a2232..affc545389 100644 --- a/resources/profiles/BBL/process/0.30mm Strength @BBL X1C 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.30mm Strength @BBL X1C 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP036", "instantiation": "true", + "description": "Compared with the default profile of a 0.6 mm nozzle, it has more wall loops and a higher sparse infill density. So, it results in higher strength of the prints, but more filament consumption and longer printing time.", "elefant_foot_compensation": "0.15", "sparse_infill_density": "25%", "wall_loops": "4", diff --git a/resources/profiles/BBL/process/0.32mm Optimal @BBL A1 0.8 nozzle.json b/resources/profiles/BBL/process/0.32mm Optimal @BBL A1 0.8 nozzle.json index fbeab32f62..b1e8658fce 100644 --- a/resources/profiles/BBL/process/0.32mm Optimal @BBL A1 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.32mm Optimal @BBL A1 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP093", "instantiation": "true", + "description": "Compared with the default profile of a 0.8 mm nozzle, it has a slightly smaller layer height, and results in slightly less but still apparent layer lines and slightly higher printing quality, but longer printing time in some printing cases.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.32mm Optimal @BBL A1M 0.8 nozzle.json b/resources/profiles/BBL/process/0.32mm Optimal @BBL A1M 0.8 nozzle.json index f793ab2063..e3778f3709 100644 --- a/resources/profiles/BBL/process/0.32mm Optimal @BBL A1M 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.32mm Optimal @BBL A1M 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP058", "instantiation": "true", + "description": "Compared with the default profile of a 0.8 mm nozzle, it has a slightly smaller layer height, and results in slightly less but still apparent layer lines and slightly higher printing quality, but longer printing time in some printing cases.", "default_acceleration": "6000", "travel_speed": "700", "compatible_printers": [ diff --git a/resources/profiles/BBL/process/0.32mm Optimal @BBL P1P 0.8 nozzle.json b/resources/profiles/BBL/process/0.32mm Optimal @BBL P1P 0.8 nozzle.json index 54463e5b3a..7586ed84bf 100644 --- a/resources/profiles/BBL/process/0.32mm Optimal @BBL P1P 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.32mm Optimal @BBL P1P 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP075", "instantiation": "true", + "description": "Compared with the default profile of a 0.8 mm nozzle, it has a slightly smaller layer height, and results in slightly less but still apparent layer lines and slightly higher printing quality, but longer printing time in some printing cases.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab P1P 0.8 nozzle" diff --git a/resources/profiles/BBL/process/0.32mm Standard @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/process/0.32mm Standard @BBL X1C 0.8 nozzle.json index 0a61d6aaa0..a75637780f 100644 --- a/resources/profiles/BBL/process/0.32mm Standard @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.32mm Standard @BBL X1C 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP033", "instantiation": "true", + "description": "Compared with the default profile of a 0.8 mm nozzle, it has a slightly smaller layer height, and results in slightly less but still apparent layer lines and slightly higher printing quality, but longer printing time in some printing cases.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab X1 Carbon 0.8 nozzle", diff --git a/resources/profiles/BBL/process/0.36mm Draft @BBL A1 0.6 nozzle.json b/resources/profiles/BBL/process/0.36mm Draft @BBL A1 0.6 nozzle.json index 3448a0f1bb..e5ebbcfe31 100644 --- a/resources/profiles/BBL/process/0.36mm Draft @BBL A1 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.36mm Draft @BBL A1 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP090", "instantiation": "true", + "description": "Compared with the default profile of a 0.6 mm nozzle, it has a bigger layer height, and results in more apparent layer lines and lower printing quality, but shorter printing time in some printing cases.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.36mm Draft @BBL A1M 0.6 nozzle.json b/resources/profiles/BBL/process/0.36mm Draft @BBL A1M 0.6 nozzle.json index 4a40cfb3d5..0268a0ea0f 100644 --- a/resources/profiles/BBL/process/0.36mm Draft @BBL A1M 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.36mm Draft @BBL A1M 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP055", "instantiation": "true", + "description": "Compared with the default profile of a 0.6 mm nozzle, it has a bigger layer height, and results in more apparent layer lines and lower printing quality, but shorter printing time in some printing cases.", "default_acceleration": "6000", "travel_speed": "700", "compatible_printers": [ diff --git a/resources/profiles/BBL/process/0.36mm Draft @BBL P1P 0.6 nozzle.json b/resources/profiles/BBL/process/0.36mm Draft @BBL P1P 0.6 nozzle.json index b7a618da19..51251017b3 100644 --- a/resources/profiles/BBL/process/0.36mm Draft @BBL P1P 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.36mm Draft @BBL P1P 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP070", "instantiation": "true", + "description": "Compared with the default profile of a 0.6 mm nozzle, it has a bigger layer height, and results in more apparent layer lines and lower printing quality, but shorter printing time in some printing cases.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab P1P 0.6 nozzle" diff --git a/resources/profiles/BBL/process/0.36mm Standard @BBL X1C 0.6 nozzle.json b/resources/profiles/BBL/process/0.36mm Standard @BBL X1C 0.6 nozzle.json index 24acdebf3b..f259218f18 100644 --- a/resources/profiles/BBL/process/0.36mm Standard @BBL X1C 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.36mm Standard @BBL X1C 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP030", "instantiation": "true", + "description": "Compared with the default profile of a 0.6 mm nozzle, it has a bigger layer height, and results in more apparent layer lines and lower printing quality, but shorter printing time in some printing cases.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", diff --git a/resources/profiles/BBL/process/0.40mm Standard @BBL A1 0.8 nozzle.json b/resources/profiles/BBL/process/0.40mm Standard @BBL A1 0.8 nozzle.json index e642efe3f4..de5ffe19c3 100644 --- a/resources/profiles/BBL/process/0.40mm Standard @BBL A1 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.40mm Standard @BBL A1 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP098", "instantiation": "true", + "description": "It has a very big layer height, and results in very apparent layer lines, low printing quality and general printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.40mm Standard @BBL A1M 0.8 nozzle.json b/resources/profiles/BBL/process/0.40mm Standard @BBL A1M 0.8 nozzle.json index 39300abc52..e4a2b2aaa1 100644 --- a/resources/profiles/BBL/process/0.40mm Standard @BBL A1M 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.40mm Standard @BBL A1M 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP037", "instantiation": "true", + "description": "It has a very big layer height, and results in very apparent layer lines, low printing quality and general printing time.", "default_acceleration": "6000", "elefant_foot_compensation": "0", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.40mm Standard @BBL P1P 0.8 nozzle.json b/resources/profiles/BBL/process/0.40mm Standard @BBL P1P 0.8 nozzle.json index 547915d19e..a647b300b6 100644 --- a/resources/profiles/BBL/process/0.40mm Standard @BBL P1P 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.40mm Standard @BBL P1P 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP017", "instantiation": "true", + "description": "It has a very big layer height, and results in very apparent layer lines, low printing quality and general printing time.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab P1P 0.8 nozzle" diff --git a/resources/profiles/BBL/process/0.40mm Standard @BBL X1 0.8 nozzle.json b/resources/profiles/BBL/process/0.40mm Standard @BBL X1 0.8 nozzle.json index 649f3e803f..f5115f43b7 100644 --- a/resources/profiles/BBL/process/0.40mm Standard @BBL X1 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.40mm Standard @BBL X1 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP012", "instantiation": "true", + "description": "It has a very big layer height, and results in very apparent layer lines, low printing quality and general printing time.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab X1 0.8 nozzle" diff --git a/resources/profiles/BBL/process/0.40mm Standard @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/process/0.40mm Standard @BBL X1C 0.8 nozzle.json index ed00b1679f..2c7cb9ba80 100644 --- a/resources/profiles/BBL/process/0.40mm Standard @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.40mm Standard @BBL X1C 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP009", "instantiation": "true", + "description": "It has a very big layer height, and results in very apparent layer lines, low printing quality and general printing time.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab X1 Carbon 0.8 nozzle", diff --git a/resources/profiles/BBL/process/0.42mm Extra Draft @BBL A1 0.6 nozzle.json b/resources/profiles/BBL/process/0.42mm Extra Draft @BBL A1 0.6 nozzle.json index b0eda75687..d6b15c6eba 100644 --- a/resources/profiles/BBL/process/0.42mm Extra Draft @BBL A1 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.42mm Extra Draft @BBL A1 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP091", "instantiation": "true", + "description": "Compared with the default profile of a 0.6 mm nozzle, it has a bigger layer height, and results in much more apparent layer lines and much lower printing quality, but shorter printing time in some printing cases.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.42mm Extra Draft @BBL A1M 0.6 nozzle.json b/resources/profiles/BBL/process/0.42mm Extra Draft @BBL A1M 0.6 nozzle.json index b29e070b82..571ab55f0d 100644 --- a/resources/profiles/BBL/process/0.42mm Extra Draft @BBL A1M 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.42mm Extra Draft @BBL A1M 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP056", "instantiation": "true", + "description": "Compared with the default profile of a 0.6 mm nozzle, it has a bigger layer height, and results in much more apparent layer lines and much lower printing quality, but shorter printing time in some printing cases.", "default_acceleration": "6000", "travel_speed": "700", "compatible_printers": [ diff --git a/resources/profiles/BBL/process/0.42mm Extra Draft @BBL P1P 0.6 nozzle.json b/resources/profiles/BBL/process/0.42mm Extra Draft @BBL P1P 0.6 nozzle.json index 9305139f2d..69578536be 100644 --- a/resources/profiles/BBL/process/0.42mm Extra Draft @BBL P1P 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.42mm Extra Draft @BBL P1P 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP073", "instantiation": "true", + "description": "Compared with the default profile of a 0.6 mm nozzle, it has a bigger layer height, and results in much more apparent layer lines and much lower printing quality, but shorter printing time in some printing cases.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab P1P 0.6 nozzle" diff --git a/resources/profiles/BBL/process/0.42mm Standard @BBL X1C 0.6 nozzle.json b/resources/profiles/BBL/process/0.42mm Standard @BBL X1C 0.6 nozzle.json index 38b90393da..dbf8255105 100644 --- a/resources/profiles/BBL/process/0.42mm Standard @BBL X1C 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.42mm Standard @BBL X1C 0.6 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP031", "instantiation": "true", + "description": "Compared with the default profile of a 0.6 mm nozzle, it has a bigger layer height, and results in much more apparent layer lines and much lower printing quality, but shorter printing time in some printing cases.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", diff --git a/resources/profiles/BBL/process/0.48mm Draft @BBL A1 0.8 nozzle.json b/resources/profiles/BBL/process/0.48mm Draft @BBL A1 0.8 nozzle.json index a03f301b78..d3e5e0c26a 100644 --- a/resources/profiles/BBL/process/0.48mm Draft @BBL A1 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.48mm Draft @BBL A1 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP094", "instantiation": "true", + "description": "Compared with the default profile of a 0.8 mm nozzle, it has a bigger layer height, and results in very apparent layer lines and much lower printing quality, but shorter printing time in some printing cases.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.48mm Draft @BBL A1M 0.8 nozzle.json b/resources/profiles/BBL/process/0.48mm Draft @BBL A1M 0.8 nozzle.json index 29d78d74d5..dc3159fb7f 100644 --- a/resources/profiles/BBL/process/0.48mm Draft @BBL A1M 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.48mm Draft @BBL A1M 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP059", "instantiation": "true", + "description": "Compared with the default profile of a 0.8 mm nozzle, it has a bigger layer height, and results in very apparent layer lines and much lower printing quality, but shorter printing time in some printing cases.", "default_acceleration": "6000", "travel_speed": "700", "compatible_printers": [ diff --git a/resources/profiles/BBL/process/0.48mm Draft @BBL P1P 0.8 nozzle.json b/resources/profiles/BBL/process/0.48mm Draft @BBL P1P 0.8 nozzle.json index 0299ac8fec..7a5062a369 100644 --- a/resources/profiles/BBL/process/0.48mm Draft @BBL P1P 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.48mm Draft @BBL P1P 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP074", "instantiation": "true", + "description": "Compared with the default profile of a 0.8 mm nozzle, it has a bigger layer height, and results in very apparent layer lines and much lower printing quality, but shorter printing time in some printing cases.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab P1P 0.8 nozzle" diff --git a/resources/profiles/BBL/process/0.48mm Standard @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/process/0.48mm Standard @BBL X1C 0.8 nozzle.json index 4075696088..77c2585943 100644 --- a/resources/profiles/BBL/process/0.48mm Standard @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.48mm Standard @BBL X1C 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP034", "instantiation": "true", + "description": "Compared with the default profile of a 0.8 mm nozzle, it has a bigger layer height, and results in very apparent layer lines and much lower printing quality, but shorter printing time in some printing cases.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab X1 Carbon 0.8 nozzle", diff --git a/resources/profiles/BBL/process/0.56mm Extra Draft @BBL A1 0.8 nozzle.json b/resources/profiles/BBL/process/0.56mm Extra Draft @BBL A1 0.8 nozzle.json index 8b1312dfb9..7669c35cdc 100644 --- a/resources/profiles/BBL/process/0.56mm Extra Draft @BBL A1 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.56mm Extra Draft @BBL A1 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP095", "instantiation": "true", + "description": "Compared with the default profile of a 0.8 mm nozzle, it has a much bigger layer height, and results in extremely apparent layer lines and much lower printing quality, but much shorter printing time in some printing cases.", "default_acceleration": "6000", "elefant_foot_compensation": "0.075", "travel_speed": "700", diff --git a/resources/profiles/BBL/process/0.56mm Extra Draft @BBL A1M 0.8 nozzle.json b/resources/profiles/BBL/process/0.56mm Extra Draft @BBL A1M 0.8 nozzle.json index 43895dd832..8090a64617 100644 --- a/resources/profiles/BBL/process/0.56mm Extra Draft @BBL A1M 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.56mm Extra Draft @BBL A1M 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP060", "instantiation": "true", + "description": "Compared with the default profile of a 0.8 mm nozzle, it has a much bigger layer height, and results in extremely apparent layer lines and much lower printing quality, but much shorter printing time in some printing cases.", "default_acceleration": "6000", "travel_speed": "700", "compatible_printers": [ diff --git a/resources/profiles/BBL/process/0.56mm Extra Draft @BBL P1P 0.8 nozzle.json b/resources/profiles/BBL/process/0.56mm Extra Draft @BBL P1P 0.8 nozzle.json index ca90e061ea..fcc8b66b82 100644 --- a/resources/profiles/BBL/process/0.56mm Extra Draft @BBL P1P 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.56mm Extra Draft @BBL P1P 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP071", "instantiation": "true", + "description": "Compared with the default profile of a 0.8 mm nozzle, it has a much bigger layer height, and results in extremely apparent layer lines and much lower printing quality, but much shorter printing time in some printing cases.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab P1P 0.8 nozzle" diff --git a/resources/profiles/BBL/process/0.56mm Standard @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/process/0.56mm Standard @BBL X1C 0.8 nozzle.json index 48cb2aac2e..64d3187b44 100644 --- a/resources/profiles/BBL/process/0.56mm Standard @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.56mm Standard @BBL X1C 0.8 nozzle.json @@ -5,6 +5,7 @@ "from": "system", "setting_id": "GP035", "instantiation": "true", + "description": "Compared with the default profile of a 0.8 mm nozzle, it has a much bigger layer height, and results in extremely apparent layer lines and much lower printing quality, but much shorter printing time in some printing cases.", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab X1 Carbon 0.8 nozzle", diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.06_nozzle_0.2.json b/resources/profiles/BBL/process/fdm_process_bbl_0.06_nozzle_0.2.json index c01ea54987..0857a48e0e 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.06_nozzle_0.2.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.06_nozzle_0.2.json @@ -21,5 +21,7 @@ "initial_layer_speed": "40", "initial_layer_infill_speed": "70", "sparse_infill_speed": "100", - "top_surface_speed": "150" + "top_surface_speed": "150", + "support_top_z_distance": "0.06", + "support_bottom_z_distance": "0.06" } \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.08.json b/resources/profiles/BBL/process/fdm_process_bbl_0.08.json index 836980d3fd..61897f7a73 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.08.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.08.json @@ -20,5 +20,7 @@ "overhang_1_4_speed": "60", "overhang_2_4_speed": "30", "overhang_3_4_speed": "10", - "support_threshold_angle": "15" + "support_threshold_angle": "15", + "support_top_z_distance": "0.08", + "support_bottom_z_distance": "0.08" } \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.08_nozzle_0.2.json b/resources/profiles/BBL/process/fdm_process_bbl_0.08_nozzle_0.2.json index 43a8b60f07..80670ce3b6 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.08_nozzle_0.2.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.08_nozzle_0.2.json @@ -21,5 +21,7 @@ "initial_layer_speed": "40", "initial_layer_infill_speed": "70", "sparse_infill_speed": "100", - "top_surface_speed": "150" + "top_surface_speed": "150", + "support_top_z_distance": "0.08", + "support_bottom_z_distance": "0.08" } \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.10_nozzle_0.2.json b/resources/profiles/BBL/process/fdm_process_bbl_0.10_nozzle_0.2.json index cc7d773953..9d54d14c18 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.10_nozzle_0.2.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.10_nozzle_0.2.json @@ -21,5 +21,7 @@ "initial_layer_speed": "40", "initial_layer_infill_speed": "70", "sparse_infill_speed": "100", - "top_surface_speed": "150" + "top_surface_speed": "150", + "support_top_z_distance": "0.1", + "support_bottom_z_distance": "0.1" } \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.12.json b/resources/profiles/BBL/process/fdm_process_bbl_0.12.json index e76673b434..e22593fb30 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.12.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.12.json @@ -20,5 +20,7 @@ "overhang_1_4_speed": "60", "overhang_2_4_speed": "30", "overhang_3_4_speed": "10", - "support_threshold_angle": "20" + "support_threshold_angle": "20", + "support_top_z_distance": "0.12", + "support_bottom_z_distance": "0.12" } \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.12_nozzle_0.2.json b/resources/profiles/BBL/process/fdm_process_bbl_0.12_nozzle_0.2.json index 040df9f8a9..9d35f2501e 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.12_nozzle_0.2.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.12_nozzle_0.2.json @@ -21,5 +21,7 @@ "initial_layer_speed": "40", "initial_layer_infill_speed": "70", "sparse_infill_speed": "100", - "top_surface_speed": "150" + "top_surface_speed": "150", + "support_top_z_distance": "0.12", + "support_bottom_z_distance": "0.12" } \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.14_nozzle_0.2.json b/resources/profiles/BBL/process/fdm_process_bbl_0.14_nozzle_0.2.json index be12c21e1c..573669d4a5 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.14_nozzle_0.2.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.14_nozzle_0.2.json @@ -21,5 +21,7 @@ "initial_layer_speed": "40", "initial_layer_infill_speed": "70", "sparse_infill_speed": "100", - "top_surface_speed": "150" + "top_surface_speed": "150", + "support_top_z_distance": "0.14", + "support_bottom_z_distance": "0.14" } \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.16.json b/resources/profiles/BBL/process/fdm_process_bbl_0.16.json index ecc31c5421..3d60b01d8b 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.16.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.16.json @@ -20,5 +20,7 @@ "overhang_1_4_speed": "60", "overhang_2_4_speed": "30", "overhang_3_4_speed": "10", - "support_threshold_angle": "25" + "support_threshold_angle": "25", + "support_top_z_distance": "0.16", + "support_bottom_z_distance": "0.16" } \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.18_nozzle_0.6.json b/resources/profiles/BBL/process/fdm_process_bbl_0.18_nozzle_0.6.json index 3baf1fd45d..0220f43a0d 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.18_nozzle_0.6.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.18_nozzle_0.6.json @@ -20,5 +20,7 @@ "sparse_infill_speed": "100", "top_surface_speed": "150", "bridge_speed": "30", - "overhang_3_4_speed": "15" + "overhang_3_4_speed": "15", + "support_top_z_distance": "0.18", + "support_bottom_z_distance": "0.18" } \ No newline at end of file diff --git a/resources/web/homepage/js/home.js b/resources/web/homepage/js/home.js index 17de9d6b3e..2fbaa43304 100644 --- a/resources/web/homepage/js/home.js +++ b/resources/web/homepage/js/home.js @@ -1,20 +1,15 @@ -/*var TestData={"sequence_id":"0","command":"studio_send_recentfile","data":[{"path":"D:\\work\\Models\\Toy\\3d-puzzle-cube-model_files\\3d-puzzle-cube.3mf","time":"2022\/3\/24 20:33:10"},{"path":"D:\\work\\Models\\Art\\Carved Stone Vase - remeshed+drainage\\Carved Stone Vase.3mf","time":"2022\/3\/24 17:11:51"},{"path":"D:\\work\\Models\\Art\\Kity & Cat\\Cat.3mf","time":"2022\/3\/24 17:07:55"},{"path":"D:\\work\\Models\\Toy\\鐩村墤.3mf","time":"2022\/3\/24 17:06:02"},{"path":"D:\\work\\Models\\Toy\\minimalistic-dual-tone-whistle-model_files\\minimalistic-dual-tone-whistle.3mf","time":"2022\/3\/22 21:12:22"},{"path":"D:\\work\\Models\\Toy\\spiral-city-model_files\\spiral-city.3mf","time":"2022\/3\/22 18:58:37"},{"path":"D:\\work\\Models\\Toy\\impossible-dovetail-puzzle-box-model_files\\impossible-dovetail-puzzle-box.3mf","time":"2022\/3\/22 20:08:40"}]};*/ +//var TestData={"sequence_id":"0","command":"get_recent_projects","response":[{"path":"D:\\work\\Models\\Toy\\3d-puzzle-cube-model_files\\3d-puzzle-cube.3mf","time":"2022\/3\/24 20:33:10"},{"path":"D:\\work\\Models\\Art\\Carved Stone Vase - remeshed+drainage\\Carved Stone Vase.3mf","time":"2022\/3\/24 17:11:51"},{"path":"D:\\work\\Models\\Art\\Kity & Cat\\Cat.3mf","time":"2022\/3\/24 17:07:55"},{"path":"D:\\work\\Models\\Toy\\鐩村墤.3mf","time":"2022\/3\/24 17:06:02"},{"path":"D:\\work\\Models\\Toy\\minimalistic-dual-tone-whistle-model_files\\minimalistic-dual-tone-whistle.3mf","time":"2022\/3\/22 21:12:22"},{"path":"D:\\work\\Models\\Toy\\spiral-city-model_files\\spiral-city.3mf","time":"2022\/3\/22 18:58:37"},{"path":"D:\\work\\Models\\Toy\\impossible-dovetail-puzzle-box-model_files\\impossible-dovetail-puzzle-box.3mf","time":"2022\/3\/22 20:08:40"}]}; var m_HotModelList=null; function OnInit() -{ - //-----Test----- - //Set_RecentFile_MouseRightBtn_Event(); - +{ //-----Official----- TranslatePage(); SendMsg_GetLoginInfo(); SendMsg_GetRecentFile(); SendMsg_GetStaffPick(); - - //InitStaffPick(); } //------最佳打开文件的右键菜单功能---------- @@ -311,14 +306,7 @@ function OnOpenRecentFile( strPath ) function OnDeleteRecentFile( ) { - var tSend={}; - tSend['sequence_id']=Math.round(new Date() / 1000); - tSend['command']="homepage_delete_recentfile"; - tSend['data']={}; - tSend['data']['path']=decodeURI(RightBtnFilePath); - - SendWXMessage( JSON.stringify(tSend) ); - + //Clear in UI $("#recnet_context_menu").hide(); let AllFile=$(".FileItem"); @@ -331,19 +319,27 @@ function OnDeleteRecentFile( ) } UpdateRecentClearBtnDisplay(); + + //Send Msg to C++ + var tSend={}; + tSend['sequence_id']=Math.round(new Date() / 1000); + tSend['command']="homepage_delete_recentfile"; + tSend['data']={}; + tSend['data']['path']=RightBtnFilePath; + + SendWXMessage( JSON.stringify(tSend) ); } function OnDeleteAllRecentFiles() { + $('#FileList').html(''); + UpdateRecentClearBtnDisplay(); + var tSend={}; tSend['sequence_id']=Math.round(new Date() / 1000); tSend['command']="homepage_delete_all_recentfile"; - SendWXMessage( JSON.stringify(tSend) ); - - $('#FileList').html(''); - - UpdateRecentClearBtnDisplay(); + SendWXMessage( JSON.stringify(tSend) ); } function UpdateRecentClearBtnDisplay() diff --git a/resources/web/homepage2/css/online.css b/resources/web/homepage2/css/online.css new file mode 100644 index 0000000000..cfed7f41ce --- /dev/null +++ b/resources/web/homepage2/css/online.css @@ -0,0 +1,162 @@ +.RedFont +{ + font-size:12px; + color: #F07E4A; +} + +.LinkBtn +{ + font-size:12px; + color: #1200FF; + cursor: pointer; +} + +.LinkBtn:hover +{ + text-decoration:underline; +} + + +/*------------------*/ + +/*--------------------*/ +#ContentBoard +{ + overflow-y:auto; + padding: 0px 40px; + display: flex; + flex-direction: column; + position: relative; + height: 100%; +} + +#Online_Models_Bar +{ + +} + +#ForU_Models_Bar +{ + display:none; +} + + +/*--Staff Pick--*/ +#HotModelArea +{ + display: none; + width: 100%; +} + +#HotModelList +{ + display: flex; + flex-wrap: wrap; + align-content: flex-start; +} + +.HotModelPiece +{ + display:flex; + flex-direction: column; + cursor: pointer; + border-radius: 8px; +} + +.HotModel_PrevBlock +{ + text-align: center; + background-color: #E4E4E4; + width: 100%; + border-radius: 8px; + line-height: 0px; + padding: 0px; +} + +.HotModel_PrevImg +{ + border-radius: 8px; + width: 100%; + aspect-ratio: 4/3; + object-fit: cover; +} + +.HotModel_Designer_Info +{ + display:flex; + align-items: center; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + padding: 4px 2px; +} + +.HotModel_Author_HeadIcon +{ + margin-right: 6px; + width: 32px; + height: 32px; +} + +.HotModel_Author_HeadIcon img +{ + width: 32px; + height: 32px; + border-radius: 16px; +} + +.HotModel_Right_1 +{ + flex: 1 1 auto; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + padding: 0px 4px; +} + +.HotModel_Name +{ + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-weight: 700; +} + + +.HotModel_Right_1_2 +{ + display:flex; +} + +.HotModel_Author_Name +{ + flex: 1 1 auto; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + margin-right: 4px; +} + + +.HotModel_click_info +{ + flex: 0 0 auto; + display: flex; + justify-content: flex-start; + align-items: center; + font-size: 12px; + overflow: hidden; +} + +.HotModel_click_info img +{ + width: 20px; + height: 20px; +} + +.Model_Click_Number +{ + display: flex; + align-items: center; +} + diff --git a/resources/web/homepage2/css/recent.css b/resources/web/homepage2/css/recent.css new file mode 100644 index 0000000000..1e3729e210 --- /dev/null +++ b/resources/web/homepage2/css/recent.css @@ -0,0 +1,257 @@ + + +#RecentFileArea +{ + flex: 1; + display: flex; + flex-direction: column; + position: relative; + top: 0px; + bottom: 0px; + right: 0px; + left: 0px; +} + +#RecentTitleBlock +{ + display:flex; + align-items: center; + justify-content:space-between; + padding: 6px 10px; +} + +#RecentClearAllBtn +{ + border-width: 1px; + border-style: solid; + padding: 0px 10px; + border-radius: 6px; + line-height: 26px; + height: 26px; + margin-left: 20px; + cursor: pointer; + display: none; +} + +#RecentClearAllBtn:hover +{ + background-color:#CDCECE; +} + +#Recent_LEFT_Title +{ + display:flex; + align-items: center; + padding: 0px 0px; +} + +#Right_Title_Block +{ + display:flex; + align-items: center; +} + +.Right_Title_Btn +{ + display:flex; + align-items: center; + margin-right: 16px; +} + +.Right_Title_Btn_Icon +{ + width:16px; + height: 16px; + margin-right: 6px; +} + +#Menu_Delete +{ + display:none; +} + +#Menu_Cancel +{ + display:none; +} + +#FileList +{ + flex: 1; + display: flex; + flex-wrap: wrap; + align-content: flex-start; + overflow-y: auto; +} + +.FileItem +{ + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + word-break: break-all; + position: relative; + cursor: pointer; + border-radius: 8px; +} + +.FileMask +{ + position:absolute; + top: 0px; + left: 0px; + right: 0px; + bottom: 0px; + background-color: darkgrey; + opacity: 0.3; + display: none; +} + +.FileCheckBox +{ + position:absolute; + top: 14px; + left: 14px; + width: 26px; + height: 26px; + border:1px solid grey; + border-radius: 4px; + background-color: white; + display: none; +} + +.FileCheckBox_checked +{ + background-image: url("../img/checkbox.svg"); + background-size: contain; +} + +.FileCheckBox_checked:hover +{ + background-image: url("../img/checkbox_hover.svg"); +} + +.FileTip +{ + position: absolute; + top: 0px; + left: 0px; + width: 100%; + height: 100%; +} + +.FileImg +{ + text-align: center; + background-color: #E4E4E4; + width: 100%; + border-radius: 8px; + line-height: 0px; +} + +.FileImg img +{ + border-radius: 8px; + width: 100%; + aspect-ratio: 4/3; + object-fit: cover; +} + +.FileName +{ + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + word-break: break-all; + line-height: 32px; + font-weight: 700; + padding: 0px 4px; +} + +.FileDate +{ + color: #A8A8A8; + font-size: 10px; + padding: 0px 4px; +} + +#recnet_context_menu +{ + position: absolute; + margin: 0px; + padding: 10px; + border: 0px; + min-width: 100px; + border: 1px solid #D7D7D7; + top: 100px; + border-radius: 5px; + color: #323A3D; + background-color: #fff; + display: none; + z-index: 1; +} + +.CT_Item +{ + padding: 4px 12px; + display: flex; + flex-direction: row; + align-items: center; +} + +.CT_Item:hover +{ + cursor: pointer; + background-color: #0078D4; + border-radius: 4px; + color: #fff; +} + + +.CT_Icon +{ + margin-right: 6px; + width: 16px; + height: 16px; +} + +#CT_Delete_Bar:hover .CT_Delete +{ + background: url("../img/remove2.svg"); + background-repeat: no-repeat; + background-size: contain; +} + +.CT_Delete +{ + background: url("../img/remove.svg"); + background-repeat: no-repeat; + background-size: contain; +} + +#CT_Folder_Bar:hover .CT_Explore +{ + background: url("../img/open_folder2.svg"); + background-repeat: no-repeat; + background-size: contain; +} + +.CT_Explore +{ + background: url("../img/open_folder.svg"); + background-repeat: no-repeat; + background-size: contain; +} + + +.CT_Seperate +{ + border-bottom:1px solid #C5C5C5; +} + +.CT_Text +{ + line-height: 20px; + height: 20px; + display: block; +} \ No newline at end of file diff --git a/resources/web/model/model.js b/resources/web/model/model.js index 30bbdce678..b401bea75b 100644 --- a/resources/web/model/model.js +++ b/resources/web/model/model.js @@ -206,6 +206,12 @@ function ShowModelInfo( pModel ) let sLicence=pModel.license.toUpperCase(); let sModelDesc=decodeURIComponent(pModel.description); + if( pModel.hasOwnProperty('model_id') ) + { + let m_id=pModel['model_id']+''; + UpdateModelID( m_id.trim() ); + } + SendWXDebugInfo("Model Name: "+sModelName); $('#ModelName').html(sModelName); diff --git a/src/OrcaSlicer.cpp b/src/OrcaSlicer.cpp index 1a3b6ca859..b5530bc628 100644 --- a/src/OrcaSlicer.cpp +++ b/src/OrcaSlicer.cpp @@ -80,6 +80,7 @@ using namespace nlohmann; #include "slic3r/GUI/OpenGLManager.hpp" #include "slic3r/GUI/GLCanvas3D.hpp" #include "slic3r/GUI/Camera.hpp" +#include "slic3r/GUI/Plater.hpp" #include #ifdef __WXGTK__ @@ -124,6 +125,7 @@ std::map cli_errors = { {CLI_OBJECT_ARRANGE_FAILED, "An error occurred when auto-arranging object(s)."}, {CLI_OBJECT_ORIENT_FAILED, "An error occurred when auto-orienting object(s)."}, {CLI_MODIFIED_PARAMS_TO_PRINTER, "Found modified parameter in printer preset in the 3mf file, which should not be changed."}, + {CLI_FILE_VERSION_NOT_SUPPORTED, "Unsupported 3MF version. Please make sure the 3MF file was created with the official version of Bambu Studio, not a beta version."}, {CLI_NO_SUITABLE_OBJECTS, "One of the plate is empty or has no object fully inside it. Please check that the 3mf contains no empty plate in Orca Slicer before uploading."}, {CLI_VALIDATE_ERROR, "There are some incorrect slicing parameters in the 3mf. Please verify the slicing of all plates in Orca Slicer before uploading."}, {CLI_OBJECTS_PARTLY_INSIDE, "Some objects are located over the boundary of the heated bed."}, @@ -889,6 +891,8 @@ int CLI::run(int argc, char **argv) // instruct the window manager to fall back to X server mode. ::setenv("GDK_BACKEND", "x11", /* replace */ true); + ::setenv("WEBKIT_DISABLE_COMPOSITING_MODE", "1", /* replace */ false); + // Also on Linux, we need to tell Xlib that we will be using threads, // lest we crash when we fire up GStreamer. XInitThreads(); @@ -1028,7 +1032,7 @@ int CLI::run(int argc, char **argv) int arrange_option; int plate_to_slice = 0, filament_count = 0, duplicate_count = 0, real_duplicate_count = 0; bool first_file = true, is_bbl_3mf = false, need_arrange = true, has_thumbnails = false, up_config_to_date = false, normative_check = true, duplicate_single_object = false, use_first_fila_as_default = false, minimum_save = false, enable_timelapse = false; - bool allow_rotations = true, skip_modified_gcodes = false, avoid_extrusion_cali_region = false; + bool allow_rotations = true, skip_modified_gcodes = false, avoid_extrusion_cali_region = false, skip_useless_pick = false, allow_newer_file = false; Semver file_version; std::map orients_requirement; std::vector project_presets; @@ -1073,6 +1077,14 @@ int CLI::run(int argc, char **argv) if (skip_modified_gcodes_option) skip_modified_gcodes = skip_modified_gcodes_option->value; + ConfigOptionBool* skip_useless_picks_option = m_config.option("skip_useless_pick"); + if (skip_useless_picks_option) + skip_useless_pick = skip_useless_picks_option->value; + + ConfigOptionBool* allow_newer_file_option = m_config.option("allow_newer_file"); + if (allow_newer_file_option) + allow_newer_file = allow_newer_file_option->value; + ConfigOptionBool* avoid_extrusion_cali_region_option = m_config.option("avoid_extrusion_cali_region"); if (avoid_extrusion_cali_region_option) avoid_extrusion_cali_region = avoid_extrusion_cali_region_option->value; @@ -1124,8 +1136,8 @@ int CLI::run(int argc, char **argv) const std::vector clone_objects = m_config.option("clone_objects", true)->values; //when load objects from stl/obj, the total used filaments set std::set used_filament_set; - BOOST_LOG_TRIVIAL(info) << boost::format("allow_multicolor_oneplate %1%, allow_rotations %2% skip_modified_gcodes %3% avoid_extrusion_cali_region %4% loaded_filament_ids size %5%, clone_objects size %6%") - %allow_multicolor_oneplate %allow_rotations %skip_modified_gcodes %avoid_extrusion_cali_region %loaded_filament_ids.size() %clone_objects.size(); + BOOST_LOG_TRIVIAL(info) << boost::format("allow_multicolor_oneplate %1%, allow_rotations %2% skip_modified_gcodes %3% avoid_extrusion_cali_region %4% loaded_filament_ids size %5%, clone_objects size %6%, skip_useless_pick %7%, allow_newer_file %8%") + %allow_multicolor_oneplate %allow_rotations %skip_modified_gcodes %avoid_extrusion_cali_region %loaded_filament_ids.size() %clone_objects.size() %skip_useless_pick %allow_newer_file; if (clone_objects.size() > 0) { if (clone_objects.size() != m_input_files.size()) @@ -1223,6 +1235,12 @@ int CLI::run(int argc, char **argv) BOOST_LOG_TRIVIAL(info) << "object "<name <<", id :" << o->id().id << ", from bbl 3mf\n"; }*/ + Semver cli_ver = *Semver::parse(SLIC3R_VERSION); + if (!allow_newer_file && ((cli_ver.maj() != file_version.maj()) || (cli_ver.min() < file_version.min()))){ + BOOST_LOG_TRIVIAL(error) << boost::format("Version Check: File Version %1% not supported by current cli version %2%")%file_version.to_string() %SLIC3R_VERSION; + record_exit_reson(outfile_dir, CLI_FILE_VERSION_NOT_SUPPORTED, 0, cli_errors[CLI_FILE_VERSION_NOT_SUPPORTED], sliced_info); + flush_and_exit(CLI_FILE_VERSION_NOT_SUPPORTED); + } Semver old_version(1, 5, 9), old_version2(1, 5, 9); if ((file_version < old_version) && !config.empty()) { translate_old = true; @@ -2605,8 +2623,8 @@ int CLI::run(int argc, char **argv) //flush_vol_vector.resize(project_filament_count); //set multiplier to 1? m_print_config.option("flush_multiplier", true)->set(new ConfigOptionFloat(1.f)); - ConfigOption* extra_flush_volume_opt = m_print_config.option("nozzle_volume"); - int extra_flush_volume = extra_flush_volume_opt ? (int)extra_flush_volume_opt->getFloat() : 0; + + const std::vector& min_flush_volumes = Slic3r::GUI::get_min_flush_volumes(); if (filament_is_support->size() != project_filament_count) { @@ -2615,9 +2633,13 @@ int CLI::run(int argc, char **argv) flush_and_exit(CLI_CONFIG_FILE_ERROR); } - BOOST_LOG_TRIVIAL(info) << boost::format("extra_flush_volume: %1%")%extra_flush_volume; - BOOST_LOG_TRIVIAL(info) << boost::format("filament_is_support: %1%")%filament_is_support->serialize(); - BOOST_LOG_TRIVIAL(info) << boost::format("flush_volumes_matrix before computing: %1%")%m_print_config.option("flush_volumes_matrix")->serialize(); + { + std::ostringstream volumes_str; + std::copy(min_flush_volumes.begin(), min_flush_volumes.end(), std::ostream_iterator(volumes_str, ",")); + BOOST_LOG_TRIVIAL(info) << boost::format("extra_flush_volume: %1%") % volumes_str.str(); + BOOST_LOG_TRIVIAL(info) << boost::format("filament_is_support: %1%") % filament_is_support->serialize(); + BOOST_LOG_TRIVIAL(info) << boost::format("flush_volumes_matrix before computing: %1%") % m_print_config.option("flush_volumes_matrix")->serialize(); + } for (int from_idx = 0; from_idx < project_filament_count; from_idx++) { const std::string& from_color = project_filament_colors[from_idx]; unsigned char from_rgb[4] = {}; @@ -2641,7 +2663,7 @@ int CLI::run(int argc, char **argv) //BOOST_LOG_TRIVIAL(info) << boost::format("src_rgba {%1%,%2%,%3%,%4%} dst_rgba {%5%,%6%,%7%,%8%}")%(unsigned int)(from_rgb[0]) %(unsigned int)(from_rgb[1]) %(unsigned int)(from_rgb[2]) %(unsigned int)(from_rgb[3]) // %(unsigned int)(to_rgb[0]) %(unsigned int)(to_rgb[1]) %(unsigned int)(to_rgb[2]) %(unsigned int)(to_rgb[3]); - Slic3r::FlushVolCalculator calculator(extra_flush_volume, Slic3r::g_max_flush_volume); + Slic3r::FlushVolCalculator calculator(min_flush_volumes[from_idx], Slic3r::g_max_flush_volume); flushing_volume = calculator.calc_flush_vol(from_rgb[3], from_rgb[0], from_rgb[1], from_rgb[2], to_rgb[3], to_rgb[0], to_rgb[1], to_rgb[2]); if (is_from_support) { @@ -3540,6 +3562,7 @@ int CLI::run(int argc, char **argv) bool finished_arrange = false, first_run = true; Slic3r::GUI::PartPlate* cur_plate = nullptr; int low_duplicate_count = 0, up_duplicate_count = duplicate_count, arrange_count = 0; + float orig_wipe_x = 0.f, orig_wipe_y = 0.f; if (duplicate_count > 0) { original_model = model; @@ -3566,8 +3589,22 @@ int CLI::run(int argc, char **argv) unprintable.clear(); locked_aps.clear(); } - else + else { first_run = false; + if (plate_to_slice > 0) { + ConfigOptionFloats* wipe_x_option = m_print_config.option("wipe_tower_x"); + ConfigOptionFloats* wipe_y_option = m_print_config.option("wipe_tower_y"); + + if (wipe_x_option && (wipe_x_option->size() > (plate_to_slice-1))) { + orig_wipe_x = wipe_x_option->get_at(plate_to_slice-1); + BOOST_LOG_TRIVIAL(info) << boost::format("%1%, plate_to_slice %2%, orig_wipe_x=%3%")%__LINE__%plate_to_slice%orig_wipe_x; + } + if (wipe_y_option && (wipe_y_option->size() > (plate_to_slice-1))) { + orig_wipe_y = wipe_y_option->get_at(plate_to_slice-1); + BOOST_LOG_TRIVIAL(info) << boost::format("%1%, plate_to_slice %2%, orig_wipe_y=%3%")%__LINE__%plate_to_slice%orig_wipe_y; + } + } + } cur_plate = (Slic3r::GUI::PartPlate *)partplate_list.get_plate(plate_to_slice-1); cur_plate->duplicate_all_instance(duplicate_count, need_skip, skip_maps); @@ -4000,11 +4037,22 @@ int CLI::run(int argc, char **argv) if (duplicate_count == 0) { //restore to the original - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": restore to the original model and plates"); + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": restore to the original model and plates, orig_wipe_x %1%, orig_wipe_y %2%")%orig_wipe_x %orig_wipe_y; finished_arrange = true; model = original_model; partplate_list.load_from_3mf_structure(plate_data_src); partplate_list.reset_size(current_printable_width, current_printable_depth, current_printable_height, true, true); + if ((orig_wipe_x > 0.f) && (orig_wipe_y > 0.f)) + { + ConfigOptionFloat wt_x_opt(orig_wipe_x); + ConfigOptionFloat wt_y_opt(orig_wipe_y); + ConfigOptionFloats* wipe_x_option = m_print_config.option("wipe_tower_x", true); + ConfigOptionFloats* wipe_y_option = m_print_config.option("wipe_tower_y", true); + + wipe_x_option->set_at(&wt_x_opt, plate_to_slice-1, 0); + wipe_y_option->set_at(&wt_y_opt, plate_to_slice-1, 0); + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": restore wipe_tower position to {%1%, %2%}")%orig_wipe_x %orig_wipe_y; + } BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": exit arrange process"); } continue; @@ -4013,7 +4061,7 @@ int CLI::run(int argc, char **argv) if (duplicate_single_object) { if (real_duplicate_count <= 1) { - BOOST_LOG_TRIVIAL(warning) << "no object can be placed under single object mode, restore to the original model and plates also" << std::endl; + BOOST_LOG_TRIVIAL(warning) << boost::format("no object can be placed under single object mode, restore to the original model and plates also, orig_wipe_x %1%, orig_wipe_y %2%")%orig_wipe_x %orig_wipe_y; //record_exit_reson(outfile_dir, CLI_OBJECT_ARRANGE_FAILED, 0, cli_errors[CLI_OBJECT_ARRANGE_FAILED], sliced_info); //flush_and_exit(CLI_OBJECT_ARRANGE_FAILED); finished_arrange = true; @@ -4021,6 +4069,17 @@ int CLI::run(int argc, char **argv) partplate_list.load_from_3mf_structure(plate_data_src); partplate_list.reset_size(current_printable_width, current_printable_depth, current_printable_height, true, true); duplicate_count = 0; + if ((orig_wipe_x > 0.f) && (orig_wipe_y > 0.f)) + { + ConfigOptionFloat wt_x_opt(orig_wipe_x); + ConfigOptionFloat wt_y_opt(orig_wipe_y); + ConfigOptionFloats* wipe_x_option = m_print_config.option("wipe_tower_x", true); + ConfigOptionFloats* wipe_y_option = m_print_config.option("wipe_tower_y", true); + + wipe_x_option->set_at(&wt_x_opt, plate_to_slice-1, 0); + wipe_y_option->set_at(&wt_y_opt, plate_to_slice-1, 0); + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": restore wipe_tower position to {%1%, %2%}")%orig_wipe_x %orig_wipe_y; + } BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": exit arrange process"); continue; } diff --git a/src/admesh/stl.h b/src/admesh/stl.h index 2593777969..0f1a0cec88 100644 --- a/src/admesh/stl.h +++ b/src/admesh/stl.h @@ -45,7 +45,7 @@ typedef Eigen::Matrix stl_triangle_vertex_indices static_assert(sizeof(stl_vertex) == 12, "size of stl_vertex incorrect"); static_assert(sizeof(stl_normal) == 12, "size of stl_normal incorrect"); -typedef std::function ImportstlProgressFn; +typedef std::function ImportstlProgressFn; typedef enum { eNormal, // normal face @@ -98,8 +98,12 @@ struct stl_neighbors { }; struct stl_stats { - stl_stats() { memset(&header, 0, 81); } - char header[81]; + stl_stats() {} + void reset_header(int size) { + header.clear(); + header.resize(size +1); + } + std::vector header; stl_type type = (stl_type)0; // Should always match the number of facets stored inside stl_file::facet_start. uint32_t number_of_facets = 0; @@ -247,7 +251,7 @@ struct indexed_triangle_set } }; -extern bool stl_open(stl_file *stl, const char *file, ImportstlProgressFn stlFn = nullptr); +extern bool stl_open(stl_file *stl, const char *file, ImportstlProgressFn stlFn = nullptr,int custom_header_length = 80); extern void stl_stats_out(stl_file *stl, FILE *file, char *input_file); extern bool stl_print_neighbors(stl_file *stl, char *file); extern bool stl_write_ascii(stl_file *stl, const char *file, const char *label); diff --git a/src/admesh/stl_io.cpp b/src/admesh/stl_io.cpp index 26f5dc3212..221572bca6 100644 --- a/src/admesh/stl_io.cpp +++ b/src/admesh/stl_io.cpp @@ -41,7 +41,7 @@ void stl_stats_out(stl_file *stl, FILE *file, char *input_file) fprintf(file, "File type : Binary STL file\n"); else fprintf(file, "File type : ASCII STL file\n"); - fprintf(file, "Header : %s\n", stl->stats.header); + fprintf(file, "Header : %s\n", stl->stats.header.data()); fprintf(file, "============== Size ==============\n"); fprintf(file, "Min X = % f, Max X = % f\n", stl->stats.min(0), stl->stats.max(0)); fprintf(file, "Min Y = % f, Max Y = % f\n", stl->stats.min(1), stl->stats.max(1)); diff --git a/src/admesh/stlinit.cpp b/src/admesh/stlinit.cpp index ec044f87e5..8196bf10cb 100644 --- a/src/admesh/stlinit.cpp +++ b/src/admesh/stlinit.cpp @@ -45,8 +45,9 @@ extern void stl_internal_reverse_quads(char *buf, size_t cnt); const int LOAD_STL_UNIT_NUM = 5; static std::string model_id = ""; +static std::string country_code = ""; -static FILE* stl_open_count_facets(stl_file *stl, const char *file) +static FILE *stl_open_count_facets(stl_file *stl, const char *file, unsigned int custom_header_length) { // Open the file in binary mode first. FILE *fp = boost::nowide::fopen(file, "rb"); @@ -59,7 +60,8 @@ static FILE* stl_open_count_facets(stl_file *stl, const char *file) long file_size = ftell(fp); // Check for binary or ASCII file. - fseek(fp, HEADER_SIZE, SEEK_SET); + int header_size = custom_header_length + NUM_FACET_SIZE; + fseek(fp, header_size, SEEK_SET); unsigned char chtest[128]; if (! fread(chtest, sizeof(chtest), 1, fp)) { BOOST_LOG_TRIVIAL(error) << "stl_open_count_facets: The input is an empty file: " << file; @@ -81,16 +83,16 @@ static FILE* stl_open_count_facets(stl_file *stl, const char *file) // If the .STL file is binary, then do the following: if (stl->stats.type == binary) { // Test if the STL file has the right size. - if (((file_size - HEADER_SIZE) % SIZEOF_STL_FACET != 0) || (file_size < STL_MIN_FILE_SIZE)) { + if (((file_size - header_size) % SIZEOF_STL_FACET != 0) || (file_size < STL_MIN_FILE_SIZE)) { BOOST_LOG_TRIVIAL(error) << "stl_open_count_facets: The file " << file << " has the wrong size."; fclose(fp); return nullptr; } - num_facets = (file_size - HEADER_SIZE) / SIZEOF_STL_FACET; + num_facets = (file_size - header_size) / SIZEOF_STL_FACET; // Read the header. - if (fread(stl->stats.header, LABEL_SIZE, 1, fp) > 79) - stl->stats.header[80] = '\0'; + if (fread(stl->stats.header.data(), custom_header_length, 1, fp) > custom_header_length -1) + stl->stats.header[custom_header_length] = '\0'; // Read the int following the header. This should contain # of facets. uint32_t header_num_facets; @@ -134,9 +136,9 @@ static FILE* stl_open_count_facets(stl_file *stl, const char *file) // Get the header. int i = 0; - for (; i < 80 && (stl->stats.header[i] = getc(fp)) != '\n'; ++ i) ; + for (; i < custom_header_length && (stl->stats.header[i] = getc(fp)) != '\n'; ++ i) ; stl->stats.header[i] = '\0'; // Lose the '\n' - stl->stats.header[80] = '\0'; + stl->stats.header[custom_header_length] = '\0'; num_facets = num_lines / ASCII_LINES_PER_FACET; } @@ -149,10 +151,13 @@ static FILE* stl_open_count_facets(stl_file *stl, const char *file) /* Reads the contents of the file pointed to by fp into the stl structure, starting at facet first_facet. The second argument says if it's our first time running this for the stl and therefore we should reset our max and min stats. */ -static bool stl_read(stl_file *stl, FILE *fp, int first_facet, bool first, ImportstlProgressFn stlFn) +static bool stl_read(stl_file *stl, FILE *fp, int first_facet, bool first, ImportstlProgressFn stlFn, int custom_header_length) { if (stl->stats.type == binary) { - fseek(fp, HEADER_SIZE, SEEK_SET); + int header_size = custom_header_length + NUM_FACET_SIZE; + fseek(fp, header_size, SEEK_SET); + model_id = ""; + country_code = ""; } else { rewind(fp); @@ -165,18 +170,22 @@ static bool stl_read(stl_file *stl, FILE *fp, int first_facet, bool first, Impor // Extract the value after "MW" char version_str[16]; char model_id_str[128]; - int num_values = sscanf(mw_position + 3, "%s %s", version_str, model_id_str); - if (num_values == 2) { + char country_code_str[16]; + int num_values = sscanf(mw_position + 3, "%s %s %s", version_str, model_id_str, country_code_str); + if (num_values == 3) { if (strcmp(version_str, "1.0") == 0) { model_id = model_id_str; + country_code = country_code_str; } } else { model_id = ""; + country_code = ""; } } else { model_id = ""; // No MW format found + country_code = ""; } } } @@ -195,7 +204,7 @@ static bool stl_read(stl_file *stl, FILE *fp, int first_facet, bool first, Impor if ((i % unit) == 0) { bool cb_cancel = false; if (stlFn) { - stlFn(i, facets_num, cb_cancel, model_id); + stlFn(i, facets_num, cb_cancel, model_id, country_code); if (cb_cancel) return false; } @@ -293,20 +302,24 @@ static bool stl_read(stl_file *stl, FILE *fp, int first_facet, bool first, Impor return true; } -bool stl_open(stl_file *stl, const char *file, ImportstlProgressFn stlFn) +bool stl_open(stl_file *stl, const char *file, ImportstlProgressFn stlFn, int custom_header_length) { + if (custom_header_length < LABEL_SIZE) { + custom_header_length = LABEL_SIZE; + } Slic3r::CNumericLocalesSetter locales_setter; stl->clear(); - FILE *fp = stl_open_count_facets(stl, file); + stl->stats.reset_header(custom_header_length); + FILE *fp = stl_open_count_facets(stl, file, custom_header_length); if (fp == nullptr) return false; stl_allocate(stl); - bool result = stl_read(stl, fp, 0, true, stlFn); + bool result = stl_read(stl, fp, 0, true, stlFn, custom_header_length); fclose(fp); return result; } -void stl_allocate(stl_file *stl) +void stl_allocate(stl_file *stl) { // Allocate memory for the entire .STL file. stl->facet_start.assign(stl->stats.number_of_facets, stl_facet()); @@ -314,7 +327,7 @@ void stl_allocate(stl_file *stl) stl->neighbors_start.assign(stl->stats.number_of_facets, stl_neighbors()); } -void stl_reallocate(stl_file *stl) +void stl_reallocate(stl_file *stl) { stl->facet_start.resize(stl->stats.number_of_facets); stl->neighbors_start.resize(stl->stats.number_of_facets); diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index bec3f3c9ae..9e9b56e9d8 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -279,6 +279,10 @@ void AppConfig::set_defaults() set_bool("remember_printer_config", true); } + if (get("auto_calculate_when_filament_change").empty()){ + set_bool("auto_calculate_when_filament_change", true); + } + if (get("show_home_page").empty()) { set_bool("show_home_page", true); } @@ -562,6 +566,8 @@ std::string AppConfig::load() cali_info.cali_finished = bool(calis_j["cali_finished"].get()); if (calis_j.contains("flow_ratio")) cali_info.cache_flow_ratio = calis_j["flow_ratio"].get(); + if (calis_j.contains("cache_flow_rate_calibration_type")) + cali_info.cache_flow_rate_calibration_type = static_cast(calis_j["cache_flow_rate_calibration_type"].get()); if (calis_j.contains("presets")) { cali_info.selected_presets.clear(); for (auto cali_it = calis_j["presets"].begin(); cali_it != calis_j["presets"].end(); cali_it++) { @@ -684,6 +690,7 @@ void AppConfig::save() cali_json["dev_id"] = cali_info.dev_id; cali_json["flow_ratio"] = cali_info.cache_flow_ratio; cali_json["cali_finished"] = cali_info.cali_finished ? 1 : 0; + cali_json["cache_flow_rate_calibration_type"] = static_cast(cali_info.cache_flow_rate_calibration_type); for (auto filament_preset : cali_info.selected_presets) { json preset_json; preset_json["tray_id"] = filament_preset.tray_id; @@ -1036,6 +1043,7 @@ void AppConfig::save_printer_cali_infos(const PrinterCaliInfo &cali_info, bool n } (*iter).cache_flow_ratio = cali_info.cache_flow_ratio; (*iter).selected_presets = cali_info.selected_presets; + (*iter).cache_flow_rate_calibration_type = cali_info.cache_flow_rate_calibration_type; } m_dirty = true; } diff --git a/src/libslic3r/Arachne/SkeletalTrapezoidation.cpp b/src/libslic3r/Arachne/SkeletalTrapezoidation.cpp index b7e0ea61e9..5d085f333b 100644 --- a/src/libslic3r/Arachne/SkeletalTrapezoidation.cpp +++ b/src/libslic3r/Arachne/SkeletalTrapezoidation.cpp @@ -10,37 +10,17 @@ #include #include -#include "utils/VoronoiUtils.hpp" - #include "utils/linearAlg2D.hpp" #include "Utils.hpp" #include "SVG.hpp" #include "Geometry/VoronoiVisualUtils.hpp" #include "Geometry/VoronoiUtilsCgal.hpp" #include "../EdgeGrid.hpp" -#include "ankerl/unordered_dense.h" + +#include "Geometry/VoronoiUtils.hpp" #define SKELETAL_TRAPEZOIDATION_BEAD_SEARCH_MAX 1000 //A limit to how long it'll keep searching for adjacent beads. Increasing will re-use beadings more often (saving performance), but search longer for beading (costing performance). -namespace boost::polygon { - -template<> struct geometry_concept -{ - typedef segment_concept type; -}; - -template<> struct segment_traits -{ - typedef coord_t coordinate_type; - typedef Slic3r::Point point_type; - static inline point_type get(const Slic3r::Arachne::PolygonsSegmentIndex &CSegment, direction_1d dir) - { - return dir.to_int() ? CSegment.p() : CSegment.next().p(); - } -}; - -} // namespace boost::polygon - namespace Slic3r::Arachne { @@ -109,8 +89,7 @@ static void export_graph_to_svg(const std::string } #endif -SkeletalTrapezoidation::node_t& SkeletalTrapezoidation::makeNode(vd_t::vertex_type& vd_node, Point p) -{ +SkeletalTrapezoidation::node_t &SkeletalTrapezoidation::makeNode(const VD::vertex_type &vd_node, Point p) { auto he_node_it = vd_node_to_he_node.find(&vd_node); if (he_node_it == vd_node_to_he_node.end()) { @@ -125,8 +104,7 @@ SkeletalTrapezoidation::node_t& SkeletalTrapezoidation::makeNode(vd_t::vertex_ty } } -void SkeletalTrapezoidation::transferEdge(Point from, Point to, vd_t::edge_type& vd_edge, edge_t*& prev_edge, Point& start_source_point, Point& end_source_point, const std::vector& segments) -{ +void SkeletalTrapezoidation::transferEdge(Point from, Point to, const VD::edge_type &vd_edge, edge_t *&prev_edge, Point &start_source_point, Point &end_source_point, const std::vector &segments) { auto he_edge_it = vd_edge_to_he_edge.find(vd_edge.twin()); if (he_edge_it != vd_edge_to_he_edge.end()) { // Twin segment(s) have already been made @@ -181,7 +159,7 @@ void SkeletalTrapezoidation::transferEdge(Point from, Point to, vd_t::edge_type& } else { - std::vector discretized = discretize(vd_edge, segments); + Points discretized = discretize(vd_edge, segments); assert(discretized.size() >= 2); if(discretized.size() < 2) { @@ -236,45 +214,42 @@ void SkeletalTrapezoidation::transferEdge(Point from, Point to, vd_t::edge_type& } } -std::vector SkeletalTrapezoidation::discretize(const vd_t::edge_type& vd_edge, const std::vector& segments) +Points SkeletalTrapezoidation::discretize(const VD::edge_type& vd_edge, const std::vector& segments) { + assert(Geometry::VoronoiUtils::is_in_range(vd_edge)); + /*Terminology in this function assumes that the edge moves horizontally from left to right. This is not necessarily the case; the edge can go in any direction, but it helps to picture it in a certain direction in your head.*/ - const vd_t::cell_type* left_cell = vd_edge.cell(); - const vd_t::cell_type* right_cell = vd_edge.twin()->cell(); + const VD::cell_type *left_cell = vd_edge.cell(); + const VD::cell_type *right_cell = vd_edge.twin()->cell(); - assert(VoronoiUtils::p(vd_edge.vertex0()).x() <= std::numeric_limits::max() && VoronoiUtils::p(vd_edge.vertex0()).x() >= std::numeric_limits::lowest()); - assert(VoronoiUtils::p(vd_edge.vertex0()).y() <= std::numeric_limits::max() && VoronoiUtils::p(vd_edge.vertex0()).y() >= std::numeric_limits::lowest()); - assert(VoronoiUtils::p(vd_edge.vertex1()).x() <= std::numeric_limits::max() && VoronoiUtils::p(vd_edge.vertex1()).x() >= std::numeric_limits::lowest()); - assert(VoronoiUtils::p(vd_edge.vertex1()).y() <= std::numeric_limits::max() && VoronoiUtils::p(vd_edge.vertex1()).y() >= std::numeric_limits::lowest()); + Point start = Geometry::VoronoiUtils::to_point(vd_edge.vertex0()).cast(); + Point end = Geometry::VoronoiUtils::to_point(vd_edge.vertex1()).cast(); - Point start = VoronoiUtils::p(vd_edge.vertex0()).cast(); - Point end = VoronoiUtils::p(vd_edge.vertex1()).cast(); - bool point_left = left_cell->contains_point(); bool point_right = right_cell->contains_point(); if ((!point_left && !point_right) || vd_edge.is_secondary()) // Source vert is directly connected to source segment { - return std::vector({ start, end }); + return Points({ start, end }); } else if (point_left != point_right) //This is a parabolic edge between a point and a line. { - Point p = VoronoiUtils::getSourcePoint(*(point_left ? left_cell : right_cell), segments); - const Segment& s = VoronoiUtils::getSourceSegment(*(point_left ? right_cell : left_cell), segments); - return VoronoiUtils::discretizeParabola(p, s, start, end, discretization_step_size, transitioning_angle); + Point p = Geometry::VoronoiUtils::get_source_point(*(point_left ? left_cell : right_cell), segments.begin(), segments.end()); + const Segment& s = Geometry::VoronoiUtils::get_source_segment(*(point_left ? right_cell : left_cell), segments.begin(), segments.end()); + return Geometry::VoronoiUtils::discretize_parabola(p, s, start, end, discretization_step_size, transitioning_angle); } else //This is a straight edge between two points. { /*While the edge is straight, it is still discretized since the part becomes narrower between the two points. As such it may need different beadings along the way.*/ - Point left_point = VoronoiUtils::getSourcePoint(*left_cell, segments); - Point right_point = VoronoiUtils::getSourcePoint(*right_cell, segments); - coord_t d = (right_point - left_point).cast().norm(); - Point middle = (left_point + right_point) / 2; - Point x_axis_dir = Point(right_point - left_point).rotate_90_degree_ccw(); + Point left_point = Geometry::VoronoiUtils::get_source_point(*left_cell, segments.begin(), segments.end()); + Point right_point = Geometry::VoronoiUtils::get_source_point(*right_cell, segments.begin(), segments.end()); + coord_t d = (right_point - left_point).cast().norm(); + Point middle = (left_point + right_point) / 2; + Point x_axis_dir = perp(Point(right_point - left_point)); coord_t x_axis_length = x_axis_dir.cast().norm(); const auto projected_x = [x_axis_dir, x_axis_length, middle](Point from) //Project a point on the edge. @@ -311,7 +286,7 @@ std::vector SkeletalTrapezoidation::discretize(const vd_t::edge_type& vd_ //Start generating points along the edge. Point a = start; Point b = end; - std::vector ret; + Points ret; ret.emplace_back(a); //Introduce an extra edge at the borders of the markings? @@ -351,8 +326,7 @@ std::vector SkeletalTrapezoidation::discretize(const vd_t::edge_type& vd_ } } -bool SkeletalTrapezoidation::computePointCellRange(vd_t::cell_type& cell, Point& start_source_point, Point& end_source_point, vd_t::edge_type*& starting_vd_edge, vd_t::edge_type*& ending_vd_edge, const std::vector& segments) -{ +bool SkeletalTrapezoidation::computePointCellRange(const VD::cell_type &cell, Point &start_source_point, Point &end_source_point, const VD::edge_type *&starting_vd_edge, const VD::edge_type *&ending_vd_edge, const std::vector &segments) { if (cell.incident_edge()->is_infinite()) return false; //Infinite edges only occur outside of the polygon. Don't copy any part of this cell. @@ -360,16 +334,16 @@ bool SkeletalTrapezoidation::computePointCellRange(vd_t::cell_type& cell, Point& // Copy whole cell into graph or not at all // If the cell.incident_edge()->vertex0() is far away so much that it doesn't even fit into Vec2i64, then there is no way that it will be inside the input polygon. - if (const vd_t::vertex_type &vert = *cell.incident_edge()->vertex0(); + if (const VD::vertex_type &vert = *cell.incident_edge()->vertex0(); vert.x() >= double(std::numeric_limits::max()) || vert.x() <= double(std::numeric_limits::lowest()) || vert.y() >= double(std::numeric_limits::max()) || vert.y() <= double(std::numeric_limits::lowest())) return false; // Don't copy any part of this cell - const Point source_point = VoronoiUtils::getSourcePoint(cell, segments); - const PolygonsPointIndex source_point_index = VoronoiUtils::getSourcePointIndex(cell, segments); - Vec2i64 some_point = VoronoiUtils::p(cell.incident_edge()->vertex0()); + const Point source_point = Geometry::VoronoiUtils::get_source_point(cell, segments.begin(), segments.end()); + const PolygonsPointIndex source_point_index = Geometry::VoronoiUtils::get_source_point_index(cell, segments.begin(), segments.end()); + Vec2i64 some_point = Geometry::VoronoiUtils::to_point(cell.incident_edge()->vertex0()); if (some_point == source_point.cast()) - some_point = VoronoiUtils::p(cell.incident_edge()->vertex1()); + some_point = Geometry::VoronoiUtils::to_point(cell.incident_edge()->vertex1()); //Test if the some_point is even inside the polygon. //The edge leading out of a polygon must have an endpoint that's not in the corner following the contour of the polygon at that vertex. @@ -378,16 +352,16 @@ bool SkeletalTrapezoidation::computePointCellRange(vd_t::cell_type& cell, Point& if (!LinearAlg2D::isInsideCorner(source_point_index.prev().p(), source_point_index.p(), source_point_index.next().p(), some_point)) return false; // Don't copy any part of this cell - vd_t::edge_type* vd_edge = cell.incident_edge(); + const VD::edge_type* vd_edge = cell.incident_edge(); do { assert(vd_edge->is_finite()); - if (Vec2i64 p1 = VoronoiUtils::p(vd_edge->vertex1()); p1 == source_point.cast()) { + if (Vec2i64 p1 = Geometry::VoronoiUtils::to_point(vd_edge->vertex1()); p1 == source_point.cast()) { start_source_point = source_point; end_source_point = source_point; starting_vd_edge = vd_edge->next(); ending_vd_edge = vd_edge; } else { - assert((VoronoiUtils::p(vd_edge->vertex0()) == source_point.cast() || !vd_edge->is_secondary()) && "point cells must end in the point! They cannot cross the point with an edge, because collinear edges are not allowed in the input."); + assert((Geometry::VoronoiUtils::to_point(vd_edge->vertex0()) == source_point.cast() || !vd_edge->is_secondary()) && "point cells must end in the point! They cannot cross the point with an edge, because collinear edges are not allowed in the input."); } } while (vd_edge = vd_edge->next(), vd_edge != cell.incident_edge()); @@ -396,47 +370,6 @@ bool SkeletalTrapezoidation::computePointCellRange(vd_t::cell_type& cell, Point& return true; } -void SkeletalTrapezoidation::computeSegmentCellRange(vd_t::cell_type& cell, Point& start_source_point, Point& end_source_point, vd_t::edge_type*& starting_vd_edge, vd_t::edge_type*& ending_vd_edge, const std::vector& segments) -{ - const Segment &source_segment = VoronoiUtils::getSourceSegment(cell, segments); - const Point from = source_segment.from(); - const Point to = source_segment.to(); - - // Find starting edge - // Find end edge - bool seen_possible_start = false; - bool after_start = false; - bool ending_edge_is_set_before_start = false; - vd_t::edge_type* edge = cell.incident_edge(); - do { - if (edge->is_infinite()) - continue; - - Vec2i64 v0 = VoronoiUtils::p(edge->vertex0()); - Vec2i64 v1 = VoronoiUtils::p(edge->vertex1()); - - assert(!(v0 == to.cast() && v1 == from.cast() )); - if (v0 == to.cast() && !after_start) { // Use the last edge which starts in source_segment.to - starting_vd_edge = edge; - seen_possible_start = true; - } - else if (seen_possible_start) { - after_start = true; - } - - if (v1 == from.cast() && (!ending_vd_edge || ending_edge_is_set_before_start)) { - ending_edge_is_set_before_start = !after_start; - ending_vd_edge = edge; - } - } while (edge = edge->next(), edge != cell.incident_edge()); - - assert(starting_vd_edge && ending_vd_edge); - assert(starting_vd_edge != ending_vd_edge); - - start_source_point = source_segment.to(); - end_source_point = source_segment.from(); -} - SkeletalTrapezoidation::SkeletalTrapezoidation(const Polygons& polys, const BeadingStrategy& beading_strategy, double transitioning_angle, coord_t discretization_step_size, coord_t transition_filter_dist, coord_t allowed_filter_deviation, @@ -451,128 +384,6 @@ SkeletalTrapezoidation::SkeletalTrapezoidation(const Polygons& polys, const Bead constructFromPolygons(polys); } -static bool has_finite_edge_with_non_finite_vertex(const Geometry::VoronoiDiagram &voronoi_diagram) -{ - for (const VoronoiUtils::vd_t::edge_type &edge : voronoi_diagram.edges()) { - if (edge.is_finite()) { - assert(edge.vertex0() != nullptr && edge.vertex1() != nullptr); - if (edge.vertex0() == nullptr || edge.vertex1() == nullptr || !VoronoiUtils::is_finite(*edge.vertex0()) || - !VoronoiUtils::is_finite(*edge.vertex1())) - return true; - } - } - return false; -} - -static bool detect_missing_voronoi_vertex(const Geometry::VoronoiDiagram &voronoi_diagram, const std::vector &segments) { - if (has_finite_edge_with_non_finite_vertex(voronoi_diagram)) - return true; - - for (VoronoiUtils::vd_t::cell_type cell : voronoi_diagram.cells()) { - if (!cell.incident_edge()) - continue; // There is no spoon - - if (cell.contains_segment()) { - const SkeletalTrapezoidation::Segment &source_segment = VoronoiUtils::getSourceSegment(cell, segments); - const Point from = source_segment.from(); - const Point to = source_segment.to(); - - // Find starting edge - // Find end edge - bool seen_possible_start = false; - bool after_start = false; - bool ending_edge_is_set_before_start = false; - VoronoiUtils::vd_t::edge_type *starting_vd_edge = nullptr; - VoronoiUtils::vd_t::edge_type *ending_vd_edge = nullptr; - VoronoiUtils::vd_t::edge_type *edge = cell.incident_edge(); - do { - if (edge->is_infinite() || edge->vertex0() == nullptr || edge->vertex1() == nullptr || !VoronoiUtils::is_finite(*edge->vertex0()) || !VoronoiUtils::is_finite(*edge->vertex1())) - continue; - - Vec2i64 v0 = VoronoiUtils::p(edge->vertex0()); - Vec2i64 v1 = VoronoiUtils::p(edge->vertex1()); - - assert(!(v0 == to.cast() && v1 == from.cast())); - if (v0 == to.cast() && !after_start) { // Use the last edge which starts in source_segment.to - starting_vd_edge = edge; - seen_possible_start = true; - } else if (seen_possible_start) { - after_start = true; - } - - if (v1 == from.cast() && (!ending_vd_edge || ending_edge_is_set_before_start)) { - ending_edge_is_set_before_start = !after_start; - ending_vd_edge = edge; - } - } while (edge = edge->next(), edge != cell.incident_edge()); - - if (!starting_vd_edge || !ending_vd_edge || starting_vd_edge == ending_vd_edge) - return true; - } - } - - return false; -} - -static bool has_missing_twin_edge(const SkeletalTrapezoidationGraph &graph) -{ - for (const auto &edge : graph.edges) - if (edge.twin == nullptr) - return true; - return false; -} - -inline static ankerl::unordered_dense::map try_to_fix_degenerated_voronoi_diagram_by_rotation( - Geometry::VoronoiDiagram &voronoi_diagram, - const Polygons &polys, - Polygons &polys_rotated, - std::vector &segments, - const double fix_angle) -{ - ankerl::unordered_dense::map vertex_mapping; - for (Polygon &poly : polys_rotated) - poly.rotate(fix_angle); - - assert(polys_rotated.size() == polys.size()); - for (size_t poly_idx = 0; poly_idx < polys.size(); ++poly_idx) { - assert(polys_rotated[poly_idx].size() == polys[poly_idx].size()); - for (size_t point_idx = 0; point_idx < polys[poly_idx].size(); ++point_idx) - vertex_mapping.insert({polys_rotated[poly_idx][point_idx], polys[poly_idx][point_idx]}); - } - - segments.clear(); - for (size_t poly_idx = 0; poly_idx < polys_rotated.size(); poly_idx++) - for (size_t point_idx = 0; point_idx < polys_rotated[poly_idx].size(); point_idx++) - segments.emplace_back(&polys_rotated, poly_idx, point_idx); - - voronoi_diagram.clear(); - construct_voronoi(segments.begin(), segments.end(), &voronoi_diagram); - -#ifdef ARACHNE_DEBUG_VORONOI - { - static int iRun = 0; - dump_voronoi_to_svg(debug_out_path("arachne_voronoi-diagram-rotated-%d.svg", iRun++).c_str(), voronoi_diagram, to_points(polys), to_lines(polys)); - } -#endif - - assert(Geometry::VoronoiUtilsCgal::is_voronoi_diagram_planar_intersection(voronoi_diagram)); - - return vertex_mapping; -} - -inline static void rotate_back_skeletal_trapezoidation_graph_after_fix(SkeletalTrapezoidationGraph &graph, - const double fix_angle, - const ankerl::unordered_dense::map &vertex_mapping) -{ - for (STHalfEdgeNode &node : graph.nodes) { - // If a mapping exists between a rotated point and an original point, use this mapping. Otherwise, rotate a point in the opposite direction. - if (auto node_it = vertex_mapping.find(node.p); node_it != vertex_mapping.end()) - node.p = node_it->second; - else - node.p.rotate(-fix_angle); - } -} - void SkeletalTrapezoidation::constructFromPolygons(const Polygons& polys) { #ifdef ARACHNE_DEBUG @@ -604,8 +415,8 @@ void SkeletalTrapezoidation::constructFromPolygons(const Polygons& polys) } #endif - Geometry::VoronoiDiagram voronoi_diagram; - construct_voronoi(segments.begin(), segments.end(), &voronoi_diagram); + VD voronoi_diagram; + voronoi_diagram.construct_voronoi(segments.cbegin(), segments.cend()); #ifdef ARACHNE_DEBUG_VORONOI { @@ -614,126 +425,59 @@ void SkeletalTrapezoidation::constructFromPolygons(const Polygons& polys) } #endif - // Try to detect cases when some Voronoi vertex is missing and when - // the Voronoi diagram is not planar. - // When any Voronoi vertex is missing, or the Voronoi diagram is not - // planar, rotate the input polygon and try again. - const bool has_missing_voronoi_vertex = detect_missing_voronoi_vertex(voronoi_diagram, segments); - // Detection of non-planar Voronoi diagram detects at least GH issues #8474, #8514 and #8446. - const bool is_voronoi_diagram_planar = Geometry::VoronoiUtilsCgal::is_voronoi_diagram_planar_angle(voronoi_diagram); - const double fix_angle = PI / 6; - - ankerl::unordered_dense::map vertex_mapping; - // polys_copy is referenced through items stored in the std::vector segments. - Polygons polys_copy = polys; - if (has_missing_voronoi_vertex || !is_voronoi_diagram_planar) { - if (has_missing_voronoi_vertex) - BOOST_LOG_TRIVIAL(warning) << "Detected missing Voronoi vertex, input polygons will be rotated back and forth."; - else if (!is_voronoi_diagram_planar) - BOOST_LOG_TRIVIAL(warning) << "Detected non-planar Voronoi diagram, input polygons will be rotated back and forth."; - - vertex_mapping = try_to_fix_degenerated_voronoi_diagram_by_rotation(voronoi_diagram, polys, polys_copy, segments, fix_angle); - - assert(!detect_missing_voronoi_vertex(voronoi_diagram, segments)); - assert(Geometry::VoronoiUtilsCgal::is_voronoi_diagram_planar_angle(voronoi_diagram)); - if (detect_missing_voronoi_vertex(voronoi_diagram, segments)) - BOOST_LOG_TRIVIAL(error) << "Detected missing Voronoi vertex even after the rotation of input."; - else if (!Geometry::VoronoiUtilsCgal::is_voronoi_diagram_planar_angle(voronoi_diagram)) - BOOST_LOG_TRIVIAL(error) << "Detected non-planar Voronoi diagram even after the rotation of input."; - } - - bool degenerated_voronoi_diagram = has_missing_voronoi_vertex || !is_voronoi_diagram_planar; - -process_voronoi_diagram: assert(this->graph.edges.empty() && this->graph.nodes.empty() && this->vd_edge_to_he_edge.empty() && this->vd_node_to_he_node.empty()); - for (vd_t::cell_type cell : voronoi_diagram.cells()) { + for (const VD::cell_type &cell : voronoi_diagram.cells()) { if (!cell.incident_edge()) continue; // There is no spoon - Point start_source_point; - Point end_source_point; - vd_t::edge_type* starting_vonoroi_edge = nullptr; - vd_t::edge_type* ending_vonoroi_edge = nullptr; + Point start_source_point; + Point end_source_point; + const VD::edge_type *starting_voronoi_edge = nullptr; + const VD::edge_type *ending_voronoi_edge = nullptr; // Compute and store result in above variables - + if (cell.contains_point()) { - const bool keep_going = computePointCellRange(cell, start_source_point, end_source_point, starting_vonoroi_edge, ending_vonoroi_edge, segments); + const bool keep_going = computePointCellRange(cell, start_source_point, end_source_point, starting_voronoi_edge, ending_voronoi_edge, segments); if (!keep_going) continue; } else { assert(cell.contains_segment()); - computeSegmentCellRange(cell, start_source_point, end_source_point, starting_vonoroi_edge, ending_vonoroi_edge, segments); + Geometry::SegmentCellRange cell_range = Geometry::VoronoiUtils::compute_segment_cell_range(cell, segments.cbegin(), segments.cend()); + assert(cell_range.is_valid()); + start_source_point = cell_range.segment_start_point; + end_source_point = cell_range.segment_end_point; + starting_voronoi_edge = cell_range.edge_begin; + ending_voronoi_edge = cell_range.edge_end; } - - if (!starting_vonoroi_edge || !ending_vonoroi_edge) { + + if (!starting_voronoi_edge || !ending_voronoi_edge) { assert(false && "Each cell should start / end in a polygon vertex"); continue; } - + // Copy start to end edge to graph - edge_t* prev_edge = nullptr; - assert(VoronoiUtils::p(starting_vonoroi_edge->vertex1()).x() <= std::numeric_limits::max() && VoronoiUtils::p(starting_vonoroi_edge->vertex1()).x() >= std::numeric_limits::lowest()); - assert(VoronoiUtils::p(starting_vonoroi_edge->vertex1()).y() <= std::numeric_limits::max() && VoronoiUtils::p(starting_vonoroi_edge->vertex1()).y() >= std::numeric_limits::lowest()); - transferEdge(start_source_point, VoronoiUtils::p(starting_vonoroi_edge->vertex1()).cast(), *starting_vonoroi_edge, prev_edge, start_source_point, end_source_point, segments); - node_t* starting_node = vd_node_to_he_node[starting_vonoroi_edge->vertex0()]; + assert(Geometry::VoronoiUtils::is_in_range(*starting_voronoi_edge)); + edge_t *prev_edge = nullptr; + transferEdge(start_source_point, Geometry::VoronoiUtils::to_point(starting_voronoi_edge->vertex1()).cast(), *starting_voronoi_edge, prev_edge, start_source_point, end_source_point, segments); + node_t *starting_node = vd_node_to_he_node[starting_voronoi_edge->vertex0()]; starting_node->data.distance_to_boundary = 0; constexpr bool is_next_to_start_or_end = true; graph.makeRib(prev_edge, start_source_point, end_source_point, is_next_to_start_or_end); - for (vd_t::edge_type* vd_edge = starting_vonoroi_edge->next(); vd_edge != ending_vonoroi_edge; vd_edge = vd_edge->next()) { + for (const VD::edge_type* vd_edge = starting_voronoi_edge->next(); vd_edge != ending_voronoi_edge; vd_edge = vd_edge->next()) { assert(vd_edge->is_finite()); + assert(Geometry::VoronoiUtils::is_in_range(*vd_edge)); - assert(VoronoiUtils::p(vd_edge->vertex0()).x() <= std::numeric_limits::max() && VoronoiUtils::p(vd_edge->vertex0()).x() >= std::numeric_limits::lowest()); - assert(VoronoiUtils::p(vd_edge->vertex0()).y() <= std::numeric_limits::max() && VoronoiUtils::p(vd_edge->vertex0()).y() >= std::numeric_limits::lowest()); - assert(VoronoiUtils::p(vd_edge->vertex1()).x() <= std::numeric_limits::max() && VoronoiUtils::p(vd_edge->vertex1()).x() >= std::numeric_limits::lowest()); - assert(VoronoiUtils::p(vd_edge->vertex1()).y() <= std::numeric_limits::max() && VoronoiUtils::p(vd_edge->vertex1()).y() >= std::numeric_limits::lowest()); - - Point v1 = VoronoiUtils::p(vd_edge->vertex0()).cast(); - Point v2 = VoronoiUtils::p(vd_edge->vertex1()).cast(); + Point v1 = Geometry::VoronoiUtils::to_point(vd_edge->vertex0()).cast(); + Point v2 = Geometry::VoronoiUtils::to_point(vd_edge->vertex1()).cast(); transferEdge(v1, v2, *vd_edge, prev_edge, start_source_point, end_source_point, segments); - - graph.makeRib(prev_edge, start_source_point, end_source_point, vd_edge->next() == ending_vonoroi_edge); + graph.makeRib(prev_edge, start_source_point, end_source_point, vd_edge->next() == ending_voronoi_edge); } - assert(VoronoiUtils::p(starting_vonoroi_edge->vertex0()).x() <= std::numeric_limits::max() && VoronoiUtils::p(starting_vonoroi_edge->vertex0()).x() >= std::numeric_limits::lowest()); - assert(VoronoiUtils::p(starting_vonoroi_edge->vertex0()).y() <= std::numeric_limits::max() && VoronoiUtils::p(starting_vonoroi_edge->vertex0()).y() >= std::numeric_limits::lowest()); - transferEdge(VoronoiUtils::p(ending_vonoroi_edge->vertex0()).cast(), end_source_point, *ending_vonoroi_edge, prev_edge, start_source_point, end_source_point, segments); + transferEdge(Geometry::VoronoiUtils::to_point(ending_voronoi_edge->vertex0()).cast(), end_source_point, *ending_voronoi_edge, prev_edge, start_source_point, end_source_point, segments); prev_edge->to->data.distance_to_boundary = 0; } - // For some input polygons, as in GH issues #8474 and #8514 resulting Voronoi diagram is degenerated because it is not planar. - // When this degenerated Voronoi diagram is processed, the resulting half-edge structure contains some edges that don't have - // a twin edge. Based on this, we created a fast mechanism that detects those causes and tries to recompute the Voronoi - // diagram on slightly rotated input polygons that usually make the Voronoi generator generate a non-degenerated Voronoi diagram. - if (!degenerated_voronoi_diagram && has_missing_twin_edge(this->graph)) { - BOOST_LOG_TRIVIAL(warning) << "Detected degenerated Voronoi diagram, input polygons will be rotated back and forth."; - degenerated_voronoi_diagram = true; - vertex_mapping = try_to_fix_degenerated_voronoi_diagram_by_rotation(voronoi_diagram, polys, polys_copy, segments, fix_angle); - - assert(!detect_missing_voronoi_vertex(voronoi_diagram, segments)); - if (detect_missing_voronoi_vertex(voronoi_diagram, segments)) - BOOST_LOG_TRIVIAL(error) << "Detected missing Voronoi vertex after the rotation of input."; - - assert(Geometry::VoronoiUtilsCgal::is_voronoi_diagram_planar_intersection(voronoi_diagram)); - - this->graph.edges.clear(); - this->graph.nodes.clear(); - this->vd_edge_to_he_edge.clear(); - this->vd_node_to_he_node.clear(); - - goto process_voronoi_diagram; - } - - if (degenerated_voronoi_diagram) { - assert(!has_missing_twin_edge(this->graph)); - - if (has_missing_twin_edge(this->graph)) - BOOST_LOG_TRIVIAL(error) << "Detected degenerated Voronoi diagram even after the rotation of input."; - } - - if (degenerated_voronoi_diagram) - rotate_back_skeletal_trapezoidation_graph_after_fix(this->graph, fix_angle, vertex_mapping); - #ifdef ARACHNE_DEBUG assert(Geometry::VoronoiUtilsCgal::is_voronoi_diagram_planar_intersection(voronoi_diagram)); #endif @@ -742,7 +486,7 @@ process_voronoi_diagram: graph.collapseSmallEdges(); - // Set [incident_edge] the the first possible edge that way we can iterate over all reachable edges from node.incident_edge, + // Set [incident_edge] the first possible edge that way we can iterate over all reachable edges from node.incident_edge, // without needing to iterate backward for (edge_t& edge : graph.edges) if (!edge.prev) @@ -751,7 +495,7 @@ process_voronoi_diagram: void SkeletalTrapezoidation::separatePointyQuadEndNodes() { - ankerl::unordered_dense::set visited_nodes; + NodeSet visited_nodes; for (edge_t& edge : graph.edges) { if (edge.prev) @@ -2221,16 +1965,16 @@ void SkeletalTrapezoidation::addToolpathSegment(const ExtrusionJunction& from, c void SkeletalTrapezoidation::connectJunctions(ptr_vector_t& edge_junctions) { - ankerl::unordered_dense::set unprocessed_quad_starts(graph.edges.size() * 5 / 2); + EdgeSet unprocessed_quad_starts(graph.edges.size() * 5 / 2); for (edge_t& edge : graph.edges) { if (!edge.prev) { - unprocessed_quad_starts.insert(&edge); + unprocessed_quad_starts.emplace(&edge); } } - ankerl::unordered_dense::set passed_odd_edges; + EdgeSet passed_odd_edges; while (!unprocessed_quad_starts.empty()) { diff --git a/src/libslic3r/Arachne/SkeletalTrapezoidation.hpp b/src/libslic3r/Arachne/SkeletalTrapezoidation.hpp index 225bf53861..75ff940155 100644 --- a/src/libslic3r/Arachne/SkeletalTrapezoidation.hpp +++ b/src/libslic3r/Arachne/SkeletalTrapezoidation.hpp @@ -7,9 +7,10 @@ #include #include // smart pointers -#include #include // pair +#include + #include "utils/HalfEdgeGraph.hpp" #include "utils/PolygonsSegmentIndex.hpp" #include "utils/ExtrusionJunction.hpp" @@ -23,8 +24,9 @@ //#define ARACHNE_DEBUG //#define ARACHNE_DEBUG_VORONOI -namespace Slic3r::Arachne -{ +namespace Slic3r::Arachne { + +using VD = Slic3r::Geometry::VoronoiDiagram; /*! * Main class of the dynamic beading strategies. @@ -47,8 +49,6 @@ deposition modeling" by Kuipers et al. */ class SkeletalTrapezoidation { - using pos_t = double; - using vd_t = boost::polygon::voronoi_diagram; using graph_t = SkeletalTrapezoidationGraph; using edge_t = STHalfEdge; using node_t = STHalfEdgeNode; @@ -79,7 +79,11 @@ class SkeletalTrapezoidation const BeadingStrategy& beading_strategy; public: - using Segment = PolygonsSegmentIndex; + using Segment = PolygonsSegmentIndex; + using NodeSet = ankerl::unordered_dense::set; + using EdgeSet = ankerl::unordered_dense::set; + using EdgeMap = ankerl::unordered_dense::map; + using NodeMap = ankerl::unordered_dense::map; /*! * Construct a new trapezoidation problem to solve. @@ -163,9 +167,9 @@ protected: * mapping each voronoi VD edge to the corresponding halfedge HE edge * In case the result segment is discretized, we map the VD edge to the *last* HE edge */ - ankerl::unordered_dense::map vd_edge_to_he_edge; - ankerl::unordered_dense::map vd_node_to_he_node; - node_t& makeNode(vd_t::vertex_type& vd_node, Point p); //!< Get the node which the VD node maps to, or create a new mapping if there wasn't any yet. + EdgeMap vd_edge_to_he_edge; + NodeMap vd_node_to_he_node; + node_t &makeNode(const VD::vertex_type &vd_node, Point p); //!< Get the node which the VD node maps to, or create a new mapping if there wasn't any yet. /*! * (Eventual) returned 'polylines per index' result (from generateToolpaths): @@ -176,7 +180,7 @@ protected: * Transfer an edge from the VD to the HE and perform discretization of parabolic edges (and vertex-vertex edges) * \p prev_edge serves as input and output. May be null as input. */ - void transferEdge(Point from, Point to, vd_t::edge_type& vd_edge, edge_t*& prev_edge, Point& start_source_point, Point& end_source_point, const std::vector& segments); + void transferEdge(Point from, Point to, const VD::edge_type &vd_edge, edge_t *&prev_edge, Point &start_source_point, Point &end_source_point, const std::vector &segments); /*! * Discretize a Voronoi edge that represents the medial axis of a vertex- @@ -203,7 +207,7 @@ protected: * \return A number of coordinates along the edge where the edge is broken * up into discrete pieces. */ - std::vector discretize(const vd_t::edge_type& segment, const std::vector& segments); + Points discretize(const VD::edge_type& segment, const std::vector& segments); /*! * Compute the range of line segments that surround a cell of the skeletal @@ -229,33 +233,7 @@ protected: * /return Whether the cell is inside of the polygon. If it's outside of the * polygon we should skip processing it altogether. */ - bool computePointCellRange(vd_t::cell_type& cell, Point& start_source_point, Point& end_source_point, vd_t::edge_type*& starting_vd_edge, vd_t::edge_type*& ending_vd_edge, const std::vector& segments); - - /*! - * Compute the range of line segments that surround a cell of the skeletal - * graph that belongs to a line segment of the medial axis. - * - * This should only be used on cells that belong to a central line segment - * of the skeletal graph, e.g. trapezoid cells, not triangular cells. - * - * The resulting line segments is just the first and the last segment. They - * are linked to the neighboring segments, so you can iterate over the - * segments until you reach the last segment. - * \param cell The cell to compute the range of line segments for. - * \param[out] start_source_point The start point of the source segment of - * this cell. - * \param[out] end_source_point The end point of the source segment of this - * cell. - * \param[out] starting_vd_edge The edge of the Voronoi diagram where the - * loop around the cell starts. - * \param[out] ending_vd_edge The edge of the Voronoi diagram where the loop - * around the cell ends. - * \param points All vertices of the input Polygons. - * \param segments All edges of the input Polygons. - * /return Whether the cell is inside of the polygon. If it's outside of the - * polygon we should skip processing it altogether. - */ - void computeSegmentCellRange(vd_t::cell_type& cell, Point& start_source_point, Point& end_source_point, vd_t::edge_type*& starting_vd_edge, vd_t::edge_type*& ending_vd_edge, const std::vector& segments); + static bool computePointCellRange(const VD::cell_type &cell, Point &start_source_point, Point &end_source_point, const VD::edge_type *&starting_vd_edge, const VD::edge_type *&ending_vd_edge, const std::vector &segments); /*! * For VD cells associated with an input polygon vertex, we need to separate the node at the end and start of the cell into two diff --git a/src/libslic3r/Arachne/utils/PolygonsSegmentIndex.hpp b/src/libslic3r/Arachne/utils/PolygonsSegmentIndex.hpp index 6eff3d62ee..3258b41c7d 100644 --- a/src/libslic3r/Arachne/utils/PolygonsSegmentIndex.hpp +++ b/src/libslic3r/Arachne/utils/PolygonsSegmentIndex.hpp @@ -27,5 +27,24 @@ public: } // namespace Slic3r::Arachne +namespace boost::polygon { + +template<> struct geometry_concept +{ + typedef segment_concept type; +}; + +template<> struct segment_traits +{ + typedef coord_t coordinate_type; + typedef Slic3r::Point point_type; + + static inline point_type get(const Slic3r::Arachne::PolygonsSegmentIndex &CSegment, direction_1d dir) + { + return dir.to_int() ? CSegment.to() : CSegment.from(); + } +}; + +} // namespace boost::polygon #endif//UTILS_POLYGONS_SEGMENT_INDEX_H diff --git a/src/libslic3r/Arachne/utils/VoronoiUtils.cpp b/src/libslic3r/Arachne/utils/VoronoiUtils.cpp deleted file mode 100644 index 82bd79523f..0000000000 --- a/src/libslic3r/Arachne/utils/VoronoiUtils.cpp +++ /dev/null @@ -1,251 +0,0 @@ -//Copyright (c) 2021 Ultimaker B.V. -//CuraEngine is released under the terms of the AGPLv3 or higher. - -#include -#include -#include - -#include "linearAlg2D.hpp" -#include "VoronoiUtils.hpp" - -namespace Slic3r::Arachne -{ - -Vec2i64 VoronoiUtils::p(const vd_t::vertex_type *node) -{ - const double x = node->x(); - const double y = node->y(); - assert(std::isfinite(x) && std::isfinite(y)); - assert(x <= double(std::numeric_limits::max()) && x >= std::numeric_limits::lowest()); - assert(y <= double(std::numeric_limits::max()) && y >= std::numeric_limits::lowest()); - return {int64_t(x + 0.5 - (x < 0)), int64_t(y + 0.5 - (y < 0))}; // Round to the nearest integer coordinates. -} - -Point VoronoiUtils::getSourcePoint(const vd_t::cell_type& cell, const std::vector& segments) -{ - assert(cell.contains_point()); - if(!cell.contains_point()) - BOOST_LOG_TRIVIAL(debug) << "Voronoi cell doesn't contain a source point!"; - - switch (cell.source_category()) { - case boost::polygon::SOURCE_CATEGORY_SINGLE_POINT: - assert(false && "Voronoi diagram is always constructed using segments, so cell.source_category() shouldn't be SOURCE_CATEGORY_SINGLE_POINT!\n"); - BOOST_LOG_TRIVIAL(error) << "Voronoi diagram is always constructed using segments, so cell.source_category() shouldn't be SOURCE_CATEGORY_SINGLE_POINT!"; - break; - case boost::polygon::SOURCE_CATEGORY_SEGMENT_START_POINT: - assert(cell.source_index() < segments.size()); - return segments[cell.source_index()].to(); - break; - case boost::polygon::SOURCE_CATEGORY_SEGMENT_END_POINT: - assert(cell.source_index() < segments.size()); - return segments[cell.source_index()].from(); - break; - default: - assert(false && "getSourcePoint should only be called on point cells!\n"); - break; - } - - assert(false && "cell.source_category() is equal to an invalid value!\n"); - BOOST_LOG_TRIVIAL(error) << "cell.source_category() is equal to an invalid value!"; - return {}; -} - -PolygonsPointIndex VoronoiUtils::getSourcePointIndex(const vd_t::cell_type& cell, const std::vector& segments) -{ - assert(cell.contains_point()); - if(!cell.contains_point()) - BOOST_LOG_TRIVIAL(debug) << "Voronoi cell doesn't contain a source point!"; - - assert(cell.source_category() != boost::polygon::SOURCE_CATEGORY_SINGLE_POINT); - switch (cell.source_category()) { - case boost::polygon::SOURCE_CATEGORY_SEGMENT_START_POINT: { - assert(cell.source_index() < segments.size()); - PolygonsPointIndex ret = segments[cell.source_index()]; - ++ret; - return ret; - break; - } - case boost::polygon::SOURCE_CATEGORY_SEGMENT_END_POINT: { - assert(cell.source_index() < segments.size()); - return segments[cell.source_index()]; - break; - } - default: - assert(false && "getSourcePoint should only be called on point cells!\n"); - break; - } - PolygonsPointIndex ret = segments[cell.source_index()]; - return ++ret; -} - -const VoronoiUtils::Segment &VoronoiUtils::getSourceSegment(const vd_t::cell_type &cell, const std::vector &segments) -{ - assert(cell.contains_segment()); - if (!cell.contains_segment()) - BOOST_LOG_TRIVIAL(debug) << "Voronoi cell doesn't contain a source segment!"; - - return segments[cell.source_index()]; -} - -class PointMatrix -{ -public: - double matrix[4]; - - PointMatrix() - { - matrix[0] = 1; - matrix[1] = 0; - matrix[2] = 0; - matrix[3] = 1; - } - - PointMatrix(double rotation) - { - rotation = rotation / 180 * M_PI; - matrix[0] = cos(rotation); - matrix[1] = -sin(rotation); - matrix[2] = -matrix[1]; - matrix[3] = matrix[0]; - } - - PointMatrix(const Point p) - { - matrix[0] = p.x(); - matrix[1] = p.y(); - double f = sqrt((matrix[0] * matrix[0]) + (matrix[1] * matrix[1])); - matrix[0] /= f; - matrix[1] /= f; - matrix[2] = -matrix[1]; - matrix[3] = matrix[0]; - } - - static PointMatrix scale(double s) - { - PointMatrix ret; - ret.matrix[0] = s; - ret.matrix[3] = s; - return ret; - } - - Point apply(const Point p) const - { - return Point(coord_t(p.x() * matrix[0] + p.y() * matrix[1]), coord_t(p.x() * matrix[2] + p.y() * matrix[3])); - } - - Point unapply(const Point p) const - { - return Point(coord_t(p.x() * matrix[0] + p.y() * matrix[2]), coord_t(p.x() * matrix[1] + p.y() * matrix[3])); - } -}; -std::vector VoronoiUtils::discretizeParabola(const Point& p, const Segment& segment, Point s, Point e, coord_t approximate_step_size, float transitioning_angle) -{ - std::vector discretized; - // x is distance of point projected on the segment ab - // xx is point projected on the segment ab - const Point a = segment.from(); - const Point b = segment.to(); - const Point ab = b - a; - const Point as = s - a; - const Point ae = e - a; - const coord_t ab_size = ab.cast().norm(); - const coord_t sx = as.cast().dot(ab.cast()) / ab_size; - const coord_t ex = ae.cast().dot(ab.cast()) / ab_size; - const coord_t sxex = ex - sx; - - assert((as.cast().dot(ab.cast()) / int64_t(ab_size)) <= std::numeric_limits::max()); - assert((ae.cast().dot(ab.cast()) / int64_t(ab_size)) <= std::numeric_limits::max()); - - const Point ap = p - a; - const coord_t px = ap.cast().dot(ab.cast()) / ab_size; - - assert((ap.cast().dot(ab.cast()) / int64_t(ab_size)) <= std::numeric_limits::max()); - - Point pxx; - Line(a, b).distance_to_infinite_squared(p, &pxx); - const Point ppxx = pxx - p; - const coord_t d = ppxx.cast().norm(); - const PointMatrix rot = PointMatrix(ppxx.rotate_90_degree_ccw()); - - if (d == 0) - { - discretized.emplace_back(s); - discretized.emplace_back(e); - return discretized; - } - - const float marking_bound = atan(transitioning_angle * 0.5); - int64_t msx = - marking_bound * int64_t(d); // projected marking_start - int64_t mex = marking_bound * int64_t(d); // projected marking_end - - assert(msx <= std::numeric_limits::max()); - assert(double(msx) * double(msx) <= double(std::numeric_limits::max())); - assert(mex <= std::numeric_limits::max()); - assert(double(msx) * double(msx) / double(2 * d) + double(d / 2) <= std::numeric_limits::max()); - - const coord_t marking_start_end_h = msx * msx / (2 * d) + d / 2; - Point marking_start = rot.unapply(Point(coord_t(msx), marking_start_end_h)) + pxx; - Point marking_end = rot.unapply(Point(coord_t(mex), marking_start_end_h)) + pxx; - const int dir = (sx > ex) ? -1 : 1; - if (dir < 0) - { - std::swap(marking_start, marking_end); - std::swap(msx, mex); - } - - bool add_marking_start = msx * int64_t(dir) > int64_t(sx - px) * int64_t(dir) && msx * int64_t(dir) < int64_t(ex - px) * int64_t(dir); - bool add_marking_end = mex * int64_t(dir) > int64_t(sx - px) * int64_t(dir) && mex * int64_t(dir) < int64_t(ex - px) * int64_t(dir); - - const Point apex = rot.unapply(Point(0, d / 2)) + pxx; - bool add_apex = int64_t(sx - px) * int64_t(dir) < 0 && int64_t(ex - px) * int64_t(dir) > 0; - - assert(!(add_marking_start && add_marking_end) || add_apex); - if(add_marking_start && add_marking_end && !add_apex) - { - BOOST_LOG_TRIVIAL(warning) << "Failing to discretize parabola! Must add an apex or one of the endpoints."; - } - - const coord_t step_count = static_cast(static_cast(std::abs(ex - sx)) / approximate_step_size + 0.5); - - discretized.emplace_back(s); - for (coord_t step = 1; step < step_count; step++) - { - assert(double(sxex) * double(step) <= double(std::numeric_limits::max())); - const int64_t x = int64_t(sx) + int64_t(sxex) * int64_t(step) / int64_t(step_count) - int64_t(px); - assert(double(x) * double(x) <= double(std::numeric_limits::max())); - assert(double(x) * double(x) / double(2 * d) + double(d / 2) <= double(std::numeric_limits::max())); - const int64_t y = int64_t(x) * int64_t(x) / int64_t(2 * d) + int64_t(d / 2); - - if (add_marking_start && msx * int64_t(dir) < int64_t(x) * int64_t(dir)) - { - discretized.emplace_back(marking_start); - add_marking_start = false; - } - if (add_apex && int64_t(x) * int64_t(dir) > 0) - { - discretized.emplace_back(apex); - add_apex = false; // only add the apex just before the - } - if (add_marking_end && mex * int64_t(dir) < int64_t(x) * int64_t(dir)) - { - discretized.emplace_back(marking_end); - add_marking_end = false; - } - assert(x <= std::numeric_limits::max() && x >= std::numeric_limits::lowest()); - assert(y <= std::numeric_limits::max() && y >= std::numeric_limits::lowest()); - const Point result = rot.unapply(Point(x, y)) + pxx; - discretized.emplace_back(result); - } - if (add_apex) - { - discretized.emplace_back(apex); - } - if (add_marking_end) - { - discretized.emplace_back(marking_end); - } - discretized.emplace_back(e); - return discretized; -} - -}//namespace Slic3r::Arachne diff --git a/src/libslic3r/Arachne/utils/VoronoiUtils.hpp b/src/libslic3r/Arachne/utils/VoronoiUtils.hpp deleted file mode 100644 index aa46936437..0000000000 --- a/src/libslic3r/Arachne/utils/VoronoiUtils.hpp +++ /dev/null @@ -1,47 +0,0 @@ -//Copyright (c) 2020 Ultimaker B.V. -//CuraEngine is released under the terms of the AGPLv3 or higher. - - -#ifndef UTILS_VORONOI_UTILS_H -#define UTILS_VORONOI_UTILS_H - -#include - - -#include - -#include "PolygonsSegmentIndex.hpp" - -namespace Slic3r::Arachne -{ - -/*! - */ -class VoronoiUtils -{ -public: - using Segment = PolygonsSegmentIndex; - using voronoi_data_t = double; - using vd_t = boost::polygon::voronoi_diagram; - - static Point getSourcePoint(const vd_t::cell_type &cell, const std::vector &segments); - static const Segment &getSourceSegment(const vd_t::cell_type &cell, const std::vector &segments); - static PolygonsPointIndex getSourcePointIndex(const vd_t::cell_type &cell, const std::vector &segments); - - static Vec2i64 p(const vd_t::vertex_type *node); - - /*! - * Discretize a parabola based on (approximate) step size. - * The \p approximate_step_size is measured parallel to the \p source_segment, not along the parabola. - */ - static std::vector discretizeParabola(const Point &source_point, const Segment &source_segment, Point start, Point end, coord_t approximate_step_size, float transitioning_angle); - - static inline bool is_finite(const VoronoiUtils::vd_t::vertex_type &vertex) - { - return std::isfinite(vertex.x()) && std::isfinite(vertex.y()); - } -}; - -} // namespace Slic3r::Arachne - -#endif // UTILS_VORONOI_UTILS_H diff --git a/src/libslic3r/Arrange.cpp b/src/libslic3r/Arrange.cpp index 2631b936ed..7952b3aa87 100644 --- a/src/libslic3r/Arrange.cpp +++ b/src/libslic3r/Arrange.cpp @@ -101,8 +101,14 @@ void update_selected_items_inflation(ArrangePolygons& selected, const DynamicPri Points bedpts = get_shrink_bedpts(print_cfg, params); BoundingBox bedbb = Polygon(bedpts).bounding_box(); // set obj distance for auto seq_print - if (params.min_obj_distance == 0 && params.is_seq_print) - params.min_obj_distance = scaled(params.cleareance_radius + 0.001); + if (params.is_seq_print) { + bool all_objects_are_short = std::all_of(selected.begin(), selected.end(), [&](ArrangePolygon& ap) { return ap.height < params.nozzle_height; }); + if (all_objects_are_short) { + params.min_obj_distance = std::max(params.min_obj_distance, scaled(double(MAX_OUTER_NOZZLE_DIAMETER)/2+0.001)); + } + else + params.min_obj_distance = std::max(params.min_obj_distance, scaled(params.cleareance_radius + 0.001)); // +0.001mm to avoid clearance check fail due to rounding error + } double brim_max = 0; bool plate_has_tree_support = false; std::for_each(selected.begin(), selected.end(), [&](ArrangePolygon& ap) { diff --git a/src/libslic3r/Arrange.hpp b/src/libslic3r/Arrange.hpp index bf9815be6b..fd53420414 100644 --- a/src/libslic3r/Arrange.hpp +++ b/src/libslic3r/Arrange.hpp @@ -132,6 +132,7 @@ struct ArrangeParams { float clearance_height_to_rod = 0; float clearance_height_to_lid = 0; float cleareance_radius = 0; + float nozzle_height = 0; float printable_height = 256.0; Vec2d align_center{ 0.5,0.5 }; diff --git a/src/libslic3r/CMakeLists.txt b/src/libslic3r/CMakeLists.txt index ebabfab426..dfd82cbde7 100644 --- a/src/libslic3r/CMakeLists.txt +++ b/src/libslic3r/CMakeLists.txt @@ -194,9 +194,12 @@ set(lisbslic3r_sources Geometry/Curves.hpp Geometry/MedialAxis.cpp Geometry/MedialAxis.hpp + Geometry/Voronoi.cpp Geometry/Voronoi.hpp Geometry/VoronoiOffset.cpp Geometry/VoronoiOffset.hpp + Geometry/VoronoiUtils.hpp + Geometry/VoronoiUtils.cpp Geometry/VoronoiUtilsCgal.cpp Geometry/VoronoiUtilsCgal.hpp Geometry/VoronoiVisualUtils.hpp @@ -238,6 +241,8 @@ set(lisbslic3r_sources NSVGUtils.hpp ObjectID.cpp ObjectID.hpp + ParameterUtils.cpp + ParameterUtils.hpp PerimeterGenerator.cpp PerimeterGenerator.hpp PlaceholderParser.cpp @@ -431,8 +436,6 @@ set(lisbslic3r_sources Arachne/utils/PolygonsSegmentIndex.hpp Arachne/utils/PolylineStitcher.hpp Arachne/utils/PolylineStitcher.cpp - Arachne/utils/VoronoiUtils.hpp - Arachne/utils/VoronoiUtils.cpp Arachne/SkeletalTrapezoidation.hpp Arachne/SkeletalTrapezoidation.cpp Arachne/SkeletalTrapezoidationEdge.hpp diff --git a/src/libslic3r/CSGMesh/CSGMesh.hpp b/src/libslic3r/CSGMesh/CSGMesh.hpp index d14ed76595..177d343296 100644 --- a/src/libslic3r/CSGMesh/CSGMesh.hpp +++ b/src/libslic3r/CSGMesh/CSGMesh.hpp @@ -70,6 +70,7 @@ struct CSGPart { Transform3f trafo; CSGType operation; CSGStackOp stack_operation; + std::string name; CSGPart(AnyPtr ptr = {}, CSGType op = CSGType::Union, diff --git a/src/libslic3r/CSGMesh/ModelToCSGMesh.hpp b/src/libslic3r/CSGMesh/ModelToCSGMesh.hpp index 446326dc88..5963b29109 100644 --- a/src/libslic3r/CSGMesh/ModelToCSGMesh.hpp +++ b/src/libslic3r/CSGMesh/ModelToCSGMesh.hpp @@ -64,7 +64,7 @@ bool model_to_csgmesh(const ModelObject &mo, CSGPart part{&(vol->mesh().its), vol->is_model_part() ? CSGType::Union : CSGType::Difference, (trafo * vol->get_matrix()).cast()}; - + part.name = vol->name; *out = std::move(part); ++out; } diff --git a/src/libslic3r/CSGMesh/PerformCSGMeshBooleans.hpp b/src/libslic3r/CSGMesh/PerformCSGMeshBooleans.hpp index e989033782..a9a48b48c0 100644 --- a/src/libslic3r/CSGMesh/PerformCSGMeshBooleans.hpp +++ b/src/libslic3r/CSGMesh/PerformCSGMeshBooleans.hpp @@ -11,6 +11,7 @@ #include "libslic3r/MeshBoolean.hpp" namespace Slic3r { namespace csg { + enum class BooleanFailReason { OK, MeshEmpty, NotBoundAVolume, SelfIntersect, NoIntersection}; // This method can be overriden when a specific CSGPart type supports caching // of the voxel grid @@ -256,12 +257,13 @@ void perform_csgmesh_booleans_mcut(MeshBoolean::mcut::McutMeshPtr& mcutm, template -It check_csgmesh_booleans(const Range &csgrange, Visitor &&vfn) +std::tuple check_csgmesh_booleans(const Range &csgrange, Visitor &&vfn) { using namespace detail_cgal; - + BooleanFailReason fail_reason = BooleanFailReason::OK; + std::string fail_part_name; std::vector cgalmeshes(csgrange.size()); - auto check_part = [&csgrange, &cgalmeshes](size_t i) + auto check_part = [&csgrange, &cgalmeshes,&fail_reason,&fail_part_name](size_t i) { auto it = csgrange.begin(); std::advance(it, i); @@ -275,14 +277,26 @@ It check_csgmesh_booleans(const Range &csgrange, Visitor &&vfn) } try { - if (!m || MeshBoolean::cgal::empty(*m)) + if (!m || MeshBoolean::cgal::empty(*m)) { + BOOST_LOG_TRIVIAL(info) << "check_csgmesh_booleans fails! mesh " << i << "/" << csgrange.size() << " is empty, cannot do boolean!"; + fail_reason= BooleanFailReason::MeshEmpty; + fail_part_name = csgpart.name; return; + } - if (!MeshBoolean::cgal::does_bound_a_volume(*m)) + if (!MeshBoolean::cgal::does_bound_a_volume(*m)) { + BOOST_LOG_TRIVIAL(info) << "check_csgmesh_booleans fails! mesh "< &csgrange, Visitor &&vfn) }; execution::for_each(ex_tbb, size_t(0), csgrange.size(), check_part); - It ret = csgrange.end(); - for (size_t i = 0; i < csgrange.size(); ++i) { - if (!cgalmeshes[i]) { - auto it = csgrange.begin(); - std::advance(it, i); - vfn(it); + //It ret = csgrange.end(); + //for (size_t i = 0; i < csgrange.size(); ++i) { + // if (!cgalmeshes[i]) { + // auto it = csgrange.begin(); + // std::advance(it, i); + // vfn(it); - if (ret == csgrange.end()) - ret = it; - } - } + // if (ret == csgrange.end()) + // ret = it; + // } + //} - return ret; + return { fail_reason,fail_part_name }; } template -It check_csgmesh_booleans(const Range &csgrange, bool use_mcut=false) +std::tuple check_csgmesh_booleans(const Range &csgrange, bool use_mcut=false) { if(!use_mcut) return check_csgmesh_booleans(csgrange, [](auto &) {}); else { using namespace detail_mcut; + BooleanFailReason fail_reason = BooleanFailReason::OK; + std::string fail_part_name; std::vector McutMeshes(csgrange.size()); - auto check_part = [&csgrange, &McutMeshes](size_t i) { + auto check_part = [&csgrange, &McutMeshes,&fail_reason,&fail_part_name](size_t i) { auto it = csgrange.begin(); std::advance(it, i); auto& csgpart = *it; @@ -327,27 +343,18 @@ It check_csgmesh_booleans(const Range &csgrange, bool use_mcut=false) } try { - if (!m || MeshBoolean::mcut::empty(*m)) + if (!m || MeshBoolean::mcut::empty(*m)) { + fail_reason=BooleanFailReason::MeshEmpty; + fail_part_name = csgpart.name; return; + } } catch (...) { return; } McutMeshes[i] = std::move(m); }; execution::for_each(ex_tbb, size_t(0), csgrange.size(), check_part); - - It ret = csgrange.end(); - for (size_t i = 0; i < csgrange.size(); ++i) { - if (!McutMeshes[i]) { - auto it = csgrange.begin(); - std::advance(it, i); - - if (ret == csgrange.end()) - ret = it; - } - } - - return ret; + return { fail_reason,fail_part_name }; } } diff --git a/src/libslic3r/ExtrusionEntity.cpp b/src/libslic3r/ExtrusionEntity.cpp index dee7477939..942a5d07b0 100644 --- a/src/libslic3r/ExtrusionEntity.cpp +++ b/src/libslic3r/ExtrusionEntity.cpp @@ -13,6 +13,8 @@ namespace Slic3r { +static const double slope_inner_outer_wall_gap = 0.4; + void ExtrusionPath::intersect_expolygons(const ExPolygons &collection, ExtrusionEntityCollection* retval) const { this->_inflate_collection(intersection_pl(Polylines{ polyline }, collection), retval); @@ -409,11 +411,8 @@ ExtrusionLoopSloped::ExtrusionLoopSloped(ExtrusionPaths& original_paths, : ExtrusionLoop(role) { // create slopes - const auto add_slop = [this, slope_max_segment_length, seam_gap](const ExtrusionPath& path, const Polyline& poly, - double ratio_begin, double ratio_end) { - if (poly.empty()) { - return; - } + const auto add_slop = [this, slope_max_segment_length, seam_gap](const ExtrusionPath &path, const Polyline &poly, double ratio_begin, double ratio_end) { + if (poly.empty()) { return; } // Ensure `slope_max_segment_length` Polyline detailed_poly; @@ -421,7 +420,7 @@ ExtrusionLoopSloped::ExtrusionLoopSloped(ExtrusionPaths& original_paths, detailed_poly.append(poly.first_point()); // Recursively split the line into half until no longer than `slope_max_segment_length` - const std::function handle_line = [slope_max_segment_length, &detailed_poly, &handle_line](const Line& line) { + const std::function handle_line = [slope_max_segment_length, &detailed_poly, &handle_line](const Line &line) { if (line.length() <= slope_max_segment_length) { detailed_poly.append(line.b); } else { @@ -432,13 +431,10 @@ ExtrusionLoopSloped::ExtrusionLoopSloped(ExtrusionPaths& original_paths, } }; - for (const auto& l : poly.lines()) { - handle_line(l); - } + for (const auto &l : poly.lines()) { handle_line(l); } } - starts.emplace_back(detailed_poly, path, ExtrusionPathSloped::Slope{ratio_begin, ratio_begin}, - ExtrusionPathSloped::Slope{ratio_end, ratio_end}); + starts.emplace_back(detailed_poly, path, ExtrusionPathSloped::Slope{ratio_begin, ratio_begin}, ExtrusionPathSloped::Slope{ratio_end, ratio_end}); if (is_approx(ratio_end, 1.) && seam_gap > 0) { // Remove the segments that has no extrusion @@ -456,10 +452,8 @@ ExtrusionLoopSloped::ExtrusionLoopSloped(ExtrusionPaths& original_paths, detailed_poly.clear(); } } - if (!detailed_poly.empty()) { - ends.emplace_back(detailed_poly, path, ExtrusionPathSloped::Slope{1., 1. - ratio_begin}, - ExtrusionPathSloped::Slope{1., 1. - ratio_end}); - } + if (!detailed_poly.empty()) { ends.emplace_back(detailed_poly, path, ExtrusionPathSloped::Slope{1., 1. - ratio_begin}, ExtrusionPathSloped::Slope{1., 1. - ratio_end}); } + }; double remaining_length = slope_min_length; @@ -509,6 +503,61 @@ std::vector ExtrusionLoopSloped::get_all_paths() const { return r; } +void ExtrusionLoopSloped::clip_slope(double distance, bool inter_perimeter) +{ + + this->clip_end(distance); + this->clip_front(distance*2); +} + +void ExtrusionLoopSloped::clip_end(const double distance) +{ + double clip_dist = distance; + std::vector &ends_slope = this->ends; + while (clip_dist > 0 && !ends_slope.empty()) { + ExtrusionPathSloped &last_path = ends_slope.back(); + double len = last_path.length(); + if (len <= clip_dist) { + ends_slope.pop_back(); + clip_dist -= len; + } else { + last_path.polyline.clip_end(clip_dist); + break; + } + } +} + +void ExtrusionLoopSloped::clip_front(const double distance) +{ + double clip_dist = distance; + if (this->role() == erPerimeter) + clip_dist = scale_(this->slope_path_length()) * slope_inner_outer_wall_gap; + + std::vector &start_slope = this->starts; + + Polyline front_inward; + while (distance > 0 && !start_slope.empty()) { + ExtrusionPathSloped &first_path = start_slope.front(); + double len = first_path.length(); + if (len <= clip_dist) { + start_slope.erase(start_slope.begin()); + clip_dist -= len; + } else { + first_path.polyline.reverse(); + first_path.polyline.clip_end(clip_dist); + first_path.polyline.reverse(); + break; + } + } +} + +double ExtrusionLoopSloped::slope_path_length() { + double total_length = 0.0; + for (ExtrusionPathSloped start_ep : this->starts) { + total_length += unscale_(start_ep.length()); + } + return total_length; +} std::string ExtrusionEntity::role_to_string(ExtrusionRole role) { diff --git a/src/libslic3r/ExtrusionEntity.hpp b/src/libslic3r/ExtrusionEntity.hpp index 0f6a37779a..4394d00264 100644 --- a/src/libslic3r/ExtrusionEntity.hpp +++ b/src/libslic3r/ExtrusionEntity.hpp @@ -151,7 +151,7 @@ class ExtrusionPath : public ExtrusionEntity { public: Polyline polyline; - int overhang_degree = 0; + double overhang_degree = 0; int curve_degree = 0; // Volumetric velocity. mm^3 of plastic per mm of linear head motion. Used by the G-code generator. double mm3_per_mm; @@ -163,7 +163,8 @@ public: ExtrusionPath() : mm3_per_mm(-1), width(-1), height(-1), m_role(erNone), m_no_extrusion(false) {} ExtrusionPath(ExtrusionRole role) : mm3_per_mm(-1), width(-1), height(-1), m_role(role), m_no_extrusion(false) {} ExtrusionPath(ExtrusionRole role, double mm3_per_mm, float width, float height, bool no_extrusion = false) : mm3_per_mm(mm3_per_mm), width(width), height(height), m_role(role), m_no_extrusion(no_extrusion) {} - ExtrusionPath(int overhang_degree, int curve_degree, ExtrusionRole role, double mm3_per_mm, float width, float height) : overhang_degree(overhang_degree), curve_degree(curve_degree), mm3_per_mm(mm3_per_mm), width(width), height(height), m_role(role) {} + ExtrusionPath(double overhang_degree, int curve_degree, ExtrusionRole role, double mm3_per_mm, float width, float height) : overhang_degree(overhang_degree), curve_degree(curve_degree), mm3_per_mm(mm3_per_mm), width(width), height(height), m_role(role) {} + ExtrusionPath(const ExtrusionPath &rhs) : polyline(rhs.polyline) , overhang_degree(rhs.overhang_degree) @@ -277,8 +278,8 @@ public: }; int get_overhang_degree() const { // only perimeter has overhang degree. Other return 0; - if (is_perimeter(m_role) || is_bridge(m_role)) - return overhang_degree; + if (is_perimeter(m_role)) + return (int)overhang_degree; return 0; }; void set_curve_degree(int curve) { @@ -513,6 +514,10 @@ public: ExtrusionLoopRole role = elrDefault); [[nodiscard]] std::vector get_all_paths() const; + void clip_slope(double distance, bool inter_perimeter = false ); + void clip_end(const double distance); + void clip_front(const double distance); + double slope_path_length(); }; inline void extrusion_paths_append(ExtrusionPaths &dst, Polylines &polylines, ExtrusionRole role, double mm3_per_mm, float width, float height) @@ -525,7 +530,7 @@ inline void extrusion_paths_append(ExtrusionPaths &dst, Polylines &polylines, Ex } } -inline void extrusion_paths_append(ExtrusionPaths &dst, Polylines &polylines, int overhang_degree, int curva_degree, ExtrusionRole role, double mm3_per_mm, float width, float height) +inline void extrusion_paths_append(ExtrusionPaths &dst, Polylines &polylines, double overhang_degree, int curva_degree, ExtrusionRole role, double mm3_per_mm, float width, float height) { dst.reserve(dst.size() + polylines.size()); for (Polyline &polyline : polylines) @@ -546,7 +551,7 @@ inline void extrusion_paths_append(ExtrusionPaths &dst, Polylines &&polylines, E polylines.clear(); } -inline void extrusion_paths_append(ExtrusionPaths &dst, Polylines &&polylines, int overhang_degree, int curva_degree, ExtrusionRole role, double mm3_per_mm, float width, float height) +inline void extrusion_paths_append(ExtrusionPaths &dst, Polylines &&polylines, double overhang_degree, int curva_degree, ExtrusionRole role, double mm3_per_mm, float width, float height) { dst.reserve(dst.size() + polylines.size()); for (Polyline &polyline : polylines) @@ -557,6 +562,16 @@ inline void extrusion_paths_append(ExtrusionPaths &dst, Polylines &&polylines, i polylines.clear(); } +inline void extrusion_paths_append(ExtrusionPaths &dst, Polyline &&polyline, double overhang_degree, int curva_degree, ExtrusionRole role, double mm3_per_mm, float width, float height) +{ + dst.reserve(dst.size() + 1); + if (polyline.is_valid()) { + dst.push_back(ExtrusionPath(overhang_degree, curva_degree, role, mm3_per_mm, width, height)); + dst.back().polyline = std::move(polyline); + } + polyline.clear(); +} + inline void extrusion_entities_append_paths(ExtrusionEntitiesPtr &dst, Polylines &polylines, ExtrusionRole role, double mm3_per_mm, float width, float height, bool can_reverse = true) { dst.reserve(dst.size() + polylines.size()); diff --git a/src/libslic3r/Fill/Fill.cpp b/src/libslic3r/Fill/Fill.cpp index d68c14ce51..d87588c6d9 100644 --- a/src/libslic3r/Fill/Fill.cpp +++ b/src/libslic3r/Fill/Fill.cpp @@ -65,7 +65,10 @@ struct SurfaceFillParams // Index of this entry in a linear vector. size_t idx = 0; - + // infill speed settings + float sparse_infill_speed = 0; + float top_surface_speed = 0; + float solid_infill_speed = 0; bool operator<(const SurfaceFillParams &rhs) const { #define RETURN_COMPARE_NON_EQUAL(KEY) if (this->KEY < rhs.KEY) return true; if (this->KEY > rhs.KEY) return false; @@ -89,6 +92,10 @@ struct SurfaceFillParams RETURN_COMPARE_NON_EQUAL(flow.nozzle_diameter()); RETURN_COMPARE_NON_EQUAL_TYPED(unsigned, bridge); RETURN_COMPARE_NON_EQUAL_TYPED(unsigned, extrusion_role); + RETURN_COMPARE_NON_EQUAL(sparse_infill_speed); + RETURN_COMPARE_NON_EQUAL(top_surface_speed); + RETURN_COMPARE_NON_EQUAL(solid_infill_speed); + return false; } @@ -105,7 +112,10 @@ struct SurfaceFillParams this->anchor_length == rhs.anchor_length && this->anchor_length_max == rhs.anchor_length_max && this->flow == rhs.flow && - this->extrusion_role == rhs.extrusion_role; + this->extrusion_role == rhs.extrusion_role && + this->sparse_infill_speed == rhs.sparse_infill_speed && + this->top_surface_speed == rhs.top_surface_speed && + this->solid_infill_speed == rhs.solid_infill_speed; } }; @@ -490,7 +500,15 @@ std::vector group_fills(const Layer &layer) //Orca: enable thick bridge based on config layerm.bridging_flow(extrusion_role, is_thick_bridge) : layerm.flow(extrusion_role, (surface.thickness == -1) ? layer.height : surface.thickness); - + // record speed params + if (!params.bridge) { + if (params.extrusion_role == erInternalInfill) + params.sparse_infill_speed = region_config.sparse_infill_speed; + else if (params.extrusion_role == erTopSolidInfill) + params.top_surface_speed = region_config.top_surface_speed; + else if (params.extrusion_role == erSolidInfill) + params.solid_infill_speed = region_config.internal_solid_infill_speed; + } // Calculate flow spacing for infill pattern generation. if (surface.is_solid() || is_bridge) { params.spacing = params.flow.spacing(); diff --git a/src/libslic3r/Fill/Fill3DHoneycomb.cpp b/src/libslic3r/Fill/Fill3DHoneycomb.cpp index 6c8c099c4c..7b7a3b8878 100644 --- a/src/libslic3r/Fill/Fill3DHoneycomb.cpp +++ b/src/libslic3r/Fill/Fill3DHoneycomb.cpp @@ -186,15 +186,18 @@ static Polylines makeGrid(coordf_t z, coordf_t gridSize, coordf_t boundWidth, co // dont_adjust [avoid filling space evenly] // monotonic [fill strictly left to right] // complete [complete each loop] - + void Fill3DHoneycomb::_fill_surface_single( - const FillParams ¶ms, + const FillParams ¶ms, unsigned int thickness_layers, - const std::pair &direction, + const std::pair &direction, ExPolygon expolygon, Polylines &polylines_out) { // no rotation is supported for this infill pattern + // Support infill angle + auto infill_angle = float(this->angle); + if (std::abs(infill_angle) >= EPSILON) expolygon.rotate(-infill_angle); BoundingBox bb = expolygon.contour.bounding_box(); // Note: with equally-scaled X/Y/Z, the pattern will create a vertically-stretched @@ -216,7 +219,7 @@ void Fill3DHoneycomb::_fill_surface_single( // Z scale is adjusted to make the layer patterns consistent / symmetric // This means that the resultant infill won't be an ideal truncated octahedron, // but it should look better than the equivalent quantised version - + coordf_t layerHeight = scale_(thickness_layers); // ceiling to an integer value of layers per Z // (with a little nudge in case it's close to perfect) @@ -248,7 +251,7 @@ void Fill3DHoneycomb::_fill_surface_single( // (a module is 2*$gridSize since one $gridSize half-module is // growing while the other $gridSize half-module is shrinking) bb.merge(align_to_grid(bb.min, Point(gridSize*4, gridSize*4))); - + // generate pattern Polylines polylines = makeGrid( @@ -257,7 +260,7 @@ void Fill3DHoneycomb::_fill_surface_single( bb.size()(0), bb.size()(1), !params.dont_adjust); - + // move pattern in place for (Polyline &pl : polylines){ pl.translate(bb.min); @@ -266,11 +269,21 @@ void Fill3DHoneycomb::_fill_surface_single( // clip pattern to boundaries, chain the clipped polylines polylines = intersection_pl(polylines, to_polygons(expolygon)); - // connect lines if needed - if (params.dont_connect() || polylines.size() <= 1) + // copy from fliplines + if (!polylines.empty()) { + int infill_start_idx = polylines_out.size(); // only rotate what belongs to us. + // connect lines + if (params.dont_connect() || polylines.size() <= 1) append(polylines_out, chain_polylines(std::move(polylines))); - else + else this->connect_infill(std::move(polylines), expolygon, polylines_out, this->spacing, params); + + // rotate back + if (std::abs(infill_angle) >= EPSILON) { + for (auto it = polylines_out.begin() + infill_start_idx; it != polylines_out.end(); ++it) + it->rotate(infill_angle); + } + } } } // namespace Slic3r \ No newline at end of file diff --git a/src/libslic3r/Format/STL.cpp b/src/libslic3r/Format/STL.cpp index 133a7a5056..1888f5cd18 100644 --- a/src/libslic3r/Format/STL.cpp +++ b/src/libslic3r/Format/STL.cpp @@ -14,13 +14,13 @@ namespace Slic3r { -bool load_stl(const char *path, Model *model, const char *object_name_in, ImportstlProgressFn stlFn) +bool load_stl(const char *path, Model *model, const char *object_name_in, ImportstlProgressFn stlFn, int custom_header_length) { TriangleMesh mesh; std::string design_id; - if (! mesh.ReadSTLFile(path, true, stlFn)) { -// die "Failed to open $file\n" if !-e $path; + if (!mesh.ReadSTLFile(path, true, stlFn, custom_header_length)) { + // die "Failed to open $file\n" if !-e $path; return false; } if (mesh.empty()) { diff --git a/src/libslic3r/Format/STL.hpp b/src/libslic3r/Format/STL.hpp index 5f2f838bfe..e545e1c6d0 100644 --- a/src/libslic3r/Format/STL.hpp +++ b/src/libslic3r/Format/STL.hpp @@ -10,7 +10,7 @@ class TriangleMesh; class ModelObject; // Load an STL file into a provided model. -extern bool load_stl(const char *path, Model *model, const char *object_name = nullptr, ImportstlProgressFn stlFn = nullptr); +extern bool load_stl(const char *path, Model *model, const char *object_name = nullptr, ImportstlProgressFn stlFn = nullptr, int custom_header_length = 80); extern bool store_stl(const char *path, TriangleMesh *mesh, bool binary); extern bool store_stl(const char *path, ModelObject *model_object, bool binary); diff --git a/src/libslic3r/Format/bbs_3mf.cpp b/src/libslic3r/Format/bbs_3mf.cpp index a451c08492..8275cf7c5f 100644 --- a/src/libslic3r/Format/bbs_3mf.cpp +++ b/src/libslic3r/Format/bbs_3mf.cpp @@ -291,6 +291,8 @@ static constexpr const char* LOCK_ATTR = "locked"; static constexpr const char* BED_TYPE_ATTR = "bed_type"; static constexpr const char* PRINT_SEQUENCE_ATTR = "print_sequence"; static constexpr const char* FIRST_LAYER_PRINT_SEQUENCE_ATTR = "first_layer_print_sequence"; +static constexpr const char* OTHER_LAYERS_PRINT_SEQUENCE_ATTR = "other_layers_print_sequence"; +static constexpr const char* OTHER_LAYERS_PRINT_SEQUENCE_NUMS_ATTR = "other_layers_print_sequence_nums"; static constexpr const char* SPIRAL_VASE_MODE = "spiral_mode"; static constexpr const char* GCODE_FILE_ATTR = "gcode_file"; static constexpr const char* THUMBNAIL_FILE_ATTR = "thumbnail_file"; @@ -1491,6 +1493,8 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) plate->is_label_object_enabled = it->second->is_label_object_enabled; plate->skipped_objects = it->second->skipped_objects; plate->slice_filaments_info = it->second->slice_filaments_info; + plate->printer_model_id = it->second->printer_model_id; + plate->nozzle_diameters = it->second->nozzle_diameters; plate->warnings = it->second->warnings; plate->thumbnail_file = it->second->thumbnail_file; if (plate->thumbnail_file.empty()) { @@ -4096,6 +4100,19 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) }; m_curr_plater->config.set_key_value("first_layer_print_sequence", new ConfigOptionInts(get_vector_from_string(value))); } + else if (key == OTHER_LAYERS_PRINT_SEQUENCE_ATTR) { + auto get_vector_from_string = [](const std::string &str) -> std::vector { + std::stringstream stream(str); + int value; + std::vector results; + while (stream >> value) { results.push_back(value); } + return results; + }; + m_curr_plater->config.set_key_value("other_layers_print_sequence", new ConfigOptionInts(get_vector_from_string(value))); + } + else if (key == OTHER_LAYERS_PRINT_SEQUENCE_NUMS_ATTR) { + m_curr_plater->config.set_key_value("other_layers_print_sequence_nums", new ConfigOptionInt(stoi(value))); + } else if (key == SPIRAL_VASE_MODE) { bool spiral_mode = false; std::istringstream(value) >> std::boolalpha >> spiral_mode; @@ -4185,6 +4202,16 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) if (m_curr_plater) std::istringstream(value) >> std::boolalpha >> m_curr_plater->is_label_object_enabled; } + else if (key == PRINTER_MODEL_ID_ATTR) + { + if (m_curr_plater) + m_curr_plater->printer_model_id = value; + } + else if (key == NOZZLE_DIAMETERS_ATTR) + { + if (m_curr_plater) + m_curr_plater->nozzle_diameters = value; + } } return true; @@ -7415,6 +7442,24 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) stream << "\"/>\n"; } + + ConfigOptionInts *other_layers_print_sequence_opt = plate_data->config.option("other_layers_print_sequence"); + if (other_layers_print_sequence_opt != nullptr) { + stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << OTHER_LAYERS_PRINT_SEQUENCE_ATTR << "\" " << VALUE_ATTR << "=\""; + const std::vector &values = other_layers_print_sequence_opt->values; + for (int i = 0; i < values.size(); ++i) { + stream << values[i]; + if (i != (values.size() - 1)) + stream << " "; + } + stream << "\"/>\n"; + } + + const ConfigOptionInt *sequence_nums_opt = dynamic_cast(plate_data->config.option("other_layers_print_sequence_nums")); + if (sequence_nums_opt != nullptr) { + stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << OTHER_LAYERS_PRINT_SEQUENCE_NUMS_ATTR << "\" " << VALUE_ATTR << "=\"" << sequence_nums_opt->getInt() << "\"/>\n"; + } + ConfigOption* spiral_mode_opt = plate_data->config.option("spiral_mode"); if (spiral_mode_opt) stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << SPIRAL_VASE_MODE << "\" " << VALUE_ATTR << "=\"" << spiral_mode_opt->getBool() << "\"/>\n"; @@ -7780,18 +7825,22 @@ bool _BBS_3MF_Exporter::_add_auxiliary_dir_to_archive(mz_zip_archive &archive, c int root_dir_len = dir.string().length() + 1; //boost file access while (!directories.empty()) { - boost::filesystem::directory_iterator iterator(directories.front()); + boost::system::error_code ec; + boost::filesystem::directory_iterator iterator(directories.front(), ec); directories.pop_front(); - for (auto &dir_entry : iterator) + if (ec) continue; + for (; iterator != end(iterator); iterator.increment(ec)) { + if (ec) break; + auto dir_entry = *iterator; std::string src_file; std::string dst_in_3mf; - if (boost::filesystem::is_directory(dir_entry.path())) + if (boost::filesystem::is_directory(dir_entry.path(), ec)) { directories.push_back(dir_entry.path()); continue; } - if (boost::filesystem::is_regular_file(dir_entry.path()) && !m_skip_auxiliary) + if (boost::filesystem::is_regular_file(dir_entry.path(), ec) && !m_skip_auxiliary) { src_file = dir_entry.path().string(); dst_in_3mf = dir_entry.path().string(); diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 6664294962..467ec4bbeb 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -639,6 +639,8 @@ static std::vector get_path_of_change_filament(const Print& print) } gcodegen.placeholder_parser().set("current_extruder", new_extruder_id); + gcodegen.placeholder_parser().set("retraction_distance_when_cut", gcodegen.m_config.retraction_distances_when_cut.get_at(new_extruder_id)); + gcodegen.placeholder_parser().set("long_retraction_when_cut", gcodegen.m_config.long_retractions_when_cut.get_at(new_extruder_id)); // Process the start filament gcode. std::string start_filament_gcode_str; @@ -1425,8 +1427,21 @@ namespace DoExport { total_cost += weight * extruder->filament_cost() * 0.001; } - total_cost += config.time_cost.getFloat() * (normal_print_time/3600.0); - + for (auto volume : result.print_statistics.support_volumes_per_extruder) { + total_extruded_volume += volume.second; + + size_t extruder_id = volume.first; + auto extruder = std::find_if(extruders.begin(), extruders.end(), [extruder_id](const Extruder& extr) {return extr.id() == extruder_id; }); + if (extruder == extruders.end()) + continue; + + double s = PI * sqr(0.5* extruder->filament_diameter()); + double weight = volume.second * extruder->filament_density() * 0.001; + total_used_filament += volume.second/s; + total_weight += weight; + total_cost += weight * extruder->filament_cost() * 0.001; + } + print_statistics.total_extruded_volume = total_extruded_volume; print_statistics.total_used_filament = total_used_filament; print_statistics.total_weight = total_weight; @@ -1613,6 +1628,15 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu m_processor.result().timelapse_warning_code = m_timelapse_warning_code; m_processor.result().support_traditional_timelapse = m_support_traditional_timelapse; + bool activate_long_retraction_when_cut = false; + for (const auto& extruder : m_writer.extruders()) + activate_long_retraction_when_cut |= ( + m_config.long_retractions_when_cut.get_at(extruder.id()) + && m_config.retraction_distances_when_cut.get_at(extruder.id()) > 0 + ); + + m_processor.result().long_retraction_when_cut = activate_long_retraction_when_cut; + { //BBS:check bed and filament compatible const ConfigOptionDef *bed_type_def = print_config_def.get("curr_bed_type"); assert(bed_type_def != nullptr); @@ -2275,6 +2299,12 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato this->placeholder_parser().set("initial_no_support_tool", initial_non_support_extruder_id); this->placeholder_parser().set("initial_no_support_extruder", initial_non_support_extruder_id); this->placeholder_parser().set("current_extruder", initial_extruder_id); + //set the key for compatibilty + this->placeholder_parser().set("retraction_distance_when_cut", m_config.retraction_distances_when_cut.get_at(initial_extruder_id)); + this->placeholder_parser().set("long_retraction_when_cut", m_config.long_retractions_when_cut.get_at(initial_extruder_id)); + + this->placeholder_parser().set("retraction_distances_when_cut", new ConfigOptionFloats(m_config.retraction_distances_when_cut)); + this->placeholder_parser().set("long_retractions_when_cut",new ConfigOptionBools(m_config.long_retractions_when_cut)); //Set variable for total layer count so it can be used in custom gcode. this->placeholder_parser().set("total_layer_count", m_layer_count); // Useful for sequential prints. @@ -2295,6 +2325,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato { BoundingBoxf bbox_bed(print.config().printable_area.values); + Vec2f plate_offset = m_writer.get_xy_offset(); this->placeholder_parser().set("print_bed_min", new ConfigOptionFloats({ bbox_bed.min.x(), bbox_bed.min.y()})); this->placeholder_parser().set("print_bed_max", new ConfigOptionFloats({ bbox_bed.max.x(), bbox_bed.max.y()})); this->placeholder_parser().set("print_bed_size", new ConfigOptionFloats({ bbox_bed.size().x(), bbox_bed.size().y() })); @@ -2322,12 +2353,37 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato pts->values.emplace_back(print.translate_to_print_space(pt)); bbox = BoundingBoxf((pts->values)); } - BoundingBoxf bbox_head_wrap_zone (print.config().head_wrap_detect_zone.values); this->placeholder_parser().set("first_layer_print_convex_hull", pts.release()); this->placeholder_parser().set("first_layer_print_min", new ConfigOptionFloats({bbox.min.x(), bbox.min.y()})); this->placeholder_parser().set("first_layer_print_max", new ConfigOptionFloats({bbox.max.x(), bbox.max.y()})); this->placeholder_parser().set("first_layer_print_size", new ConfigOptionFloats({ bbox.size().x(), bbox.size().y() })); - this->placeholder_parser().set("in_head_wrap_detect_zone",bbox_head_wrap_zone.overlap(bbox)); + + { + // use first layer convex_hull union with each object's bbox to check whether in head detect zone + Polygons object_projections; + for (auto& obj : print.objects()) { + for (auto& instance : obj->instances()) { + const auto& bbox = instance.get_bounding_box(); + Point min_p{ coord_t(scale_(bbox.min.x())),coord_t(scale_(bbox.min.y())) }; + Point max_p{ coord_t(scale_(bbox.max.x())),coord_t(scale_(bbox.max.y())) }; + Polygon instance_projection = { + {min_p.x(),min_p.y()}, + {max_p.x(),min_p.y()}, + {max_p.x(),max_p.y()}, + {min_p.x(),max_p.y()} + }; + object_projections.emplace_back(std::move(instance_projection)); + } + } + object_projections.emplace_back(print.first_layer_convex_hull()); + + Polygons project_polys = union_(object_projections); + Polygon head_wrap_detect_zone; + for (auto& point : print.config().head_wrap_detect_zone.values) + head_wrap_detect_zone.append(scale_(point).cast() + scale_(plate_offset).cast()); + + this->placeholder_parser().set("in_head_wrap_detect_zone", !intersection_pl(project_polys, {head_wrap_detect_zone}).empty()); + } BoundingBoxf mesh_bbox(m_config.bed_mesh_min, m_config.bed_mesh_max); auto mesh_margin = m_config.adaptive_bed_mesh_margin.value; @@ -4705,6 +4761,7 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou // Calculate the sloped loop ExtrusionLoopSloped new_loop(paths, seam_gap, slope_min_length, slope_max_segment_length, start_slope_ratio, loop.loop_role()); + new_loop.clip_slope(seam_gap); // Then extrude it for (const auto& p : new_loop.get_all_paths()) { @@ -4985,6 +5042,30 @@ static std::map overhang_speed_key_map = {5, "bridge_speed"}, }; +double GCode::get_overhang_degree_corr_speed(float normal_speed, double path_degree) { + + //BBS: protection: overhang degree is float, make sure it not excess degree range + if (path_degree <= 0) + return normal_speed; + + if (path_degree >= 5 ) + return m_config.get_abs_value(overhang_speed_key_map[5].c_str()); + + int lower_degree_bound = int(path_degree); + if (path_degree==lower_degree_bound) + return m_config.get_abs_value(overhang_speed_key_map[lower_degree_bound].c_str()); + int upper_degree_bound = lower_degree_bound + 1; + + double lower_speed_bound = lower_degree_bound == 0 ? normal_speed : m_config.get_abs_value(overhang_speed_key_map[lower_degree_bound].c_str()); + double upper_speed_bound = upper_degree_bound == 0 ? normal_speed : m_config.get_abs_value(overhang_speed_key_map[upper_degree_bound].c_str()); + + lower_speed_bound = lower_speed_bound == 0 ? normal_speed : lower_speed_bound; + upper_speed_bound = upper_speed_bound == 0 ? normal_speed : upper_speed_bound; + + double speed_out = lower_speed_bound + (upper_speed_bound - lower_speed_bound) * (path_degree - lower_degree_bound); + return speed_out; +} + std::string GCode::_extrude(const ExtrusionPath &path, std::string description, double speed) { std::string gcode; @@ -5092,12 +5173,11 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, // set speed if (speed == -1) { - int overhang_degree = path.get_overhang_degree(); if (path.role() == erPerimeter) { speed = m_config.get_abs_value("inner_wall_speed"); - if (m_config.overhang_speed_classic.value && m_config.enable_overhang_speed.value && overhang_degree > 0 && - overhang_degree <= 5) { - double new_speed = m_config.get_abs_value(overhang_speed_key_map[overhang_degree].c_str()); + if (m_config.overhang_speed_classic.value && m_config.enable_overhang_speed.value) { + double new_speed = 0; + new_speed = get_overhang_degree_corr_speed(speed, path.overhang_degree); speed = new_speed == 0.0 ? speed : new_speed; } @@ -5106,9 +5186,9 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, } } else if (path.role() == erExternalPerimeter) { speed = m_config.get_abs_value("outer_wall_speed"); - if (m_config.overhang_speed_classic.value && m_config.enable_overhang_speed.value && - overhang_degree > 0 && overhang_degree <= 5) { - double new_speed = m_config.get_abs_value(overhang_speed_key_map[overhang_degree].c_str()); + if (m_config.overhang_speed_classic.value && m_config.enable_overhang_speed.value ) { + double new_speed = 0; + new_speed = get_overhang_degree_corr_speed(speed, path.overhang_degree); speed = new_speed == 0.0 ? speed : new_speed; } if (sloped) { @@ -5405,6 +5485,8 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, for (const Line& line : path.polyline.lines()) { std::string tempDescription = description; const double line_length = line.length() * SCALING_FACTOR; + if (line_length < EPSILON) + continue; path_length += line_length; auto dE = e_per_mm * line_length; if (m_small_area_infill_flow_compensator && m_config.small_area_infill_flow_compensation.value) { @@ -5444,6 +5526,8 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, for (size_t point_index = start_index + 1; point_index < end_index + 1; point_index++) { const Line line = Line(path.polyline.points[point_index - 1], path.polyline.points[point_index]); const double line_length = line.length() * SCALING_FACTOR; + if (line_length < EPSILON) + continue; auto dE = e_per_mm * line_length; if (m_small_area_infill_flow_compensator && m_config.small_area_infill_flow_compensation.value) { auto oldE = dE; @@ -5464,6 +5548,8 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, case EMovePathType::Arc_move_ccw: { const ArcSegment& arc = fitting_result[fitting_index].arc_data; const double arc_length = fitting_result[fitting_index].arc_data.length * SCALING_FACTOR; + if (arc_length < EPSILON) + continue; const Vec2d center_offset = this->point_to_gcode(arc.center) - this->point_to_gcode(arc.start_point); auto dE = e_per_mm * arc_length; if (m_small_area_infill_flow_compensator && m_config.small_area_infill_flow_compensation.value) { @@ -5545,6 +5631,8 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, } const double line_length = (p - prev).norm(); + if(line_length < EPSILON) + continue; path_length += line_length; double new_speed = pre_processed_point.speed * 60.0; if (last_set_speed != new_speed) { @@ -5971,6 +6059,8 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z, bool b // if we are running a single-extruder setup, just set the extruder and return nothing if (!m_writer.multiple_extruders) { this->placeholder_parser().set("current_extruder", extruder_id); + this->placeholder_parser().set("retraction_distance_when_cut", m_config.retraction_distances_when_cut.get_at(extruder_id)); + this->placeholder_parser().set("long_retraction_when_cut", m_config.long_retractions_when_cut.get_at(extruder_id)); std::string gcode; // Append the filament start G-code. @@ -6162,6 +6252,8 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z, bool b } this->placeholder_parser().set("current_extruder", extruder_id); + this->placeholder_parser().set("retraction_distance_when_cut", m_config.retraction_distances_when_cut.get_at(extruder_id)); + this->placeholder_parser().set("long_retraction_when_cut", m_config.long_retractions_when_cut.get_at(extruder_id)); // Append the filament start G-code. const std::string &filament_start_gcode = m_config.filament_start_gcode.get_at(extruder_id); diff --git a/src/libslic3r/GCode.hpp b/src/libslic3r/GCode.hpp index 03ba079fae..18ea653546 100644 --- a/src/libslic3r/GCode.hpp +++ b/src/libslic3r/GCode.hpp @@ -577,6 +577,7 @@ private: int get_bed_temperature(const int extruder_id, const bool is_first_layer, const BedType bed_type) const; std::string _extrude(const ExtrusionPath &path, std::string description = "", double speed = -1); + double get_overhang_degree_corr_speed(float speed, double path_degree); void print_machine_envelope(GCodeOutputStream &file, Print &print); void _print_first_layer_bed_temperature(GCodeOutputStream &file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait); void _print_first_layer_extruder_temperatures(GCodeOutputStream &file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait); diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 2ae00168d7..9258c6bf5d 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -762,6 +762,15 @@ void GCodeProcessor::UsedFilaments::reset() wipe_tower_cache = 0.0f; wipe_tower_volume_per_extruder.clear(); + + support_volume_cache = 0.0f; + support_volume_per_extruder.clear(); +} + +void GCodeProcessor::UsedFilaments::increase_support_caches(double extruded_volume) +{ + support_volume_cache += extruded_volume; + role_cache += extruded_volume; } void GCodeProcessor::UsedFilaments::increase_model_caches(double extruded_volume) @@ -774,6 +783,7 @@ void GCodeProcessor::UsedFilaments::increase_model_caches(double extruded_volume void GCodeProcessor::UsedFilaments::increase_wipe_tower_caches(double extruded_volume) { wipe_tower_cache += extruded_volume; + role_cache += extruded_volume; } void GCodeProcessor::UsedFilaments::process_color_change_cache() @@ -808,6 +818,18 @@ void GCodeProcessor::UsedFilaments::process_wipe_tower_cache(GCodeProcessor* pro } } +void GCodeProcessor::UsedFilaments::process_support_cache(GCodeProcessor* processor) +{ + size_t active_extruder_id = processor->m_extruder_id; + if (support_volume_cache != 0.0f){ + if (support_volume_per_extruder.find(active_extruder_id) != support_volume_per_extruder.end()) + support_volume_per_extruder[active_extruder_id] += support_volume_cache; + else + support_volume_per_extruder[active_extruder_id] = support_volume_cache; + support_volume_cache = 0.0f; + } +} + void GCodeProcessor::UsedFilaments::update_flush_per_filament(size_t extrude_id, float flush_volume) { if (flush_per_filament.find(extrude_id) != flush_per_filament.end()) @@ -842,6 +864,7 @@ void GCodeProcessor::UsedFilaments::process_caches(GCodeProcessor* processor) process_model_cache(processor); process_role_cache(processor); process_wipe_tower_cache(processor); + process_support_cache(processor); } #if ENABLE_GCODE_VIEWER_STATISTICS @@ -885,6 +908,7 @@ void GCodeProcessorResult::reset() { toolpath_outside = false; //BBS: add label_object_enabled label_object_enabled = false; + long_retraction_when_cut = false; timelapse_warning_code = 0; printable_height = 0.0f; settings_ids.reset(); @@ -2932,7 +2956,10 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line) float delta_xyz = std::sqrt(sqr(delta_pos[X]) + sqr(delta_pos[Y]) + sqr(delta_pos[Z])); float volume_extruded_filament = area_filament_cross_section * delta_pos[E]; float area_toolpath_cross_section = volume_extruded_filament / delta_xyz; - if (m_wipe_tower) { + + if(m_extrusion_role == ExtrusionRole::erSupportMaterial || m_extrusion_role == ExtrusionRole::erSupportMaterialInterface || m_extrusion_role ==ExtrusionRole::erSupportTransition) + m_used_filaments.increase_support_caches(volume_extruded_filament); + else if (m_extrusion_role==ExtrusionRole::erWipeTower) { m_used_filaments.increase_wipe_tower_caches(volume_extruded_filament); } else { @@ -3406,7 +3433,10 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line) if (type == EMoveType::Extrude) { float volume_extruded_filament = area_filament_cross_section * delta_pos[E]; float area_toolpath_cross_section = volume_extruded_filament / delta_xyz; - if (m_wipe_tower) { + + if(m_extrusion_role == ExtrusionRole::erSupportMaterial || m_extrusion_role == ExtrusionRole::erSupportMaterialInterface || m_extrusion_role ==ExtrusionRole::erSupportTransition) + m_used_filaments.increase_support_caches(volume_extruded_filament); + else if (m_extrusion_role == ExtrusionRole::erWipeTower) { //BBS: save wipe tower volume to the cache m_used_filaments.increase_wipe_tower_caches(volume_extruded_filament); } @@ -4511,6 +4541,7 @@ void GCodeProcessor::process_filaments(CustomGCode::Type code) if (code == CustomGCode::ToolChange) { m_used_filaments.process_model_cache(this); + m_used_filaments.process_support_cache(this); //BBS: reset remaining filament m_remaining_volume = m_nozzle_volume; } @@ -4544,6 +4575,7 @@ void GCodeProcessor::update_estimated_times_stats() m_result.print_statistics.volumes_per_color_change = m_used_filaments.volumes_per_color_change; m_result.print_statistics.volumes_per_extruder = m_used_filaments.volumes_per_extruder; m_result.print_statistics.wipe_tower_volumes_per_extruder = m_used_filaments.wipe_tower_volume_per_extruder; + m_result.print_statistics.support_volumes_per_extruder = m_used_filaments.support_volume_per_extruder; m_result.print_statistics.flush_per_filament = m_used_filaments.flush_per_filament; m_result.print_statistics.used_filaments_per_role = m_used_filaments.filaments_per_role; } diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index 2b3a46206a..ed38b2af37 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -22,6 +22,7 @@ namespace Slic3r { #define BED_TEMP_TOO_HIGH_THAN_FILAMENT "bed_temperature_too_high_than_filament" #define NOT_SUPPORT_TRADITIONAL_TIMELAPSE "not_support_traditional_timelapse" #define NOT_GENERATE_TIMELAPSE "not_generate_timelapse" +#define LONG_RETRACTION_WHEN_CUT "activate_long_retraction_when_cut" enum class EMoveType : unsigned char { @@ -74,6 +75,7 @@ namespace Slic3r { std::vector volumes_per_color_change; std::map volumes_per_extruder; std::map wipe_tower_volumes_per_extruder; + std::map support_volumes_per_extruder; //BBS: the flush amount of every filament std::map flush_per_filament; std::map> used_filaments_per_role; @@ -195,6 +197,8 @@ namespace Slic3r { bool toolpath_outside; //BBS: add object_label_enabled bool label_object_enabled; + //BBS : extra retraction when change filament,experiment func + bool long_retraction_when_cut {0}; int timelapse_warning_code {0}; bool support_traditional_timelapse{true}; float printable_height; @@ -231,6 +235,7 @@ namespace Slic3r { bed_exclude_area = other.bed_exclude_area; toolpath_outside = other.toolpath_outside; label_object_enabled = other.label_object_enabled; + long_retraction_when_cut = other.long_retraction_when_cut; timelapse_warning_code = other.timelapse_warning_code; printable_height = other.printable_height; settings_ids = other.settings_ids; @@ -500,6 +505,9 @@ namespace Slic3r { double wipe_tower_cache; std::mapwipe_tower_volume_per_extruder; + double support_volume_cache; + std::mapsupport_volume_per_extruder; + //BBS: the flush amount of every filament std::map flush_per_filament; @@ -508,12 +516,15 @@ namespace Slic3r { void reset(); + void increase_support_caches(double extruded_volume); void increase_model_caches(double extruded_volume); void increase_wipe_tower_caches(double extruded_volume); void process_color_change_cache(); void process_model_cache(GCodeProcessor* processor); void process_wipe_tower_cache(GCodeProcessor* processor); + void process_support_cache(GCodeProcessor* processor); + void update_flush_per_filament(size_t extrude_id, float flush_length); void process_role_cache(GCodeProcessor* processor); void process_caches(GCodeProcessor* processor); diff --git a/src/libslic3r/GCode/SpiralVase.cpp b/src/libslic3r/GCode/SpiralVase.cpp index e1440bc7db..8462e73111 100644 --- a/src/libslic3r/GCode/SpiralVase.cpp +++ b/src/libslic3r/GCode/SpiralVase.cpp @@ -164,13 +164,19 @@ std::string SpiralVase::process_layer(const std::string &gcode, bool last_layer) if (found && dist < max_xy_dist_for_smoothing) { // Interpolate between the point on this layer and the point on the previous layer SpiralVase::SpiralPoint target = SpiralVaseHelpers::add(SpiralVaseHelpers::scale(nearestp, 1 - factor), SpiralVaseHelpers::scale(p, factor)); - line.set(reader, X, target.x); - line.set(reader, Y, target.y); + + // Remove tiny movement // We need to figure out the distance of this new line! float modified_dist_XY = SpiralVaseHelpers::distance(last_point, target); - // Scale the extrusion amount according to change in length - line.set(reader, E, line.e() * modified_dist_XY / dist_XY, 5 /*decimal_digits*/); - last_point = target; + if (modified_dist_XY < 0.001) + line.clear(); + else { + line.set(reader, X, target.x); + line.set(reader, Y, target.y); + // Scale the extrusion amount according to change in length + line.set(reader, E, line.e() * modified_dist_XY / dist_XY, 5 /*decimal_digits*/); + last_point = target; + } } else { last_point = p; } diff --git a/src/libslic3r/GCode/ToolOrdering.cpp b/src/libslic3r/GCode/ToolOrdering.cpp index a5aaf4e00b..dc272e9464 100644 --- a/src/libslic3r/GCode/ToolOrdering.cpp +++ b/src/libslic3r/GCode/ToolOrdering.cpp @@ -1,6 +1,8 @@ #include "Print.hpp" #include "ToolOrdering.hpp" #include "Layer.hpp" +#include "ClipperUtils.hpp" +#include "ParameterUtils.hpp" // #define SLIC3R_DEBUG @@ -21,9 +23,74 @@ namespace Slic3r { const static bool g_wipe_into_objects = false; + +// Shortest hamilton path problem +static std::vector solve_extruder_order(const std::vector>& wipe_volumes, std::vector all_extruders, unsigned int start_extruder_id) +{ + auto start_iter = std::find(all_extruders.begin(), all_extruders.end(), start_extruder_id); + bool add_start_extruder_flag = false; + if (start_iter == all_extruders.end()) + all_extruders.insert(all_extruders.begin(), start_extruder_id), add_start_extruder_flag = true; + else + std::swap(*all_extruders.begin(), *start_iter); + + unsigned int iterations = (1 << all_extruders.size()); + unsigned int final_state = iterations - 1; + std::vector>cache(iterations, std::vector(all_extruders.size(),0x7fffffff)); + std::vector>prev(iterations, std::vector(all_extruders.size(), -1)); + cache[1][0] = 0.; + for (unsigned int state = 0; state < iterations; ++state) { + if (state & 1) { + for (unsigned int target = 0; target < all_extruders.size(); ++target) { + if (state >> target & 1) { + for (unsigned int mid_point = 0; mid_point < all_extruders.size(); ++mid_point) { + if(state>>mid_point&1){ + auto tmp = cache[state - (1 << target)][mid_point] + wipe_volumes[all_extruders[mid_point]][all_extruders[target]]; + if (cache[state][target] >tmp) { + cache[state][target] = tmp; + prev[state][target] = mid_point; + } + } + } + } + } + } + } + + //get res + float cost = std::numeric_limits::max(); + int final_dst =0; + for (unsigned int dst = 0; dst < all_extruders.size(); ++dst) { + if (all_extruders[dst] != start_extruder_id && cost > cache[final_state][dst]) { + cost = cache[final_state][dst]; + final_dst = dst; + } + } + + std::vectorpath; + unsigned int curr_state = final_state; + int curr_point = final_dst; + while (curr_point != -1) { + path.emplace_back(all_extruders[curr_point]); + auto mid_point = prev[curr_state][curr_point]; + curr_state -= (1 << curr_point); + curr_point = mid_point; + }; + + if (add_start_extruder_flag) + path.pop_back(); + + std::reverse(path.begin(), path.end()); + return path; +} + std::vector get_extruders_order(const std::vector> &wipe_volumes, std::vector all_extruders, unsigned int start_extruder_id) { - if (all_extruders.size() > 1) { +#define USE_DP_OPTIMIZE +#ifdef USE_DP_OPTIMIZE + return solve_extruder_order(wipe_volumes, all_extruders, start_extruder_id); +#else +if (all_extruders.size() > 1) { int begin_index = 0; auto iter = std::find(all_extruders.begin(), all_extruders.end(), start_extruder_id); if (iter != all_extruders.end()) { @@ -52,6 +119,8 @@ std::vector get_extruders_order(const std::vector(number_of_extruders, print_config->prime_volume)); } + auto extruders_to_hash_key = [](const std::vector& extruders, unsigned int initial_extruder_id)->uint32_t { + uint32_t hash_key = 0; + // high 16 bit define initial extruder ,low 16 bit define extruder set + hash_key |= (1 << (16 + initial_extruder_id)); + for (auto item : extruders) + hash_key |= (1 << item); + return hash_key; + }; + + std::vector other_layers_seqs; + const ConfigOptionInts *other_layers_print_sequence_op = print_config->option("other_layers_print_sequence"); + const ConfigOptionInt *other_layers_print_sequence_nums_op = print_config->option("other_layers_print_sequence_nums"); + if (other_layers_print_sequence_op && other_layers_print_sequence_nums_op) { + const std::vector &print_sequence = other_layers_print_sequence_op->values; + int sequence_nums = other_layers_print_sequence_nums_op->value; + other_layers_seqs = get_other_layers_print_sequence(sequence_nums, print_sequence); + } + + // other_layers_seq: the layer_idx and extruder_idx are base on 1 + auto get_custom_seq = [&other_layers_seqs](int layer_idx, std::vector& out_seq) -> bool { + for (size_t idx = other_layers_seqs.size() - 1; idx != size_t(-1); --idx) { + const auto &other_layers_seq = other_layers_seqs[idx]; + if (layer_idx + 1 >= other_layers_seq.first.first && layer_idx + 1 <= other_layers_seq.first.second) { + out_seq = other_layers_seq.second; + return true; + } + } + return false; + }; + unsigned int current_extruder_id = -1; for (int i = 0; i < m_layer_tools.size(); ++i) { LayerTools& lt = m_layer_tools[i]; if (lt.extruders.empty()) continue; - // todo: The algorithm complexity is too high(o(n2)), currently only 12 colors are supported - if (i != 0 && lt.extruders.size() <= 12) { - lt.extruders = get_extruders_order(wipe_volumes, lt.extruders, current_extruder_id); + + std::vector custom_extruder_seq; + if (get_custom_seq(i, custom_extruder_seq) && !custom_extruder_seq.empty()) { + std::vector unsign_custom_extruder_seq; + for (int extruder : custom_extruder_seq) { + unsigned int unsign_extruder = static_cast(extruder) - 1; + auto it = std::find(lt.extruders.begin(), lt.extruders.end(), unsign_extruder); + if (it != lt.extruders.end()) { + unsign_custom_extruder_seq.emplace_back(unsign_extruder); + } + } + assert(lt.extruders.size() == unsign_custom_extruder_seq.size()); + lt.extruders = unsign_custom_extruder_seq; + current_extruder_id = lt.extruders.back(); + continue; + } + + // The algorithm complexity is O(n2*2^n) + if (i != 0) { + auto hash_key = extruders_to_hash_key(lt.extruders, current_extruder_id); + auto iter = m_tool_order_cache.find(hash_key); + if (iter == m_tool_order_cache.end()) { + lt.extruders = get_extruders_order(wipe_volumes, lt.extruders, current_extruder_id); + std::vector hash_val; + hash_val.reserve(lt.extruders.size()); + for (auto item : lt.extruders) + hash_val.emplace_back(static_cast(item)); + m_tool_order_cache[hash_key] = hash_val; + } + else { + std::vectorextruder_order; + extruder_order.reserve(iter->second.size()); + for (auto item : iter->second) + extruder_order.emplace_back(static_cast(item)); + lt.extruders = std::move(extruder_order); + } } current_extruder_id = lt.extruders.back(); } diff --git a/src/libslic3r/GCode/ToolOrdering.hpp b/src/libslic3r/GCode/ToolOrdering.hpp index 1cc6f74c8a..d9a93131a7 100644 --- a/src/libslic3r/GCode/ToolOrdering.hpp +++ b/src/libslic3r/GCode/ToolOrdering.hpp @@ -156,7 +156,9 @@ public: // (print->config().print_sequence == PrintSequence::ByObject is false). ToolOrdering(const Print& print, unsigned int first_extruder, bool prime_multi_material = false); - void clear() { m_layer_tools.clear(); } + void clear() { + m_layer_tools.clear(); m_tool_order_cache.clear(); + } // Only valid for non-sequential print: // Assign a pointer to a custom G-code to the respective ToolOrdering::LayerTools. @@ -207,7 +209,7 @@ private: unsigned int m_last_printing_extruder = (unsigned int)-1; // All extruders, which extrude some material over m_layer_tools. std::vector m_all_printing_extruders; - + std::unordered_map> m_tool_order_cache; const PrintConfig* m_print_config_ptr = nullptr; const PrintObject* m_print_object_ptr = nullptr; bool m_is_BBL_printer = false; diff --git a/src/libslic3r/GCodeReader.hpp b/src/libslic3r/GCodeReader.hpp index ea0df3dd70..52a37dde55 100644 --- a/src/libslic3r/GCodeReader.hpp +++ b/src/libslic3r/GCodeReader.hpp @@ -26,6 +26,7 @@ public: const std::string_view comment() const { size_t pos = m_raw.find(';'); return (pos == std::string::npos) ? std::string_view() : std::string_view(m_raw).substr(pos + 1); } + void clear() { m_raw.clear(); } bool has(Axis axis) const { return (m_mask & (1 << int(axis))) != 0; } float value(Axis axis) const { return m_axis[axis]; } bool has(char axis) const; diff --git a/src/libslic3r/Geometry/MedialAxis.cpp b/src/libslic3r/Geometry/MedialAxis.cpp index 39677c9285..44eccd9851 100644 --- a/src/libslic3r/Geometry/MedialAxis.cpp +++ b/src/libslic3r/Geometry/MedialAxis.cpp @@ -448,7 +448,7 @@ MedialAxis::MedialAxis(double min_width, double max_width, const ExPolygon &expo void MedialAxis::build(ThickPolylines* polylines) { - construct_voronoi(m_lines.begin(), m_lines.end(), &m_vd); + m_vd.construct_voronoi(m_lines.begin(), m_lines.end()); Slic3r::Voronoi::annotate_inside_outside(m_vd, m_lines); // static constexpr double threshold_alpha = M_PI / 12.; // 30 degrees // std::vector skeleton_edges = Slic3r::Voronoi::skeleton_edges_rough(vd, lines, threshold_alpha); diff --git a/src/libslic3r/Geometry/Voronoi.cpp b/src/libslic3r/Geometry/Voronoi.cpp new file mode 100644 index 0000000000..e1df7322a4 --- /dev/null +++ b/src/libslic3r/Geometry/Voronoi.cpp @@ -0,0 +1,354 @@ +#include "Voronoi.hpp" + +#include "libslic3r/Arachne/utils/PolygonsSegmentIndex.hpp" +#include "libslic3r/Geometry/VoronoiUtils.hpp" +#include "libslic3r/Geometry/VoronoiUtilsCgal.hpp" +#include "libslic3r/MultiMaterialSegmentation.hpp" + +#include + +namespace Slic3r::Geometry { + +using PolygonsSegmentIndexConstIt = std::vector::const_iterator; +using LinesIt = Lines::iterator; +using ColoredLinesConstIt = ColoredLines::const_iterator; + +// Explicit template instantiation. +template void VoronoiDiagram::construct_voronoi(LinesIt, LinesIt, bool); +template void VoronoiDiagram::construct_voronoi(ColoredLinesConstIt, ColoredLinesConstIt, bool); +template void VoronoiDiagram::construct_voronoi(PolygonsSegmentIndexConstIt, PolygonsSegmentIndexConstIt, bool); + +template +typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + void>::type +VoronoiDiagram::construct_voronoi(const SegmentIterator segment_begin, const SegmentIterator segment_end, const bool try_to_repair_if_needed) { + boost::polygon::construct_voronoi(segment_begin, segment_end, &m_voronoi_diagram); + if (try_to_repair_if_needed) { + if (m_issue_type = detect_known_issues(*this, segment_begin, segment_end); m_issue_type != IssueType::NO_ISSUE_DETECTED) { + if (m_issue_type == IssueType::MISSING_VORONOI_VERTEX) { + BOOST_LOG_TRIVIAL(warning) << "Detected missing Voronoi vertex, input polygons will be rotated back and forth."; + } else if (m_issue_type == IssueType::NON_PLANAR_VORONOI_DIAGRAM) { + BOOST_LOG_TRIVIAL(warning) << "Detected non-planar Voronoi diagram, input polygons will be rotated back and forth."; + } else if (m_issue_type == IssueType::VORONOI_EDGE_INTERSECTING_INPUT_SEGMENT) { + BOOST_LOG_TRIVIAL(warning) << "Detected Voronoi edge intersecting input segment, input polygons will be rotated back and forth."; + } else if (m_issue_type == IssueType::FINITE_EDGE_WITH_NON_FINITE_VERTEX) { + BOOST_LOG_TRIVIAL(warning) << "Detected finite Voronoi vertex with non finite vertex, input polygons will be rotated back and forth."; + } else { + BOOST_LOG_TRIVIAL(error) << "Detected unknown Voronoi diagram issue, input polygons will be rotated back and forth."; + } + + if (m_issue_type = try_to_repair_degenerated_voronoi_diagram(segment_begin, segment_end); m_issue_type != IssueType::NO_ISSUE_DETECTED) { + if (m_issue_type == IssueType::MISSING_VORONOI_VERTEX) { + BOOST_LOG_TRIVIAL(error) << "Detected missing Voronoi vertex even after the rotation of input."; + } else if (m_issue_type == IssueType::NON_PLANAR_VORONOI_DIAGRAM) { + BOOST_LOG_TRIVIAL(error) << "Detected non-planar Voronoi diagram even after the rotation of input."; + } else if (m_issue_type == IssueType::VORONOI_EDGE_INTERSECTING_INPUT_SEGMENT) { + BOOST_LOG_TRIVIAL(error) << "Detected Voronoi edge intersecting input segment even after the rotation of input."; + } else if (m_issue_type == IssueType::FINITE_EDGE_WITH_NON_FINITE_VERTEX) { + BOOST_LOG_TRIVIAL(error) << "Detected finite Voronoi vertex with non finite vertex even after the rotation of input."; + } else { + BOOST_LOG_TRIVIAL(error) << "Detected unknown Voronoi diagram issue even after the rotation of input."; + } + + m_state = State::REPAIR_UNSUCCESSFUL; + } else { + m_state = State::REPAIR_SUCCESSFUL; + } + } else { + m_state = State::REPAIR_NOT_NEEDED; + m_issue_type = IssueType::NO_ISSUE_DETECTED; + } + } else { + m_state = State::UNKNOWN; + m_issue_type = IssueType::UNKNOWN; + } +} + +void VoronoiDiagram::clear() +{ + if (m_is_modified) { + m_vertices.clear(); + m_edges.clear(); + m_cells.clear(); + m_is_modified = false; + } else { + m_voronoi_diagram.clear(); + } + + m_state = State::UNKNOWN; + m_issue_type = IssueType::UNKNOWN; +} + +void VoronoiDiagram::copy_to_local(voronoi_diagram_type &voronoi_diagram) { + m_edges.clear(); + m_cells.clear(); + m_vertices.clear(); + + // Copy Voronoi edges. + m_edges.reserve(voronoi_diagram.num_edges()); + for (const edge_type &edge : voronoi_diagram.edges()) { + m_edges.emplace_back(edge.is_linear(), edge.is_primary()); + m_edges.back().color(edge.color()); + } + + // Copy Voronoi cells. + m_cells.reserve(voronoi_diagram.num_cells()); + for (const cell_type &cell : voronoi_diagram.cells()) { + m_cells.emplace_back(cell.source_index(), cell.source_category()); + m_cells.back().color(cell.color()); + + if (cell.incident_edge()) { + size_t incident_edge_idx = cell.incident_edge() - voronoi_diagram.edges().data(); + m_cells.back().incident_edge(&m_edges[incident_edge_idx]); + } + } + + // Copy Voronoi vertices. + m_vertices.reserve(voronoi_diagram.num_vertices()); + for (const vertex_type &vertex : voronoi_diagram.vertices()) { + m_vertices.emplace_back(vertex.x(), vertex.y()); + m_vertices.back().color(vertex.color()); + + if (vertex.incident_edge()) { + size_t incident_edge_idx = vertex.incident_edge() - voronoi_diagram.edges().data(); + m_vertices.back().incident_edge(&m_edges[incident_edge_idx]); + } + } + + // Assign all pointers for each Voronoi edge. + for (const edge_type &old_edge : voronoi_diagram.edges()) { + size_t edge_idx = &old_edge - voronoi_diagram.edges().data(); + edge_type &new_edge = m_edges[edge_idx]; + + if (old_edge.cell()) { + size_t cell_idx = old_edge.cell() - voronoi_diagram.cells().data(); + new_edge.cell(&m_cells[cell_idx]); + } + + if (old_edge.vertex0()) { + size_t vertex0_idx = old_edge.vertex0() - voronoi_diagram.vertices().data(); + new_edge.vertex0(&m_vertices[vertex0_idx]); + } + + if (old_edge.twin()) { + size_t twin_edge_idx = old_edge.twin() - voronoi_diagram.edges().data(); + new_edge.twin(&m_edges[twin_edge_idx]); + } + + if (old_edge.next()) { + size_t next_edge_idx = old_edge.next() - voronoi_diagram.edges().data(); + new_edge.next(&m_edges[next_edge_idx]); + } + + if (old_edge.prev()) { + size_t prev_edge_idx = old_edge.prev() - voronoi_diagram.edges().data(); + new_edge.prev(&m_edges[prev_edge_idx]); + } + } +} + +template +typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + VoronoiDiagram::IssueType>::type +VoronoiDiagram::detect_known_issues(const VoronoiDiagram &voronoi_diagram, SegmentIterator segment_begin, SegmentIterator segment_end) +{ + if (has_finite_edge_with_non_finite_vertex(voronoi_diagram)) { + return IssueType::FINITE_EDGE_WITH_NON_FINITE_VERTEX; + } else if (const IssueType cell_issue_type = detect_known_voronoi_cell_issues(voronoi_diagram, segment_begin, segment_end); cell_issue_type != IssueType::NO_ISSUE_DETECTED) { + return cell_issue_type; + } else if (!VoronoiUtilsCgal::is_voronoi_diagram_planar_angle(voronoi_diagram, segment_begin, segment_end)) { + // Detection of non-planar Voronoi diagram detects at least GH issues #8474, #8514 and #8446. + return IssueType::NON_PLANAR_VORONOI_DIAGRAM; + } + + return IssueType::NO_ISSUE_DETECTED; +} + +template +typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + VoronoiDiagram::IssueType>::type +VoronoiDiagram::detect_known_voronoi_cell_issues(const VoronoiDiagram &voronoi_diagram, + const SegmentIterator segment_begin, + const SegmentIterator segment_end) +{ + using Segment = typename std::iterator_traits::value_type; + using Point = typename boost::polygon::segment_point_type::type; + using SegmentCellRange = SegmentCellRange; + + for (VD::cell_type cell : voronoi_diagram.cells()) { + if (cell.is_degenerate() || !cell.contains_segment()) + continue; // Skip degenerated cell that has no spoon. Also, skip a cell that doesn't contain a segment. + + if (const SegmentCellRange cell_range = VoronoiUtils::compute_segment_cell_range(cell, segment_begin, segment_end); cell_range.is_valid()) { + // Detection if Voronoi edge is intersecting input segment. + // It detects this type of issue at least in GH issues #8446, #8474 and #8514. + + const Segment &source_segment = Geometry::VoronoiUtils::get_source_segment(cell, segment_begin, segment_end); + const Vec2d source_segment_from = boost::polygon::segment_traits::get(source_segment, boost::polygon::LOW).template cast(); + const Vec2d source_segment_to = boost::polygon::segment_traits::get(source_segment, boost::polygon::HIGH).template cast(); + const Vec2d source_segment_vec = source_segment_to - source_segment_from; + + // All Voronoi vertices must be on the left side of the source segment, otherwise the Voronoi diagram is invalid. + for (const VD::edge_type *edge = cell_range.edge_begin; edge != cell_range.edge_end; edge = edge->next()) { + if (edge->is_infinite()) { + // When there is a missing Voronoi vertex, we may encounter an infinite Voronoi edge. + // This happens, for example, in GH issue #8846. + return IssueType::MISSING_VORONOI_VERTEX; + } else if (const Vec2d edge_v1(edge->vertex1()->x(), edge->vertex1()->y()); Slic3r::cross2(source_segment_vec, edge_v1 - source_segment_from) < 0) { + return IssueType::VORONOI_EDGE_INTERSECTING_INPUT_SEGMENT; + } + } + } else { + // When there is a missing Voronoi vertex (especially at one of the endpoints of the input segment), + // the returned cell_range is marked as invalid. + // It detects this type of issue at least in GH issue #8846. + return IssueType::MISSING_VORONOI_VERTEX; + } + } + + return IssueType::NO_ISSUE_DETECTED; +} + +bool VoronoiDiagram::has_finite_edge_with_non_finite_vertex(const VoronoiDiagram &voronoi_diagram) +{ + for (const voronoi_diagram_type::edge_type &edge : voronoi_diagram.edges()) { + if (edge.is_finite()) { + assert(edge.vertex0() != nullptr && edge.vertex1() != nullptr); + if (edge.vertex0() == nullptr || edge.vertex1() == nullptr || !VoronoiUtils::is_finite(*edge.vertex0()) || !VoronoiUtils::is_finite(*edge.vertex1())) + return true; + } + } + return false; +} + +template +typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + VoronoiDiagram::IssueType>::type +VoronoiDiagram::try_to_repair_degenerated_voronoi_diagram(const SegmentIterator segment_begin, const SegmentIterator segment_end) +{ + IssueType issue_type = m_issue_type; + + const std::vector fix_angles = {PI / 6, PI / 5, PI / 7, PI / 11}; + for (const double fix_angle : fix_angles) { + issue_type = try_to_repair_degenerated_voronoi_diagram_by_rotation(segment_begin, segment_end, fix_angle); + if (issue_type == IssueType::NO_ISSUE_DETECTED) { + return issue_type; + } + } + + return issue_type; +} + +inline VD::vertex_type::color_type encode_input_segment_endpoint(const VD::cell_type::source_index_type cell_source_index, const boost::polygon::direction_1d dir) +{ + return (cell_source_index + 1) << 1 | (dir.to_int() ? 1 : 0); +} + +template +inline typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + typename boost::polygon::segment_point_type::value_type>::type>::type +decode_input_segment_endpoint(const VD::vertex_type::color_type color, const SegmentIterator segment_begin, const SegmentIterator segment_end) +{ + using SegmentType = typename std::iterator_traits::value_type; + using PointType = typename boost::polygon::segment_traits::point_type; + + const size_t segment_idx = (color >> 1) - 1; + const SegmentIterator segment_it = segment_begin + segment_idx; + const PointType source_point = boost::polygon::segment_traits::get(*segment_it, ((color & 1) ? boost::polygon::HIGH : + boost::polygon::LOW)); + return source_point; +} + +template +typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + VoronoiDiagram::IssueType>::type +VoronoiDiagram::try_to_repair_degenerated_voronoi_diagram_by_rotation(const SegmentIterator segment_begin, + const SegmentIterator segment_end, + const double fix_angle) +{ + using SegmentType = typename std::iterator_traits::value_type; + using PointType = typename boost::polygon::segment_traits::point_type; + + // Copy all segments and rotate their vertices. + std::vector segments_rotated; + segments_rotated.reserve(std::distance(segment_begin, segment_end)); + for (auto segment_it = segment_begin; segment_it != segment_end; ++segment_it) { + PointType from = boost::polygon::segment_traits::get(*segment_it, boost::polygon::LOW); + PointType to = boost::polygon::segment_traits::get(*segment_it, boost::polygon::HIGH); + segments_rotated.emplace_back(from.rotated(fix_angle), to.rotated(fix_angle)); + } + + VoronoiDiagram::voronoi_diagram_type voronoi_diagram_rotated; + boost::polygon::construct_voronoi(segments_rotated.begin(), segments_rotated.end(), &voronoi_diagram_rotated); + + this->copy_to_local(voronoi_diagram_rotated); + const IssueType issue_type = detect_known_issues(*this, segments_rotated.begin(), segments_rotated.end()); + + // We want to remap all Voronoi vertices at the endpoints of input segments + // to ensure that Voronoi vertices at endpoints will be preserved after rotation. + // So we assign every Voronoi vertices color to map this Vertex into input segments. + for (cell_type cell : m_cells) { + if (cell.is_degenerate()) + continue; + + if (cell.contains_segment()) { + if (const SegmentCellRange cell_range = VoronoiUtils::compute_segment_cell_range(cell, segments_rotated.begin(), segments_rotated.end()); cell_range.is_valid()) { + if (cell_range.edge_end->vertex1()->color() == 0) { + // Vertex 1 of edge_end points to the starting endpoint of the input segment (from() or line.a). + VD::vertex_type::color_type color = encode_input_segment_endpoint(cell.source_index(), boost::polygon::LOW); + cell_range.edge_end->vertex1()->color(color); + } + + if (cell_range.edge_begin->vertex0()->color() == 0) { + // Vertex 0 of edge_end points to the ending endpoint of the input segment (to() or line.b). + VD::vertex_type::color_type color = encode_input_segment_endpoint(cell.source_index(), boost::polygon::HIGH); + cell_range.edge_begin->vertex0()->color(color); + } + } else { + // This could happen when there is a missing Voronoi vertex even after rotation. + assert(cell_range.is_valid()); + } + } + + // FIXME @hejllukas: Implement mapping also for source points and not just for source segments. + } + + // Rotate all Voronoi vertices back. + // When a Voronoi vertex can be mapped to the input segment endpoint, then we don't need to do rotation back. + for (vertex_type &vertex : m_vertices) { + if (vertex.color() == 0) { + // This vertex isn't mapped to any vertex, so we rotate it back. + vertex = VoronoiUtils::make_rotated_vertex(vertex, -fix_angle); + } else { + // This vertex can be mapped to the input segment endpoint. + PointType endpoint = decode_input_segment_endpoint(vertex.color(), segment_begin, segment_end); + vertex_type endpoint_vertex{double(endpoint.x()), double(endpoint.y())}; + endpoint_vertex.incident_edge(vertex.incident_edge()); + endpoint_vertex.color(vertex.color()); + vertex = endpoint_vertex; + } + } + + // We have to clear all marked vertices because some algorithms expect that all vertices have a color equal to 0. + for (vertex_type &vertex : m_vertices) + vertex.color(0); + + m_voronoi_diagram.clear(); + m_is_modified = true; + + return issue_type; +} + +} // namespace Slic3r::Geometry diff --git a/src/libslic3r/Geometry/Voronoi.hpp b/src/libslic3r/Geometry/Voronoi.hpp index 5529750f3b..ef1c622769 100644 --- a/src/libslic3r/Geometry/Voronoi.hpp +++ b/src/libslic3r/Geometry/Voronoi.hpp @@ -4,10 +4,8 @@ #include "../Line.hpp" #include "../Polyline.hpp" -#define BOOST_VORONOI_USE_GMP 1 - #ifdef _MSC_VER -// Suppress warning C4146 in OpenVDB: unary minus operator applied to unsigned type, result still unsigned +// Suppress warning C4146 in OpenVDB: unary minus operator applied to unsigned type, result still unsigned #pragma warning(push) #pragma warning(disable : 4146) #endif // _MSC_VER @@ -16,18 +14,182 @@ #pragma warning(pop) #endif // _MSC_VER -namespace Slic3r { +namespace Slic3r::Geometry { -namespace Geometry { - -class VoronoiDiagram : public boost::polygon::voronoi_diagram { +class VoronoiDiagram +{ public: - typedef double coord_type; - typedef boost::polygon::point_data point_type; - typedef boost::polygon::segment_data segment_type; - typedef boost::polygon::rectangle_data rect_type; + using coord_type = double; + using voronoi_diagram_type = boost::polygon::voronoi_diagram; + using point_type = boost::polygon::point_data; + using segment_type = boost::polygon::segment_data; + using rect_type = boost::polygon::rectangle_data; + + using coordinate_type = voronoi_diagram_type::coordinate_type; + using vertex_type = voronoi_diagram_type::vertex_type; + using edge_type = voronoi_diagram_type::edge_type; + using cell_type = voronoi_diagram_type::cell_type; + + using const_vertex_iterator = voronoi_diagram_type::const_vertex_iterator; + using const_edge_iterator = voronoi_diagram_type::const_edge_iterator; + using const_cell_iterator = voronoi_diagram_type::const_cell_iterator; + + using vertex_container_type = voronoi_diagram_type::vertex_container_type; + using edge_container_type = voronoi_diagram_type::edge_container_type; + using cell_container_type = voronoi_diagram_type::cell_container_type; + + enum class IssueType { + NO_ISSUE_DETECTED, + FINITE_EDGE_WITH_NON_FINITE_VERTEX, + MISSING_VORONOI_VERTEX, + NON_PLANAR_VORONOI_DIAGRAM, + VORONOI_EDGE_INTERSECTING_INPUT_SEGMENT, + UNKNOWN // Repairs are disabled in the constructor. + }; + + enum class State { + REPAIR_NOT_NEEDED, // The original Voronoi diagram doesn't have any issue. + REPAIR_SUCCESSFUL, // The original Voronoi diagram has some issues, but it was repaired. + REPAIR_UNSUCCESSFUL, // The original Voronoi diagram has some issues, but it wasn't repaired. + UNKNOWN // Repairs are disabled in the constructor. + }; + + VoronoiDiagram() = default; + + virtual ~VoronoiDiagram() = default; + + IssueType get_issue_type() const { return m_issue_type; } + + State get_state() const { return m_state; } + + bool is_valid() const { return m_state != State::REPAIR_UNSUCCESSFUL; } + + void clear(); + + const vertex_container_type &vertices() const { return m_is_modified ? m_vertices : m_voronoi_diagram.vertices(); } + + const edge_container_type &edges() const { return m_is_modified ? m_edges : m_voronoi_diagram.edges(); } + + const cell_container_type &cells() const { return m_is_modified ? m_cells : m_voronoi_diagram.cells(); } + + std::size_t num_vertices() const { return m_is_modified ? m_vertices.size() : m_voronoi_diagram.num_vertices(); } + + std::size_t num_edges() const { return m_is_modified ? m_edges.size() : m_voronoi_diagram.num_edges(); } + + std::size_t num_cells() const { return m_is_modified ? m_cells.size() : m_voronoi_diagram.num_cells(); } + + template + typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + void>::type + construct_voronoi(SegmentIterator segment_begin, SegmentIterator segment_end, bool try_to_repair_if_needed = true); + + template + typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + void>::type + construct_voronoi(const PointIterator first, const PointIterator last) + { + boost::polygon::construct_voronoi(first, last, &m_voronoi_diagram); + m_state = State::UNKNOWN; + m_issue_type = IssueType::UNKNOWN; + } + + template + typename boost::polygon::enable_if< + typename boost::polygon::gtl_and< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + typename boost::polygon::gtl_if::value_type>::type>::type>::type>::type, + void>::type + construct_voronoi(const PointIterator p_first, const PointIterator p_last, const SegmentIterator s_first, const SegmentIterator s_last) + { + boost::polygon::construct_voronoi(p_first, p_last, s_first, s_last, &m_voronoi_diagram); + m_state = State::UNKNOWN; + m_issue_type = IssueType::UNKNOWN; + } + + // Try to detect cases when some Voronoi vertex is missing, when the Voronoi diagram + // is not planar or some Voronoi edge is intersecting input segment. + template + static typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + IssueType>::type + detect_known_issues(const VoronoiDiagram &voronoi_diagram, SegmentIterator segment_begin, SegmentIterator segment_end); + + template + typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + VoronoiDiagram::IssueType>::type + try_to_repair_degenerated_voronoi_diagram_by_rotation(SegmentIterator segment_begin, SegmentIterator segment_end, double fix_angle); + + template + typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + VoronoiDiagram::IssueType>::type + try_to_repair_degenerated_voronoi_diagram(SegmentIterator segment_begin, SegmentIterator segment_end); + +private: + struct Segment + { + Point from; + Point to; + + Segment() = delete; + explicit Segment(const Point &from, const Point &to) : from(from), to(to) {} + }; + + void copy_to_local(voronoi_diagram_type &voronoi_diagram); + + // Detect issues related to Voronoi cells, or that can be detected by iterating over Voronoi cells. + // The first type of issue that can be detected is a missing Voronoi vertex, especially when it is + // missing at one of the endpoints of the input segment. + // The second type of issue that can be detected is a Voronoi edge that intersects the input segment. + template + static typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + IssueType>::type + detect_known_voronoi_cell_issues(const VoronoiDiagram &voronoi_diagram, SegmentIterator segment_begin, SegmentIterator segment_end); + + static bool has_finite_edge_with_non_finite_vertex(const VoronoiDiagram &voronoi_diagram); + + voronoi_diagram_type m_voronoi_diagram; + vertex_container_type m_vertices; + edge_container_type m_edges; + cell_container_type m_cells; + bool m_is_modified = false; + State m_state = State::UNKNOWN; + IssueType m_issue_type = IssueType::UNKNOWN; + +public: + using SegmentIt = std::vector::iterator; + + friend struct boost::polygon::segment_traits; }; -} } // namespace Slicer::Geometry +} // namespace Slic3r::Geometry + +namespace boost::polygon { +template<> struct geometry_concept +{ + typedef segment_concept type; +}; + +template<> struct segment_traits +{ + using coordinate_type = coord_t; + using point_type = Slic3r::Point; + using segment_type = Slic3r::Geometry::VoronoiDiagram::Segment; + + static inline point_type get(const segment_type &segment, direction_1d dir) { return dir.to_int() ? segment.to : segment.from; } +}; +} // namespace boost::polygon #endif // slic3r_Geometry_Voronoi_hpp_ diff --git a/src/libslic3r/Geometry/VoronoiOffset.cpp b/src/libslic3r/Geometry/VoronoiOffset.cpp index ed8d9c2b18..46105220a4 100644 --- a/src/libslic3r/Geometry/VoronoiOffset.cpp +++ b/src/libslic3r/Geometry/VoronoiOffset.cpp @@ -782,9 +782,6 @@ void annotate_inside_outside(VD &vd, const Lines &lines) for (const VD::edge_type &edge : vd.edges()) if (edge.vertex1() == nullptr) { - if (edge.vertex0() == nullptr) - continue; - // Infinite Voronoi edge separating two Point sites or a Point site and a Segment site. // Infinite edge is always outside and it references at least one valid vertex. assert(edge.is_infinite()); @@ -891,9 +888,6 @@ void annotate_inside_outside(VD &vd, const Lines &lines) for (const VD::edge_type &edge : vd.edges()) { assert((edge_category(edge) == EdgeCategory::Unknown) == (edge_category(edge.twin()) == EdgeCategory::Unknown)); if (edge_category(edge) == EdgeCategory::Unknown) { - if (!edge.is_finite()) - continue; - assert(edge.is_finite()); const VD::cell_type &cell = *edge.cell(); const VD::cell_type &cell2 = *edge.twin()->cell(); diff --git a/src/libslic3r/Geometry/VoronoiUtils.cpp b/src/libslic3r/Geometry/VoronoiUtils.cpp new file mode 100644 index 0000000000..1e9436325f --- /dev/null +++ b/src/libslic3r/Geometry/VoronoiUtils.cpp @@ -0,0 +1,283 @@ +#include + +#include +#include + +#include "VoronoiUtils.hpp" + +namespace Slic3r::Geometry { + +using PolygonsSegmentIndexConstIt = std::vector::const_iterator; +using LinesIt = Lines::iterator; +using ColoredLinesIt = ColoredLines::iterator; +using ColoredLinesConstIt = ColoredLines::const_iterator; + +// Explicit template instantiation. +template LinesIt::reference VoronoiUtils::get_source_segment(const VoronoiDiagram::cell_type &, LinesIt, LinesIt); +template VD::SegmentIt::reference VoronoiUtils::get_source_segment(const VoronoiDiagram::cell_type &, VD::SegmentIt, VD::SegmentIt); +template ColoredLinesIt::reference VoronoiUtils::get_source_segment(const VoronoiDiagram::cell_type &, ColoredLinesIt, ColoredLinesIt); +template ColoredLinesConstIt::reference VoronoiUtils::get_source_segment(const VoronoiDiagram::cell_type &, ColoredLinesConstIt, ColoredLinesConstIt); +template PolygonsSegmentIndexConstIt::reference VoronoiUtils::get_source_segment(const VoronoiDiagram::cell_type &, PolygonsSegmentIndexConstIt, PolygonsSegmentIndexConstIt); +template Point VoronoiUtils::get_source_point(const VoronoiDiagram::cell_type &, LinesIt, LinesIt); +template Point VoronoiUtils::get_source_point(const VoronoiDiagram::cell_type &, VD::SegmentIt, VD::SegmentIt); +template Point VoronoiUtils::get_source_point(const VoronoiDiagram::cell_type &, ColoredLinesIt, ColoredLinesIt); +template Point VoronoiUtils::get_source_point(const VoronoiDiagram::cell_type &, ColoredLinesConstIt, ColoredLinesConstIt); +template Point VoronoiUtils::get_source_point(const VoronoiDiagram::cell_type &, PolygonsSegmentIndexConstIt, PolygonsSegmentIndexConstIt); +template SegmentCellRange VoronoiUtils::compute_segment_cell_range(const VoronoiDiagram::cell_type &, LinesIt, LinesIt); +template SegmentCellRange VoronoiUtils::compute_segment_cell_range(const VoronoiDiagram::cell_type &, VD::SegmentIt, VD::SegmentIt); +template SegmentCellRange VoronoiUtils::compute_segment_cell_range(const VoronoiDiagram::cell_type &, ColoredLinesConstIt, ColoredLinesConstIt); +template SegmentCellRange VoronoiUtils::compute_segment_cell_range(const VoronoiDiagram::cell_type &, PolygonsSegmentIndexConstIt, PolygonsSegmentIndexConstIt); +template Points VoronoiUtils::discretize_parabola(const Point &, const Arachne::PolygonsSegmentIndex &, const Point &, const Point &, coord_t, float); +template Arachne::PolygonsPointIndex VoronoiUtils::get_source_point_index(const VoronoiDiagram::cell_type &, PolygonsSegmentIndexConstIt, PolygonsSegmentIndexConstIt); + +template +typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + typename std::iterator_traits::reference>::type +VoronoiUtils::get_source_segment(const VoronoiDiagram::cell_type &cell, const SegmentIterator segment_begin, const SegmentIterator segment_end) +{ + if (!cell.contains_segment()) + throw Slic3r::InvalidArgument("Voronoi cell doesn't contain a source segment!"); + + if (cell.source_index() >= size_t(std::distance(segment_begin, segment_end))) + throw Slic3r::OutOfRange("Voronoi cell source index is out of range!"); + + return *(segment_begin + cell.source_index()); +} + +template +typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + typename boost::polygon::segment_point_type::value_type>::type>::type +VoronoiUtils::get_source_point(const VoronoiDiagram::cell_type &cell, const SegmentIterator segment_begin, const SegmentIterator segment_end) +{ + using Segment = typename std::iterator_traits::value_type; + + if (!cell.contains_point()) + throw Slic3r::InvalidArgument("Voronoi cell doesn't contain a source point!"); + + if (cell.source_category() == boost::polygon::SOURCE_CATEGORY_SEGMENT_START_POINT) { + assert(int(cell.source_index()) < std::distance(segment_begin, segment_end)); + const SegmentIterator segment_it = segment_begin + cell.source_index(); + return boost::polygon::segment_traits::get(*segment_it, boost::polygon::LOW); + } else if (cell.source_category() == boost::polygon::SOURCE_CATEGORY_SEGMENT_END_POINT) { + assert(int(cell.source_index()) < std::distance(segment_begin, segment_end)); + const SegmentIterator segment_it = segment_begin + cell.source_index(); + return boost::polygon::segment_traits::get(*segment_it, boost::polygon::HIGH); + } else if (cell.source_category() == boost::polygon::SOURCE_CATEGORY_SINGLE_POINT) { + throw Slic3r::RuntimeError("Voronoi diagram is always constructed using segments, so cell.source_category() shouldn't be SOURCE_CATEGORY_SINGLE_POINT!"); + } else { + throw Slic3r::InvalidArgument("Function get_source_point() should only be called on point cells!"); + } +} + +template +typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + Arachne::PolygonsPointIndex>::type +VoronoiUtils::get_source_point_index(const VD::cell_type &cell, const SegmentIterator segment_begin, const SegmentIterator segment_end) +{ + if (!cell.contains_point()) + throw Slic3r::InvalidArgument("Voronoi cell doesn't contain a source point!"); + + if (cell.source_category() == boost::polygon::SOURCE_CATEGORY_SEGMENT_START_POINT) { + assert(int(cell.source_index()) < std::distance(segment_begin, segment_end)); + const SegmentIterator segment_it = segment_begin + cell.source_index(); + return (*segment_it); + } else if (cell.source_category() == boost::polygon::SOURCE_CATEGORY_SEGMENT_END_POINT) { + assert(int(cell.source_index()) < std::distance(segment_begin, segment_end)); + const SegmentIterator segment_it = segment_begin + cell.source_index(); + return (*segment_it).next(); + } else if (cell.source_category() == boost::polygon::SOURCE_CATEGORY_SINGLE_POINT) { + throw Slic3r::RuntimeError("Voronoi diagram is always constructed using segments, so cell.source_category() shouldn't be SOURCE_CATEGORY_SINGLE_POINT!"); + } else { + throw Slic3r::InvalidArgument("Function get_source_point_index() should only be called on point cells!"); + } +} + +template +typename boost::polygon::enable_if::type>::type>::type, + Points>::type +VoronoiUtils::discretize_parabola(const Point &source_point, const Segment &source_segment, const Point &start, const Point &end, const coord_t approximate_step_size, float transitioning_angle) +{ + Points discretized; + // x is distance of point projected on the segment ab + // xx is point projected on the segment ab + const Point a = source_segment.from(); + const Point b = source_segment.to(); + const Point ab = b - a; + const Point as = start - a; + const Point ae = end - a; + const coord_t ab_size = ab.cast().norm(); + const coord_t sx = as.cast().dot(ab.cast()) / ab_size; + const coord_t ex = ae.cast().dot(ab.cast()) / ab_size; + const coord_t sxex = ex - sx; + + const Point ap = source_point - a; + const coord_t px = ap.cast().dot(ab.cast()) / ab_size; + + Point pxx; + Line(a, b).distance_to_infinite_squared(source_point, &pxx); + const Point ppxx = pxx - source_point; + const coord_t d = ppxx.cast().norm(); + + const Vec2d rot = perp(ppxx).cast().normalized(); + const double rot_cos_theta = rot.x(); + const double rot_sin_theta = rot.y(); + + if (d == 0) { + discretized.emplace_back(start); + discretized.emplace_back(end); + return discretized; + } + + const double marking_bound = atan(transitioning_angle * 0.5); + int64_t msx = -marking_bound * int64_t(d); // projected marking_start + int64_t mex = marking_bound * int64_t(d); // projected marking_end + + const coord_t marking_start_end_h = msx * msx / (2 * d) + d / 2; + Point marking_start = Point(coord_t(msx), marking_start_end_h).rotated(rot_cos_theta, rot_sin_theta) + pxx; + Point marking_end = Point(coord_t(mex), marking_start_end_h).rotated(rot_cos_theta, rot_sin_theta) + pxx; + const int dir = (sx > ex) ? -1 : 1; + if (dir < 0) { + std::swap(marking_start, marking_end); + std::swap(msx, mex); + } + + bool add_marking_start = msx * int64_t(dir) > int64_t(sx - px) * int64_t(dir) && msx * int64_t(dir) < int64_t(ex - px) * int64_t(dir); + bool add_marking_end = mex * int64_t(dir) > int64_t(sx - px) * int64_t(dir) && mex * int64_t(dir) < int64_t(ex - px) * int64_t(dir); + + const Point apex = Point(0, d / 2).rotated(rot_cos_theta, rot_sin_theta) + pxx; + bool add_apex = int64_t(sx - px) * int64_t(dir) < 0 && int64_t(ex - px) * int64_t(dir) > 0; + + assert(!add_marking_start || !add_marking_end || add_apex); + if (add_marking_start && add_marking_end && !add_apex) + BOOST_LOG_TRIVIAL(warning) << "Failing to discretize parabola! Must add an apex or one of the endpoints."; + + const coord_t step_count = lround(static_cast(std::abs(ex - sx)) / approximate_step_size); + discretized.emplace_back(start); + for (coord_t step = 1; step < step_count; ++step) { + const int64_t x = int64_t(sx) + int64_t(sxex) * int64_t(step) / int64_t(step_count) - int64_t(px); + const int64_t y = int64_t(x) * int64_t(x) / int64_t(2 * d) + int64_t(d / 2); + + if (add_marking_start && msx * int64_t(dir) < int64_t(x) * int64_t(dir)) { + discretized.emplace_back(marking_start); + add_marking_start = false; + } + + if (add_apex && int64_t(x) * int64_t(dir) > 0) { + discretized.emplace_back(apex); + add_apex = false; // only add the apex just before the + } + + if (add_marking_end && mex * int64_t(dir) < int64_t(x) * int64_t(dir)) { + discretized.emplace_back(marking_end); + add_marking_end = false; + } + + assert(is_in_range(x) && is_in_range(y)); + const Point result = Point(x, y).rotated(rot_cos_theta, rot_sin_theta) + pxx; + discretized.emplace_back(result); + } + + if (add_apex) + discretized.emplace_back(apex); + + if (add_marking_end) + discretized.emplace_back(marking_end); + + discretized.emplace_back(end); + return discretized; +} + +template +typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + Geometry::SegmentCellRange< + typename boost::polygon::segment_point_type::value_type>::type>>::type +VoronoiUtils::compute_segment_cell_range(const VD::cell_type &cell, const SegmentIterator segment_begin, const SegmentIterator segment_end) +{ + using Segment = typename std::iterator_traits::value_type; + using Point = typename boost::polygon::segment_point_type::type; + using SegmentCellRange = SegmentCellRange; + + const Segment &source_segment = Geometry::VoronoiUtils::get_source_segment(cell, segment_begin, segment_end); + const Point from = boost::polygon::segment_traits::get(source_segment, boost::polygon::LOW); + const Point to = boost::polygon::segment_traits::get(source_segment, boost::polygon::HIGH); + const Vec2i64 from_i64 = from.template cast(); + const Vec2i64 to_i64 = to.template cast(); + + // FIXME @hejllukas: Ensure that there is no infinite edge during iteration between edge_begin and edge_end. + SegmentCellRange cell_range(to, from); + + // Find starting edge and end edge + bool seen_possible_start = false; + bool after_start = false; + bool ending_edge_is_set_before_start = false; + const VD::edge_type *edge = cell.incident_edge(); + do { + if (edge->is_infinite()) + continue; + + Vec2i64 v0 = Geometry::VoronoiUtils::to_point(edge->vertex0()); + Vec2i64 v1 = Geometry::VoronoiUtils::to_point(edge->vertex1()); + assert(v0 != to_i64 || v1 != from_i64); + + if (v0 == to_i64 && !after_start) { // Use the last edge which starts in source_segment.to + cell_range.edge_begin = edge; + seen_possible_start = true; + } else if (seen_possible_start) { + after_start = true; + } + + if (v1 == from_i64 && (!cell_range.edge_end || ending_edge_is_set_before_start)) { + ending_edge_is_set_before_start = !after_start; + cell_range.edge_end = edge; + } + } while (edge = edge->next(), edge != cell.incident_edge()); + + return cell_range; +} + +Vec2i64 VoronoiUtils::to_point(const VD::vertex_type *vertex) +{ + assert(vertex != nullptr); + return VoronoiUtils::to_point(*vertex); +} + +Vec2i64 VoronoiUtils::to_point(const VD::vertex_type &vertex) +{ + const double x = vertex.x(), y = vertex.y(); + + assert(std::isfinite(x) && std::isfinite(y)); + assert(is_in_range(x) && is_in_range(y)); + + return {std::llround(x), std::llround(y)}; +} + +bool VoronoiUtils::is_finite(const VD::vertex_type &vertex) +{ + return std::isfinite(vertex.x()) && std::isfinite(vertex.y()); +} + +VD::vertex_type VoronoiUtils::make_rotated_vertex(VD::vertex_type &vertex, const double angle) +{ + const double cos_a = std::cos(angle); + const double sin_a = std::sin(angle); + + const double rotated_x = (cos_a * vertex.x() - sin_a * vertex.y()); + const double rotated_y = (cos_a * vertex.y() + sin_a * vertex.x()); + + VD::vertex_type rotated_vertex{rotated_x, rotated_y}; + rotated_vertex.incident_edge(vertex.incident_edge()); + rotated_vertex.color(vertex.color()); + + return rotated_vertex; +} + +} // namespace Slic3r::Geometry diff --git a/src/libslic3r/Geometry/VoronoiUtils.hpp b/src/libslic3r/Geometry/VoronoiUtils.hpp new file mode 100644 index 0000000000..bf63914677 --- /dev/null +++ b/src/libslic3r/Geometry/VoronoiUtils.hpp @@ -0,0 +1,120 @@ +#ifndef slic3r_VoronoiUtils_hpp_ +#define slic3r_VoronoiUtils_hpp_ + +#include "libslic3r/Geometry/Voronoi.hpp" +#include "libslic3r/Arachne/utils/PolygonsSegmentIndex.hpp" + +using VD = Slic3r::Geometry::VoronoiDiagram; + +namespace Slic3r::Geometry { + +// Represent trapezoid Voronoi cell around segment. +template struct SegmentCellRange +{ + const PT segment_start_point; // The start point of the source segment of this cell. + const PT segment_end_point; // The end point of the source segment of this cell. + const VD::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts. + const VD::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends. + + SegmentCellRange() = delete; + explicit SegmentCellRange(const PT &segment_start_point, const PT &segment_end_point) + : segment_start_point(segment_start_point), segment_end_point(segment_end_point) + {} + + bool is_valid() const { return edge_begin && edge_end && edge_begin != edge_end; } +}; + +class VoronoiUtils +{ +public: + static Vec2i64 to_point(const VD::vertex_type *vertex); + + static Vec2i64 to_point(const VD::vertex_type &vertex); + + static bool is_finite(const VD::vertex_type &vertex); + + static VD::vertex_type make_rotated_vertex(VD::vertex_type &vertex, double angle); + + template + static typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + typename std::iterator_traits::reference>::type + get_source_segment(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end); + + template + static typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + typename boost::polygon::segment_point_type::value_type>::type>::type + get_source_point(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end); + + template + static typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + Arachne::PolygonsPointIndex>::type + get_source_point_index(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end); + + /** + * Discretize a parabola based on (approximate) step size. + * + * Adapted from CuraEngine VoronoiUtils::discretizeParabola by Tim Kuipers @BagelOrb and @Ghostkeeper. + * + * @param approximate_step_size is measured parallel to the source_segment, not along the parabola. + */ + template + static typename boost::polygon::enable_if::type>::type>::type, + Points>::type + discretize_parabola(const Point &source_point, const Segment &source_segment, const Point &start, const Point &end, coord_t approximate_step_size, float transitioning_angle); + + /** + * Compute the range of line segments that surround a cell of the skeletal + * graph that belongs to a line segment of the medial axis. + * + * This should only be used on cells that belong to a central line segment + * of the skeletal graph, e.g. trapezoid cells, not triangular cells. + * + * The resulting line segments is just the first and the last segment. They + * are linked to the neighboring segments, so you can iterate over the + * segments until you reach the last segment. + * + * Adapted from CuraEngine VoronoiUtils::computePointCellRange by Tim Kuipers @BagelOrb, + * Jaime van Kessel @nallath, Remco Burema @rburema and @Ghostkeeper. + * + * @param cell The cell to compute the range of line segments for. + * @param segment_begin Begin iterator for all edges of the input Polygons. + * @param segment_end End iterator for all edges of the input Polygons. + * @return Range of line segments that surround the cell. + */ + template + static typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + Geometry::SegmentCellRange< + typename boost::polygon::segment_point_type::value_type>::type>>::type + compute_segment_cell_range(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end); + + template static bool is_in_range(double value) + { + return double(std::numeric_limits::lowest()) <= value && value <= double(std::numeric_limits::max()); + } + + template static bool is_in_range(const VD::vertex_type &vertex) + { + return VoronoiUtils::is_finite(vertex) && is_in_range(vertex.x()) && is_in_range(vertex.y()); + } + + template static bool is_in_range(const VD::edge_type &edge) + { + if (edge.vertex0() == nullptr || edge.vertex1() == nullptr) + return false; + + return is_in_range(*edge.vertex0()) && is_in_range(*edge.vertex1()); + } +}; + +} // namespace Slic3r::Geometry + +#endif // slic3r_VoronoiUtils_hpp_ diff --git a/src/libslic3r/Geometry/VoronoiUtilsCgal.cpp b/src/libslic3r/Geometry/VoronoiUtilsCgal.cpp index e76decf5f1..a0e2191af5 100644 --- a/src/libslic3r/Geometry/VoronoiUtilsCgal.cpp +++ b/src/libslic3r/Geometry/VoronoiUtilsCgal.cpp @@ -4,7 +4,9 @@ #include #include "libslic3r/Geometry/Voronoi.hpp" -#include "libslic3r/Arachne/utils/VoronoiUtils.hpp" +#include "libslic3r/Geometry/VoronoiUtils.hpp" +#include "libslic3r/Arachne/utils/PolygonsSegmentIndex.hpp" +#include "libslic3r/MultiMaterialSegmentation.hpp" #include "VoronoiUtilsCgal.hpp" @@ -12,18 +14,145 @@ using VD = Slic3r::Geometry::VoronoiDiagram; namespace Slic3r::Geometry { -using CGAL_Point = CGAL::Exact_predicates_exact_constructions_kernel::Point_2; -using CGAL_Segment = CGAL::Arr_segment_traits_2::Curve_2; +using PolygonsSegmentIndexConstIt = std::vector::const_iterator; +using LinesIt = Lines::iterator; +using ColoredLinesConstIt = ColoredLines::const_iterator; -inline static CGAL_Point to_cgal_point(const VD::vertex_type &pt) { return {pt.x(), pt.y()}; } +// Explicit template instantiation. +template bool VoronoiUtilsCgal::is_voronoi_diagram_planar_angle(const VD &, LinesIt, LinesIt); +template bool VoronoiUtilsCgal::is_voronoi_diagram_planar_angle(const VD &, VD::SegmentIt, VD::SegmentIt); +template bool VoronoiUtilsCgal::is_voronoi_diagram_planar_angle(const VD &, ColoredLinesConstIt, ColoredLinesConstIt); +template bool VoronoiUtilsCgal::is_voronoi_diagram_planar_angle(const VD &, PolygonsSegmentIndexConstIt, PolygonsSegmentIndexConstIt); + +// The tangent vector of the parabola is computed based on the Proof of the reflective property. +// https://en.wikipedia.org/wiki/Parabola#Proof_of_the_reflective_property +// https://math.stackexchange.com/q/2439647/2439663#comment5039739_2439663 +namespace impl { + using K = CGAL::Simple_cartesian; + using FK = CGAL::Simple_cartesian; + using EK = CGAL::Simple_cartesian; + using C2E = CGAL::Cartesian_converter; + using C2F = CGAL::Cartesian_converter; + class Epick : public CGAL::Filtered_kernel_adaptor::Type, Epick>, true> {}; + + template + inline typename K::Vector_2 calculate_parabolic_tangent_vector( + // Test point on the parabola, where the tangent will be calculated. + const typename K::Point_2 &p, + // Focus point of the parabola. + const typename K::Point_2 &f, + // Points of a directrix of the parabola. + const typename K::Point_2 &u, + const typename K::Point_2 &v, + // On which side of the parabolic segment endpoints the focus point is, which determines the orientation of the tangent. + const typename K::Orientation &tangent_orientation) + { + using RT = typename K::RT; + using Vector_2 = typename K::Vector_2; + + const Vector_2 directrix_vec = v - u; + const RT directrix_vec_sqr_length = CGAL::scalar_product(directrix_vec, directrix_vec); + Vector_2 focus_vec = (f - u) * directrix_vec_sqr_length - directrix_vec * CGAL::scalar_product(directrix_vec, p - u); + Vector_2 tangent_vec = focus_vec.perpendicular(tangent_orientation); + return tangent_vec; + } + + template struct ParabolicTangentToSegmentOrientationPredicate + { + using Point_2 = typename K::Point_2; + using Vector_2 = typename K::Vector_2; + using Orientation = typename K::Orientation; + using result_type = typename K::Orientation; + + result_type operator()( + // Test point on the parabola, where the tangent will be calculated. + const Point_2 &p, + // End of the linear segment (p, q), for which orientation towards the tangent to parabola will be evaluated. + const Point_2 &q, + // Focus point of the parabola. + const Point_2 &f, + // Points of a directrix of the parabola. + const Point_2 &u, + const Point_2 &v, + // On which side of the parabolic segment endpoints the focus point is, which determines the orientation of the tangent. + const Orientation &tangent_orientation) const + { + assert(tangent_orientation == CGAL::Orientation::LEFT_TURN || tangent_orientation == CGAL::Orientation::RIGHT_TURN); + + Vector_2 tangent_vec = calculate_parabolic_tangent_vector(p, f, u, v, tangent_orientation); + Vector_2 linear_vec = q - p; + + return CGAL::sign(tangent_vec.x() * linear_vec.y() - tangent_vec.y() * linear_vec.x()); + } + }; + + template struct ParabolicTangentToParabolicTangentOrientationPredicate + { + using Point_2 = typename K::Point_2; + using Vector_2 = typename K::Vector_2; + using Orientation = typename K::Orientation; + using result_type = typename K::Orientation; + + result_type operator()( + // Common point on both parabolas, where the tangent will be calculated. + const Point_2 &p, + // Focus point of the first parabola. + const Point_2 &f_0, + // Points of a directrix of the first parabola. + const Point_2 &u_0, + const Point_2 &v_0, + // On which side of the parabolic segment endpoints the focus point is, which determines the orientation of the tangent. + const Orientation &tangent_orientation_0, + // Focus point of the second parabola. + const Point_2 &f_1, + // Points of a directrix of the second parabola. + const Point_2 &u_1, + const Point_2 &v_1, + // On which side of the parabolic segment endpoints the focus point is, which determines the orientation of the tangent. + const Orientation &tangent_orientation_1) const + { + assert(tangent_orientation_0 == CGAL::Orientation::LEFT_TURN || tangent_orientation_0 == CGAL::Orientation::RIGHT_TURN); + assert(tangent_orientation_1 == CGAL::Orientation::LEFT_TURN || tangent_orientation_1 == CGAL::Orientation::RIGHT_TURN); + + Vector_2 tangent_vec_0 = calculate_parabolic_tangent_vector(p, f_0, u_0, v_0, tangent_orientation_0); + Vector_2 tangent_vec_1 = calculate_parabolic_tangent_vector(p, f_1, u_1, v_1, tangent_orientation_1); + + return CGAL::sign(tangent_vec_0.x() * tangent_vec_1.y() - tangent_vec_0.y() * tangent_vec_1.x()); + } + }; + + using ParabolicTangentToSegmentOrientationPredicateFiltered = CGAL::Filtered_predicate, ParabolicTangentToSegmentOrientationPredicate, C2E, C2F>; + using ParabolicTangentToParabolicTangentOrientationPredicateFiltered = CGAL::Filtered_predicate, ParabolicTangentToParabolicTangentOrientationPredicate, C2E, C2F>; +} // namespace impl + +using ParabolicTangentToSegmentOrientation = impl::ParabolicTangentToSegmentOrientationPredicateFiltered; +using ParabolicTangentToParabolicTangentOrientation = impl::ParabolicTangentToParabolicTangentOrientationPredicateFiltered; +using CGAL_Point = impl::K::Point_2; + +inline CGAL_Point to_cgal_point(const VD::vertex_type *pt) { return {pt->x(), pt->y()}; } +inline CGAL_Point to_cgal_point(const Point &pt) { return {pt.x(), pt.y()}; } +inline CGAL_Point to_cgal_point(const Vec2d &pt) { return {pt.x(), pt.y()}; } + +inline Linef make_linef(const VD::edge_type &edge) +{ + const VD::vertex_type *v0 = edge.vertex0(); + const VD::vertex_type *v1 = edge.vertex1(); + return {Vec2d(v0->x(), v0->y()), Vec2d(v1->x(), v1->y())}; +} + +[[maybe_unused]] inline bool is_equal(const VD::vertex_type &vertex_first, const VD::vertex_type &vertex_second) { return vertex_first.x() == vertex_second.x() && vertex_first.y() == vertex_second.y(); } // FIXME Lukas H.: Also includes parabolic segments. bool VoronoiUtilsCgal::is_voronoi_diagram_planar_intersection(const VD &voronoi_diagram) { + using CGAL_E_Point = CGAL::Exact_predicates_exact_constructions_kernel::Point_2; + using CGAL_E_Segment = CGAL::Arr_segment_traits_2::Curve_2; + auto to_cgal_point = [](const VD::vertex_type &pt) -> CGAL_E_Point { return {pt.x(), pt.y()}; }; + assert(std::all_of(voronoi_diagram.edges().cbegin(), voronoi_diagram.edges().cend(), [](const VD::edge_type &edge) { return edge.color() == 0; })); - std::vector segments; + std::vector segments; segments.reserve(voronoi_diagram.num_edges()); for (const VD::edge_type &edge : voronoi_diagram.edges()) { @@ -31,7 +160,7 @@ bool VoronoiUtilsCgal::is_voronoi_diagram_planar_intersection(const VD &voronoi_ continue; if (edge.is_finite() && edge.is_linear() && edge.vertex0() != nullptr && edge.vertex1() != nullptr && - Arachne::VoronoiUtils::is_finite(*edge.vertex0()) && Arachne::VoronoiUtils::is_finite(*edge.vertex1())) { + VoronoiUtils::is_finite(*edge.vertex0()) && VoronoiUtils::is_finite(*edge.vertex1())) { segments.emplace_back(to_cgal_point(*edge.vertex0()), to_cgal_point(*edge.vertex1())); edge.color(1); assert(edge.twin() != nullptr); @@ -42,42 +171,136 @@ bool VoronoiUtilsCgal::is_voronoi_diagram_planar_intersection(const VD &voronoi_ for (const VD::edge_type &edge : voronoi_diagram.edges()) edge.color(0); - std::vector intersections_pt; + std::vector intersections_pt; CGAL::compute_intersection_points(segments.begin(), segments.end(), std::back_inserter(intersections_pt)); return intersections_pt.empty(); } -static bool check_if_three_vectors_are_ccw(const CGAL_Point &common_pt, const CGAL_Point &pt_1, const CGAL_Point &pt_2, const CGAL_Point &test_pt) { - CGAL::Orientation orientation = CGAL::orientation(common_pt, pt_1, pt_2); +struct ParabolicSegment +{ + const Point focus; + const Line directrix; + // Two points on the parabola; + const Linef segment; + // Indicate if focus point is on the left side or right side relative to parabolic segment endpoints. + const CGAL::Orientation is_focus_on_left; +}; + +template +inline static typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + ParabolicSegment>::type +get_parabolic_segment(const VD::edge_type &edge, const SegmentIterator segment_begin, const SegmentIterator segment_end) +{ + using Segment = typename std::iterator_traits::value_type; + assert(edge.is_curved()); + + const VD::cell_type *left_cell = edge.cell(); + const VD::cell_type *right_cell = edge.twin()->cell(); + + const Point focus_pt = VoronoiUtils::get_source_point(*(left_cell->contains_point() ? left_cell : right_cell), segment_begin, segment_end); + const Segment &directrix = VoronoiUtils::get_source_segment(*(left_cell->contains_point() ? right_cell : left_cell), segment_begin, segment_end); + CGAL::Orientation focus_side = CGAL::opposite(CGAL::orientation(to_cgal_point(edge.vertex0()), to_cgal_point(edge.vertex1()), to_cgal_point(focus_pt))); + + assert(focus_side == CGAL::Orientation::LEFT_TURN || focus_side == CGAL::Orientation::RIGHT_TURN); + + const Point directrix_from = boost::polygon::segment_traits::get(directrix, boost::polygon::LOW); + const Point directrix_to = boost::polygon::segment_traits::get(directrix, boost::polygon::HIGH); + return {focus_pt, Line(directrix_from, directrix_to), make_linef(edge), focus_side}; +} + +template +inline static typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + CGAL::Orientation>::type +orientation_of_two_edges(const VD::edge_type &edge_a, const VD::edge_type &edge_b, const SegmentIterator segment_begin, const SegmentIterator segment_end) +{ + assert(is_equal(*edge_a.vertex0(), *edge_b.vertex0())); + CGAL::Orientation orientation; + if (edge_a.is_linear() && edge_b.is_linear()) { + orientation = CGAL::orientation(to_cgal_point(edge_a.vertex0()), to_cgal_point(edge_a.vertex1()), to_cgal_point(edge_b.vertex1())); + } else if (edge_a.is_curved() && edge_b.is_curved()) { + const ParabolicSegment parabolic_a = get_parabolic_segment(edge_a, segment_begin, segment_end); + const ParabolicSegment parabolic_b = get_parabolic_segment(edge_b, segment_begin, segment_end); + orientation = ParabolicTangentToParabolicTangentOrientation{}(to_cgal_point(parabolic_a.segment.a), + to_cgal_point(parabolic_a.focus), + to_cgal_point(parabolic_a.directrix.a), + to_cgal_point(parabolic_a.directrix.b), + parabolic_a.is_focus_on_left, + to_cgal_point(parabolic_b.focus), + to_cgal_point(parabolic_b.directrix.a), + to_cgal_point(parabolic_b.directrix.b), + parabolic_b.is_focus_on_left); + return orientation; + } else { + assert(edge_a.is_curved() != edge_b.is_curved()); + + const VD::edge_type &linear_edge = edge_a.is_curved() ? edge_b : edge_a; + const VD::edge_type ¶bolic_edge = edge_a.is_curved() ? edge_a : edge_b; + const ParabolicSegment parabolic = get_parabolic_segment(parabolic_edge, segment_begin, segment_end); + orientation = ParabolicTangentToSegmentOrientation{}(to_cgal_point(parabolic.segment.a), to_cgal_point(linear_edge.vertex1()), + to_cgal_point(parabolic.focus), + to_cgal_point(parabolic.directrix.a), + to_cgal_point(parabolic.directrix.b), + parabolic.is_focus_on_left); + + if (edge_b.is_curved()) + orientation = CGAL::opposite(orientation); + } + + return orientation; +} + +template +static typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + bool>::type +check_if_three_edges_are_ccw(const VD::edge_type &edge_first, + const VD::edge_type &edge_second, + const VD::edge_type &edge_third, + const SegmentIterator segment_begin, + const SegmentIterator segment_end) +{ + assert(is_equal(*edge_first.vertex0(), *edge_second.vertex0()) && is_equal(*edge_second.vertex0(), *edge_third.vertex0())); + + CGAL::Orientation orientation = orientation_of_two_edges(edge_first, edge_second, segment_begin, segment_end); if (orientation == CGAL::Orientation::COLLINEAR) { // The first two edges are collinear, so the third edge must be on the right side on the first of them. - return CGAL::orientation(common_pt, pt_1, test_pt) == CGAL::Orientation::RIGHT_TURN; + return orientation_of_two_edges(edge_first, edge_third, segment_begin, segment_end) == CGAL::Orientation::RIGHT_TURN; } else if (orientation == CGAL::Orientation::LEFT_TURN) { // CCW oriented angle between vectors (common_pt, pt1) and (common_pt, pt2) is bellow PI. // So we need to check if test_pt isn't between them. - CGAL::Orientation orientation1 = CGAL::orientation(common_pt, pt_1, test_pt); - CGAL::Orientation orientation2 = CGAL::orientation(common_pt, pt_2, test_pt); + CGAL::Orientation orientation1 = orientation_of_two_edges(edge_first, edge_third, segment_begin, segment_end); + CGAL::Orientation orientation2 = orientation_of_two_edges(edge_second, edge_third, segment_begin, segment_end); return (orientation1 != CGAL::Orientation::LEFT_TURN || orientation2 != CGAL::Orientation::RIGHT_TURN); } else { assert(orientation == CGAL::Orientation::RIGHT_TURN); // CCW oriented angle between vectors (common_pt, pt1) and (common_pt, pt2) is upper PI. // So we need to check if test_pt is between them. - CGAL::Orientation orientation1 = CGAL::orientation(common_pt, pt_1, test_pt); - CGAL::Orientation orientation2 = CGAL::orientation(common_pt, pt_2, test_pt); + CGAL::Orientation orientation1 = orientation_of_two_edges(edge_first, edge_third, segment_begin, segment_end); + CGAL::Orientation orientation2 = orientation_of_two_edges(edge_second, edge_third, segment_begin, segment_end); return (orientation1 == CGAL::Orientation::RIGHT_TURN || orientation2 == CGAL::Orientation::LEFT_TURN); } } -bool VoronoiUtilsCgal::is_voronoi_diagram_planar_angle(const VoronoiDiagram &voronoi_diagram) +template +typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + bool>::type +VoronoiUtilsCgal::is_voronoi_diagram_planar_angle(const VD &voronoi_diagram, + const SegmentIterator segment_begin, + const SegmentIterator segment_end) { for (const VD::vertex_type &vertex : voronoi_diagram.vertices()) { std::vector edges; const VD::edge_type *edge = vertex.incident_edge(); do { - // FIXME Lukas H.: Also process parabolic segments. - if (edge->is_finite() && edge->is_linear() && edge->vertex0() != nullptr && edge->vertex1() != nullptr && - Arachne::VoronoiUtils::is_finite(*edge->vertex0()) && Arachne::VoronoiUtils::is_finite(*edge->vertex1())) + if (edge->is_finite() && edge->vertex0() != nullptr && edge->vertex1() != nullptr && VoronoiUtils::is_finite(*edge->vertex0()) && VoronoiUtils::is_finite(*edge->vertex1())) edges.emplace_back(edge); edge = edge->rot_next(); @@ -86,12 +309,11 @@ bool VoronoiUtilsCgal::is_voronoi_diagram_planar_angle(const VoronoiDiagram &vor // Checking for CCW make sense for three and more edges. if (edges.size() > 2) { for (auto edge_it = edges.begin() ; edge_it != edges.end(); ++edge_it) { - const Geometry::VoronoiDiagram::edge_type *prev_edge = edge_it == edges.begin() ? edges.back() : *std::prev(edge_it); - const Geometry::VoronoiDiagram::edge_type *curr_edge = *edge_it; - const Geometry::VoronoiDiagram::edge_type *next_edge = std::next(edge_it) == edges.end() ? edges.front() : *std::next(edge_it); + const VD::edge_type *prev_edge = edge_it == edges.begin() ? edges.back() : *std::prev(edge_it); + const VD::edge_type *curr_edge = *edge_it; + const VD::edge_type *next_edge = std::next(edge_it) == edges.end() ? edges.front() : *std::next(edge_it); - if (!check_if_three_vectors_are_ccw(to_cgal_point(*prev_edge->vertex0()), to_cgal_point(*prev_edge->vertex1()), - to_cgal_point(*curr_edge->vertex1()), to_cgal_point(*next_edge->vertex1()))) + if (!check_if_three_edges_are_ccw(*prev_edge, *curr_edge, *next_edge, segment_begin, segment_end)) return false; } } @@ -100,5 +322,4 @@ bool VoronoiUtilsCgal::is_voronoi_diagram_planar_angle(const VoronoiDiagram &vor return true; } - } // namespace Slic3r::Geometry diff --git a/src/libslic3r/Geometry/VoronoiUtilsCgal.hpp b/src/libslic3r/Geometry/VoronoiUtilsCgal.hpp index 897891bd93..33ae847802 100644 --- a/src/libslic3r/Geometry/VoronoiUtilsCgal.hpp +++ b/src/libslic3r/Geometry/VoronoiUtilsCgal.hpp @@ -2,6 +2,7 @@ #define slic3r_VoronoiUtilsCgal_hpp_ #include "Voronoi.hpp" +#include "../Arachne/utils/PolygonsSegmentIndex.hpp" namespace Slic3r::Geometry { class VoronoiDiagram; @@ -13,8 +14,12 @@ public: static bool is_voronoi_diagram_planar_intersection(const VoronoiDiagram &voronoi_diagram); // Check if the Voronoi diagram is planar using verification that all neighboring edges are ordered CCW for each vertex. - static bool is_voronoi_diagram_planar_angle(const VoronoiDiagram &voronoi_diagram); - + template + static typename boost::polygon::enable_if< + typename boost::polygon::gtl_if::value_type>::type>::type>::type, + bool>::type + is_voronoi_diagram_planar_angle(const VoronoiDiagram &voronoi_diagram, SegmentIterator segment_begin, SegmentIterator segment_end); }; } // namespace Slic3r::Geometry diff --git a/src/libslic3r/MeshBoolean.cpp b/src/libslic3r/MeshBoolean.cpp index f9e66e9ebb..f6dd46e9ee 100644 --- a/src/libslic3r/MeshBoolean.cpp +++ b/src/libslic3r/MeshBoolean.cpp @@ -201,12 +201,12 @@ indexed_triangle_set cgal_to_indexed_triangle_set(const _Mesh &cgalmesh) const auto &vertices = cgalmesh.vertices(); int vsize = int(vertices.size()); - for (const auto &vi : vertices) { + for (auto &vi : vertices) { auto &v = cgalmesh.point(vi); // Don't ask... its.vertices.emplace_back(to_vec3f(v)); } - for (const auto &face : faces) { + for (auto &face : faces) { auto vtc = cgalmesh.vertices_around_face(cgalmesh.halfedge(face)); int i = 0; @@ -782,7 +782,7 @@ void do_boolean(McutMesh& srcMesh, const McutMesh& cutMesh, const std::string& b auto src_part = triangle_mesh_to_mcut(src_parts[i]); for (size_t j = 0; j < cut_parts.size(); j++) { auto cut_part = triangle_mesh_to_mcut(cut_parts[j]); - bool success = do_boolean_single(*src_part, *cut_part, boolean_opts); + do_boolean_single(*src_part, *cut_part, boolean_opts); } TriangleMesh tri_part = mcut_to_triangle_mesh(*src_part); its_merge(all_its, tri_part.its); @@ -811,7 +811,9 @@ void make_boolean(const TriangleMesh &src_mesh, const TriangleMesh &cut_mesh, st triangle_mesh_to_mcut(cut_mesh, cutMesh); //dst_mesh = make_boolean(srcMesh, cutMesh, boolean_opts); do_boolean(srcMesh, cutMesh, boolean_opts); - dst_mesh.push_back(mcut_to_triangle_mesh(srcMesh)); + TriangleMesh tri_src = mcut_to_triangle_mesh(srcMesh); + if (!tri_src.empty()) + dst_mesh.push_back(std::move(tri_src)); } } // namespace mcut diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp index 8d475cefbb..66aef84a3d 100644 --- a/src/libslic3r/Model.cpp +++ b/src/libslic3r/Model.cpp @@ -104,6 +104,7 @@ Model& Model::assign_copy(const Model &rhs) this->design_info = rhs.design_info; this->model_info = rhs.model_info; this->stl_design_id = rhs.stl_design_id; + this->stl_design_country = rhs.stl_design_country; this->profile_info = rhs.profile_info; this->mk_name = rhs.mk_name; @@ -138,6 +139,7 @@ Model& Model::assign_copy(Model &&rhs) //BBS: add auxiliary path logic // BBS: backup, all in one temp dir this->stl_design_id = rhs.stl_design_id; + this->stl_design_country = rhs.stl_design_country; this->mk_name = rhs.mk_name; this->mk_version = rhs.mk_version; this->backup_path = std::move(rhs.backup_path); @@ -217,6 +219,8 @@ Model Model::read_from_file(const std::string& input_file, DynamicPrintConfig* c result = load_step(input_file.c_str(), &model, is_cb_cancel, stepFn, stepIsUtf8Fn); else if (boost::algorithm::iends_with(input_file, ".stl")) result = load_stl(input_file.c_str(), &model, nullptr, stlFn); + else if (boost::algorithm::iends_with(input_file, ".oltp")) + result = load_stl(input_file.c_str(), &model, nullptr, stlFn,256); else if (boost::algorithm::iends_with(input_file, ".obj")) result = load_obj(input_file.c_str(), &model, message); else if (boost::algorithm::iends_with(input_file, ".svg")) @@ -954,6 +958,7 @@ void Model::load_from(Model& model) next_object_backup_id = model.next_object_backup_id; design_info = model.design_info; stl_design_id = model.stl_design_id; + stl_design_country = model.stl_design_country; model_info = model.model_info; profile_info = model.profile_info; mk_name = model.mk_name; @@ -1508,13 +1513,16 @@ BoundingBoxf3 ModelObject::instance_bounding_box(const ModelInstance &instance, //BBS: add convex bounding box BoundingBoxf3 ModelObject::instance_convex_hull_bounding_box(size_t instance_idx, bool dont_translate) const +{ + return instance_convex_hull_bounding_box(this->instances[instance_idx], dont_translate); +} + +BoundingBoxf3 ModelObject::instance_convex_hull_bounding_box(const ModelInstance* instance, bool dont_translate) const { BoundingBoxf3 bb; - const Transform3d& inst_matrix = dont_translate ? - this->instances[instance_idx]->get_transformation().get_matrix_no_offset() : - this->instances[instance_idx]->get_transformation().get_matrix(); - for (ModelVolume *v : this->volumes) - { + const Transform3d inst_matrix = dont_translate ? instance->get_transformation().get_matrix_no_offset() : + instance->get_transformation().get_matrix(); + for (ModelVolume* v : this->volumes) { if (v->is_model_part()) bb.merge(v->get_convex_hull().transformed_bounding_box(inst_matrix * v->get_matrix())); } diff --git a/src/libslic3r/Model.hpp b/src/libslic3r/Model.hpp index ecab5a1296..03b25b810e 100644 --- a/src/libslic3r/Model.hpp +++ b/src/libslic3r/Model.hpp @@ -482,6 +482,7 @@ public: //BBS: add instance convex hull bounding box BoundingBoxf3 instance_convex_hull_bounding_box(size_t instance_idx, bool dont_translate = false) const; + BoundingBoxf3 instance_convex_hull_bounding_box(const ModelInstance* instance, bool dont_translate = false) const; // Calculate 2D convex hull of of a projection of the transformed printable volumes into the XY plane. // This method is cheap in that it does not make any unnecessary copy of the volume meshes. @@ -1510,6 +1511,7 @@ public: // DesignInfo of Model std::string stl_design_id; + std::string stl_design_country; std::shared_ptr design_info = nullptr; std::shared_ptr model_info = nullptr; std::shared_ptr profile_info = nullptr; diff --git a/src/libslic3r/ModelArrange.cpp b/src/libslic3r/ModelArrange.cpp index 92ac77b191..477509e69e 100644 --- a/src/libslic3r/ModelArrange.cpp +++ b/src/libslic3r/ModelArrange.cpp @@ -176,7 +176,8 @@ ArrangePolygon get_instance_arrange_poly(ModelInstance* instance, const Slic3r:: ap.has_tree_support = true; } - ap.height = obj->bounding_box_exact().size().z(); + auto size = obj->instance_convex_hull_bounding_box(instance).size(); + ap.height = size.z(); ap.name = obj->name; return ap; } diff --git a/src/libslic3r/MultiMaterialSegmentation.cpp b/src/libslic3r/MultiMaterialSegmentation.cpp index 596fc56db4..148fdc9921 100644 --- a/src/libslic3r/MultiMaterialSegmentation.cpp +++ b/src/libslic3r/MultiMaterialSegmentation.cpp @@ -4,11 +4,11 @@ #include "Layer.hpp" #include "Print.hpp" #include "Geometry/VoronoiVisualUtils.hpp" +#include "Geometry/VoronoiUtils.hpp" #include "MutablePolygon.hpp" #include "format.hpp" #include -#include #include #include @@ -16,36 +16,19 @@ #include #include -namespace Slic3r { -struct ColoredLine { - Line line; - int color; - int poly_idx = -1; - int local_line_idx = -1; -}; -} +//#define MM_SEGMENTATION_DEBUG_GRAPH +//#define MM_SEGMENTATION_DEBUG_REGIONS +//#define MM_SEGMENTATION_DEBUG_INPUT +//#define MM_SEGMENTATION_DEBUG_PAINTED_LINES +//#define MM_SEGMENTATION_DEBUG_COLORIZED_POLYGONS -#include -namespace boost::polygon { -template <> -struct geometry_concept { typedef segment_concept type; }; +#if defined(MM_SEGMENTATION_DEBUG_GRAPH) || defined(MM_SEGMENTATION_DEBUG_REGIONS) || \ + defined(MM_SEGMENTATION_DEBUG_INPUT) || defined(MM_SEGMENTATION_DEBUG_PAINTED_LINES) || \ + defined(MM_SEGMENTATION_DEBUG_COLORIZED_POLYGONS) +#define MM_SEGMENTATION_DEBUG +#endif -template <> -struct segment_traits { - typedef coord_t coordinate_type; - typedef Slic3r::Point point_type; - - static inline point_type get(const Slic3r::ColoredLine& line, const direction_1d& dir) { - return dir.to_int() ? line.line.b : line.line.a; - } -}; -} - -//#define MMU_SEGMENTATION_DEBUG_GRAPH -//#define MMU_SEGMENTATION_DEBUG_REGIONS -//#define MMU_SEGMENTATION_DEBUG_INPUT -//#define MMU_SEGMENTATION_DEBUG_PAINTED_LINES -//#define MMU_SEGMENTATION_DEBUG_COLORIZED_POLYGONS +//#define MM_SEGMENTATION_DEBUG_TOP_BOTTOM namespace Slic3r { bool is_equal(float left, float right, float eps = 1e-3) { @@ -156,55 +139,31 @@ struct PaintedLineVisitor static inline const double append_threshold2 = Slic3r::sqr(append_threshold); }; -static Polygon colored_points_to_polygon(const std::vector &lines) -{ - Polygon out; - out.points.reserve(lines.size()); - for (const ColoredLine &l : lines) - out.points.emplace_back(l.line.a); - return out; -} - -static Polygons colored_points_to_polygon(const std::vector> &lines) -{ - Polygons out; - out.reserve(lines.size()); - for (const std::vector &l : lines) - out.emplace_back(colored_points_to_polygon(l)); - return out; +BoundingBox get_extents(const std::vector &colored_polygons) { + BoundingBox bbox; + for (const ColoredLines &colored_lines : colored_polygons) { + for (const ColoredLine &colored_line : colored_lines) { + bbox.merge(colored_line.line.a); + bbox.merge(colored_line.line.b); + } + } + return bbox; } // Flatten the vector of vectors into a vector. -static inline std::vector to_lines(const std::vector> &c_lines) +static inline ColoredLines to_lines(const std::vector &c_lines) { size_t n_lines = 0; for (const auto &c_line : c_lines) n_lines += c_line.size(); - std::vector lines; + ColoredLines lines; lines.reserve(n_lines); for (const auto &c_line : c_lines) lines.insert(lines.end(), c_line.begin(), c_line.end()); return lines; } -static bool vertex_equal_to_point(const Voronoi::VD::vertex_type &vertex, const Vec2d &ipt) -{ - // Convert ipt to doubles, force the 80bit FPU temporary to 64bit and then compare. - // This should work with any settings of math compiler switches and the C++ compiler - // shall understand the memcpies as type punning and it shall optimize them out. - using ulp_cmp_type = boost::polygon::detail::ulp_comparison; - ulp_cmp_type ulp_cmp; - static constexpr int ULPS = boost::polygon::voronoi_diagram_traits::vertex_equality_predicate_type::ULPS; - return ulp_cmp(vertex.x(), ipt.x(), ULPS) == ulp_cmp_type::EQUAL && - ulp_cmp(vertex.y(), ipt.y(), ULPS) == ulp_cmp_type::EQUAL; -} - -static inline bool vertex_equal_to_point(const Voronoi::VD::vertex_type *vertex, const Vec2d &ipt) -{ - return vertex_equal_to_point(*vertex, ipt); -} - -static std::vector> get_segments(const std::vector &polygon) +static std::vector> get_segments(const ColoredLines &polygon) { std::vector> segments; @@ -229,16 +188,6 @@ static std::vector> get_segments(const std::vector>> get_all_segments(const std::vector> &color_poly) -{ - std::vector>> all_segments(color_poly.size()); - for (size_t poly_idx = 0; poly_idx < color_poly.size(); ++poly_idx) { - const std::vector &c_polygon = color_poly[poly_idx]; - all_segments[poly_idx] = get_segments(c_polygon); - } - return all_segments; -} - static std::vector filter_painted_lines(const Line &line_to_process, const size_t start_idx, const size_t end_idx, const std::vector &painted_lines) { const int filter_eps_value = scale_(0.1f); @@ -319,7 +268,7 @@ static std::vector> post_process_painted_lines(const st } #ifndef NDEBUG -static bool are_lines_connected(const std::vector &colored_lines) +static bool are_lines_connected(const ColoredLines &colored_lines) { for (size_t line_idx = 1; line_idx < colored_lines.size(); ++line_idx) if (colored_lines[line_idx - 1].line.b != colored_lines[line_idx].line.a) @@ -328,7 +277,7 @@ static bool are_lines_connected(const std::vector &colored_lines) } #endif -static std::vector colorize_line(const Line &line_to_process, +static ColoredLines colorize_line(const Line &line_to_process, const size_t start_idx, const size_t end_idx, const std::vector &painted_contour) @@ -336,9 +285,9 @@ static std::vector colorize_line(const Line &line_to_process, assert(start_idx < painted_contour.size() && end_idx < painted_contour.size() && start_idx <= end_idx); assert(std::all_of(painted_contour.begin() + start_idx, painted_contour.begin() + end_idx + 1, [&painted_contour, &start_idx](const auto &p_line) { return painted_contour[start_idx].line_idx == p_line.line_idx; })); - const int filter_eps_value = scale_(0.1f); - std::vector final_lines; - const PaintedLine &first_line = painted_contour[start_idx]; + const int filter_eps_value = scale_(0.1f); + ColoredLines final_lines; + const PaintedLine &first_line = painted_contour[start_idx]; if (double dist_to_start = (first_line.projected_line.a - line_to_process.a).cast().norm(); dist_to_start > filter_eps_value) final_lines.push_back({Line(line_to_process.a, first_line.projected_line.a), 0}); final_lines.push_back({first_line.projected_line, first_line.color}); @@ -377,7 +326,7 @@ static std::vector colorize_line(const Line &line_to_process, if (line_1.line.length() <= scale_(0.2)) line_1.color = line_0.color; } - std::vector colored_lines_simple; + ColoredLines colored_lines_simple; colored_lines_simple.emplace_back(final_lines.front()); for (size_t line_idx = 1; line_idx < final_lines.size(); ++line_idx) { const ColoredLine &line_0 = final_lines[line_idx]; @@ -405,7 +354,7 @@ static std::vector colorize_line(const Line &line_to_process, return final_lines; } -static std::vector filter_colorized_polygon(std::vector &&new_lines) { +static ColoredLines filter_colorized_polygon(ColoredLines &&new_lines) { for (size_t line_idx = 2; line_idx < new_lines.size(); ++line_idx) { const ColoredLine &line_0 = new_lines[line_idx - 2]; ColoredLine &line_1 = new_lines[line_idx - 1]; @@ -494,10 +443,10 @@ static std::vector filter_colorized_polygon(std::vector colorize_contour(const EdgeGrid::Contour &contour, const std::vector &painted_contour) { +static ColoredLines colorize_contour(const EdgeGrid::Contour &contour, const std::vector &painted_contour) { assert(painted_contour.empty() || std::all_of(painted_contour.begin(), painted_contour.end(), [&painted_contour](const auto &p_line) { return painted_contour.front().contour_idx == p_line.contour_idx; })); - std::vector colorized_contour; + ColoredLines colorized_contour; if (painted_contour.empty()) { // Appends contour with default color for lines before the first PaintedLine. colorized_contour.reserve(contour.num_segments()); @@ -534,297 +483,33 @@ static std::vector colorize_contour(const EdgeGrid::Contour &contou return filter_colorized_polygon(std::move(colorized_contour)); } -static std::vector> colorize_contours(const std::vector &contours, const std::vector> &painted_contours) +static std::vector colorize_contours(const std::vector &contours, const std::vector> &painted_contours) { assert(contours.size() == painted_contours.size()); - std::vector> colorized_contours(contours.size()); + std::vector colorized_contours(contours.size()); for (const std::vector &painted_contour : painted_contours) { size_t contour_idx = &painted_contour - &painted_contours.front(); colorized_contours[contour_idx] = colorize_contour(contours[contour_idx], painted_contours[contour_idx]); } + + size_t poly_idx = 0; + for (ColoredLines &color_lines : colorized_contours) { + size_t line_idx = 0; + for (size_t color_line_idx = 0; color_line_idx < color_lines.size(); ++color_line_idx) { + color_lines[color_line_idx].poly_idx = int(poly_idx); + color_lines[color_line_idx].local_line_idx = int(line_idx); + ++line_idx; + } + ++poly_idx; + } + return colorized_contours; } -using boost::polygon::voronoi_diagram; - -static inline Point mk_point(const Voronoi::VD::vertex_type *point) { return {coord_t(point->x()), coord_t(point->y())}; } - -static inline Point mk_point(const Voronoi::Internal::point_type &point) { return {coord_t(point.x()), coord_t(point.y())}; } - -static inline Point mk_point(const voronoi_diagram::vertex_type &point) { return {coord_t(point.x()), coord_t(point.y())}; } - -static inline Point mk_point(const Vec2d &point) { return {coord_t(std::round(point.x())), coord_t(std::round(point.y()))}; } - -static inline Vec2d mk_vec2(const voronoi_diagram::vertex_type *point) { return {point->x(), point->y()}; } - -struct MMU_Graph -{ - enum class ARC_TYPE { BORDER, NON_BORDER }; - - struct Arc - { - size_t from_idx; - size_t to_idx; - int color; - ARC_TYPE type; - - bool operator==(const Arc &rhs) const { return (from_idx == rhs.from_idx) && (to_idx == rhs.to_idx) && (color == rhs.color) && (type == rhs.type); } - bool operator!=(const Arc &rhs) const { return !operator==(rhs); } - }; - - struct Node - { - Vec2d point; - std::list arc_idxs; - - void remove_edge(const size_t to_idx, MMU_Graph &graph) - { - for (auto arc_it = this->arc_idxs.begin(); arc_it != this->arc_idxs.end(); ++arc_it) { - MMU_Graph::Arc &arc = graph.arcs[*arc_it]; - if (arc.to_idx == to_idx) { - assert(arc.type != ARC_TYPE::BORDER); - this->arc_idxs.erase(arc_it); - break; - } - } - } - }; - - std::vector nodes; - std::vector arcs; - size_t all_border_points{}; - - std::vector polygon_idx_offset; - std::vector polygon_sizes; - - void remove_edge(const size_t from_idx, const size_t to_idx) - { - nodes[from_idx].remove_edge(to_idx, *this); - nodes[to_idx].remove_edge(from_idx, *this); - } - - [[nodiscard]] size_t get_global_index(const size_t poly_idx, const size_t point_idx) const { return polygon_idx_offset[poly_idx] + point_idx; } - - void append_edge(const size_t &from_idx, const size_t &to_idx, int color = -1, ARC_TYPE type = ARC_TYPE::NON_BORDER) - { - // Don't append duplicate edges between the same nodes. - for (const size_t &arc_idx : this->nodes[from_idx].arc_idxs) - if (arcs[arc_idx].to_idx == to_idx) - return; - for (const size_t &arc_idx : this->nodes[to_idx].arc_idxs) - if (arcs[arc_idx].to_idx == from_idx) - return; - - this->nodes[from_idx].arc_idxs.push_back(this->arcs.size()); - this->arcs.push_back({from_idx, to_idx, color, type}); - - // Always insert only one directed arc for the input polygons. - // Two directed arcs in both directions are inserted if arcs aren't between points of the input polygons. - if (type == ARC_TYPE::NON_BORDER) { - this->nodes[to_idx].arc_idxs.push_back(this->arcs.size()); - this->arcs.push_back({to_idx, from_idx, color, type}); - } - } - - // It assumes that between points of the input polygons is always only one directed arc, - // with the same direction as lines of the input polygon. - [[nodiscard]] MMU_Graph::Arc get_border_arc(size_t idx) const { - assert(idx < this->all_border_points); - return this->arcs[idx]; - } - - [[nodiscard]] size_t nodes_count() const { return this->nodes.size(); } - - void remove_nodes_with_one_arc() - { - std::queue update_queue; - for (const MMU_Graph::Node &node : this->nodes) { - size_t node_idx = &node - &this->nodes.front(); - // Skip nodes that represent points of input polygons. - if (node.arc_idxs.size() == 1 && node_idx >= this->all_border_points) - update_queue.emplace(&node - &this->nodes.front()); - } - - while (!update_queue.empty()) { - size_t node_from_idx = update_queue.front(); - MMU_Graph::Node &node_from = this->nodes[update_queue.front()]; - update_queue.pop(); - if (node_from.arc_idxs.empty()) - continue; - - assert(node_from.arc_idxs.size() == 1); - size_t node_to_idx = arcs[node_from.arc_idxs.front()].to_idx; - MMU_Graph::Node &node_to = this->nodes[node_to_idx]; - this->remove_edge(node_from_idx, node_to_idx); - if (node_to.arc_idxs.size() == 1 && node_to_idx >= this->all_border_points) - update_queue.emplace(node_to_idx); - } - } - - void add_contours(const std::vector> &color_poly) - { - this->all_border_points = nodes.size(); - this->polygon_sizes = std::vector(color_poly.size()); - for (size_t polygon_idx = 0; polygon_idx < color_poly.size(); ++polygon_idx) - this->polygon_sizes[polygon_idx] = color_poly[polygon_idx].size(); - this->polygon_idx_offset = std::vector(color_poly.size()); - this->polygon_idx_offset[0] = 0; - for (size_t polygon_idx = 1; polygon_idx < color_poly.size(); ++polygon_idx) { - this->polygon_idx_offset[polygon_idx] = this->polygon_idx_offset[polygon_idx - 1] + color_poly[polygon_idx - 1].size(); - } - - size_t poly_idx = 0; - for (const std::vector &color_lines : color_poly) { - size_t line_idx = 0; - for (const ColoredLine &color_line : color_lines) { - size_t from_idx = this->get_global_index(poly_idx, line_idx); - size_t to_idx = this->get_global_index(poly_idx, (line_idx + 1) % color_lines.size()); - this->append_edge(from_idx, to_idx, color_line.color, ARC_TYPE::BORDER); - ++line_idx; - } - ++poly_idx; - } - } - - // Nodes 0..all_border_points are only one with are on countour. Other vertexis are consider as not on coouter. So we check if base on attach index - inline bool is_vertex_on_contour(const Voronoi::VD::vertex_type *vertex) const - { - assert(vertex != nullptr); - return vertex->color() < this->all_border_points; - } - - [[nodiscard]] inline bool is_edge_attach_to_contour(const voronoi_diagram::const_edge_iterator &edge_iterator) const - { - return this->is_vertex_on_contour(edge_iterator->vertex0()) || this->is_vertex_on_contour(edge_iterator->vertex1()); - } - - [[nodiscard]] inline bool is_edge_connecting_two_contour_vertices(const voronoi_diagram::const_edge_iterator &edge_iterator) const - { - return this->is_vertex_on_contour(edge_iterator->vertex0()) && this->is_vertex_on_contour(edge_iterator->vertex1()); - } - - // All Voronoi vertices are post-processes to merge very close vertices to single. Witch eliminates issues with intersection edges. - // Also, Voronoi vertices outside of the bounding of input polygons are throw away by marking them. - void append_voronoi_vertices(const Geometry::VoronoiDiagram &vd, const Polygons &color_poly_tmp, BoundingBox bbox) { - bbox.offset(SCALED_EPSILON); - - struct CPoint - { - CPoint() = delete; - CPoint(const Vec2d &point, size_t contour_idx, size_t point_idx) : m_point_double(point), m_point(mk_point(point)), m_point_idx(point_idx), m_contour_idx(contour_idx) {} - CPoint(const Vec2d &point, size_t point_idx) : m_point_double(point), m_point(mk_point(point)), m_point_idx(point_idx), m_contour_idx(0) {} - const Vec2d m_point_double; - const Point m_point; - size_t m_point_idx; - size_t m_contour_idx; - - [[nodiscard]] const Vec2d &point_double() const { return m_point_double; } - [[nodiscard]] const Point &point() const { return m_point; } - bool operator==(const CPoint &rhs) const { return this->m_point_double == rhs.m_point_double && this->m_contour_idx == rhs.m_contour_idx && this->m_point_idx == rhs.m_point_idx; } - }; - struct CPointAccessor { const Point* operator()(const CPoint &pt) const { return &pt.point(); }}; - typedef ClosestPointInRadiusLookup CPointLookupType; - - CPointLookupType closest_voronoi_point(coord_t(SCALED_EPSILON)); - CPointLookupType closest_contour_point(3 * coord_t(SCALED_EPSILON)); - for (const Polygon &polygon : color_poly_tmp) - for (const Point &pt : polygon.points) - closest_contour_point.insert(CPoint(Vec2d(pt.x(), pt.y()), &polygon - &color_poly_tmp.front(), &pt - &polygon.points.front())); - - for (const voronoi_diagram::vertex_type &vertex : vd.vertices()) { - vertex.color(-1); - Vec2d vertex_point_double = Vec2d(vertex.x(), vertex.y()); - Point vertex_point = mk_point(vertex); - - const Vec2d &first_point_double = this->nodes[this->get_border_arc(vertex.incident_edge()->cell()->source_index()).from_idx].point; - const Vec2d &second_point_double = this->nodes[this->get_border_arc(vertex.incident_edge()->twin()->cell()->source_index()).from_idx].point; - - if (vertex_equal_to_point(&vertex, first_point_double)) { - assert(vertex.color() != vertex.incident_edge()->cell()->source_index()); - assert(vertex.color() != vertex.incident_edge()->twin()->cell()->source_index()); - vertex.color(this->get_border_arc(vertex.incident_edge()->cell()->source_index()).from_idx); - } else if (vertex_equal_to_point(&vertex, second_point_double)) { - assert(vertex.color() != vertex.incident_edge()->cell()->source_index()); - assert(vertex.color() != vertex.incident_edge()->twin()->cell()->source_index()); - vertex.color(this->get_border_arc(vertex.incident_edge()->twin()->cell()->source_index()).from_idx); - } else if (bbox.contains(vertex_point)) { - if (auto [contour_pt, c_dist_sqr] = closest_contour_point.find(vertex_point); contour_pt != nullptr && c_dist_sqr < Slic3r::sqr(3 * SCALED_EPSILON)) { - vertex.color(this->get_global_index(contour_pt->m_contour_idx, contour_pt->m_point_idx)); - } else if (auto [voronoi_pt, v_dist_sqr] = closest_voronoi_point.find(vertex_point); voronoi_pt == nullptr || v_dist_sqr >= Slic3r::sqr(SCALED_EPSILON / 10.0)) { - closest_voronoi_point.insert(CPoint(vertex_point_double, this->nodes_count())); - vertex.color(this->nodes_count()); - this->nodes.push_back({vertex_point_double}); - } else { - // Boost Voronoi diagram generator sometimes creates two very closed points instead of one point. - // For the example points (146872.99999999997, -146872.99999999997) and (146873, -146873), this example also included in Voronoi generator test cases. - std::vector> all_closes_c_points = closest_voronoi_point.find_all(vertex_point); - int merge_to_point = -1; - for (const std::pair &c_point : all_closes_c_points) - if ((vertex_point_double - c_point.first->point_double()).squaredNorm() <= Slic3r::sqr(EPSILON)) { - merge_to_point = int(c_point.first->m_point_idx); - break; - } - - if (merge_to_point != -1) { - vertex.color(merge_to_point); - } else { - closest_voronoi_point.insert(CPoint(vertex_point_double, this->nodes_count())); - vertex.color(this->nodes_count()); - this->nodes.push_back({vertex_point_double}); - } - } - } - } - } - - void garbage_collect() - { - std::vector nodes_map(this->nodes.size(), -1); - int nodes_count = 0; - size_t arcs_count = 0; - for (const MMU_Graph::Node &node : this->nodes) - if (size_t node_idx = &node - &this->nodes.front(); !node.arc_idxs.empty()) { - nodes_map[node_idx] = nodes_count++; - arcs_count += node.arc_idxs.size(); - } - - std::vector new_nodes; - std::vector new_arcs; - new_nodes.reserve(nodes_count); - new_arcs.reserve(arcs_count); - for (const MMU_Graph::Node &node : this->nodes) - if (size_t node_idx = &node - &this->nodes.front(); nodes_map[node_idx] >= 0) { - new_nodes.push_back({node.point}); - for (const size_t &arc_idx : node.arc_idxs) { - const Arc &arc = this->arcs[arc_idx]; - new_nodes.back().arc_idxs.emplace_back(new_arcs.size()); - new_arcs.push_back({size_t(nodes_map[arc.from_idx]), size_t(nodes_map[arc.to_idx]), arc.color, arc.type}); - } - } - - this->nodes = std::move(new_nodes); - this->arcs = std::move(new_arcs); - } -}; - -static inline void mark_processed(const voronoi_diagram::const_edge_iterator &edge_iterator) -{ - edge_iterator->color(true); - edge_iterator->twin()->color(true); -} - -// Return true, if "p" is closer to line.a, then line.b -static inline bool is_point_closer_to_beginning_of_line(const Line &line, const Point &p) -{ - return (p - line.a).cast().squaredNorm() < (p - line.b).cast().squaredNorm(); -} - -static inline bool has_same_color(const ColoredLine &cl1, const ColoredLine &cl2) { return cl1.color == cl2.color; } - // Determines if the line points from the point between two contour lines is pointing inside polygon or outside. static inline bool points_inside(const Line &contour_first, const Line &contour_second, const Point &new_point) { - // Used in points_inside for decision if line leading thought the common point of two lines is pointing inside polygon or outside + // TODO: Used in points_inside for decision if line leading thought the common point of two lines is pointing inside polygon or outside auto three_points_inward_normal = [](const Point &left, const Point &middle, const Point &right) -> Vec2d { assert(left != middle); assert(middle != right); @@ -839,534 +524,309 @@ static inline bool points_inside(const Line &contour_first, const Line &contour_ return side > 0.; } -static inline bool line_intersection_with_epsilon(const Line &line_to_extend, const Line &other, Point *intersection) -{ - Line extended_line = line_to_extend; - extended_line.extend(15 * SCALED_EPSILON); - return extended_line.intersection(other, intersection); +enum VD_ANNOTATION : Voronoi::VD::cell_type::color_type { + VERTEX_ON_CONTOUR = 1, + DELETED = 2 +}; + +#ifdef MM_SEGMENTATION_DEBUG_GRAPH +static void export_graph_to_svg(const std::string &path, const Voronoi::VD& vd, const std::vector& colored_polygons) { + const coordf_t stroke_width = scaled(0.05f); + const BoundingBox bbox = get_extents(colored_polygons); + + SVG svg(path.c_str(), bbox); + for (const ColoredLines &colored_lines : colored_polygons) + for (const ColoredLine &colored_line : colored_lines) + svg.draw(colored_line.line, "black", stroke_width); + + for (const Voronoi::VD::vertex_type &vertex : vd.vertices()) { + if (Geometry::VoronoiUtils::is_in_range(vertex)) { + if (const Point pt = Geometry::VoronoiUtils::to_point(&vertex).cast(); vertex.color() == VD_ANNOTATION::VERTEX_ON_CONTOUR) { + svg.draw(pt, "blue", coord_t(stroke_width)); + } else if (vertex.color() != VD_ANNOTATION::DELETED) { + svg.draw(pt, "green", coord_t(stroke_width)); + } + } + } + + for (const Voronoi::VD::edge_type &edge : vd.edges()) { + if (edge.is_infinite() || !Geometry::VoronoiUtils::is_in_range(edge)) + continue; + + const Point from = Geometry::VoronoiUtils::to_point(edge.vertex0()).cast(); + const Point to = Geometry::VoronoiUtils::to_point(edge.vertex1()).cast(); + + if (edge.color() != VD_ANNOTATION::DELETED) + svg.draw(Line(from, to), "red", stroke_width); + } +} +#endif // MM_SEGMENTATION_DEBUG_GRAPH + +static size_t non_deleted_edge_count(const VD::vertex_type &vertex) { + size_t non_deleted_edge_cnt = 0; + const VD::edge_type *edge = vertex.incident_edge(); + do { + if (edge->color() != VD_ANNOTATION::DELETED) + ++non_deleted_edge_cnt; + } while (edge = edge->prev()->twin(), edge != vertex.incident_edge()); + + return non_deleted_edge_cnt; } -// For every ColoredLine in lines_colored_out, assign the index of the polygon to which belongs and also the index of this line inside of the polygon. -static inline void init_polygon_indices(const MMU_Graph &graph, - const std::vector> &color_poly, - std::vector &lines_colored_out) -{ - size_t poly_idx = 0; - for (const std::vector &color_lines : color_poly) { - size_t line_idx = 0; - for (size_t color_line_idx = 0; color_line_idx < color_lines.size(); ++color_line_idx) { - size_t from_idx = graph.get_global_index(poly_idx, line_idx); - lines_colored_out[from_idx].poly_idx = int(poly_idx); - lines_colored_out[from_idx].local_line_idx = int(line_idx); - ++line_idx; - } - ++poly_idx; +static bool can_vertex_be_deleted(const VD::vertex_type &vertex) { + if (vertex.color() == VD_ANNOTATION::VERTEX_ON_CONTOUR || vertex.color() == VD_ANNOTATION::DELETED) + return false; + + return non_deleted_edge_count(vertex) <= 1; +} + +static void delete_vertex_deep(const VD::vertex_type &vertex) { + std::queue vertices_to_delete; + vertices_to_delete.emplace(&vertex); + + while (!vertices_to_delete.empty()) { + const VD::vertex_type &vertex_to_delete = *vertices_to_delete.front(); + vertices_to_delete.pop(); + vertex_to_delete.color(VD_ANNOTATION::DELETED); + + const VD::edge_type *edge = vertex_to_delete.incident_edge(); + do { + edge->color(VD_ANNOTATION::DELETED); + edge->twin()->color(VD_ANNOTATION::DELETED); + + if (edge->is_finite() && can_vertex_be_deleted(*edge->vertex1())) + vertices_to_delete.emplace(edge->vertex1()); + } while (edge = edge->prev()->twin(), edge != vertex_to_delete.incident_edge()); } } -// Voronoi edges produced by Voronoi generator cloud have coordinates that don't fit inside coord_t (int32_t). -// Because of that, this function tries to clip edges that have one endpoint of the edge inside the BoundingBox. -static inline Line clip_finite_voronoi_edge(const Voronoi::VD::edge_type &edge, const BoundingBoxf &bbox) -{ +static inline Vec2d mk_point_vec2d(const VD::vertex_type *point) { + assert(point != nullptr); + return {point->x(), point->y()}; +} + +static inline Vec2d mk_vector_vec2d(const VD::edge_type *edge) { + assert(edge != nullptr); + return mk_point_vec2d(edge->vertex1()) - mk_point_vec2d(edge->vertex0()); +} + +static inline Vec2d mk_flipped_vector_vec2d(const VD::edge_type *edge) { + assert(edge != nullptr); + return mk_point_vec2d(edge->vertex0()) - mk_point_vec2d(edge->vertex1()); +} + +static double edge_length(const VD::edge_type &edge) { assert(edge.is_finite()); - Vec2d v0 = mk_vec2(edge.vertex0()); - Vec2d v1 = mk_vec2(edge.vertex1()); - bool contains_v0 = bbox.contains(v0); - bool contains_v1 = bbox.contains(v1); - if ((contains_v0 && contains_v1) || (!contains_v0 && !contains_v1)) - return {mk_point(edge.vertex0()), mk_point(edge.vertex1())}; - - Vec2d vector = (v1 - v0).normalized() * bbox.size().norm(); - if (!contains_v0) - v0 = (v1 - vector); - else - v1 = (v0 + vector); - - return {v0.cast(), v1.cast()}; -} - -static MMU_Graph build_graph(size_t layer_idx, const std::vector> &color_poly) -{ - Geometry::VoronoiDiagram vd; - std::vector lines_colored = to_lines(color_poly); - const Polygons color_poly_tmp = colored_points_to_polygon(color_poly); - const Points points = to_points(color_poly_tmp); - const Lines lines = to_lines(color_poly_tmp); - - // The algorithm adds edges to the graph that are between two different colors. - // If a polygon is colored entirely with one color, we need to add at least one edge from that polygon artificially. - // Adding this edge is necessary for cases where the expolygon has an outer contour colored whole with one color - // and a hole colored with a different color. If an edge wasn't added to the graph, - // the entire expolygon would be colored with single random color instead of two different. - std::vector force_edge_adding(color_poly.size()); - - // For each polygon, check if it is all colored with the same color. If it is, we need to force adding one edge to it. - for (const std::vector &c_poly : color_poly) { - bool force_edge = true; - for (const ColoredLine &c_line : c_poly) - if (c_line.color != c_poly.front().color) { - force_edge = false; - break; - } - force_edge_adding[&c_poly - &color_poly.front()] = force_edge; - } - - boost::polygon::construct_voronoi(lines_colored.begin(), lines_colored.end(), &vd); - MMU_Graph graph; - graph.nodes.reserve(points.size() + vd.vertices().size()); - for (const Point &point : points) - graph.nodes.push_back({Vec2d(double(point.x()), double(point.y()))}); - - graph.add_contours(color_poly); - init_polygon_indices(graph, color_poly, lines_colored); - - assert(graph.nodes.size() == lines_colored.size()); - BoundingBox bbox = get_extents(color_poly_tmp); - graph.append_voronoi_vertices(vd, color_poly_tmp, bbox); - - auto get_prev_contour_line = [&lines_colored, &color_poly, &graph](const voronoi_diagram::const_edge_iterator &edge_it) -> ColoredLine { - size_t contour_line_local_idx = lines_colored[edge_it->cell()->source_index()].local_line_idx; - size_t contour_line_size = color_poly[lines_colored[edge_it->cell()->source_index()].poly_idx].size(); - size_t contour_prev_idx = graph.get_global_index(lines_colored[edge_it->cell()->source_index()].poly_idx, - (contour_line_local_idx > 0) ? contour_line_local_idx - 1 : contour_line_size - 1); - return lines_colored[contour_prev_idx]; - }; - - auto get_next_contour_line = [&lines_colored, &color_poly, &graph](const voronoi_diagram::const_edge_iterator &edge_it) -> ColoredLine { - size_t contour_line_local_idx = lines_colored[edge_it->cell()->source_index()].local_line_idx; - size_t contour_line_size = color_poly[lines_colored[edge_it->cell()->source_index()].poly_idx].size(); - size_t contour_next_idx = graph.get_global_index(lines_colored[edge_it->cell()->source_index()].poly_idx, - (contour_line_local_idx + 1) % contour_line_size); - return lines_colored[contour_next_idx]; - }; - - bbox.offset(scale_(10.)); - const BoundingBoxf bbox_clip(bbox.min.cast(), bbox.max.cast()); - const double bbox_dim_max = double(std::max(bbox.size().x(), bbox.size().y())); - - // Make a copy of the input segments with the double type. - std::vector segments; - for (const Line &line : lines) - segments.emplace_back(Voronoi::Internal::point_type(double(line.a(0)), double(line.a(1))), - Voronoi::Internal::point_type(double(line.b(0)), double(line.b(1)))); - - for (auto edge_it = vd.edges().begin(); edge_it != vd.edges().end(); ++edge_it) { - // Skip second half-edge - if (edge_it->cell()->source_index() > edge_it->twin()->cell()->source_index() || edge_it->color()) - continue; - - if (edge_it->is_infinite() && (edge_it->vertex0() != nullptr || edge_it->vertex1() != nullptr)) { - // Infinite edge is leading through a point on the counter, but there are no Voronoi vertices. - // So we could fix this case by computing the intersection between the contour line and infinity edge. - std::vector samples; - Voronoi::Internal::clip_infinite_edge(points, segments, *edge_it, bbox_dim_max, &samples); - if (samples.empty()) - continue; - - const Line edge_line(mk_point(samples[0]), mk_point(samples[1])); - const ColoredLine &contour_line = lines_colored[edge_it->cell()->source_index()]; - Point contour_intersection; - - if (line_intersection_with_epsilon(contour_line.line, edge_line, &contour_intersection)) { - const MMU_Graph::Arc &graph_arc = graph.get_border_arc(edge_it->cell()->source_index()); - const size_t from_idx = (edge_it->vertex1() != nullptr) ? edge_it->vertex1()->color() : edge_it->vertex0()->color(); - size_t to_idx = ((contour_line.line.a - contour_intersection).cast().squaredNorm() < - (contour_line.line.b - contour_intersection).cast().squaredNorm()) ? - graph_arc.from_idx : - graph_arc.to_idx; - if (from_idx != to_idx && from_idx < graph.nodes_count() && to_idx < graph.nodes_count()) { - graph.append_edge(from_idx, to_idx); - mark_processed(edge_it); - } - } - } else if (edge_it->is_finite()) { - // Both points are on contour, so skip them. In cases of duplicate Voronoi vertices, skip edges between the same two points. - if (graph.is_edge_connecting_two_contour_vertices(edge_it) || (edge_it->vertex0()->color() == edge_it->vertex1()->color())) - continue; - - const Line edge_line = clip_finite_voronoi_edge(*edge_it, bbox_clip); - const Line contour_line = lines_colored[edge_it->cell()->source_index()].line; - const ColoredLine colored_line = lines_colored[edge_it->cell()->source_index()]; - const ColoredLine contour_line_prev = get_prev_contour_line(edge_it); - const ColoredLine contour_line_next = get_next_contour_line(edge_it); - - if (edge_it->vertex0()->color() >= graph.nodes_count() || edge_it->vertex1()->color() >= graph.nodes_count()) { - enum class Vertex { VERTEX0, VERTEX1 }; - auto append_edge_if_intersects_with_contour = [&graph, &lines_colored, &edge_line, &contour_line](const voronoi_diagram::const_edge_iterator &edge_iterator, const Vertex vertex) { - Point intersection; - Line contour_line_twin = lines_colored[edge_iterator->twin()->cell()->source_index()].line; - if (line_intersection_with_epsilon(contour_line_twin, edge_line, &intersection)) { - const MMU_Graph::Arc &graph_arc = graph.get_border_arc(edge_iterator->twin()->cell()->source_index()); - const size_t to_idx_l = is_point_closer_to_beginning_of_line(contour_line_twin, intersection) ? graph_arc.from_idx : - graph_arc.to_idx; - graph.append_edge(vertex == Vertex::VERTEX0 ? edge_iterator->vertex0()->color() : edge_iterator->vertex1()->color(), to_idx_l); - } else if (line_intersection_with_epsilon(contour_line, edge_line, &intersection)) { - const MMU_Graph::Arc &graph_arc = graph.get_border_arc(edge_iterator->cell()->source_index()); - const size_t to_idx_l = is_point_closer_to_beginning_of_line(contour_line, intersection) ? graph_arc.from_idx : graph_arc.to_idx; - graph.append_edge(vertex == Vertex::VERTEX0 ? edge_iterator->vertex0()->color() : edge_iterator->vertex1()->color(), to_idx_l); - } - mark_processed(edge_iterator); - }; - - if (edge_it->vertex0()->color() < graph.nodes_count() && !graph.is_vertex_on_contour(edge_it->vertex0())) - append_edge_if_intersects_with_contour(edge_it, Vertex::VERTEX0); - - if (edge_it->vertex1()->color() < graph.nodes_count() && !graph.is_vertex_on_contour(edge_it->vertex1())) - append_edge_if_intersects_with_contour(edge_it, Vertex::VERTEX1); - } else if (graph.is_edge_attach_to_contour(edge_it)) { - mark_processed(edge_it); - // Skip edges witch connection two points on a contour - if (graph.is_edge_connecting_two_contour_vertices(edge_it)) - continue; - - const size_t from_idx = edge_it->vertex0()->color(); - const size_t to_idx = edge_it->vertex1()->color(); - if (graph.is_vertex_on_contour(edge_it->vertex0())) { - if (is_point_closer_to_beginning_of_line(contour_line, edge_line.a)) { - if ((!has_same_color(contour_line_prev, colored_line) || force_edge_adding[colored_line.poly_idx]) && points_inside(contour_line_prev.line, contour_line, edge_line.b)) { - graph.append_edge(from_idx, to_idx); - force_edge_adding[colored_line.poly_idx] = false; - } - } else { - if ((!has_same_color(contour_line_next, colored_line) || force_edge_adding[colored_line.poly_idx]) && points_inside(contour_line, contour_line_next.line, edge_line.b)) { - graph.append_edge(from_idx, to_idx); - force_edge_adding[colored_line.poly_idx] = false; - } - } - } else { - assert(graph.is_vertex_on_contour(edge_it->vertex1())); - if (is_point_closer_to_beginning_of_line(contour_line, edge_line.b)) { - if ((!has_same_color(contour_line_prev, colored_line) || force_edge_adding[colored_line.poly_idx]) && points_inside(contour_line_prev.line, contour_line, edge_line.a)) { - graph.append_edge(from_idx, to_idx); - force_edge_adding[colored_line.poly_idx] = false; - } - } else { - if ((!has_same_color(contour_line_next, colored_line) || force_edge_adding[colored_line.poly_idx]) && points_inside(contour_line, contour_line_next.line, edge_line.a)) { - graph.append_edge(from_idx, to_idx); - force_edge_adding[colored_line.poly_idx] = false; - } - } - } - } else if (Point intersection; line_intersection_with_epsilon(contour_line, edge_line, &intersection)) { - mark_processed(edge_it); - Vec2d real_v0_double = graph.nodes[edge_it->vertex0()->color()].point; - Vec2d real_v1_double = graph.nodes[edge_it->vertex1()->color()].point; - Point real_v0 = Point(coord_t(real_v0_double.x()), coord_t(real_v0_double.y())); - Point real_v1 = Point(coord_t(real_v1_double.x()), coord_t(real_v1_double.y())); - - if (is_point_closer_to_beginning_of_line(contour_line, intersection)) { - Line first_part(intersection, real_v0); - Line second_part(intersection, real_v1); - - if (!has_same_color(contour_line_prev, colored_line)) { - if (points_inside(contour_line_prev.line, contour_line, first_part.b)) - graph.append_edge(edge_it->vertex0()->color(), graph.get_border_arc(edge_it->cell()->source_index()).from_idx); - - if (points_inside(contour_line_prev.line, contour_line, second_part.b)) - graph.append_edge(edge_it->vertex1()->color(), graph.get_border_arc(edge_it->cell()->source_index()).from_idx); - } - } else { - const size_t int_point_idx = graph.get_border_arc(edge_it->cell()->source_index()).to_idx; - const Vec2d int_point_double = graph.nodes[int_point_idx].point; - const Point int_point = Point(coord_t(int_point_double.x()), coord_t(int_point_double.y())); - - const Line first_part(int_point, real_v0); - const Line second_part(int_point, real_v1); - - if (!has_same_color(contour_line_next, colored_line)) { - if (points_inside(contour_line, contour_line_next.line, first_part.b)) - graph.append_edge(edge_it->vertex0()->color(), int_point_idx); - - if (points_inside(contour_line, contour_line_next.line, second_part.b)) - graph.append_edge(edge_it->vertex1()->color(), int_point_idx); - } - } - } - } - } - - for (auto edge_it = vd.edges().begin(); edge_it != vd.edges().end(); ++edge_it) { - // Skip second half-edge and processed edges - if (edge_it->cell()->source_index() > edge_it->twin()->cell()->source_index() || edge_it->color()) - continue; - - if (edge_it->is_finite() && !bool(edge_it->color()) && edge_it->vertex0()->color() < graph.nodes_count() && - edge_it->vertex1()->color() < graph.nodes_count()) { - // Skip cases, when the edge is between two same vertices, which is in cases two near vertices were merged together. - if (edge_it->vertex0()->color() == edge_it->vertex1()->color()) - continue; - - size_t from_idx = edge_it->vertex0()->color(); - size_t to_idx = edge_it->vertex1()->color(); - graph.append_edge(from_idx, to_idx); - } - mark_processed(edge_it); - } - - graph.remove_nodes_with_one_arc(); - return graph; -} - -static inline Polygon to_polygon(const std::vector> &id_to_lines) -{ - std::vector lines; - for (auto id_to_line : id_to_lines) - lines.emplace_back(id_to_line.second); - - Polygon poly_out; - poly_out.points.reserve(lines.size()); - for (const Linef &line : lines) - poly_out.points.emplace_back(mk_point(line.a)); - return poly_out; -} - - -static std::vector> get_all_next_arcs( - const MMU_Graph &graph, - std::vector &used_arcs, - const Linef &process_line, - const MMU_Graph::Arc &original_arc, - const int color) -{ - std::vector> all_next_arcs; - for (const size_t &arc_idx : graph.nodes[original_arc.to_idx].arc_idxs) { - std::vector next_continue_arc; - - const MMU_Graph::Arc & arc = graph.arcs[arc_idx]; - if (graph.nodes[arc.to_idx].point == process_line.a || used_arcs[arc_idx]) - continue; - - if (original_arc.type == MMU_Graph::ARC_TYPE::BORDER && original_arc.color != color) - continue; - - if (arc.type == MMU_Graph::ARC_TYPE::BORDER && arc.color != color) - continue; - - Vec2d arc_line = graph.nodes[arc.to_idx].point - graph.nodes[arc.from_idx].point; - next_continue_arc.emplace_back(&arc); - all_next_arcs.emplace_back(next_continue_arc); - } - return all_next_arcs; -} - -// two points that are very close are considered as one point -// std::vector contain the close points -static std::vector get_next_arc( - const MMU_Graph &graph, - std::vector &used_arcs, - const Linef &process_line, - const MMU_Graph::Arc &original_arc, - const int color) -{ - std::vector res; - - std::vector> all_next_arcs = get_all_next_arcs(graph, used_arcs, process_line, original_arc, color); - if (all_next_arcs.empty()) { - res.emplace_back(&original_arc); - return res; - } - - std::vector, double>> sorted_arcs; - for (auto next_arc : all_next_arcs) { - if (next_arc.empty()) - continue; - - Vec2d process_line_vec_n = (process_line.a - process_line.b).normalized(); - Vec2d neighbour_line_vec_n = (graph.nodes[next_arc.back()->to_idx].point - graph.nodes[next_arc.back()->from_idx].point).normalized(); - - double angle = ::acos(std::clamp(neighbour_line_vec_n.dot(process_line_vec_n), -1.0, 1.0)); - if (Slic3r::cross2(neighbour_line_vec_n, process_line_vec_n) < 0.0) - angle = 2.0 * (double) PI - angle; - - sorted_arcs.emplace_back(next_arc, angle); - } - - std::sort(sorted_arcs.begin(), sorted_arcs.end(), - [](std::pair, double> &l, std::pair, double> &r) -> bool { - return l.second < r.second; - }); - - // Try to return left most edge witch is unused - for (auto &sorted_arc : sorted_arcs) { - if (size_t arc_idx = sorted_arc.first.back() - &graph.arcs.front(); !used_arcs[arc_idx]) - return sorted_arc.first; - } - - if (sorted_arcs.empty()) { - res.emplace_back(&original_arc); - return res; - } - - return sorted_arcs.front().first; -} - -static bool is_profile_self_interaction(Polygon poly) -{ - auto lines = poly.lines(); - Point intersection; - for (int i = 0; i < lines.size(); ++i) { - for (int j = i + 2; j < std::min(lines.size(), lines.size() + i - 1); ++j) { - if (lines[i].intersection(lines[j], &intersection)) - return true; - } - } - return false; -} - -// Returns list of polygons and assigned colors. -// It iterates through all nodes on the border between two different colors, and from this point, -// start selection always left most edges for every node to construct CCW polygons. -// Assumes that graph is planar (without self-intersection edges) -static std::vector extract_colored_segments(const MMU_Graph &graph, const size_t num_extruders) -{ - std::vector used_arcs(graph.arcs.size(), false); - - auto all_arc_used = [&used_arcs](const MMU_Graph::Node &node) -> bool { - return std::all_of(node.arc_idxs.cbegin(), node.arc_idxs.cend(), [&used_arcs](const size_t &arc_idx) -> bool { return used_arcs[arc_idx]; }); - }; - - std::vector expolygons_segments(num_extruders + 1); - for (size_t node_idx = 0; node_idx < graph.all_border_points; ++node_idx) { - const MMU_Graph::Node &node = graph.nodes[node_idx]; - - for (const size_t &arc_idx : node.arc_idxs) { - const MMU_Graph::Arc &arc = graph.arcs[arc_idx]; - if (arc.type == MMU_Graph::ARC_TYPE::NON_BORDER || used_arcs[arc_idx]) - continue; - - Linef process_line(graph.nodes[arc.from_idx].point, graph.nodes[arc.to_idx].point); - used_arcs[arc_idx] = true; - - std::vector> arc_id_to_face_lines; - arc_id_to_face_lines.emplace_back(std::make_pair(arc_idx, process_line)); - Vec2d start_p = process_line.a; - - Linef p_vec = process_line; - const MMU_Graph::Arc *p_arc = &arc; - bool flag = false; - do { - std::vector nexts = get_next_arc(graph, used_arcs, p_vec, *p_arc, arc.color); - for (auto next : nexts) { - size_t next_arc_idx = next - &graph.arcs.front(); - if (used_arcs[next_arc_idx]) { - flag = true; - break; - } - } - - if (flag) - break; - - for (auto next : nexts) { - size_t next_arc_idx = next - &graph.arcs.front(); - arc_id_to_face_lines.emplace_back(std::make_pair(next_arc_idx, Linef(graph.nodes[next->from_idx].point, graph.nodes[next->to_idx].point))); - used_arcs[next_arc_idx] = true; - } - - p_vec = Linef(graph.nodes[nexts.back()->from_idx].point, graph.nodes[nexts.back()->to_idx].point); - p_arc = nexts.back(); - - } while (graph.nodes[p_arc->to_idx].point != start_p || !all_arc_used(graph.nodes[p_arc->to_idx])); - - if (Polygon poly = to_polygon(arc_id_to_face_lines); poly.is_counter_clockwise() && poly.is_valid()) { - expolygons_segments[arc.color].emplace_back(std::move(poly)); - } else{ - while (arc_id_to_face_lines.size() > 1) - { - auto id_to_line = arc_id_to_face_lines.back(); - used_arcs[id_to_line.first] = false; - arc_id_to_face_lines.pop_back(); - Linef add_line(arc_id_to_face_lines.back().second.b, arc_id_to_face_lines.front().second.a); - arc_id_to_face_lines.emplace_back(std::make_pair(-1, add_line)); - Polygon poly = to_polygon(arc_id_to_face_lines); - if (!is_profile_self_interaction(poly) && poly.is_counter_clockwise() && poly.is_valid()) { - expolygons_segments[arc.color].emplace_back(std::move(poly)); - break; - } - arc_id_to_face_lines.pop_back(); - } - } - } - } - return expolygons_segments; + return mk_vector_vec2d(&edge).norm(); } // Used in remove_multiple_edges_in_vertices() // Returns length of edge with is connected to contour. To this length is include other edges with follows it if they are almost straight (with the // tolerance of 15) And also if node between two subsequent edges is connected only to these two edges. -static inline double compute_edge_length(const MMU_Graph &graph, const size_t start_idx, const size_t &start_arc_idx) +static inline double calc_total_edge_length(const VD::edge_type &starting_edge) { - assert(start_arc_idx < graph.arcs.size()); - std::vector used_arcs(graph.arcs.size(), false); - - used_arcs[start_arc_idx] = true; - const MMU_Graph::Arc *arc = &graph.arcs[start_arc_idx]; - size_t idx = start_idx; - double line_total_length = (graph.nodes[arc->to_idx].point - graph.nodes[idx].point).norm(); - while (graph.nodes[arc->to_idx].arc_idxs.size() == 2) { - bool found = false; - for (const size_t &arc_idx : graph.nodes[arc->to_idx].arc_idxs) { - if (const MMU_Graph::Arc &arc_n = graph.arcs[arc_idx]; arc_n.type == MMU_Graph::ARC_TYPE::NON_BORDER && !used_arcs[arc_idx] && arc_n.to_idx != idx) { - Linef first_line(graph.nodes[idx].point, graph.nodes[arc->to_idx].point); - Linef second_line(graph.nodes[arc->to_idx].point, graph.nodes[arc_n.to_idx].point); - - Vec2d first_line_vec = (first_line.a - first_line.b); - Vec2d second_line_vec = (second_line.b - second_line.a); - Vec2d first_line_vec_n = first_line_vec.normalized(); - Vec2d second_line_vec_n = second_line_vec.normalized(); - double angle = ::acos(std::clamp(first_line_vec_n.dot(second_line_vec_n), -1.0, 1.0)); - if (Slic3r::cross2(first_line_vec_n, second_line_vec_n) < 0.0) - angle = 2.0 * (double) PI - angle; - - if (std::abs(angle - PI) >= (PI / 12)) - continue; - - idx = arc->to_idx; - arc = &arc_n; - - line_total_length += (graph.nodes[arc->to_idx].point - graph.nodes[idx].point).norm(); - used_arcs[arc_idx] = true; - found = true; - break; - } - } - if (!found) + double total_edge_length = edge_length(starting_edge); + const VD::edge_type *prev = &starting_edge; + do { + if (prev->is_finite() && non_deleted_edge_count(*prev->vertex1()) > 2) break; - } - return line_total_length; + bool found_next_edge = false; + const VD::edge_type *current = prev->next(); + do { + if (current->color() == VD_ANNOTATION::DELETED) + continue; + + Vec2d first_line_vec_n = mk_flipped_vector_vec2d(prev).normalized(); + Vec2d second_line_vec_n = mk_vector_vec2d(current).normalized(); + double angle = ::acos(std::clamp(first_line_vec_n.dot(second_line_vec_n), -1.0, 1.0)); + if (Slic3r::cross2(first_line_vec_n, second_line_vec_n) < 0.0) + angle = 2.0 * (double) PI - angle; + + if (std::abs(angle - PI) >= (PI / 12)) + continue; + + prev = current; + found_next_edge = true; + total_edge_length += edge_length(*current); + + break; + } while (current = current->prev()->twin(), current != prev->next()); + + if (!found_next_edge) + break; + + } while (prev != &starting_edge); + + return total_edge_length; } -// Used for fixing double Voronoi edges for concave parts of the polygon. -static void remove_multiple_edges_in_vertices(MMU_Graph &graph, const std::vector> &color_poly) +// When a Voronoi vertex has more than one Voronoi edge (for example, in concave parts of a polygon), +// we leave just one Voronoi edge in the Voronoi vertex. +// This Voronoi edge is selected based on a heuristic. +static void remove_multiple_edges_in_vertex(const VD::vertex_type &vertex) { + if (non_deleted_edge_count(vertex) <= 1) + return; + + std::vector> edges_to_check; + const VD::edge_type *edge = vertex.incident_edge(); + do { + if (edge->color() == VD_ANNOTATION::DELETED) + continue; + + edges_to_check.emplace_back(edge, calc_total_edge_length(*edge)); + } while (edge = edge->prev()->twin(), edge != vertex.incident_edge()); + + std::sort(edges_to_check.begin(), edges_to_check.end(), [](const auto &l, const auto &r) -> bool { + return l.second > r.second; + }); + + while (edges_to_check.size() > 1) { + const VD::edge_type &edge_to_check = *edges_to_check.back().first; + edge_to_check.color(VD_ANNOTATION::DELETED); + edge_to_check.twin()->color(VD_ANNOTATION::DELETED); + + if (const VD::vertex_type &vertex_to_delete = *edge_to_check.vertex1(); can_vertex_be_deleted(vertex_to_delete)) + delete_vertex_deep(vertex_to_delete); + + edges_to_check.pop_back(); + } +} + +// Returns list of ExPolygons for each extruder + 1 for default unpainted regions. +// It iterates through all nodes on the border between two different colors, and from this point, +// start selection always left most edges for every node to construct CCW polygons. +static std::vector extract_colored_segments(const std::vector &colored_polygons, + const size_t num_extruders, + const size_t layer_idx) { - std::vector>> colored_segments = get_all_segments(color_poly); - for (const std::vector> &colored_segment_p : colored_segments) { - size_t poly_idx = &colored_segment_p - &colored_segments.front(); - for (const std::pair &colored_segment : colored_segment_p) { - size_t first_idx = graph.get_global_index(poly_idx, colored_segment.first); - size_t second_idx = graph.get_global_index(poly_idx, (colored_segment.second + 1) % graph.polygon_sizes[poly_idx]); - Linef seg_line(graph.nodes[first_idx].point, graph.nodes[second_idx].point); + const ColoredLines colored_lines = to_lines(colored_polygons); + const BoundingBox bbox = get_extents(colored_polygons); - if (graph.nodes[first_idx].arc_idxs.size() >= 3) { - std::vector> arc_to_check; - for (const size_t &arc_idx : graph.nodes[first_idx].arc_idxs) { - MMU_Graph::Arc &n_arc = graph.arcs[arc_idx]; - if (n_arc.type == MMU_Graph::ARC_TYPE::NON_BORDER) { - double total_len = compute_edge_length(graph, first_idx, arc_idx); - arc_to_check.emplace_back(&n_arc, total_len); - } - } - std::sort(arc_to_check.begin(), arc_to_check.end(), - [](std::pair &l, std::pair &r) -> bool { return l.second > r.second; }); + auto get_next_contour_line = [&colored_polygons](const ColoredLine &line) -> const ColoredLine & { + size_t contour_line_size = colored_polygons[line.poly_idx].size(); + size_t contour_next_idx = (line.local_line_idx + 1) % contour_line_size; + return colored_polygons[line.poly_idx][contour_next_idx]; + }; - while (arc_to_check.size() > 1) { - graph.remove_edge(first_idx, arc_to_check.back().first->to_idx); - arc_to_check.pop_back(); - } - } + Voronoi::VD vd; + vd.construct_voronoi(colored_lines.begin(), colored_lines.end()); + + // First, mark each Voronoi vertex on the input polygon to prevent it from being deleted later. + for (const Voronoi::VD::cell_type &cell : vd.cells()) { + if (cell.is_degenerate() || !cell.contains_segment()) + continue; + + if (const Geometry::SegmentCellRange cell_range = Geometry::VoronoiUtils::compute_segment_cell_range(cell, colored_lines.begin(), colored_lines.end()); cell_range.is_valid()) + cell_range.edge_begin->vertex0()->color(VD_ANNOTATION::VERTEX_ON_CONTOUR); + } + + // Second, remove all Voronoi vertices that are outside the bounding box of input polygons. + // Such Voronoi vertices are definitely not inside of input polygons, so we don't care about them. + for (const Voronoi::VD::vertex_type &vertex : vd.vertices()) { + if (vertex.color() == VD_ANNOTATION::DELETED || vertex.color() == VD_ANNOTATION::VERTEX_ON_CONTOUR) + continue; + + if (!Geometry::VoronoiUtils::is_in_range(vertex) || !bbox.contains(Geometry::VoronoiUtils::to_point(vertex).cast())) + delete_vertex_deep(vertex); + } + + // Third, remove all Voronoi edges that are infinite. + for (const Voronoi::VD::edge_type &edge : vd.edges()) { + if (edge.color() != VD_ANNOTATION::DELETED && edge.is_infinite()) { + edge.color(VD_ANNOTATION::DELETED); + edge.twin()->color(VD_ANNOTATION::DELETED); + + if (edge.vertex0() != nullptr && can_vertex_be_deleted(*edge.vertex0())) + delete_vertex_deep(*edge.vertex0()); + + if (edge.vertex1() != nullptr && can_vertex_be_deleted(*edge.vertex1())) + delete_vertex_deep(*edge.vertex1()); } } + + // Fourth, remove all edges that point outward from the input polygon. + for (Voronoi::VD::cell_type cell : vd.cells()) { + if (cell.is_degenerate() || !cell.contains_segment()) + continue; + + if (const Geometry::SegmentCellRange cell_range = Geometry::VoronoiUtils::compute_segment_cell_range(cell, colored_lines.begin(), colored_lines.end()); cell_range.is_valid()) { + const ColoredLine ¤t_line = Geometry::VoronoiUtils::get_source_segment(cell, colored_lines.begin(), colored_lines.end()); + const ColoredLine &next_line = get_next_contour_line(current_line); + + const VD::edge_type *edge = cell_range.edge_begin; + do { + if (edge->color() == VD_ANNOTATION::DELETED) + continue; + + if (!points_inside(current_line.line, next_line.line, Geometry::VoronoiUtils::to_point(edge->vertex1()).cast())) { + edge->color(VD_ANNOTATION::DELETED); + edge->twin()->color(VD_ANNOTATION::DELETED); + delete_vertex_deep(*edge->vertex1()); + } + } while (edge = edge->prev()->twin(), edge != cell_range.edge_begin); + } + } + + // Fifth, if a Voronoi vertex has more than one Voronoi edge, remove all but one of them based on heuristics. + for (const Voronoi::VD::vertex_type &vertex : vd.vertices()) { + if (vertex.color() == VD_ANNOTATION::VERTEX_ON_CONTOUR) + remove_multiple_edges_in_vertex(vertex); + } + +#ifdef MM_SEGMENTATION_DEBUG_GRAPH + { + static int iRun = 0; + export_graph_to_svg(debug_out_path("mm-graph-%d-%d.svg", layer_idx, iRun++), vd, colored_polygons); + } +#endif // MM_SEGMENTATION_DEBUG_GRAPH + + // Sixth, extract the colored segments from the annotated Voronoi diagram. + std::vector segmented_expolygons_per_extruder(num_extruders + 1); + for (const Voronoi::VD::cell_type &cell : vd.cells()) { + if (cell.is_degenerate() || !cell.contains_segment()) + continue; + + if (const Geometry::SegmentCellRange cell_range = Geometry::VoronoiUtils::compute_segment_cell_range(cell, colored_lines.begin(), colored_lines.end()); cell_range.is_valid()) { + if (cell_range.edge_begin->vertex0()->color() != VD_ANNOTATION::VERTEX_ON_CONTOUR) + continue; + + const ColoredLine source_segment = Geometry::VoronoiUtils::get_source_segment(cell, colored_lines.begin(), colored_lines.end()); + + Polygon segmented_polygon; + segmented_polygon.points.emplace_back(source_segment.line.b); + + // We have ensured that each segmented_polygon have to start at edge_begin->vertex0() and end at edge_end->vertex1(). + const VD::edge_type *edge = cell_range.edge_begin; + do { + if (edge->color() == VD_ANNOTATION::DELETED) + continue; + + const VD::vertex_type &next_vertex = *edge->vertex1(); + segmented_polygon.points.emplace_back(Geometry::VoronoiUtils::to_point(next_vertex).cast()); + edge->color(VD_ANNOTATION::DELETED); + + if (next_vertex.color() == VD_ANNOTATION::VERTEX_ON_CONTOUR || next_vertex.color() == VD_ANNOTATION::DELETED) { + assert(next_vertex.color() == VD_ANNOTATION::VERTEX_ON_CONTOUR); + break; + } + + edge = edge->twin(); + } while (edge = edge->twin()->next(), edge != cell_range.edge_begin); + + if (edge->vertex1() != cell_range.edge_end->vertex1()) + continue; + + cell_range.edge_begin->vertex0()->color(VD_ANNOTATION::DELETED); + segmented_expolygons_per_extruder[source_segment.color].emplace_back(std::move(segmented_polygon)); + } + } + + // Merge all polygons together for each extruder + for (auto &segmented_expolygons : segmented_expolygons_per_extruder) + segmented_expolygons = union_ex(segmented_expolygons); + + return segmented_expolygons_per_extruder; } static void cut_segmented_layers(const std::vector &input_expolygons, @@ -1375,12 +835,12 @@ static void cut_segmented_layers(const std::vector &input_exp const float interlocking_depth, const std::function &throw_on_cancel_callback) { - BOOST_LOG_TRIVIAL(debug) << "MMU segmentation - cutting segmented layers in parallel - begin"; - tbb::parallel_for(tbb::blocked_range(0, segmented_regions.size()), - [&segmented_regions, &input_expolygons, &cut_width, &interlocking_depth, &throw_on_cancel_callback](const tbb::blocked_range &range) { + BOOST_LOG_TRIVIAL(debug) << "MM segmentation - cutting segmented layers in parallel - begin"; + const float interlocking_cut_width = interlocking_depth > 0.f ? std::max(cut_width - interlocking_depth, 0.f) : 0.f; + tbb::parallel_for(tbb::blocked_range(0, segmented_regions.size()),[&segmented_regions, &input_expolygons, &cut_width, &interlocking_cut_width, &throw_on_cancel_callback](const tbb::blocked_range& range) { for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++layer_idx) { throw_on_cancel_callback(); - const float region_cut_width = ((layer_idx % 2 == 0) && (interlocking_depth != 0.f)) ? interlocking_depth : cut_width; + const float region_cut_width = (layer_idx % 2 == 0 && interlocking_cut_width > 0.f) ? interlocking_cut_width : cut_width; const size_t num_extruders_plus_one = segmented_regions[layer_idx].size(); if (region_cut_width > 0.f) { std::vector segmented_regions_cuts(num_extruders_plus_one); // Indexed by extruder_id @@ -1391,7 +851,7 @@ static void cut_segmented_layers(const std::vector &input_exp } } }); // end of parallel_for - BOOST_LOG_TRIVIAL(debug) << "MMU segmentation - cutting segmented layers in parallel - end"; + BOOST_LOG_TRIVIAL(debug) << "MM segmentation - cutting segmented layers in parallel - end"; } static bool is_volume_sinking(const indexed_triangle_set &its, const Transform3d &trafo) @@ -1431,9 +891,9 @@ static inline std::vector> mmu_segmentation_top_and_bott std::vector zs = zs_from_layers(layers); Transform3d object_trafo = print_object.trafo_centered(); -#ifdef MMU_SEGMENTATION_DEBUG_TOP_BOTTOM +#ifdef MM_SEGMENTATION_DEBUG_TOP_BOTTOM static int iRun = 0; -#endif // NDEBUG +#endif // MM_SEGMENTATION_DEBUG_TOP_BOTTOM if (max_top_layers > 0 || max_bottom_layers > 0) { for (const ModelVolume *mv : print_object.model_object()->volumes) @@ -1441,12 +901,12 @@ static inline std::vector> mmu_segmentation_top_and_bott const Transform3d volume_trafo = object_trafo * mv->get_matrix(); for (size_t extruder_idx = 0; extruder_idx < num_extruders; ++ extruder_idx) { const indexed_triangle_set painted = mv->mmu_segmentation_facets.get_facets_strict(*mv, EnforcerBlockerType(extruder_idx)); -#ifdef MMU_SEGMENTATION_DEBUG_TOP_BOTTOM +#ifdef MM_SEGMENTATION_DEBUG_TOP_BOTTOM { static int iRun = 0; its_write_obj(painted, debug_out_path("mm-painted-patch-%d-%d.obj", iRun ++, extruder_idx).c_str()); } -#endif // MMU_SEGMENTATION_DEBUG_TOP_BOTTOM +#endif // MM_SEGMENTATION_DEBUG_TOP_BOTTOM if (! painted.indices.empty()) { std::vector top, bottom; if (!zs.empty() && is_volume_sinking(painted, volume_trafo)) { @@ -1501,7 +961,7 @@ static inline std::vector> mmu_segmentation_top_and_bott filter_out_small_polygons(top_raw, Slic3r::sqr(scale_(0.1f))); filter_out_small_polygons(bottom_raw, Slic3r::sqr(scale_(0.1f))); -#ifdef MMU_SEGMENTATION_DEBUG_TOP_BOTTOM +#ifdef MM_SEGMENTATION_DEBUG_TOP_BOTTOM { const char* colors[] = { "aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "purple", "red", "silver", "teal", "yellow" }; static int iRun = 0; @@ -1523,7 +983,21 @@ static inline std::vector> mmu_segmentation_top_and_bott } ++ iRun; } -#endif // MMU_SEGMENTATION_DEBUG_TOP_BOTTOM +#endif // MM_SEGMENTATION_DEBUG_TOP_BOTTOM + + // When the upper surface of an object is occluded, it should no longer be considered the upper surface + { + for (size_t extruder_idx = 0; extruder_idx < num_extruders; ++extruder_idx) { + for (size_t layer_idx = 0; layer_idx < layers.size(); ++layer_idx) { + if (!top_raw[extruder_idx].empty() && !top_raw[extruder_idx][layer_idx].empty() && layer_idx + 1 < layers.size()) { + top_raw[extruder_idx][layer_idx] = diff(top_raw[extruder_idx][layer_idx], input_expolygons[layer_idx + 1]); + } + if (!bottom_raw[extruder_idx].empty() && !bottom_raw[extruder_idx][layer_idx].empty() && layer_idx > 0) { + bottom_raw[extruder_idx][layer_idx] = diff(bottom_raw[extruder_idx][layer_idx], input_expolygons[layer_idx - 1]); + } + } + } + } std::vector> triangles_by_color_bottom(num_extruders); std::vector> triangles_by_color_top(num_extruders); @@ -1692,7 +1166,7 @@ static std::vector> merge_segmented_layers( segmented_regions_merged.assign(num_layers, std::vector(num_extruders)); assert(num_extruders + 1 == top_and_bottom_layers.size()); - BOOST_LOG_TRIVIAL(debug) << "MMU segmentation - merging segmented layers in parallel - begin"; + BOOST_LOG_TRIVIAL(debug) << "MM segmentation - merging segmented layers in parallel - begin"; tbb::parallel_for(tbb::blocked_range(0, num_layers), [&segmented_regions, &top_and_bottom_layers, &segmented_regions_merged, &num_extruders, &throw_on_cancel_callback](const tbb::blocked_range &range) { for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++layer_idx) { assert(segmented_regions[layer_idx].size() == num_extruders + 1); @@ -1719,12 +1193,12 @@ static std::vector> merge_segmented_layers( } } }); // end of parallel_for - BOOST_LOG_TRIVIAL(debug) << "MMU segmentation - merging segmented layers in parallel - end"; + BOOST_LOG_TRIVIAL(debug) << "MM segmentation - merging segmented layers in parallel - end"; return segmented_regions_merged; } -#ifdef MMU_SEGMENTATION_DEBUG_REGIONS +#ifdef MM_SEGMENTATION_DEBUG_REGIONS static void export_regions_to_svg(const std::string &path, const std::vector ®ions, const ExPolygons &lslices) { const std::vector colors = {"blue", "cyan", "red", "orange", "magenta", "pink", "purple", "yellow"}; @@ -1736,35 +1210,15 @@ static void export_regions_to_svg(const std::string &path, const std::vector= 0 && extrude_idx < int(colors.size())) - svg.draw(by_extruder, colors[extrude_idx], stroke_width); + if (extrude_idx < int(colors.size())) + svg.draw(by_extruder, colors[extrude_idx]); else - svg.draw(by_extruder, "black", stroke_width); + svg.draw(by_extruder, "black"); } } -#endif // MMU_SEGMENTATION_DEBUG_REGIONS +#endif // MM_SEGMENTATION_DEBUG_REGIONS -#ifdef MMU_SEGMENTATION_DEBUG_GRAPH -static void export_graph_to_svg(const std::string &path, const MMU_Graph &graph, const ExPolygons &lslices) -{ - const std::vector colors = {"blue", "cyan", "red", "orange", "magenta", "pink", "purple", "green", "yellow"}; - coordf_t stroke_width = scale_(0.05); - BoundingBox bbox = get_extents(lslices); - bbox.offset(scale_(1.)); - ::Slic3r::SVG svg(path.c_str(), bbox); - for (const MMU_Graph::Node &node : graph.nodes) - for (const size_t &arc_idx : node.arc_idxs) { - const MMU_Graph::Arc &arc = graph.arcs[arc_idx]; - Line arc_line(mk_point(node.point), mk_point(graph.nodes[arc.to_idx].point)); - if (arc.type == MMU_Graph::ARC_TYPE::BORDER && arc.color >= 0 && arc.color < int(colors.size())) - svg.draw(arc_line, colors[arc.color], stroke_width); - else - svg.draw(arc_line, "black", stroke_width); - } -} -#endif // MMU_SEGMENTATION_DEBUG_GRAPH - -#ifdef MMU_SEGMENTATION_DEBUG_INPUT +#ifdef MM_SEGMENTATION_DEBUG_INPUT void export_processed_input_expolygons_to_svg(const std::string &path, const LayerRegionPtrs ®ions, const ExPolygons &processed_input_expolygons) { coordf_t stroke_width = scale_(0.05); @@ -1774,13 +1228,14 @@ void export_processed_input_expolygons_to_svg(const std::string &path, const Lay ::Slic3r::SVG svg(path.c_str(), bbox); for (LayerRegion *region : regions) - svg.draw_outline(region->slices.surfaces, "blue", "cyan", stroke_width); + for (const Surface &surface : region->slices.surfaces) + svg.draw_outline(surface, "blue", "cyan", stroke_width); svg.draw_outline(processed_input_expolygons, "red", "pink", stroke_width); } -#endif // MMU_SEGMENTATION_DEBUG_INPUT +#endif // MM_SEGMENTATION_DEBUG_INPUT -#ifdef MMU_SEGMENTATION_DEBUG_PAINTED_LINES +#ifdef MM_SEGMENTATION_DEBUG_PAINTED_LINES static void export_painted_lines_to_svg(const std::string &path, const std::vector> &all_painted_lines, const ExPolygons &lslices) { const std::vector colors = {"blue", "cyan", "red", "orange", "magenta", "pink", "purple", "yellow"}; @@ -1796,10 +1251,10 @@ static void export_painted_lines_to_svg(const std::string &path, const std::vect for (const PaintedLine &painted_line : painted_lines) svg.draw(painted_line.projected_line, painted_line.color < int(colors.size()) ? colors[painted_line.color] : "black", stroke_width); } -#endif // MMU_SEGMENTATION_DEBUG_PAINTED_LINES +#endif // MM_SEGMENTATION_DEBUG_PAINTED_LINES -#ifdef MMU_SEGMENTATION_DEBUG_COLORIZED_POLYGONS -static void export_colorized_polygons_to_svg(const std::string &path, const std::vector> &colorized_polygons, const ExPolygons &lslices) +#ifdef MM_SEGMENTATION_DEBUG_COLORIZED_POLYGONS +static void export_colorized_polygons_to_svg(const std::string &path, const std::vector &colorized_polygons, const ExPolygons &lslices) { const std::vector colors = {"blue", "cyan", "red", "orange", "magenta", "pink", "purple", "green", "yellow"}; coordf_t stroke_width = scale_(0.05); @@ -1807,19 +1262,19 @@ static void export_colorized_polygons_to_svg(const std::string &path, const std: bbox.offset(scale_(1.)); ::Slic3r::SVG svg(path.c_str(), bbox); - for (const std::vector &colorized_polygon : colorized_polygons) + for (const ColoredLines &colorized_polygon : colorized_polygons) for (const ColoredLine &colorized_line : colorized_polygon) svg.draw(colorized_line.line, colorized_line.color < int(colors.size())? colors[colorized_line.color] : "black", stroke_width); } -#endif // MMU_SEGMENTATION_DEBUG_COLORIZED_POLYGONS +#endif // MM_SEGMENTATION_DEBUG_COLORIZED_POLYGONS // Check if all ColoredLine representing a single layer uses the same color. -static bool has_layer_only_one_color(const std::vector> &colored_polygons) +static bool has_layer_only_one_color(const std::vector &colored_polygons) { assert(!colored_polygons.empty()); assert(!colored_polygons.front().empty()); int first_line_color = colored_polygons.front().front().color; - for (const std::vector &colored_polygon : colored_polygons) + for (const ColoredLines &colored_polygon : colored_polygons) for (const ColoredLine &colored_line : colored_polygon) if (first_line_color != colored_line.color) return false; @@ -1841,8 +1296,12 @@ std::vector> multi_material_segmentation_by_painting(con throw_on_cancel_callback(); +#ifdef MM_SEGMENTATION_DEBUG + static int iRun = 0; +#endif // MM_SEGMENTATION_DEBUG + // Merge all regions and remove small holes - BOOST_LOG_TRIVIAL(debug) << "MMU segmentation - slices preparation in parallel - begin"; + BOOST_LOG_TRIVIAL(debug) << "MM segmentation - slices preparation in parallel - begin"; tbb::parallel_for(tbb::blocked_range(0, num_layers), [&layers, &input_expolygons, &throw_on_cancel_callback](const tbb::blocked_range &range) { for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++layer_idx) { throw_on_cancel_callback(); @@ -1862,17 +1321,14 @@ std::vector> multi_material_segmentation_by_painting(con // Such close points sometimes caused that the Voronoi diagram has self-intersecting edges around these vertices. // This consequently leads to issues with the extraction of colored segments by function extract_colored_segments. // Calling expolygons_simplify fixed these issues. - input_expolygons[layer_idx] = remove_duplicates(expolygons_simplify(offset_ex(ex_polygons, -10.f * float(SCALED_EPSILON)), 5 * SCALED_EPSILON), scaled(0.01), PI / 6); + input_expolygons[layer_idx] = remove_duplicates(expolygons_simplify(offset_ex(ex_polygons, -10.f * float(SCALED_EPSILON)), 5 * SCALED_EPSILON), scaled(0.01), PI/6); -#ifdef MMU_SEGMENTATION_DEBUG_INPUT - { - static int iRun = 0; - export_processed_input_expolygons_to_svg(debug_out_path("mm-input-%d-%d.svg", layer_idx, iRun++), layers[layer_idx]->regions(), input_expolygons[layer_idx]); - } -#endif // MMU_SEGMENTATION_DEBUG_INPUT +#ifdef MM_SEGMENTATION_DEBUG_INPUT + export_processed_input_expolygons_to_svg(debug_out_path("mm-input-%d-%d.svg", layer_idx, iRun), layers[layer_idx]->regions(), input_expolygons[layer_idx]); +#endif // MM_SEGMENTATION_DEBUG_INPUT } }); // end of parallel_for - BOOST_LOG_TRIVIAL(debug) << "MMU segmentation - slices preparation in parallel - end"; + BOOST_LOG_TRIVIAL(debug) << "MM segmentation - slices preparation in parallel - end"; std::vector layer_bboxes(num_layers); for (size_t layer_idx = 0; layer_idx < num_layers; ++layer_idx) { @@ -1895,7 +1351,7 @@ std::vector> multi_material_segmentation_by_painting(con edge_grids[layer_idx].create(input_expolygons[layer_idx], coord_t(scale_(10.))); } - BOOST_LOG_TRIVIAL(debug) << "MMU segmentation - projection of painted triangles - begin"; + BOOST_LOG_TRIVIAL(debug) << "MM segmentation - projection of painted triangles - begin"; for (const ModelVolume *mv : print_object.model_object()->volumes) { tbb::parallel_for(tbb::blocked_range(1, num_extruders + 1), [&mv, &print_object, &layers, &edge_grids, &painted_lines, &painted_lines_mutex, &input_expolygons, &throw_on_cancel_callback](const tbb::blocked_range &range) { for (size_t extruder_idx = range.begin(); extruder_idx < range.end(); ++extruder_idx) { @@ -1917,6 +1373,9 @@ std::vector> multi_material_segmentation_by_painting(con min_z = std::min(min_z, facet[p_idx].z()); } + if (is_equal(min_z, max_z)) + continue; + // Sort the vertices by z-axis for simplification of projected_facet on slices std::sort(facet.begin(), facet.end(), [](const Vec3f &p1, const Vec3f &p2) { return p1.z() < p2.z(); }); @@ -1961,7 +1420,9 @@ std::vector> multi_material_segmentation_by_painting(con // be outside EdgeGrid's BoundingBox, for example, when the negative volume is used on the painted area (GH #7618). // To ensure that the painted line is always inside EdgeGrid's BoundingBox, it is clipped by EdgeGrid's BoundingBox in cases // when any of the endpoints of the line are outside the EdgeGrid's BoundingBox. - if (const BoundingBox &edge_grid_bbox = edge_grids[layer_idx].bbox(); !edge_grid_bbox.contains(line_to_test.a) || !edge_grid_bbox.contains(line_to_test.b)) { + BoundingBox edge_grid_bbox = edge_grids[layer_idx].bbox(); + edge_grid_bbox.offset(10 * scale_(EPSILON)); + if (!edge_grid_bbox.contains(line_to_test.a) || !edge_grid_bbox.contains(line_to_test.b)) { // If the painted line (line_to_test) is entirely outside EdgeGrid's BoundingBox, skip this painted line. if (!edge_grid_bbox.overlap(BoundingBox(Points{line_to_test.a, line_to_test.b})) || !line_to_test.clip_with_bbox(edge_grid_bbox)) @@ -1981,39 +1442,30 @@ std::vector> multi_material_segmentation_by_painting(con } }); // end of parallel_for } - BOOST_LOG_TRIVIAL(debug) << "MMU segmentation - projection of painted triangles - end"; - BOOST_LOG_TRIVIAL(debug) << "MMU segmentation - painted layers count: " + BOOST_LOG_TRIVIAL(debug) << "MM segmentation - projection of painted triangles - end"; + BOOST_LOG_TRIVIAL(debug) << "MM segmentation - painted layers count: " << std::count_if(painted_lines.begin(), painted_lines.end(), [](const std::vector &pl) { return !pl.empty(); }); - BOOST_LOG_TRIVIAL(debug) << "MMU segmentation - layers segmentation in parallel - begin"; + BOOST_LOG_TRIVIAL(debug) << "MM segmentation - layers segmentation in parallel - begin"; tbb::parallel_for(tbb::blocked_range(0, num_layers), [&edge_grids, &input_expolygons, &painted_lines, &segmented_regions, &num_extruders, &throw_on_cancel_callback](const tbb::blocked_range &range) { for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++layer_idx) { throw_on_cancel_callback(); if (!painted_lines[layer_idx].empty()) { -#ifdef MMU_SEGMENTATION_DEBUG_PAINTED_LINES - { - static int iRun = 0; - export_painted_lines_to_svg(debug_out_path("mm-painted-lines-%d-%d.svg", layer_idx, iRun++), {painted_lines[layer_idx]}, input_expolygons[layer_idx]); - } -#endif // MMU_SEGMENTATION_DEBUG_PAINTED_LINES +#ifdef MM_SEGMENTATION_DEBUG_PAINTED_LINES + export_painted_lines_to_svg(debug_out_path("0-mm-painted-lines-%d-%d.svg", layer_idx, iRun), {painted_lines[layer_idx]}, input_expolygons[layer_idx]); +#endif // MM_SEGMENTATION_DEBUG_PAINTED_LINES std::vector> post_processed_painted_lines = post_process_painted_lines(edge_grids[layer_idx].contours(), std::move(painted_lines[layer_idx])); -#ifdef MMU_SEGMENTATION_DEBUG_PAINTED_LINES - { - static int iRun = 0; - export_painted_lines_to_svg(debug_out_path("mm-painted-lines-post-processed-%d-%d.svg", layer_idx, iRun++), post_processed_painted_lines, input_expolygons[layer_idx]); - } -#endif // MMU_SEGMENTATION_DEBUG_PAINTED_LINES +#ifdef MM_SEGMENTATION_DEBUG_PAINTED_LINES + export_painted_lines_to_svg(debug_out_path("1-mm-painted-lines-post-processed-%d-%d.svg", layer_idx, iRun), post_processed_painted_lines, input_expolygons[layer_idx]); +#endif // MM_SEGMENTATION_DEBUG_PAINTED_LINES - std::vector> color_poly = colorize_contours(edge_grids[layer_idx].contours(), post_processed_painted_lines); + std::vector color_poly = colorize_contours(edge_grids[layer_idx].contours(), post_processed_painted_lines); -#ifdef MMU_SEGMENTATION_DEBUG_COLORIZED_POLYGONS - { - static int iRun = 0; - export_colorized_polygons_to_svg(debug_out_path("mm-colorized_polygons-%d-%d.svg", layer_idx, iRun++), color_poly, input_expolygons[layer_idx]); - } -#endif // MMU_SEGMENTATION_DEBUG_COLORIZED_POLYGONS +#ifdef MM_SEGMENTATION_DEBUG_COLORIZED_POLYGONS + export_colorized_polygons_to_svg(debug_out_path("2-mm-colorized_polygons-%d-%d.svg", layer_idx, iRun), color_poly, input_expolygons[layer_idx]); +#endif // MM_SEGMENTATION_DEBUG_COLORIZED_POLYGONS assert(!color_poly.empty()); assert(!color_poly.front().empty()); @@ -2021,33 +1473,19 @@ std::vector> multi_material_segmentation_by_painting(con // If the whole layer is painted using the same color, it is not needed to construct a Voronoi diagram for the segmentation of this layer. segmented_regions[layer_idx][size_t(color_poly.front().front().color)] = input_expolygons[layer_idx]; } else { - MMU_Graph graph = build_graph(layer_idx, color_poly); - remove_multiple_edges_in_vertices(graph, color_poly); - graph.remove_nodes_with_one_arc(); - -#ifdef MMU_SEGMENTATION_DEBUG_GRAPH - { - static int iRun = 0; - export_graph_to_svg(debug_out_path("mm-graph-final-%d-%d.svg", layer_idx, iRun++), graph, input_expolygons[layer_idx]); - } -#endif // MMU_SEGMENTATION_DEBUG_GRAPH - - segmented_regions[layer_idx] = extract_colored_segments(graph, num_extruders); + segmented_regions[layer_idx] = extract_colored_segments(color_poly, num_extruders, layer_idx); } -#ifdef MMU_SEGMENTATION_DEBUG_REGIONS - { - static int iRun = 0; - export_regions_to_svg(debug_out_path("mm-regions-sides-%d-%d.svg", layer_idx, iRun++), segmented_regions[layer_idx], input_expolygons[layer_idx]); - } -#endif // MMU_SEGMENTATION_DEBUG_REGIONS +#ifdef MM_SEGMENTATION_DEBUG_REGIONS + export_regions_to_svg(debug_out_path("3-mm-regions-sides-%d-%d.svg", layer_idx, iRun), segmented_regions[layer_idx], input_expolygons[layer_idx]); +#endif // MM_SEGMENTATION_DEBUG_REGIONS } } }); // end of parallel_for - BOOST_LOG_TRIVIAL(debug) << "MMU segmentation - layers segmentation in parallel - end"; + BOOST_LOG_TRIVIAL(debug) << "MM segmentation - layers segmentation in parallel - end"; throw_on_cancel_callback(); - if (auto max_width = print_object.config().mmu_segmented_region_max_width, interlocking_depth = print_object.config().mmu_segmented_region_interlocking_depth; max_width > 0.f || interlocking_depth > 0.f) { + if (auto max_width = print_object.config().mmu_segmented_region_max_width, interlocking_depth = print_object.config().mmu_segmented_region_interlocking_depth; max_width > 0.f) { cut_segmented_layers(input_expolygons, segmented_regions, float(scale_(max_width)), float(scale_(interlocking_depth)), throw_on_cancel_callback); throw_on_cancel_callback(); } @@ -2059,13 +1497,14 @@ std::vector> multi_material_segmentation_by_painting(con std::vector> segmented_regions_merged = merge_segmented_layers(segmented_regions, std::move(top_and_bottom_layers), num_extruders, throw_on_cancel_callback); throw_on_cancel_callback(); -#ifdef MMU_SEGMENTATION_DEBUG_REGIONS - { - static int iRun = 0; - for (size_t layer_idx = 0; layer_idx < print_object.layers().size(); ++layer_idx) - export_regions_to_svg(debug_out_path("mm-regions-merged-%d-%d.svg", layer_idx, iRun++), segmented_regions_merged[layer_idx], input_expolygons[layer_idx]); - } -#endif // MMU_SEGMENTATION_DEBUG_REGIONS +#ifdef MM_SEGMENTATION_DEBUG_REGIONS + for (size_t layer_idx = 0; layer_idx < print_object.layers().size(); ++layer_idx) + export_regions_to_svg(debug_out_path("4-mm-regions-merged-%d-%d.svg", layer_idx, iRun), segmented_regions_merged[layer_idx], input_expolygons[layer_idx]); +#endif // MM_SEGMENTATION_DEBUG_REGIONS + +#ifdef MM_SEGMENTATION_DEBUG + ++iRun; +#endif // MM_SEGMENTATION_DEBUG return segmented_regions_merged; } diff --git a/src/libslic3r/MultiMaterialSegmentation.hpp b/src/libslic3r/MultiMaterialSegmentation.hpp index 4efdc69514..91d0f298bc 100644 --- a/src/libslic3r/MultiMaterialSegmentation.hpp +++ b/src/libslic3r/MultiMaterialSegmentation.hpp @@ -6,13 +6,41 @@ namespace Slic3r { - class PrintObject; class ExPolygon; +using ExPolygons = std::vector; + +struct ColoredLine +{ + Line line; + int color; + int poly_idx = -1; + int local_line_idx = -1; +}; + +using ColoredLines = std::vector; // Returns MMU segmentation based on painting in MMU segmentation gizmo std::vector> multi_material_segmentation_by_painting(const PrintObject &print_object, const std::function &throw_on_cancel_callback); } // namespace Slic3r +namespace boost::polygon { +template<> struct geometry_concept +{ + typedef segment_concept type; +}; + +template<> struct segment_traits +{ + typedef coord_t coordinate_type; + typedef Slic3r::Point point_type; + + static inline point_type get(const Slic3r::ColoredLine &line, const direction_1d &dir) + { + return dir.to_int() ? line.line.b : line.line.a; + } +}; +} // namespace boost::polygon + #endif // slic3r_MultiMaterialSegmentation_hpp_ diff --git a/src/libslic3r/ParameterUtils.cpp b/src/libslic3r/ParameterUtils.cpp new file mode 100644 index 0000000000..4e5fed7e6b --- /dev/null +++ b/src/libslic3r/ParameterUtils.cpp @@ -0,0 +1,45 @@ +#include "ParameterUtils.hpp" + +namespace Slic3r { + +std::vector get_other_layers_print_sequence(int sequence_nums, const std::vector &sequence) +{ + std::vector res; + if (sequence_nums == 0 || sequence.empty()) + return res; + + assert(sequence.size() % sequence_nums == 0); + + res.reserve(sequence_nums); + size_t item_nums = sequence.size() / sequence_nums; + + for (int i = 0; i < sequence_nums; ++i) { + std::vector item; + item.assign(sequence.begin() + i * item_nums, sequence.begin() + ((i + 1) * item_nums)); + + assert(item.size() > 2); + std::pair, std::vector> res_item; + res_item.first.first = item[0]; + res_item.first.second = item[1]; + res_item.second.assign(item.begin() + 2, item.end()); + res.emplace_back(std::move(res_item)); + } + + return res; +} + +void get_other_layers_print_sequence(const std::vector &customize_sequences, int &sequence_nums, std::vector &sequence) +{ + sequence_nums = 0; + sequence.clear(); + if (customize_sequences.empty()) { return; } + + sequence_nums = (int) customize_sequences.size(); + for (const auto &customize_sequence : customize_sequences) { + sequence.push_back(customize_sequence.first.first); + sequence.push_back(customize_sequence.first.second); + sequence.insert(sequence.end(), customize_sequence.second.begin(), customize_sequence.second.end()); + } +} + +}; // namespace Slic3r diff --git a/src/libslic3r/ParameterUtils.hpp b/src/libslic3r/ParameterUtils.hpp new file mode 100644 index 0000000000..090fd8d803 --- /dev/null +++ b/src/libslic3r/ParameterUtils.hpp @@ -0,0 +1,14 @@ +#ifndef slic3r_Parameter_Utils_hpp_ +#define slic3r_Parameter_Utils_hpp_ + +#include +#include + +namespace Slic3r { +using LayerPrintSequence = std::pair, std::vector>; +std::vector get_other_layers_print_sequence(int sequence_nums, const std::vector &sequence); +void get_other_layers_print_sequence(const std::vector &customize_sequences, int &sequence_nums, std::vector &sequence); + +} // namespace Slic3r + +#endif // slic3r_Parameter_Utils_hpp_ diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index c708e5620d..86f9f5ceac 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -20,13 +20,15 @@ #include "Geometry/ConvexHull.hpp" #include "ExPolygonCollection.hpp" #include "Geometry.hpp" - +#include "Line.hpp" #include #include #include - +#include "libslic3r/AABBTreeLines.hpp" static const int overhang_sampling_number = 6; static const double narrow_loop_length_threshold = 10; +static const double min_degree_gap = 0.1; +static const int max_overhang_degree = overhang_sampling_number - 1; //BBS: when the width of expolygon is smaller than //ext_perimeter_width + ext_perimeter_spacing * (1 - SMALLER_EXT_INSET_OVERLAP_TOLERANCE), //we think it's small detail area and will generate smaller line width for it @@ -222,6 +224,188 @@ static void lowpass_filter_by_paths_overhang_degree(ExtrusionPaths& paths) { } } +struct PolylineWithDegree +{ + PolylineWithDegree(Polyline polyline, double overhang_degree) : polyline(polyline), overhang_degree(overhang_degree){}; + Polyline polyline; + double overhang_degree = 0; +}; + +static std::deque split_polyline_by_degree(const Polyline &polyline_with_insert_points, const std::deque &points_overhang) +{ + std::deque out; + Polyline left; + Polyline right; + Polyline temp_copy = polyline_with_insert_points; + + size_t poly_size = polyline_with_insert_points.size(); + // BBS: merge degree in limited range + //find first degee base + double degree_base = int(points_overhang[points_overhang.size() - 1] / min_degree_gap) * min_degree_gap + min_degree_gap; + degree_base = degree_base > max_overhang_degree ? max_overhang_degree : degree_base; + double short_poly_len = 0; + for (int point_idx = points_overhang.size() - 2; point_idx > 0; --point_idx) { + + double degree = points_overhang[point_idx]; + + if ( degree <= degree_base && degree >= degree_base - min_degree_gap ) + continue; + + temp_copy.split_at_index(point_idx, &left, &right); + + temp_copy = std::move(left); + out.push_back(PolylineWithDegree(right, degree_base)); + + degree_base = int(degree / min_degree_gap) * min_degree_gap + min_degree_gap; + degree_base = degree_base > max_overhang_degree ? max_overhang_degree : degree_base; + } + + if (!temp_copy.empty()) { + out.push_back(PolylineWithDegree(temp_copy, degree_base)); + } + + return out; + +} +static void insert_point_to_line( double left_point_degree, + Point left_point, + double right_point_degree, + Point right_point, + std::deque &points_overhang, + Polyline& polyline, + double mini_length) +{ + Line line_temp(left_point, right_point); + double line_length = line_temp.length(); + if (std::abs(left_point_degree - right_point_degree) <= 0.5 * min_degree_gap || line_length left_points_overhang; + std::deque right_points_overhang; + + double middle_degree = (left_point_degree + right_point_degree) / 2; + Polyline left_polyline; + Polyline right_polyline; + + insert_point_to_line(left_point_degree, left_point, middle_degree, middle_pt, left_points_overhang, left_polyline, mini_length); + insert_point_to_line(middle_degree, middle_pt, right_point_degree, right_point, right_points_overhang, right_polyline, mini_length); + + if (!left_polyline.empty()) { + polyline.points.insert(polyline.points.end(), std::make_move_iterator(left_polyline.points.begin()), std::make_move_iterator(left_polyline.points.end())); + points_overhang.insert(points_overhang.end(), std::make_move_iterator(left_points_overhang.begin()), std::make_move_iterator(left_points_overhang.end())); + } + + polyline.append(middle_pt); + points_overhang.emplace_back(middle_degree); + + if (!right_polyline.empty()) { + polyline.points.insert(polyline.points.end(), std::make_move_iterator(right_polyline.points.begin()), std::make_move_iterator(right_polyline.points.end())); + points_overhang.insert(points_overhang.end(), std::make_move_iterator(right_points_overhang.begin()), std::make_move_iterator(right_points_overhang.end())); + } +} + +class OverhangDistancer +{ + std::vector lines; + AABBTreeIndirect::Tree<2, double> tree; + +public: + OverhangDistancer(const Polygons layer_polygons) + { + for (const Polygon &island : layer_polygons) { + for (const auto &line : island.lines()) { + lines.emplace_back(line.a.cast(), line.b.cast()); + } + } + tree = AABBTreeLines::build_aabb_tree_over_indexed_lines(lines); + } + + float distance_from_perimeter(const Vec2f &point) const + { + Vec2d p = point.cast(); + size_t hit_idx_out{}; + Vec2d hit_point_out = Vec2d::Zero(); + auto distance = AABBTreeLines::squared_distance_to_indexed_lines(lines, tree, p, hit_idx_out, hit_point_out); + if (distance < 0) { return std::numeric_limits::max(); } + + distance = sqrt(distance); + return distance; + } +}; + +static std::deque detect_overahng_degree(Polygons lower_polygons, + Polylines middle_overhang_polyines, + const double &lower_bound, + const double &upper_bound, + Polylines &too_short_polylines) +{ + // BBS: collect lower_polygons points + //Polylines; + Points lower_polygon_points; + std::vector polygons_bound; + + std::unique_ptr prev_layer_distancer; + prev_layer_distancer = std::make_unique(lower_polygons); + std::deque out; + std::deque points_overhang; + //BBS: get overhang degree and split path + for (size_t polyline_idx = 0; polyline_idx < middle_overhang_polyines.size(); ++polyline_idx) { + //filter too short polyline + Polyline middle_poly = middle_overhang_polyines[polyline_idx]; + if (middle_poly.length() < scale_(1.0)) { + too_short_polylines.push_back(middle_poly); + continue; + } + + Polyline polyline_with_insert_points; + points_overhang.clear(); + double last_degree = 0; + // BBS : calculate overhang dist + for (size_t point_idx = 0; point_idx < middle_poly.points.size(); ++point_idx) { + Point pt = middle_poly.points[point_idx]; + + float overhang_dist = prev_layer_distancer->distance_from_perimeter(pt.cast()); + overhang_dist = overhang_dist > upper_bound ? upper_bound : overhang_dist; + // BBS : calculate overhang degree + int max_overhang = max_overhang_degree; + int min_overhang = 0; + double t = (overhang_dist - lower_bound) / (upper_bound - lower_bound); + t = t > 1.0 ? 1: t; + t = t < EPSILON ? 0 : t; + double this_degree = (1.0 - t) * min_overhang + t * max_overhang; + // BBS: intert points + if (point_idx > 0) { + insert_point_to_line(last_degree, middle_poly.points[point_idx - 1], this_degree, pt, points_overhang, polyline_with_insert_points, + upper_bound - lower_bound); + } + points_overhang.push_back(this_degree); + + polyline_with_insert_points.append(pt); + last_degree = this_degree; + + } + + // BBS : split path by degree + std::deque polyline_with_merged_degree = split_polyline_by_degree(polyline_with_insert_points, points_overhang); + out.insert(out.end(), std::make_move_iterator(polyline_with_merged_degree.begin()), std::make_move_iterator(polyline_with_merged_degree.end())); + } + + return out; +} + +std::pair PerimeterGenerator::dist_boundary(double width) +{ + std::pair out; + float nozzle_diameter = print_config->nozzle_diameter.get_at(config->wall_filament - 1); + float start_offset = -0.5 * width; + float end_offset = 0.5 * nozzle_diameter; + double degree_0 = scale_(start_offset + 0.5 * (end_offset - start_offset) / (overhang_sampling_number - 1)); + out.first = 0; + out.second = scale_(end_offset) - degree_0; + return out; +} + template static bool detect_steep_overhang(const PrintRegionConfig *config, bool is_contour, @@ -297,24 +481,28 @@ static ExtrusionEntityCollection traverse_loops(const PerimeterGenerator &perime ExtrusionPaths paths; // BBS: get lower polygons series, width, mm3_per_mm - const std::map *lower_polygons_series; + const std::vector *lower_polygons_series; + const std::pair *overhang_dist_boundary; double extrusion_mm3_per_mm; double extrusion_width; if (is_external) { if (is_small_width) { //BBS: smaller width external perimeter lower_polygons_series = &perimeter_generator.m_smaller_external_lower_polygons_series; + overhang_dist_boundary = &perimeter_generator.m_smaller_external_overhang_dist_boundary; extrusion_mm3_per_mm = perimeter_generator.smaller_width_ext_mm3_per_mm(); extrusion_width = perimeter_generator.smaller_ext_perimeter_flow.width(); } else { //BBS: normal external perimeter lower_polygons_series = &perimeter_generator.m_external_lower_polygons_series; + overhang_dist_boundary = &perimeter_generator.m_external_overhang_dist_boundary; extrusion_mm3_per_mm = perimeter_generator.ext_mm3_per_mm(); extrusion_width = perimeter_generator.ext_perimeter_flow.width(); } } else { //BBS: normal perimeter lower_polygons_series = &perimeter_generator.m_lower_polygons_series; + overhang_dist_boundary = &perimeter_generator.m_lower_overhang_dist_boundary; extrusion_mm3_per_mm = perimeter_generator.mm3_per_mm(); extrusion_width = perimeter_generator.perimeter_flow.width(); } @@ -349,50 +537,72 @@ static ExtrusionEntityCollection traverse_loops(const PerimeterGenerator &perime Polylines remain_polines; - //BBS: don't calculate overhang degree when enable fuzzy skin. It's unmeaning - if (perimeter_generator.config->overhang_speed_classic && perimeter_generator.config->enable_overhang_speed && perimeter_generator.config->fuzzy_skin == FuzzySkinType::None) { - for (auto it = lower_polygons_series->begin(); - it != lower_polygons_series->end(); it++) - { - Polygons lower_polygons_series_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(it->second, bbox); + Polygons lower_polygons_series_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(lower_polygons_series->back(), bbox); - Polylines inside_polines = (it == lower_polygons_series->begin()) ? intersection_pl({polygon}, lower_polygons_series_clipped) : - intersection_pl(remain_polines, lower_polygons_series_clipped); + Polylines inside_polines = intersection_pl({polygon}, lower_polygons_series_clipped); + + + remain_polines = diff_pl({polygon}, lower_polygons_series_clipped); + + bool detect_overhang_degree = perimeter_generator.config->overhang_speed_classic && perimeter_generator.config->enable_overhang_speed && perimeter_generator.config->fuzzy_skin == FuzzySkinType::None; + + if (!detect_overhang_degree) { + if (!inside_polines.empty()) extrusion_paths_append( paths, std::move(inside_polines), - it->first, + 0, int(0), role, extrusion_mm3_per_mm, extrusion_width, (float)perimeter_generator.layer_height); - - remain_polines = (it == lower_polygons_series->begin()) ? diff_pl({polygon}, lower_polygons_series_clipped) : - diff_pl(remain_polines, lower_polygons_series_clipped); - - if (remain_polines.size() == 0) - break; - } } else { - auto it = lower_polygons_series->end(); - it--; - Polygons lower_polygons_series_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(it->second, bbox); + Polygons lower_polygons_series_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(lower_polygons_series->front(), bbox); - Polylines inside_polines = intersection_pl({polygon}, lower_polygons_series_clipped); - extrusion_paths_append( - paths, - std::move(inside_polines), - int(0), - int(0), - role, - extrusion_mm3_per_mm, - extrusion_width, - (float)perimeter_generator.layer_height); + Polylines middle_overhang_polyines = diff_pl({inside_polines}, lower_polygons_series_clipped); + //BBS: add zero_degree_path + Polylines zero_degree_polines = intersection_pl({inside_polines}, lower_polygons_series_clipped); + if (!zero_degree_polines.empty()) + extrusion_paths_append( + paths, + std::move(zero_degree_polines), + 0, + int(0), + role, + extrusion_mm3_per_mm, + extrusion_width, + (float)perimeter_generator.layer_height); + //BBS: detect middle line overhang + if (!middle_overhang_polyines.empty()) { + Polylines too_short_polylines; + std::deque polylines_degree_collection = detect_overahng_degree(lower_polygons_series->front(), + middle_overhang_polyines, + overhang_dist_boundary->first, + overhang_dist_boundary->second, + too_short_polylines); + if (!too_short_polylines.empty()) + extrusion_paths_append(paths, + std::move(too_short_polylines), + 0, + int(0), + role, + extrusion_mm3_per_mm, + extrusion_width, + (float) perimeter_generator.layer_height); + // BBS: add path with overhang degree + for (PolylineWithDegree polylines_collection : polylines_degree_collection) { + extrusion_paths_append(paths, + std::move(polylines_collection.polyline), + polylines_collection.overhang_degree, + int(0), + role, + extrusion_mm3_per_mm, + extrusion_width, (float) perimeter_generator.layer_height); + } + } - remain_polines = diff_pl({polygon}, lower_polygons_series_clipped); } - // get 100% overhang paths by checking what parts of this loop fall // outside the grown lower slices (thus where the distance between // the loop centerline and original lower slices is >= half nozzle diameter @@ -407,9 +617,6 @@ static ExtrusionEntityCollection traverse_loops(const PerimeterGenerator &perime // We allow polyline reversal because Clipper may have randomly reversed polylines during clipping. if(paths.empty()) continue; chain_and_reorder_extrusion_paths(paths, &paths.front().first_point()); - // smothing the overhang degree - // merge small path between paths which have same overhang degree - lowpass_filter_by_paths_overhang_degree(paths); } else { ExtrusionPath path(role); //BBS. @@ -1489,12 +1696,16 @@ void PerimeterGenerator::process_classic() // prepare grown lower layer slices for overhang detection m_lower_polygons_series = generate_lower_polygons_series(this->perimeter_flow.width()); - if (ext_perimeter_width == perimeter_width) + m_lower_overhang_dist_boundary = dist_boundary(this->perimeter_flow.width()); + if (ext_perimeter_width == perimeter_width){ m_external_lower_polygons_series = m_lower_polygons_series; - else + m_external_overhang_dist_boundary=m_lower_overhang_dist_boundary; + } else { m_external_lower_polygons_series = generate_lower_polygons_series(this->ext_perimeter_flow.width()); + m_external_overhang_dist_boundary = dist_boundary(this->ext_perimeter_flow.width()); + } m_smaller_external_lower_polygons_series = generate_lower_polygons_series(this->smaller_ext_perimeter_flow.width()); - + m_smaller_external_overhang_dist_boundary = dist_boundary(this->smaller_ext_perimeter_flow.width()); // we need to process each island separately because we might have different // extra perimeters for each one Surfaces all_surfaces = this->slices->surfaces; @@ -2702,7 +2913,7 @@ bool PerimeterGeneratorLoop::is_internal_contour() const return true; } -std::map PerimeterGenerator::generate_lower_polygons_series(float width) +std::vector PerimeterGenerator::generate_lower_polygons_series(float width) { float nozzle_diameter = print_config->nozzle_diameter.get_at(config->wall_filament - 1); float start_offset = -0.5 * width; @@ -2711,23 +2922,18 @@ std::map PerimeterGenerator::generate_lower_polygons_series(float assert(overhang_sampling_number >= 3); // generate offsets std::vector offset_series; - offset_series.reserve(overhang_sampling_number - 1); - for (int i = 0; i < overhang_sampling_number - 1; i++) { - offset_series.push_back(start_offset + (i + 0.5) * (end_offset - start_offset) / (overhang_sampling_number - 1)); - } - // BBS: increase start_offset a little to avoid to calculate 90 degree as overhang - offset_series[0] = start_offset + 0.5 * (end_offset - start_offset) / (overhang_sampling_number - 1); - offset_series[overhang_sampling_number - 2] = end_offset; - offset_series.back() = 0.1 * nozzle_diameter; + offset_series.reserve(2); - std::map lower_polygons_series; + offset_series.push_back(start_offset + 0.5 * (end_offset - start_offset) / (overhang_sampling_number - 1)); + offset_series.push_back(end_offset); + std::vector lower_polygons_series; if (this->lower_slices == NULL) { return lower_polygons_series; } // offset expolygon to generate series of polygons for (int i = 0; i < offset_series.size(); i++) { - lower_polygons_series.insert(std::pair(i, offset(*this->lower_slices, float(scale_(offset_series[i]))))); + lower_polygons_series.emplace_back(offset(*this->lower_slices, float(scale_(offset_series[i])))); } return lower_polygons_series; } diff --git a/src/libslic3r/PerimeterGenerator.hpp b/src/libslic3r/PerimeterGenerator.hpp index e9da632386..c50f3b7faa 100644 --- a/src/libslic3r/PerimeterGenerator.hpp +++ b/src/libslic3r/PerimeterGenerator.hpp @@ -34,9 +34,13 @@ public: //BBS Flow smaller_ext_perimeter_flow; - std::map m_lower_polygons_series; - std::map m_external_lower_polygons_series; - std::map m_smaller_external_lower_polygons_series; + std::vector m_lower_polygons_series; + std::vector m_external_lower_polygons_series; + std::vector m_smaller_external_lower_polygons_series; + std::pair m_lower_overhang_dist_boundary; + std::pair m_external_overhang_dist_boundary; + std::pair m_smaller_external_overhang_dist_boundary; + PerimeterGenerator( // Input: @@ -79,10 +83,11 @@ public: Polygons lower_slices_polygons() const { return m_lower_slices_polygons; } private: - std::map generate_lower_polygons_series(float width); + std::vector generate_lower_polygons_series(float width); void split_top_surfaces(const ExPolygons &orig_polygons, ExPolygons &top_fills, ExPolygons &non_top_polygons, ExPolygons &fill_clip) const; void apply_extra_perimeters(ExPolygons& infill_area); void process_no_bridge(Surfaces& all_surfaces, coord_t perimeter_spacing, coord_t ext_perimeter_width); + std::pair dist_boundary(double width); private: bool m_spiral_vase; diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index a9995c15d6..20cf79206d 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -801,7 +801,7 @@ static std::vector s_Preset_print_options { "tree_support_branch_angle", "tree_support_angle_slow", "tree_support_wall_count", "tree_support_top_rate", "tree_support_branch_distance", "tree_support_tip_diameter", "tree_support_branch_diameter", "tree_support_branch_diameter_angle", "tree_support_branch_diameter_double_wall", "detect_narrow_internal_solid_infill", - "gcode_add_line_number", "enable_arc_fitting", "infill_combination", /*"adaptive_layer_height",*/ + "gcode_add_line_number", "enable_arc_fitting", "precise_z_height", "infill_combination", /*"adaptive_layer_height",*/ "support_bottom_interface_spacing", "enable_overhang_speed", "slowdown_for_curled_perimeters", "overhang_1_4_speed", "overhang_2_4_speed", "overhang_3_4_speed", "overhang_4_4_speed", "initial_layer_infill_speed", "only_one_wall_top", "timelapse_type", @@ -850,7 +850,8 @@ static std::vector s_Preset_filament_options { "filament_loading_speed", "filament_loading_speed_start", "filament_load_time", "filament_unloading_speed", "filament_unloading_speed_start", "filament_unload_time", "filament_toolchange_delay", "filament_cooling_moves", "filament_cooling_initial_speed", "filament_cooling_final_speed", "filament_ramming_parameters", - "filament_multitool_ramming", "filament_multitool_ramming_volume", "filament_multitool_ramming_flow", "activate_chamber_temp_control" + "filament_multitool_ramming", "filament_multitool_ramming_volume", "filament_multitool_ramming_flow", "activate_chamber_temp_control", + "filament_long_retractions_when_cut","filament_retraction_distances_when_cut" }; static std::vector s_Preset_machine_limits_options { @@ -867,6 +868,7 @@ static std::vector s_Preset_printer_options { "fan_kickstart", "fan_speedup_time", "fan_speedup_overhangs", "single_extruder_multi_material", "manual_filament_change", "machine_start_gcode", "machine_end_gcode", "before_layer_change_gcode", "printing_by_object_gcode", "layer_change_gcode", "time_lapse_gcode", "change_filament_gcode", "change_extrusion_role_gcode", "printer_model", "printer_variant", "printable_height", "extruder_clearance_radius", "extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod", + "nozzle_height", "default_print_profile", "inherits", "silent_mode", // BBS @@ -882,7 +884,7 @@ static std::vector s_Preset_printer_options { "cooling_tube_retraction", "cooling_tube_length", "high_current_on_filament_swap", "parking_pos_retraction", "extra_loading_move", "purge_in_prime_tower", "enable_filament_ramming", "z_offset", - "disable_m73", "preferred_orientation", "emit_machine_limits_to_gcode", "support_multi_bed_types","bed_mesh_min","bed_mesh_max","bed_mesh_probe_distance", "adaptive_bed_mesh_margin" + "disable_m73", "preferred_orientation", "emit_machine_limits_to_gcode", "support_multi_bed_types","bed_mesh_min","bed_mesh_max","bed_mesh_probe_distance", "adaptive_bed_mesh_margin", "enable_long_retraction_when_cut","long_retractions_when_cut","retraction_distances_when_cut" }; static std::vector s_Preset_sla_print_options { @@ -1184,6 +1186,8 @@ void PresetCollection::load_presets( preset.setting_id.clear(); //BBS: add config related logs BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(", preset type %1%, name %2%, path %3%, is_system %4%, is_default %5% is_visible %6%")%Preset::get_type_string(m_type) %preset.name %preset.file %preset.is_system %preset.is_default %preset.is_visible; + // add alias for custom filament preset + set_custom_preset_alias(preset); } catch (const std::ifstream::failure &err) { ++m_errors; BOOST_LOG_TRIVIAL(error) << boost::format("The user-config cannot be loaded: %1%. Reason: %2%")%preset.file %err.what(); @@ -2139,6 +2143,7 @@ bool PresetCollection::clone_presets(std::vector const &presets, auto old_name = this->get_edited_preset().name; for (auto preset : new_presets) { preset.alias.clear(); + set_custom_preset_alias(preset); preset.base_id.clear(); auto it = this->find_preset_internal(preset.name); assert((it == m_presets.end() || it->name != preset.name) || force_rewritten); @@ -2200,6 +2205,10 @@ std::map> PresetCollection::get_filamen { std::map> filament_presets; for (auto &preset : m_presets) { + if (preset.is_user()) { + if (preset.inherits() == "") { filament_presets[preset.filament_id].push_back(&preset); } + continue; + } if (get_preset_base(preset) == &preset) { filament_presets[preset.filament_id].push_back(&preset); } } return filament_presets; @@ -2456,10 +2465,13 @@ const std::string& PresetCollection::get_preset_name_by_alias(const std::string& auto it = Slic3r::lower_bound_by_predicate(m_map_alias_to_profile_name.begin(), m_map_alias_to_profile_name.end(), [&alias](auto &l){ return l.first < alias; }); // Continue over all profile names with the same alias. it != m_map_alias_to_profile_name.end() && it->first == alias; ++ it) - if (auto it_preset = this->find_preset_internal(it->second); - it_preset != m_presets.end() && it_preset->name == it->second && + for (const std::string &preset_name : it->second) { + if (auto it_preset = this->find_preset_internal(preset_name); + it_preset != m_presets.end() && it_preset->name == preset_name && it_preset->is_visible && (it_preset->is_compatible || size_t(it_preset - m_presets.begin()) == m_idx_selected)) return it_preset->name; + } + return alias; } @@ -2471,6 +2483,28 @@ const std::string* PresetCollection::get_preset_name_renamed(const std::string & return nullptr; } +bool PresetCollection::is_alias_exist(const std::string &alias, Preset* preset) +{ + auto it = m_map_alias_to_profile_name.find(alias); + if (m_map_alias_to_profile_name.end() == it) return false; + if (!preset) return true; + + auto compatible_printers = dynamic_cast(preset->config.option("compatible_printers")); + if (compatible_printers == nullptr) return true; + + for (const std::string &printer_name : compatible_printers->values) { + auto printer_iter = m_printer_hold_alias.find(printer_name); + if (m_printer_hold_alias.end() != printer_iter) { + auto alias_iter = m_printer_hold_alias[printer_name].find(alias); + if (m_printer_hold_alias[printer_name].end() != alias_iter) { + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << " The alias already exists: " << alias << " and the preset name: " << preset->name; + return true; + } + } + } + return false; +} + const std::string& PresetCollection::get_suffix_modified() { return g_suffix_modified; } @@ -2803,9 +2837,11 @@ void PresetCollection::update_vendor_ptrs_after_copy(const VendorMap &new_vendor void PresetCollection::update_map_alias_to_profile_name() { m_map_alias_to_profile_name.clear(); - for (const Preset &preset : m_presets) - m_map_alias_to_profile_name.emplace_back(preset.alias, preset.name); - std::sort(m_map_alias_to_profile_name.begin(), m_map_alias_to_profile_name.end(), [](auto &l, auto &r) { return l.first < r.first; }); + for (const Preset &preset : m_presets) { + m_map_alias_to_profile_name[preset.alias].push_back(preset.name); + } + // now m_map_alias_to_profile_name is map, not need sort + //std::sort(m_map_alias_to_profile_name.begin(), m_map_alias_to_profile_name.end(), [](auto &l, auto &r) { return l.first < r.first; }); } void PresetCollection::update_map_system_profile_renamed() @@ -2823,6 +2859,47 @@ void PresetCollection::update_map_system_profile_renamed() } } +void PresetCollection::set_custom_preset_alias(Preset &preset) +{ + if (m_type == Preset::Type::TYPE_FILAMENT && preset.config.has(BBL_JSON_KEY_INHERITS) && preset.config.option(BBL_JSON_KEY_INHERITS)->value.empty()) { + std::string alias_name; + std::string preset_name = preset.name; + if (alias_name.empty()) { + size_t end_pos = preset_name.find_first_of("@"); + if (end_pos != std::string::npos) { + alias_name = preset_name.substr(0, end_pos); + boost::trim_right(alias_name); + } + } + if (alias_name.empty() || is_alias_exist(alias_name, &preset)) + preset.alias = ""; + else { + preset.alias = std::move(alias_name); + m_map_alias_to_profile_name[preset.alias].push_back(preset.name); + set_printer_hold_alias(preset.alias, preset); + } + } +} + +void PresetCollection::set_printer_hold_alias(const std::string &alias, Preset &preset) +{ + auto compatible_printers = dynamic_cast(preset.config.option("compatible_printers")); + if (compatible_printers == nullptr) return; + for (const std::string &printer_name : compatible_printers->values) { + auto printer_iter = m_printer_hold_alias.find(printer_name); + if (m_printer_hold_alias.end() == printer_iter) { + m_printer_hold_alias[printer_name].insert(alias); + } else { + auto alias_iter = m_printer_hold_alias[printer_name].find(alias); + if (m_printer_hold_alias[printer_name].end() == alias_iter) { + m_printer_hold_alias[printer_name].insert(alias); + } else { + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << printer_name << "already has alias: " << alias << " and the preset name: " << preset.name; + } + } + } +} + std::string PresetCollection::name() const { switch (this->type()) { diff --git a/src/libslic3r/Preset.hpp b/src/libslic3r/Preset.hpp index b03ce605e3..4922f12eb1 100644 --- a/src/libslic3r/Preset.hpp +++ b/src/libslic3r/Preset.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -554,6 +555,8 @@ public: const std::string& get_preset_name_by_alias(const std::string& alias) const; const std::string* get_preset_name_renamed(const std::string &old_name) const; + bool is_alias_exist(const std::string &alias, Preset* preset = nullptr); + void set_printer_hold_alias(const std::string &alias, Preset &preset); // used to update preset_choice from Tab const std::deque& get_presets() const { return m_presets; } @@ -705,6 +708,8 @@ protected: // Update m_map_system_profile_renamed from loaded system profiles. void update_map_system_profile_renamed(); + void set_custom_preset_alias(Preset &preset); + private: // Find a preset position in the sorted list of presets. // The "-- default -- " preset is always the first, so it needs @@ -748,7 +753,8 @@ private: // so that the addresses of the presets don't change during resizing of the container. std::deque m_presets; // System profiles may have aliases. Map to the full profile name. - std::vector> m_map_alias_to_profile_name; + std::map> m_map_alias_to_profile_name; + std::unordered_map> m_printer_hold_alias; // Map from old system profile name to a current system profile name. std::map m_map_system_profile_renamed; // Initially this preset contains a copy of the selected preset. Later on, this copy may be modified by the user. diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index f46e0aebcb..e1503604bb 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -1895,7 +1895,6 @@ unsigned int PresetBundle::sync_ams_list(unsigned int &unknowns) if (filament_presets.size() < this->filament_presets.size()) { filament_presets.push_back(this->filament_presets[filament_presets.size()]); filament_colors.push_back(filament_color); - ams_multi_color_filment.push_back(filament_multi_color); ++unknowns; continue; } @@ -1945,6 +1944,96 @@ void PresetBundle::set_calibrate_printer(std::string name) } } +std::set PresetBundle::get_printer_names_by_printer_type_and_nozzle(const std::string &printer_type, std::string nozzle_diameter_str) +{ + std::set printer_names; + if ("0.0" == nozzle_diameter_str || nozzle_diameter_str.empty()) { + nozzle_diameter_str = "0.4"; + } + std::ostringstream stream; + + for (auto printer_it = this->printers.begin(); printer_it != this->printers.end(); printer_it++) { + if (!printer_it->is_system) continue; + + ConfigOption * printer_model_opt = printer_it->config.option("printer_model"); + ConfigOptionString *printer_model_str = dynamic_cast(printer_model_opt); + if (!printer_model_str) continue; + + // use printer_model as printer type + if (printer_model_str->value != printer_type) continue; + + if (printer_it->name.find(nozzle_diameter_str) != std::string::npos) printer_names.insert(printer_it->name); + } + assert(printer_names.size() == 1); + + for (auto& printer_name : printer_names) { + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << " printer name: " << printer_name; + } + + return printer_names; +} + +bool PresetBundle::check_filament_temp_equation_by_printer_type_and_nozzle_for_mas_tray( + const std::string &printer_type, std::string& nozzle_diameter_str, std::string &setting_id, std::string &tag_uid, std::string &nozzle_temp_min, std::string &nozzle_temp_max, std::string& preset_setting_id) +{ + bool is_equation = true; + + std::map> filament_list = filaments.get_filament_presets(); + std::set printer_names = get_printer_names_by_printer_type_and_nozzle(printer_type, nozzle_diameter_str); + + for (const Preset *preset : filament_list.find(setting_id)->second) { + if (tag_uid == "0" || (tag_uid.size() == 16 && tag_uid.substr(12, 2) == "01")) continue; + if (preset && !preset->is_user()) continue; + ConfigOption * printer_opt = const_cast(preset)->config.option("compatible_printers"); + ConfigOptionStrings *printer_strs = dynamic_cast(printer_opt); + bool compared = false; + for (const std::string &printer_str : printer_strs->values) { + if (printer_names.find(printer_str) != printer_names.end()) { + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << "nozzle temp matching: preset name: " << preset->name << " printer name: " << printer_str; + // Compare only once + if (!compared) { + compared = true; + bool min_temp_equation = false, max_temp_equation = false; + int min_nozzle_temp = std::stoi(nozzle_temp_min); + int max_nozzle_temp = std::stoi(nozzle_temp_max); + ConfigOption *opt_min = const_cast(preset)->config.option("nozzle_temperature_range_low"); + if (opt_min) { + ConfigOptionInts *opt_min_ints = dynamic_cast(opt_min); + min_nozzle_temp = opt_min_ints->get_at(0); + if (std::to_string(min_nozzle_temp) == nozzle_temp_min) + min_temp_equation = true; + else { + BOOST_LOG_TRIVIAL(info) << "tray min temp: " << nozzle_temp_min << " preset min temp: " << min_nozzle_temp; + nozzle_temp_min = std::to_string(min_nozzle_temp); + } + } + ConfigOption *opt_max = const_cast(preset)->config.option("nozzle_temperature_range_high"); + if (opt_max) { + ConfigOptionInts *opt_max_ints = dynamic_cast(opt_max); + max_nozzle_temp = opt_max_ints->get_at(0); + if (std::to_string(max_nozzle_temp) == nozzle_temp_max) + max_temp_equation = true; + else { + BOOST_LOG_TRIVIAL(info) << "tray max temp: " << nozzle_temp_max << " preset min temp: " << max_nozzle_temp; + nozzle_temp_max = std::to_string(max_nozzle_temp); + } + } + if (min_temp_equation && max_temp_equation) { + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << "Determine if the temperature has changed: no changed"; + } else { + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << "Determine if the temperature has changed: has changed"; + preset_setting_id = preset->setting_id; + is_equation = false; + } + } else { + assert(false); + } + } + } + } + return is_equation; +} + //BBS: check whether this is the only edited filament bool PresetBundle::is_the_only_edited_filament(unsigned int filament_index) { @@ -3544,8 +3633,10 @@ std::pair PresetBundle::load_vendor_configs_ } if (alias_name.empty()) loaded.alias = preset_name; - else + else { loaded.alias = std::move(alias_name); + filaments.set_printer_hold_alias(loaded.alias, loaded); + } loaded.renamed_from = std::move(renamed_from); if (! substitution_context.empty()) substitutions.push_back({ diff --git a/src/libslic3r/PresetBundle.hpp b/src/libslic3r/PresetBundle.hpp index c54ddda576..4cc62a3ed9 100644 --- a/src/libslic3r/PresetBundle.hpp +++ b/src/libslic3r/PresetBundle.hpp @@ -125,6 +125,15 @@ public: void set_is_validation_mode(bool mode) { validation_mode = mode; } void set_vendor_to_validate(std::string vendor) { vendor_to_validate = vendor; } + std::set get_printer_names_by_printer_type_and_nozzle(const std::string &printer_type, std::string nozzle_diameter_str); + bool check_filament_temp_equation_by_printer_type_and_nozzle_for_mas_tray(const std::string &printer_type, + std::string & nozzle_diameter_str, + std::string & setting_id, + std::string & tag_uid, + std::string & nozzle_temp_min, + std::string & nozzle_temp_max, + std::string & preset_setting_id); + PresetCollection prints; PresetCollection sla_prints; PresetCollection filaments; diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index a4756a6e38..9dfe1f9659 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -125,6 +125,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n "extruder_clearance_height_to_rod", "extruder_clearance_height_to_lid", "extruder_clearance_radius", + "nozzle_height", "extruder_colour", "extruder_offset", "filament_flow_ratio", @@ -213,6 +214,12 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n "activate_chamber_temp_control", "manual_filament_change", "disable_m73", + "use_firmware_retraction", + "enable_long_retraction_when_cut", + "long_retractions_when_cut", + "retraction_distances_when_cut", + "filament_long_retractions_when_cut", + "filament_retraction_distances_when_cut" }; static std::unordered_set steps_ignore; @@ -244,6 +251,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n || opt_key == "nozzle_diameter" || opt_key == "filament_shrink" || opt_key == "resolution" + || opt_key == "precise_z_height" // Spiral Vase forces different kind of slicing than the normal model: // In Spiral Vase mode, holes are closed and only the largest area contour is kept at each layer. // Therefore toggling the Spiral Vase on / off requires complete reslicing. @@ -280,6 +288,8 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n || opt_key == "prime_tower_width" || opt_key == "prime_tower_brim_width" || opt_key == "first_layer_print_sequence" + || opt_key == "other_layers_print_sequence" + || opt_key == "other_layers_print_sequence_nums" || opt_key == "wipe_tower_bridging" || opt_key == "wipe_tower_no_sparse_layers" || opt_key == "flush_volumes_matrix" @@ -460,8 +470,8 @@ std::vector Print::extruders(bool conside_custom_gcode) const if (conside_custom_gcode) { //BBS int num_extruders = m_config.filament_colour.size(); - for (auto plate_data : m_model.plates_custom_gcodes) { - for (auto item : plate_data.second.gcodes) { + if (m_model.plates_custom_gcodes.find(m_model.curr_plate_index) != m_model.plates_custom_gcodes.end()) { + for (auto item : m_model.plates_custom_gcodes.at(m_model.curr_plate_index).gcodes) { if (item.type == CustomGCode::Type::ToolChange && item.extruder <= num_extruders) extruders.push_back((unsigned int)(item.extruder - 1)); } @@ -576,6 +586,11 @@ StringObjectException Print::sequential_print_clearance_valid(const Print &print polygons->clear(); std::vector intersecting_idxs; + bool all_objects_are_short = print.is_all_objects_are_short(); + // Shrink the extruder_clearance_radius a tiny bit, so that if the object arrangement algorithm placed the objects + // exactly by satisfying the extruder_clearance_radius, this test will not trigger collision. + float obj_distance = all_objects_are_short ? scale_(0.5*MAX_OUTER_NOZZLE_DIAMETER-0.1) : scale_(0.5*print.config().extruder_clearance_radius.value-0.1); + for (const PrintObject *print_object : print.objects()) { assert(! print_object->model_object()->instances.empty()); assert(! print_object->instances().empty()); @@ -601,11 +616,7 @@ StringObjectException Print::sequential_print_clearance_valid(const Print &print // Now we check that no instance of convex_hull intersects any of the previously checked object instances. for (const PrintInstance &instance : print_object->instances()) { Polygon convex_hull_no_offset = convex_hull0, convex_hull; - auto tmp = offset(convex_hull_no_offset, - // Shrink the extruder_clearance_radius a tiny bit, so that if the object arrangement algorithm placed the objects - // exactly by satisfying the extruder_clearance_radius, this test will not trigger collision. - float(scale_(0.5 * print.config().extruder_clearance_radius.value - 0.1)), - jtRound, scale_(0.1)); + auto tmp = offset(convex_hull_no_offset, obj_distance, jtRound, scale_(0.1)); if (!tmp.empty()) { // tmp may be empty due to clipper's bug, see STUDIO-2452 convex_hull = tmp.front(); // instance.shift is a position of a centered object, while model object may not be centered. @@ -840,7 +851,7 @@ StringObjectException Print::sequential_print_clearance_valid(const Print &print break; } } - if (height < inst->print_object->height()) + if (height < inst->print_object->max_z()) too_tall_instances[inst] = std::make_pair(print_instance_with_bounding_box[k].hull_polygon, unscaled(height)); } @@ -1088,7 +1099,7 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons* if (m_config.spiral_mode) { size_t total_copies_count = 0; - for (const PrintObject *object : m_objects) + for (const PrintObject* object : m_objects) total_copies_count += object->instances().size(); // #4043 if (total_copies_count > 1 && m_config.print_sequence != PrintSequence::ByObject) @@ -1117,7 +1128,7 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons* for (size_t print_object_idx = 0; print_object_idx < m_objects.size(); ++ print_object_idx) { const PrintObject &print_object = *m_objects[print_object_idx]; //FIXME It is quite expensive to generate object layers just to get the print height! - if (auto layers = generate_object_layers(print_object.slicing_parameters(), layer_height_profile(print_object_idx)); + if (auto layers = generate_object_layers(print_object.slicing_parameters(), layer_height_profile(print_object_idx), print_object.config().precise_z_height.value); ! layers.empty() && layers.back() > this->config().printable_height + EPSILON) { return // Test whether the last slicing plane is below or above the print volume. @@ -1220,6 +1231,13 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons* // BBS: remove obsolete logics and _L() if (has_custom_layering) { + std::vector> layer_z_series; + layer_z_series.assign(m_objects.size(), std::vector()); + + for (size_t idx_object = 0; idx_object < m_objects.size(); ++idx_object) { + layer_z_series[idx_object] = generate_object_layers(m_objects[idx_object]->slicing_parameters(), layer_height_profiles[idx_object], m_objects[idx_object]->config().precise_z_height.value); + } + for (size_t idx_object = 0; idx_object < m_objects.size(); ++idx_object) { if (idx_object == tallest_object_idx) continue; // Check that the layer height profiles are equal. This will happen when one object is @@ -2472,7 +2490,8 @@ int Print::get_hrc_by_nozzle_type(const NozzleType&type) static std::mapnozzle_type_to_hrc; if (nozzle_type_to_hrc.empty()) { fs::path file_path = fs::path(resources_dir()) / "info" / "nozzle_info.json"; - std::ifstream in(file_path.string()); + boost::nowide::ifstream in(file_path.string()); + //std::ifstream in(file_path.string()); json j; try { j = json::parse(in); diff --git a/src/libslic3r/Print.hpp b/src/libslic3r/Print.hpp index 231761f957..f48466e575 100644 --- a/src/libslic3r/Print.hpp +++ b/src/libslic3r/Print.hpp @@ -38,6 +38,8 @@ class SupportLayer; class TreeSupportData; class TreeSupport; +#define MARGIN_HEIGHT 1.5 +#define MAX_OUTER_NOZZLE_DIAMETER 4 // BBS: move from PrintObjectSlice.cpp struct VolumeSlices { @@ -331,6 +333,7 @@ public: // Height is used for slicing, for sorting the objects by height for sequential printing and for checking vertical clearence in sequential print mode. // The height is snug. coord_t height() const { return m_size.z(); } + double max_z() const { return m_max_z; } // Centering offset of the sliced mesh from the scaled and rotated mesh of the model. const Point& center_offset() const { return m_center_offset; } @@ -505,6 +508,7 @@ private: // XYZ in scaled coordinates Vec3crd m_size; + double m_max_z; PrintObjectConfig m_config; // Translation in Z + Rotation + Scaling / Mirroring. Transform3d m_trafo = Transform3d::Identity(); @@ -954,7 +958,11 @@ public: // Unset types are just ignored. static int get_compatible_filament_type(const std::set& types); - protected: + bool is_all_objects_are_short() const { + return std::all_of(this->objects().begin(), this->objects().end(), [&](PrintObject* obj) { return obj->height() < scale_(this->config().nozzle_height.value); }); + } + +protected: // Invalidates the step, and its depending steps in Print. bool invalidate_step(PrintStep step); diff --git a/src/libslic3r/PrintApply.cpp b/src/libslic3r/PrintApply.cpp index 50fdee7cb9..b6fd173c03 100644 --- a/src/libslic3r/PrintApply.cpp +++ b/src/libslic3r/PrintApply.cpp @@ -235,11 +235,16 @@ static t_config_option_keys print_config_diffs( bool overriden = opt_new->overriden_by(opt_new_filament); if (overriden || *opt_old != *opt_new) { auto opt_copy = opt_new->clone(); - opt_copy->apply_override(opt_new_filament); + if (!((opt_key == "long_retractions_when_cut" || opt_key == "retraction_distances_when_cut") + && new_full_config.option("enable_long_retraction_when_cut")->value != LongRectrationLevel::EnableFilament)) // ugly code, remove it later if firmware supports + opt_copy->apply_override(opt_new_filament); bool changed = *opt_old != *opt_copy; if (changed) print_diff.emplace_back(opt_key); if (changed || overriden) { + if ((opt_key == "long_retractions_when_cut" || opt_key == "retraction_distances_when_cut") + && new_full_config.option("enable_long_retraction_when_cut")->value != LongRectrationLevel::EnableFilament) + continue; // filament_overrides will be applied to the placeholder parser, which layers these parameters over full_print_config. filament_overrides.set_key_value(opt_key, opt_copy); } else diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 2edde94c42..ff7722c739 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -370,11 +370,11 @@ static const t_config_enum_values s_keys_map_BedType = { CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(BedType) // BBS -static const t_config_enum_values s_keys_map_FirstLayerSeq = { +static const t_config_enum_values s_keys_map_LayerSeq = { { "Auto", flsAuto }, { "Customize", flsCutomize }, }; -CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(FirstLayerSeq) +CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(LayerSeq) static t_config_enum_values s_keys_map_NozzleType { { "undefine", int(NozzleType::ntUndefine) }, @@ -770,16 +770,37 @@ void PrintConfigDef::init_fff_params() def->max = 16; def->set_default_value(new ConfigOptionInts{0}); + def = this->add("other_layers_print_sequence", coInts); + def->label = L("Other layers print sequence"); + def->min = 0; + def->max = 16; + def->set_default_value(new ConfigOptionInts{0}); + + def = this->add("other_layers_print_sequence_nums", coInt); + def->label = L("The number of other layers print sequence"); + def->set_default_value(new ConfigOptionInt{0}); + def = this->add("first_layer_sequence_choice", coEnum); def->category = L("Quality"); def->label = L("First layer filament sequence"); - def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); + def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); def->enum_values.push_back("Auto"); def->enum_values.push_back("Customize"); def->enum_labels.push_back(L("Auto")); def->enum_labels.push_back(L("Customize")); def->mode = comSimple; - def->set_default_value(new ConfigOptionEnum(flsAuto)); + def->set_default_value(new ConfigOptionEnum(flsAuto)); + + def = this->add("other_layers_sequence_choice", coEnum); + def->category = L("Quality"); + def->label = L("Other layers filament sequence"); + def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); + def->enum_values.push_back("Auto"); + def->enum_values.push_back("Customize"); + def->enum_labels.push_back(L("Auto")); + def->enum_labels.push_back(L("Customize")); + def->mode = comSimple; + def->set_default_value(new ConfigOptionEnum(flsAuto)); def = this->add("before_layer_change_gcode", coString); def->label = L("Before layer change G-code"); @@ -1580,6 +1601,14 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(40)); + def = this->add("nozzle_height", coFloat); + def->label = L("Nozzle height"); + def->tooltip = L("The height of nozzle tip."); + def->sidetext = L("mm"); + def->min = 0; + def->mode = comDevelop; + def->set_default_value(new ConfigOptionFloat(4)); + def = this->add("bed_mesh_min", coPoint); def->label = L("Bed mesh min"); def->tooltip = L( @@ -2390,6 +2419,15 @@ def = this->add("filament_loading_speed", coFloats); def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(30)); + // BBS + def = this->add("precise_z_height", coBool); + def->label = L("Precise Z height"); + def->tooltip = L("Enable this to get precise z height of object after slicing. " + "It will get the precise object height by fine-tuning the layer heights of the last few layers. " + "Note that this is an experimental parameter."); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionBool(0)); + // BBS def = this->add("enable_arc_fitting", coBool); def->label = L("Arc fitting"); @@ -3393,6 +3431,25 @@ def = this->add("filament_loading_speed", coFloats); def->mode = comSimple; def->set_default_value(new ConfigOptionFloats { 0.8 }); + def = this->add("enable_long_retraction_when_cut",coInt); + def->mode = comDevelop; + def->set_default_value(new ConfigOptionInt {0}); + + def = this->add("long_retractions_when_cut", coBools); + def->label = L("Long retraction when cut(experimental)"); + def->tooltip = L("Experimental feature.Retracting and cutting off the filament at a longer distance during changes to minimize purge." + "While this reduces flush significantly, it may also raise the risk of nozzle clogs or other printing problems."); + def->mode = comDevelop; + def->set_default_value(new ConfigOptionBools {false}); + + def = this->add("retraction_distances_when_cut",coFloats); + def->label = L("Retraction distance when cut"); + def->tooltip = L("Experimental feature.Retraction length before cutting off during filament change"); + def->mode = comDevelop; + def->min = 10; + def->max = 18; + def->set_default_value(new ConfigOptionFloats {18}); + def = this->add("retract_length_toolchange", coFloats); def->label = L("Length"); //def->full_label = L("Retraction Length (Toolchange)"); @@ -4929,7 +4986,10 @@ def = this->add("filament_loading_speed", coFloats); // bools "retract_when_changing_layer", "wipe", // percents - "retract_before_wipe"}) { + "retract_before_wipe", + "long_retractions_when_cut", + "retraction_distances_when_cut" + }) { auto it_opt = options.find(opt_key); assert(it_opt != options.end()); def = this->add_nullable(std::string("filament_") + opt_key, it_opt->second.type); @@ -4940,9 +5000,13 @@ def = this->add("filament_loading_speed", coFloats); def->enum_keys_map = it_opt->second.enum_keys_map; def->enum_labels = it_opt->second.enum_labels; def->enum_values = it_opt->second.enum_values; + def->min = it_opt->second.min; + def->max = it_opt->second.max; //BBS: shown specific filament retract config because we hide the machine retract into comDevelop mode if ((strcmp(opt_key, "retraction_length") == 0) || - (strcmp(opt_key, "z_hop") == 0)) + (strcmp(opt_key, "z_hop") == 0)|| + (strcmp(opt_key, "long_retractions_when_cut") == 0)|| + (strcmp(opt_key, "retraction_distances_when_cut") == 0)) def->mode = comSimple; else def->mode = comAdvanced; @@ -4973,17 +5037,19 @@ void PrintConfigDef::init_extruder_option_keys() "retraction_length", "z_hop", "z_hop_types", "retract_lift_above", "retract_lift_below", "retract_lift_enforce", "retraction_speed", "deretraction_speed", "retract_before_wipe", "retract_restart_extra", "retraction_minimum_travel", "wipe", "wipe_distance", "retract_when_changing_layer", "retract_length_toolchange", "retract_restart_extra_toolchange", "extruder_colour", - "default_filament_profile" + "default_filament_profile","retraction_distances_when_cut","long_retractions_when_cut" }; m_extruder_retract_keys = { "deretraction_speed", + "long_retractions_when_cut", "retract_before_wipe", "retract_lift_above", "retract_lift_below", "retract_lift_enforce", "retract_restart_extra", "retract_when_changing_layer", + "retraction_distances_when_cut", "retraction_length", "retraction_minimum_travel", "retraction_speed", @@ -5002,17 +5068,19 @@ void PrintConfigDef::init_filament_option_keys() "retraction_length", "z_hop", "z_hop_types", "retract_lift_above", "retract_lift_below", "retract_lift_enforce", "retraction_speed", "deretraction_speed", "retract_before_wipe", "retract_restart_extra", "retraction_minimum_travel", "wipe", "wipe_distance", "retract_when_changing_layer", "retract_length_toolchange", "retract_restart_extra_toolchange", "filament_colour", - "default_filament_profile"/*,"filament_seam_gap"*/ + "default_filament_profile","retraction_distances_when_cut","long_retractions_when_cut"/*,"filament_seam_gap"*/ }; m_filament_retract_keys = { "deretraction_speed", + "long_retractions_when_cut", "retract_before_wipe", "retract_lift_above", "retract_lift_below", "retract_lift_enforce", "retract_restart_extra", "retract_when_changing_layer", + "retraction_distances_when_cut", "retraction_length", "retraction_minimum_travel", "retraction_speed", @@ -5792,7 +5860,8 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va "remove_freq_sweep", "remove_bed_leveling", "remove_extrusion_calibration", "support_transition_line_width", "support_transition_speed", "bed_temperature", "bed_temperature_initial_layer", "can_switch_nozzle_type", "can_add_auxiliary_fan", "extra_flush_volume", "spaghetti_detector", "adaptive_layer_height", - "z_hop_type", "z_lift_type", "bed_temperature_difference", + "z_hop_type", "z_lift_type", "bed_temperature_difference","long_retraction_when_cut", + "retraction_distance_when_cut", "extruder_type", "internal_bridge_support_thickness","extruder_clearance_max_radius", "top_area_threshold", "reduce_wall_solid_infill" }; @@ -6287,6 +6356,8 @@ std::map validate(const FullPrintConfig &cfg, bool und if (cfg.extruder_clearance_height_to_lid <= 0) { error_message.emplace("extruder_clearance_height_to_lid", L("invalid value ") + std::to_string(cfg.extruder_clearance_height_to_lid)); } + if (cfg.nozzle_height <= 0) + error_message.emplace("nozzle_height", L("invalid value ") + std::to_string(cfg.nozzle_height)); // --extrusion-multiplier for (double em : cfg.filament_flow_ratio.values) @@ -6848,6 +6919,12 @@ CLIMiscConfigDef::CLIMiscConfigDef() def->tooltip = "MakerLab version to generate this 3mf"; def->cli_params = "version"; def->set_default_value(new ConfigOptionString()); + + def = this->add("allow_newer_file", coBool); + def->label = "Allow 3mf with newer version to be sliced"; + def->tooltip = "Allow 3mf with newer version to be sliced"; + def->cli_params = "option"; + def->set_default_value(new ConfigOptionBool(false)); } const CLIActionsConfigDef cli_actions_config_def; diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 28e9d00923..be3edef9a3 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -144,6 +144,13 @@ enum SupportMaterialStyle { smsDefault, smsGrid, smsSnug, smsTreeSlim, smsTreeStrong, smsTreeHybrid, smsOrganic, }; +enum LongRectrationLevel +{ + Disabled=0, + EnableMachine, + EnableFilament +}; + enum SupportMaterialInterfacePattern { smipAuto, smipRectilinear, smipConcentric, smipRectilinearInterlaced, smipGrid }; @@ -268,7 +275,7 @@ enum BedType { }; // BBS -enum FirstLayerSeq { +enum LayerSeq { flsAuto, flsCutomize }; @@ -854,6 +861,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, top_surface_jerk)) ((ConfigOptionFloat, initial_layer_jerk)) ((ConfigOptionFloat, travel_jerk)) + ((ConfigOptionBool, precise_z_height)) ) // This object is mapped to Perl as Slic3r::Config::PrintRegion. @@ -1051,6 +1059,9 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionPercents, retract_before_wipe)) ((ConfigOptionFloats, retraction_length)) ((ConfigOptionFloats, retract_length_toolchange)) + ((ConfigOptionInt, enable_long_retraction_when_cut)) + ((ConfigOptionFloats, retraction_distances_when_cut)) + ((ConfigOptionBools, long_retractions_when_cut)) ((ConfigOptionFloats, z_hop)) // BBS ((ConfigOptionEnumsGeneric, z_hop_types)) @@ -1156,12 +1167,15 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionEnum,print_sequence)) ((ConfigOptionEnum, print_order)) ((ConfigOptionInts, first_layer_print_sequence)) + ((ConfigOptionInts, other_layers_print_sequence)) + ((ConfigOptionInt, other_layers_print_sequence_nums)) ((ConfigOptionBools, slow_down_for_layer_cooling)) ((ConfigOptionInts, close_fan_the_first_x_layers)) ((ConfigOptionEnum, draft_shield)) ((ConfigOptionFloat, extruder_clearance_height_to_rod))//BBs ((ConfigOptionFloat, extruder_clearance_height_to_lid))//BBS ((ConfigOptionFloat, extruder_clearance_radius)) + ((ConfigOptionFloat, nozzle_height)) ((ConfigOptionStrings, extruder_colour)) ((ConfigOptionPoints, extruder_offset)) ((ConfigOptionBools, reduce_fan_stop_start_freq)) diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 077b226668..c78e7de4b5 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -97,6 +97,7 @@ PrintObject::PrintObject(Print* print, ModelObject* model_object, const Transfor // snug height and an approximate bounding box in XY. BoundingBoxf3 bbox = model_object->raw_bounding_box(); Vec3d bbox_center = bbox.center(); + // We may need to rotate the bbox / bbox_center from the original instance to the current instance. double z_diff = Geometry::rotation_diff_z(model_object->instances.front()->get_rotation(), instances.front().model_instance->get_rotation()); if (std::abs(z_diff) > EPSILON) { @@ -109,7 +110,7 @@ PrintObject::PrintObject(Print* print, ModelObject* model_object, const Transfor m_center_offset = Point::new_scale(bbox_center.x(), bbox_center.y()); // Size of the transformed mesh. This bounding may not be snug in XY plane, but it is snug in Z. m_size = (bbox.size() * (1. / SCALING_FACTOR)).cast(); - m_size.z() = coord_t(model_object->max_z() * (1. / SCALING_FACTOR)); + m_max_z = scaled(model_object->instance_bounding_box(0).max(2)); this->set_instances(std::move(instances)); } diff --git a/src/libslic3r/PrintObjectSlice.cpp b/src/libslic3r/PrintObjectSlice.cpp index 78dd620eba..53c875555b 100644 --- a/src/libslic3r/PrintObjectSlice.cpp +++ b/src/libslic3r/PrintObjectSlice.cpp @@ -810,7 +810,7 @@ void PrintObject::slice() m_print->throw_if_canceled(); m_typed_slices = false; this->clear_layers(); - m_layers = new_layers(this, generate_object_layers(m_slicing_params, layer_height_profile)); + m_layers = new_layers(this, generate_object_layers(m_slicing_params, layer_height_profile, m_config.precise_z_height.value)); this->slice_volumes(); m_print->throw_if_canceled(); int firstLayerReplacedBy = 0; diff --git a/src/libslic3r/ProjectTask.hpp b/src/libslic3r/ProjectTask.hpp index 103d82073f..05f39f9b2c 100644 --- a/src/libslic3r/ProjectTask.hpp +++ b/src/libslic3r/ProjectTask.hpp @@ -46,6 +46,8 @@ struct FilamentInfo float used_g; int tray_id; // start with 0 float distance; + int ctype = 0; + std::vector colors = std::vector(); int mapping_result = 0; }; diff --git a/src/libslic3r/Slicing.cpp b/src/libslic3r/Slicing.cpp index 72e231c314..97a8700d83 100644 --- a/src/libslic3r/Slicing.cpp +++ b/src/libslic3r/Slicing.cpp @@ -631,10 +631,104 @@ void adjust_layer_height_profile( #endif /* _DEBUG */ } +bool adjust_layer_series_to_align_object_height(const SlicingParameters &slicing_params, std::vector& layer_series) +{ + coordf_t object_height = slicing_params.object_print_z_height(); + if (is_approx(layer_series.back(), object_height)) + return true; + + // need at least 5 + 1(first_layer) layers to adjust the height + size_t layer_size = layer_series.size(); + if (layer_size < 12) + return false; + + std::vector last_5_layers_heght; + for (size_t i = 0; i < 5; ++i) { + last_5_layers_heght.emplace_back(layer_series[layer_size - 10 + 2 * i + 1] - layer_series[layer_size - 10 + 2 * i]); + } + + coordf_t gap = abs(layer_series.back() - object_height); + std::vector can_adjust(5, true); // to record whether every layer can adjust layer height + bool taller_than_object = layer_series.back() < object_height; + + auto get_valid_size = [&can_adjust]() -> int { + int valid_size = 0; + for (auto b_adjust : can_adjust) { + valid_size += b_adjust ? 1 : 0; + } + return valid_size; + }; + + auto adjust_layer_height = [&slicing_params, &last_5_layers_heght, &can_adjust, &get_valid_size, &taller_than_object](coordf_t gap) -> coordf_t { + coordf_t delta_gap = gap / get_valid_size(); + coordf_t remain_gap = 0; + for (size_t i = 0; i < last_5_layers_heght.size(); ++i) { + coordf_t& l_height = last_5_layers_heght[i]; + if (taller_than_object) { + if (can_adjust[i] && is_approx(l_height, slicing_params.max_layer_height)) { + remain_gap += delta_gap; + can_adjust[i] = false; + continue; + } + + if (can_adjust[i] && l_height + delta_gap > slicing_params.max_layer_height) { + remain_gap += l_height + delta_gap - slicing_params.max_layer_height; + l_height = slicing_params.max_layer_height; + can_adjust[i] = false; + } + else { + l_height += delta_gap; + } + } + else { + if (can_adjust[i] && is_approx(l_height, slicing_params.min_layer_height)) { + remain_gap += delta_gap; + can_adjust[i] = false; + continue; + } + + if (can_adjust[i] && l_height - delta_gap < slicing_params.min_layer_height) { + remain_gap += slicing_params.min_layer_height + delta_gap - l_height; + l_height = slicing_params.min_layer_height; + can_adjust[i] = false; + } + else { + l_height -= delta_gap; + } + } + } + return remain_gap; + }; + + while (gap > 0) { + int valid_size = get_valid_size(); + if (valid_size == 0) { + // 5 layers can not adjust z within valid layer height + return false; + } + + gap = adjust_layer_height(gap); + if (is_approx(gap, 0.0)) { + // adjust succeed + break; + } + } + + for (size_t i = 0; i < last_5_layers_heght.size(); ++i) { + if (i > 0) { + layer_series[layer_size - 10 + 2 * i] = layer_series[layer_size - 10 + 2 * i - 1]; + } + layer_series[layer_size - 10 + 2 * i + 1] = layer_series[layer_size - 10 + 2 * i] + last_5_layers_heght[i]; + } + + return true; +} + // Produce object layers as pairs of low / high layer boundaries, stored into a linear vector. std::vector generate_object_layers( const SlicingParameters &slicing_params, - const std::vector &layer_height_profile) + const std::vector &layer_height_profile, + bool is_precise_z_height) { assert(! layer_height_profile.empty()); @@ -683,7 +777,8 @@ std::vector generate_object_layers( out.push_back(print_z); } - //FIXME Adjust the last layer to align with the top object layer exactly? + if (is_precise_z_height) + adjust_layer_series_to_align_object_height(slicing_params, out); return out; } diff --git a/src/libslic3r/Slicing.hpp b/src/libslic3r/Slicing.hpp index 464a05ba44..74b99eb8df 100644 --- a/src/libslic3r/Slicing.hpp +++ b/src/libslic3r/Slicing.hpp @@ -177,7 +177,8 @@ void adjust_layer_height_profile( // The object layers are based at z=0, ignoring the raft layers. std::vector generate_object_layers( const SlicingParameters &slicing_params, - const std::vector &layer_height_profile); + const std::vector &layer_height_profile, + bool is_precise_z_height); // Check whether the layer height profile describes a fixed layer height profile. bool check_object_layers_fixed( diff --git a/src/libslic3r/TriangleMesh.cpp b/src/libslic3r/TriangleMesh.cpp index 973d6c6d33..1ad9c03bd8 100644 --- a/src/libslic3r/TriangleMesh.cpp +++ b/src/libslic3r/TriangleMesh.cpp @@ -224,21 +224,21 @@ bool TriangleMesh::from_stl(stl_file& stl, bool repair) return true; } -bool TriangleMesh::ReadSTLFile(const char* input_file, bool repair, ImportstlProgressFn stlFn) -{ +bool TriangleMesh::ReadSTLFile(const char *input_file, bool repair, ImportstlProgressFn stlFn, int custom_header_length) +{ stl_file stl; - if (! stl_open(&stl, input_file, stlFn)) + if (!stl_open(&stl, input_file, stlFn, custom_header_length)) return false; return from_stl(stl, repair); } bool TriangleMesh::write_ascii(const char* output_file) -{ +{ return its_write_stl_ascii(output_file, "", this->its); } bool TriangleMesh::write_binary(const char* output_file) -{ +{ return its_write_stl_binary(output_file, "", this->its); } diff --git a/src/libslic3r/TriangleMesh.hpp b/src/libslic3r/TriangleMesh.hpp index fb6951c1df..54b2d45f88 100644 --- a/src/libslic3r/TriangleMesh.hpp +++ b/src/libslic3r/TriangleMesh.hpp @@ -105,7 +105,7 @@ public: explicit TriangleMesh(indexed_triangle_set &&M, const RepairedMeshErrors& repaired_errors = RepairedMeshErrors()); void clear() { this->its.clear(); this->m_stats.clear(); } bool from_stl(stl_file& stl, bool repair = true); - bool ReadSTLFile(const char* input_file, bool repair = true, ImportstlProgressFn stlFn = nullptr); + bool ReadSTLFile(const char *input_file, bool repair = true, ImportstlProgressFn stlFn = nullptr, int custom_header_length = 80); bool write_ascii(const char* output_file); bool write_binary(const char* output_file); float volume(); diff --git a/src/libslic3r/Utils.hpp b/src/libslic3r/Utils.hpp index b03f27d187..43daedb5bb 100644 --- a/src/libslic3r/Utils.hpp +++ b/src/libslic3r/Utils.hpp @@ -50,6 +50,7 @@ #define CLI_OBJECT_ARRANGE_FAILED -21 #define CLI_OBJECT_ORIENT_FAILED -22 #define CLI_MODIFIED_PARAMS_TO_PRINTER -23 +#define CLI_FILE_VERSION_NOT_SUPPORTED -24 #define CLI_NO_SUITABLE_OBJECTS -50 diff --git a/src/libslic3r/calib.hpp b/src/libslic3r/calib.hpp index 3d0146e2b8..af5bbb81d5 100644 --- a/src/libslic3r/calib.hpp +++ b/src/libslic3r/calib.hpp @@ -34,6 +34,11 @@ struct Calib_Params CalibMode mode; }; +enum FlowRatioCalibrationType { + COMPLETE_CALIBRATION = 0, + FINE_CALIBRATION, +}; + class X1CCalibInfos { public: @@ -78,6 +83,7 @@ struct PrinterCaliInfo bool cali_finished = true; float cache_flow_ratio; std::vector selected_presets; + FlowRatioCalibrationType cache_flow_rate_calibration_type = FlowRatioCalibrationType::COMPLETE_CALIBRATION; }; class PACalibResult diff --git a/src/slic3r/GUI/AMSMaterialsSetting.cpp b/src/slic3r/GUI/AMSMaterialsSetting.cpp index ddbf120b21..e91b01730d 100644 --- a/src/slic3r/GUI/AMSMaterialsSetting.cpp +++ b/src/slic3r/GUI/AMSMaterialsSetting.cpp @@ -251,8 +251,11 @@ void AMSMaterialsSetting::create_panel_normal(wxWindow* parent) m_panel_SN->Fit(); wxBoxSizer* m_tip_sizer = new wxBoxSizer(wxHORIZONTAL); - m_tip_readonly = new wxStaticText(parent, wxID_ANY, _L("Setting AMS slot information while printing is not supported"), wxDefaultPosition, wxSize(-1, AMS_MATERIALS_SETTING_INPUT_SIZE.y)); + m_tip_readonly = new Label(parent, _L("Setting AMS slot information while printing is not supported")); m_tip_readonly->SetForegroundColour(*wxBLACK); + m_tip_readonly->SetBackgroundColour(*wxWHITE); + m_tip_readonly->SetMinSize(wxSize(FromDIP(380), -1)); + m_tip_readonly->SetMaxSize(wxSize(FromDIP(380), -1)); m_tip_readonly->Hide(); m_tip_sizer->Add(m_tip_readonly, 0, wxALIGN_CENTER | wxRIGHT, FromDIP(20)); @@ -409,6 +412,7 @@ void AMSMaterialsSetting::enable_confirm_button(bool en) else { m_tip_readonly->SetLabelText(_L("Setting Virtual slot information while printing is not supported")); } + m_tip_readonly->Wrap(FromDIP(380)); m_tip_readonly->Show(!en); } } @@ -443,7 +447,7 @@ void AMSMaterialsSetting::on_select_reset(wxCommandEvent& event) { } // set k / n value - if (obj->get_printer_series() != PrinterSeries::SERIES_X1) { + if (obj->cali_version <= -1 && obj->get_printer_series() == PrinterSeries::SERIES_P1P) { // set extrusion cali ratio int cali_tray_id = ams_id * 4 + tray_id; @@ -561,7 +565,7 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event) wxString k_text = m_input_k_val->GetTextCtrl()->GetValue(); wxString n_text = m_input_n_val->GetTextCtrl()->GetValue(); - if ((obj->get_printer_series() != PrinterSeries::SERIES_X1) && !ExtrusionCalibration::check_k_validation(k_text)) { + if (obj->cali_version <= -1 && (obj->get_printer_series() != PrinterSeries::SERIES_X1) && !ExtrusionCalibration::check_k_validation(k_text)) { wxString k_tips = _L("Please input a valid value (K in 0~0.3)"); wxString kn_tips = _L("Please input a valid value (K in 0~0.3, N in 0.6~2.0)"); MessageDialog msg_dlg(nullptr, k_tips, wxEmptyString, wxICON_WARNING | wxOK); @@ -586,7 +590,7 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event) ; } - if (obj->get_printer_series() == PrinterSeries::SERIES_X1) { + if (obj->cali_version >= 0) { PACalibIndexInfo select_index_info; select_index_info.tray_id = tray_id; select_index_info.nozzle_diameter = obj->nozzle_diameter; @@ -625,7 +629,7 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event) ; } - if (obj->get_printer_series() == PrinterSeries::SERIES_X1) { + if (obj->cali_version >= 0) { PACalibIndexInfo select_index_info; select_index_info.tray_id = cali_tray_id; select_index_info.nozzle_diameter = obj->nozzle_diameter; @@ -728,7 +732,7 @@ void AMSMaterialsSetting::update_widgets() else m_panel_normal->Hide(); m_panel_kn->Show(); - } else if (obj && (obj->ams_support_virtual_tray || (obj->get_printer_series() == PrinterSeries::SERIES_X1))) { + } else if (obj && (obj->ams_support_virtual_tray || obj->cali_version >= 0)) { m_panel_normal->Show(); m_panel_kn->Show(); } else { @@ -774,8 +778,12 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi std::set filament_id_set; - - PresetBundle* preset_bundle = wxGetApp().preset_bundle; + PresetBundle * preset_bundle = wxGetApp().preset_bundle; + std::ostringstream stream; + stream << std::fixed << std::setprecision(1) << obj->nozzle_diameter; + std::string nozzle_diameter_str = stream.str(); + std::set printer_names = preset_bundle->get_printer_names_by_printer_type_and_nozzle(MachineObject::get_preset_printer_model_name(obj->printer_type), nozzle_diameter_str); + if (preset_bundle) { BOOST_LOG_TRIVIAL(trace) << "system_preset_bundle filament number=" << preset_bundle->filaments.size(); for (auto filament_it = preset_bundle->filaments.begin(); filament_it != preset_bundle->filaments.end(); filament_it++) { @@ -787,79 +795,64 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi if (preset_bundle->filaments.get_preset_base(*filament_it) != &preset || (!filament_it->is_system && !obj->is_support_user_preset)) { continue; } + + ConfigOption * printer_opt = filament_it->config.option("compatible_printers"); + ConfigOptionStrings *printer_strs = dynamic_cast(printer_opt); + for (auto printer_str : printer_strs->values) { + if (printer_names.find(printer_str) != printer_names.end()) { + if (filament_id_set.find(filament_it->filament_id) != filament_id_set.end()) { + continue; + } else { + filament_id_set.insert(filament_it->filament_id); + // name matched + if (filament_it->is_system) { + filament_items.push_back(filament_it->alias); + FilamentInfos filament_infos; + filament_infos.filament_id = filament_it->filament_id; + filament_infos.setting_id = filament_it->setting_id; + map_filament_items[filament_it->alias] = filament_infos; + } else { + char target = '@'; + size_t pos = filament_it->name.find(target); + if (pos != std::string::npos) { + std::string user_preset_alias = filament_it->name.substr(0, pos - 1); + wxString wx_user_preset_alias = wxString(user_preset_alias.c_str(), wxConvUTF8); + user_preset_alias = wx_user_preset_alias.ToStdString(); - for (auto printer_it = preset_bundle->printers.begin(); printer_it != preset_bundle->printers.end(); printer_it++) { - // filter by system preset - if (!printer_it->is_system) continue; - // get printer_model - ConfigOption* printer_model_opt = printer_it->config.option("printer_model"); - ConfigOptionString* printer_model_str = dynamic_cast(printer_model_opt); - if (!printer_model_str ) - continue; - - // use printer_model as printer type - if (printer_model_str->value != MachineObject::get_preset_printer_model_name(obj->printer_type)) - continue; - ConfigOption* printer_opt = filament_it->config.option("compatible_printers"); - ConfigOptionStrings* printer_strs = dynamic_cast(printer_opt); - for (auto printer_str : printer_strs->values) { - if (printer_it->name == printer_str) { - if (filament_id_set.find(filament_it->filament_id) != filament_id_set.end()) { - continue; - } - else { - filament_id_set.insert(filament_it->filament_id); - // name matched - if (filament_it->is_system) { - filament_items.push_back(filament_it->alias); + filament_items.push_back(user_preset_alias); FilamentInfos filament_infos; - filament_infos.filament_id = filament_it->filament_id; - filament_infos.setting_id = filament_it->setting_id; - map_filament_items[filament_it->alias] = filament_infos; + filament_infos.filament_id = filament_it->filament_id; + filament_infos.setting_id = filament_it->setting_id; + map_filament_items[user_preset_alias] = filament_infos; } - else { - char target = '@'; - size_t pos = filament_it->name.find(target); - if (pos != std::string::npos) { - std::string user_preset_alias = filament_it->name.substr(0, pos-1); - wxString wx_user_preset_alias = wxString(user_preset_alias.c_str(), wxConvUTF8); - user_preset_alias = wx_user_preset_alias.ToStdString(); - - filament_items.push_back(user_preset_alias); - FilamentInfos filament_infos; - filament_infos.filament_id = filament_it->filament_id; - filament_infos.setting_id = filament_it->setting_id; - map_filament_items[user_preset_alias] = filament_infos; - } - - } - - if (filament_it->filament_id == ams_filament_id) { - selection_idx = idx; - - // update if nozzle_temperature_range is found - ConfigOption* opt_min = filament_it->config.option("nozzle_temperature_range_low"); - if (opt_min) { - ConfigOptionInts* opt_min_ints = dynamic_cast(opt_min); - if (opt_min_ints) { - wxString text_nozzle_temp_min = wxString::Format("%d", opt_min_ints->get_at(0)); - m_input_nozzle_min->GetTextCtrl()->SetValue(text_nozzle_temp_min); - } - } - ConfigOption* opt_max = filament_it->config.option("nozzle_temperature_range_high"); - if (opt_max) { - ConfigOptionInts* opt_max_ints = dynamic_cast(opt_max); - if (opt_max_ints) { - wxString text_nozzle_temp_max = wxString::Format("%d", opt_max_ints->get_at(0)); - m_input_nozzle_max->GetTextCtrl()->SetValue(text_nozzle_temp_max); - } - } - } - idx++; } + + if (filament_it->filament_id == ams_filament_id) { + selection_idx = idx; + + // update if nozzle_temperature_range is found + ConfigOption *opt_min = filament_it->config.option("nozzle_temperature_range_low"); + if (opt_min) { + ConfigOptionInts *opt_min_ints = dynamic_cast(opt_min); + if (opt_min_ints) { + wxString text_nozzle_temp_min = wxString::Format("%d", opt_min_ints->get_at(0)); + m_input_nozzle_min->GetTextCtrl()->SetValue(text_nozzle_temp_min); + } + } + ConfigOption *opt_max = filament_it->config.option("nozzle_temperature_range_high"); + if (opt_max) { + ConfigOptionInts *opt_max_ints = dynamic_cast(opt_max); + if (opt_max_ints) { + wxString text_nozzle_temp_max = wxString::Format("%d", opt_max_ints->get_at(0)); + m_input_nozzle_max->GetTextCtrl()->SetValue(text_nozzle_temp_max); + } + } + } + idx++; } } } + } } @@ -884,7 +877,7 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi m_readonly_filament->Hide(); } - if (obj->get_printer_series() == PrinterSeries::SERIES_X1) { + if (obj->cali_version >= 0) { m_title_pa_profile->Show(); m_comboBox_cali_result->Show(); m_input_k_val->Disable(); @@ -943,12 +936,26 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt) m_filament_type = ""; PresetBundle* preset_bundle = wxGetApp().preset_bundle; if (preset_bundle) { + std::ostringstream stream; + if (obj) + stream << std::fixed << std::setprecision(1) << obj->nozzle_diameter; + std::string nozzle_diameter_str = stream.str(); + std::set printer_names = preset_bundle->get_printer_names_by_printer_type_and_nozzle(MachineObject::get_preset_printer_model_name(obj->printer_type), + nozzle_diameter_str); for (auto it = preset_bundle->filaments.begin(); it != preset_bundle->filaments.end(); it++) { if (!m_comboBox_filament->GetValue().IsEmpty()) { auto filament_item = map_filament_items[m_comboBox_filament->GetValue().ToStdString()]; std::string filament_id = filament_item.filament_id; if (it->filament_id.compare(filament_id) == 0) { - + bool has_compatible_printer = false; + std::string preset_name = it->name; + for (std::string printer_name : printer_names) { + if (preset_name.find(printer_name) != std::string::npos) { + has_compatible_printer = true; + break; + } + } + if (!it->is_system && !has_compatible_printer) continue; // ) if nozzle_temperature_range is found ConfigOption* opt_min = it->config.option("nozzle_temperature_range_low"); if (opt_min) { @@ -1039,7 +1046,7 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt) m_pa_profile_items.clear(); m_comboBox_cali_result->SetValue(wxEmptyString); - if (obj->get_printer_series() == PrinterSeries::SERIES_X1) { + if (obj->cali_version >= 0) { m_input_k_val->GetTextCtrl()->SetValue(wxEmptyString); std::vector cali_history = this->obj->pa_calib_tab; for (auto cali_item : cali_history) { @@ -1442,7 +1449,7 @@ void ColorPickerPopup::on_custom_clr_picker(wxMouseEvent& event) m_clrData->GetColour().Red(), m_clrData->GetColour().Green(), m_clrData->GetColour().Blue(), - 254 + 255 ); if (picker_color.Alpha() == 0) { diff --git a/src/slic3r/GUI/AMSMaterialsSetting.hpp b/src/slic3r/GUI/AMSMaterialsSetting.hpp index c66052a077..6a10255d28 100644 --- a/src/slic3r/GUI/AMSMaterialsSetting.hpp +++ b/src/slic3r/GUI/AMSMaterialsSetting.hpp @@ -166,7 +166,7 @@ protected: wxStaticBitmap * bitmap_min_degree; Button * m_button_reset; Button * m_button_confirm; - wxStaticText* m_tip_readonly; + Label* m_tip_readonly; Button * m_button_close; wxColourData * m_clrData; diff --git a/src/slic3r/GUI/AMSSetting.cpp b/src/slic3r/GUI/AMSSetting.cpp index ac62d1ebaf..b2ef34e620 100644 --- a/src/slic3r/GUI/AMSSetting.cpp +++ b/src/slic3r/GUI/AMSSetting.cpp @@ -21,29 +21,31 @@ void AMSSetting::create() auto m_static_ams_settings = new wxStaticText(this, wxID_ANY, _L("AMS Settings"), wxDefaultPosition, wxDefaultSize, 0); m_static_ams_settings->SetFont(::Label::Head_14); m_static_ams_settings->SetForegroundColour(AMS_SETTING_GREY800); - m_sizer_main->Add(0,0,0,wxTOP,FromDIP(10)); - m_sizer_main->Add(m_static_ams_settings, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(24)); + m_panel_body = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, -1), wxTAB_TRAVERSAL); m_panel_body->SetBackgroundColour(*wxWHITE); wxBoxSizer *m_sizerl_body = new wxBoxSizer(wxVERTICAL); + m_panel_Insert_material = new wxPanel(m_panel_body, wxID_ANY, wxDefaultPosition, wxSize(-1, -1), wxTAB_TRAVERSAL); + m_panel_Insert_material->SetBackgroundColour(*wxWHITE); + wxBoxSizer* m_sizer_main_Insert_material = new wxBoxSizer(wxVERTICAL); // checkbox area 1 wxBoxSizer *m_sizer_Insert_material = new wxBoxSizer(wxHORIZONTAL); - m_checkbox_Insert_material_auto_read = new ::CheckBox(m_panel_body); + m_checkbox_Insert_material_auto_read = new ::CheckBox(m_panel_Insert_material); m_checkbox_Insert_material_auto_read->Bind(wxEVT_TOGGLEBUTTON, &AMSSetting::on_insert_material_read, this); m_sizer_Insert_material->Add(m_checkbox_Insert_material_auto_read, 0, wxTOP, 1); m_sizer_Insert_material->Add(0, 0, 0, wxLEFT, 12); - m_title_Insert_material_auto_read = new wxStaticText(m_panel_body, wxID_ANY, _L("Insertion update"), + m_title_Insert_material_auto_read = new wxStaticText(m_panel_Insert_material, wxID_ANY, _L("Insertion update"), wxDefaultPosition, wxDefaultSize, 0); m_title_Insert_material_auto_read->SetFont(::Label::Head_13); m_title_Insert_material_auto_read->SetForegroundColour(AMS_SETTING_GREY800); m_title_Insert_material_auto_read->Wrap(AMS_SETTING_BODY_WIDTH); - m_sizer_Insert_material->Add(m_title_Insert_material_auto_read, 1, wxALL | wxEXPAND, 0); + m_sizer_Insert_material->Add(m_title_Insert_material_auto_read, 0, wxALL | wxEXPAND, 0); @@ -53,7 +55,7 @@ void AMSSetting::create() m_sizer_Insert_material_tip->Add(0, 0, 0, wxLEFT, 10); // tip line1 - m_tip_Insert_material_line1 = new Label(m_panel_body, + m_tip_Insert_material_line1 = new Label(m_panel_Insert_material, _L("The AMS will automatically read the filament information when inserting a new Bambu Lab filament. This takes about 20 seconds.") ); m_tip_Insert_material_line1->SetFont(::Label::Body_13); @@ -64,8 +66,8 @@ void AMSSetting::create() m_sizer_Insert_material_tip_inline->Add(m_tip_Insert_material_line1, 0, wxEXPAND, 0); // tip line2 - m_tip_Insert_material_line2 = new Label(m_panel_body, - _L("Note: if new filament is inserted during printing, the AMS will not automatically read any information until printing is completed.") + m_tip_Insert_material_line2 = new Label(m_panel_Insert_material, + _L("Note: if a new filament is inserted during printing, the AMS will not automatically read any information until printing is completed.") ); m_tip_Insert_material_line2->SetFont(::Label::Body_13); m_tip_Insert_material_line2->SetForegroundColour(AMS_SETTING_GREY700); @@ -74,8 +76,8 @@ void AMSSetting::create() m_tip_Insert_material_line2->Hide(); m_sizer_Insert_material_tip_inline->Add(m_tip_Insert_material_line2, 0, wxEXPAND | wxTOP, 8); - // tip line2 - m_tip_Insert_material_line3 = new Label(m_panel_body, + // tip line3 + m_tip_Insert_material_line3 = new Label(m_panel_Insert_material, _L("When inserting a new filament, the AMS will not automatically read its information, leaving it blank for you to enter manually.") ); m_tip_Insert_material_line3->SetFont(::Label::Body_13); @@ -87,7 +89,10 @@ void AMSSetting::create() m_sizer_Insert_material_tip->Add(m_sizer_Insert_material_tip_inline, 1, wxALIGN_CENTER, 0); - + m_sizer_main_Insert_material->Add(m_sizer_Insert_material, 0, wxEXPAND | wxTOP, FromDIP(4)); + m_sizer_main_Insert_material->Add(m_sizer_Insert_material_tip, 0, wxEXPAND | wxLEFT | wxTOP, 18); + m_panel_Insert_material->SetSizer(m_sizer_main_Insert_material); + // checkbox area 2 wxBoxSizer *m_sizer_starting = new wxBoxSizer(wxHORIZONTAL); m_checkbox_starting_auto_read = new ::CheckBox(m_panel_body); @@ -205,10 +210,7 @@ void AMSSetting::create() m_sizer_remain_block->Add(m_sizer_remain_tip, 0, wxLEFT, 18); m_sizer_remain_block->Add(0, 0, 0, wxTOP, 15); - m_sizerl_body->Add(m_sizer_Insert_material, 0, wxEXPAND, 0); - m_sizerl_body->Add(0, 0, 0, wxTOP, 8); - m_sizerl_body->Add(m_sizer_Insert_material_tip, 0, wxEXPAND | wxLEFT, 18); - m_sizerl_body->Add(0, 0, 0, wxTOP, 15); + m_sizerl_body->Add(m_panel_Insert_material, 0, 0, 0); m_sizerl_body->Add(m_sizer_starting, 0, wxEXPAND | wxTOP, FromDIP(8)); m_sizerl_body->Add(0, 0, 0, wxTOP, 8); m_sizerl_body->Add(m_sizer_starting_tip, 0, wxLEFT, 18); @@ -224,7 +226,10 @@ void AMSSetting::create() m_panel_body->SetSizer(m_sizerl_body); m_panel_body->Layout(); m_sizerl_body->Fit(m_panel_body); - m_sizer_main->Add(m_panel_body, 1, wxALL | wxEXPAND, FromDIP(24)); + m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(10)); + m_sizer_main->Add(m_static_ams_settings, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(24)); + m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(10)); + m_sizer_main->Add(m_panel_body, 1, wxBottom | wxLEFT | wxRIGHT | wxEXPAND, FromDIP(24)); this->SetSizer(m_sizer_main); this->Layout(); @@ -245,18 +250,34 @@ void AMSSetting::create() }); } -void AMSSetting::update_insert_material_read_mode(bool selected) +void AMSSetting::update_insert_material_read_mode(bool selected, std::string version) { - m_checkbox_Insert_material_auto_read->SetValue(selected); - if (selected) { - m_tip_Insert_material_line1->Show(); - m_tip_Insert_material_line2->Show(); - m_tip_Insert_material_line3->Hide(); - } else { + if (!version.empty() && version >= AMS_F1_SUPPORT_INSERTION_UPDATE_DEFAULT) { + m_checkbox_Insert_material_auto_read->SetValue(true); + m_checkbox_Insert_material_auto_read->Hide(); + m_title_Insert_material_auto_read->Hide(); m_tip_Insert_material_line1->Hide(); m_tip_Insert_material_line2->Hide(); - m_tip_Insert_material_line3->Show(); + m_tip_Insert_material_line3->Hide(); + m_panel_Insert_material->Hide(); } + else { + m_panel_Insert_material->Show(); + m_checkbox_Insert_material_auto_read->SetValue(selected); + m_checkbox_Insert_material_auto_read->Show(); + m_title_Insert_material_auto_read->Show(); + if (selected) { + m_tip_Insert_material_line1->Show(); + m_tip_Insert_material_line2->Show(); + m_tip_Insert_material_line3->Hide(); + } + else { + m_tip_Insert_material_line1->Hide(); + m_tip_Insert_material_line2->Hide(); + m_tip_Insert_material_line3->Show(); + } + } + m_panel_Insert_material->Layout(); m_sizer_Insert_material_tip_inline->Layout(); Layout(); Fit(); diff --git a/src/slic3r/GUI/AMSSetting.hpp b/src/slic3r/GUI/AMSSetting.hpp index 4fddf47660..f87479f034 100644 --- a/src/slic3r/GUI/AMSSetting.hpp +++ b/src/slic3r/GUI/AMSSetting.hpp @@ -17,6 +17,7 @@ #define AMS_SETTING_GREY200 wxColour(248, 248, 248) #define AMS_SETTING_BODY_WIDTH FromDIP(380) #define AMS_SETTING_BUTTON_SIZE wxSize(FromDIP(150), FromDIP(24)) +#define AMS_F1_SUPPORT_INSERTION_UPDATE_DEFAULT std::string("00.00.07.89") namespace Slic3r { namespace GUI { @@ -27,7 +28,7 @@ public: ~AMSSetting(); void create(); - void update_insert_material_read_mode(bool selected); + void update_insert_material_read_mode(bool selected, std::string version); void update_ams_img(std::string ams_icon_str); void update_starting_read_mode(bool selected); void update_remain_mode(bool selected); @@ -49,6 +50,7 @@ protected: protected: wxPanel * m_panel_body; + wxPanel* m_panel_Insert_material; CheckBox * m_checkbox_Insert_material_auto_read; wxStaticText *m_title_Insert_material_auto_read; Label* m_tip_Insert_material_line1; diff --git a/src/slic3r/GUI/AmsMappingPopup.cpp b/src/slic3r/GUI/AmsMappingPopup.cpp index 1c4c186816..f1308efec5 100644 --- a/src/slic3r/GUI/AmsMappingPopup.cpp +++ b/src/slic3r/GUI/AmsMappingPopup.cpp @@ -58,11 +58,13 @@ void MaterialItem::msw_rescale() { m_transparent_mitem = ScalableBitmap(this, "transparent_material_item", FromDIP(32)); } -void MaterialItem::set_ams_info(wxColour col, wxString txt) +void MaterialItem::set_ams_info(wxColour col, wxString txt, int ctype, std::vector cols) { auto need_refresh = false; + if (m_ams_cols != cols) { m_ams_cols = cols; need_refresh = true; } + if (m_ams_ctype != ctype) { m_ams_ctype = ctype; need_refresh = true; } if (m_ams_coloul != col) { m_ams_coloul = col; need_refresh = true;} - if (m_ams_name != txt) {m_ams_name = txt;need_refresh = true;} + if (m_ams_name != txt) { m_ams_name = txt; need_refresh = true; } if (need_refresh) { Refresh();} } @@ -140,14 +142,11 @@ void MaterialItem::render(wxDC &dc) auto mcolor = m_material_coloul; auto acolor = m_ams_coloul; + change_the_opacity(acolor); if (!IsEnabled()) { mcolor = wxColour(0x90, 0x90, 0x90); acolor = wxColour(0x90, 0x90, 0x90); } - else { - mcolor = m_material_coloul; - acolor = m_ams_coloul; - } // materials name dc.SetFont(::Label::Body_13); @@ -183,8 +182,10 @@ void MaterialItem::render(wxDC &dc) void MaterialItem::doRender(wxDC &dc) { + wxSize size = GetSize(); auto mcolor = m_material_coloul; auto acolor = m_ams_coloul; + change_the_opacity(acolor); if (mcolor.Alpha() == 0 || acolor.Alpha() == 0) { dc.DrawBitmap(m_transparent_mitem.bmp(), FromDIP(1), FromDIP(1)); @@ -194,10 +195,6 @@ void MaterialItem::doRender(wxDC &dc) mcolor = wxColour(0x90, 0x90, 0x90); acolor = wxColour(0x90, 0x90, 0x90); } - else { - mcolor = m_material_coloul; - acolor = m_ams_coloul; - } //top dc.SetPen(*wxTRANSPARENT_PEN); @@ -205,18 +202,48 @@ void MaterialItem::doRender(wxDC &dc) dc.DrawRoundedRectangle(FromDIP(1), FromDIP(1), MATERIAL_ITEM_REAL_SIZE.x, FromDIP(18), 5); //bottom - dc.SetPen(*wxTRANSPARENT_PEN); - dc.SetBrush(wxBrush(wxColour(acolor))); - dc.DrawRoundedRectangle(FromDIP(1), FromDIP(18), MATERIAL_ITEM_REAL_SIZE.x, FromDIP(16), 5); + if (m_ams_cols.size() > 1) { + int left = FromDIP(1); + int gwidth = std::round(MATERIAL_ITEM_REAL_SIZE.x / (m_ams_cols.size() - 1)); + //gradient + if (m_ams_ctype == 0) { + for (int i = 0; i < m_ams_cols.size() - 1; i++) { + auto rect = wxRect(left, FromDIP(18), MATERIAL_ITEM_REAL_SIZE.x, FromDIP(16)); + dc.GradientFillLinear(rect, m_ams_cols[i], m_ams_cols[i + 1], wxEAST); + left += gwidth; + } + } + else { + int cols_size = m_ams_cols.size(); + for (int i = 0; i < cols_size; i++) { + dc.SetBrush(wxBrush(m_ams_cols[i])); + float x = left + ((float)MATERIAL_ITEM_REAL_SIZE.x) * i / cols_size; + if (i != cols_size - 1) { + dc.DrawRoundedRectangle(x, FromDIP(18), ((float)MATERIAL_ITEM_REAL_SIZE.x) / cols_size + FromDIP(3), FromDIP(16), 3); + } + else { + dc.DrawRoundedRectangle(x, FromDIP(18), ((float)MATERIAL_ITEM_REAL_SIZE.x) / cols_size , FromDIP(16), 3); + } + } + + } + } + else { + + dc.SetPen(*wxTRANSPARENT_PEN); + dc.SetBrush(wxBrush(wxColour(acolor))); + dc.DrawRoundedRectangle(FromDIP(1), FromDIP(18), MATERIAL_ITEM_REAL_SIZE.x, FromDIP(16), 5); + ////middle - ////middle + dc.SetPen(*wxTRANSPARENT_PEN); + dc.SetBrush(wxBrush(acolor)); + dc.DrawRectangle(FromDIP(1), FromDIP(18), MATERIAL_ITEM_REAL_SIZE.x, FromDIP(8)); + } dc.SetPen(*wxTRANSPARENT_PEN); dc.SetBrush(wxBrush(mcolor)); dc.DrawRectangle(FromDIP(1), FromDIP(11), MATERIAL_ITEM_REAL_SIZE.x, FromDIP(8)); - dc.SetPen(*wxTRANSPARENT_PEN); - dc.SetBrush(wxBrush(acolor)); - dc.DrawRectangle(FromDIP(1), FromDIP(18), MATERIAL_ITEM_REAL_SIZE.x, FromDIP(8)); + ////border #if __APPLE__ @@ -247,10 +274,10 @@ void MaterialItem::doRender(wxDC &dc) //arrow if ( (acolor.Red() > 160 && acolor.Green() > 160 && acolor.Blue() > 160) && (acolor.Red() < 180 && acolor.Green() < 180 && acolor.Blue() < 180)) { - dc.DrawBitmap(m_arraw_bitmap_white.bmp(), GetSize().x - m_arraw_bitmap_white.GetBmpSize().x - FromDIP(7), GetSize().y - m_arraw_bitmap_white.GetBmpSize().y); + dc.DrawBitmap(m_arraw_bitmap_white.bmp(), size.x - m_arraw_bitmap_white.GetBmpSize().x - FromDIP(7), size.y - m_arraw_bitmap_white.GetBmpSize().y); } else { - dc.DrawBitmap(m_arraw_bitmap_gray.bmp(), GetSize().x - m_arraw_bitmap_gray.GetBmpSize().x - FromDIP(7), GetSize().y - m_arraw_bitmap_gray.GetBmpSize().y); + dc.DrawBitmap(m_arraw_bitmap_gray.bmp(), size.x - m_arraw_bitmap_gray.GetBmpSize().x - FromDIP(7), size.y - m_arraw_bitmap_gray.GetBmpSize().y); } @@ -437,6 +464,10 @@ void AmsMapingPopup::update_ams_data(std::map amsList) td.colour = AmsTray::decode_color(tray_data->color); td.name = tray_data->get_display_filament_type(); td.filament_type = tray_data->get_filament_type(); + td.ctype = tray_data->ctype; + for (auto col : tray_data->cols) { + td.material_cols.push_back(AmsTray::decode_color(col)); + } } } @@ -518,7 +549,7 @@ void AmsMapingPopup::add_ams_mapping(std::vector tray_data, wxWindow* m_mapping_item_list.push_back(m_mapping_item); if (tray_data[i].type == NORMAL) { - if (is_match_material(tray_data[i].filament_type)) { + if (is_match_material(tray_data[i].filament_type)) { m_mapping_item->set_data(tray_data[i].colour, tray_data[i].name, tray_data[i]); } else { m_mapping_item->set_data(wxColour(0xEE,0xEE,0xEE), tray_data[i].name, tray_data[i], true); @@ -673,14 +704,38 @@ void MappingItem::set_data(wxColour colour, wxString name, TrayData data, bool u void MappingItem::doRender(wxDC &dc) { - dc.SetPen(m_coloul); - dc.SetBrush(wxBrush(m_coloul)); + wxSize size = GetSize(); + wxColour color = m_coloul; + change_the_opacity(color); - if (m_coloul.Alpha() == 0) { - dc.DrawBitmap( m_transparent_mapping_item.bmp(), 0, (GetSize().y - MAPPING_ITEM_REAL_SIZE.y) / 2); + dc.SetPen(color); + dc.SetBrush(wxBrush(color)); + + if (m_tray_data.material_cols.size() > 1) { + int left = 0; + int gwidth = std::round(MAPPING_ITEM_REAL_SIZE.x / (m_tray_data.material_cols.size() - 1)); + //gradient + if (m_tray_data.ctype == 0) { + for (int i = 0; i < m_tray_data.material_cols.size() - 1; i++) { + auto rect = wxRect(left, (size.y - MAPPING_ITEM_REAL_SIZE.y) / 2, MAPPING_ITEM_REAL_SIZE.x, MAPPING_ITEM_REAL_SIZE.y); + dc.GradientFillLinear(rect, m_tray_data.material_cols[i], m_tray_data.material_cols[i + 1], wxEAST); + left += gwidth; + } + } + else { + int cols_size = m_tray_data.material_cols.size(); + for (int i = 0; i < cols_size; i++) { + dc.SetBrush(wxBrush(m_tray_data.material_cols[i])); + float x = (float)MAPPING_ITEM_REAL_SIZE.x * i / cols_size; + dc.DrawRectangle(x, (size.y - MAPPING_ITEM_REAL_SIZE.y) / 2, (float)MAPPING_ITEM_REAL_SIZE.x / cols_size, MAPPING_ITEM_REAL_SIZE.y); + } + } + } + else if (color.Alpha() == 0) { + dc.DrawBitmap( m_transparent_mapping_item.bmp(), 0, (size.y - MAPPING_ITEM_REAL_SIZE.y) / 2); } else { - dc.DrawRectangle(0, (GetSize().y - MAPPING_ITEM_REAL_SIZE.y) / 2, MAPPING_ITEM_REAL_SIZE.x, MAPPING_ITEM_REAL_SIZE.y); + dc.DrawRectangle(0, (size.y - MAPPING_ITEM_REAL_SIZE.y) / 2, MAPPING_ITEM_REAL_SIZE.x, MAPPING_ITEM_REAL_SIZE.y); } @@ -689,11 +744,11 @@ void MappingItem::doRender(wxDC &dc) dc.SetPen(side_colour); dc.SetBrush(wxBrush(side_colour)); #ifdef __APPLE__ - dc.DrawRectangle(0, 0, FromDIP(4), GetSize().y); - dc.DrawRectangle(GetSize().x - FromDIP(4), 0, FromDIP(4), GetSize().y); + dc.DrawRectangle(0, 0, FromDIP(4), size.y); + dc.DrawRectangle(size.x - FromDIP(4), 0, FromDIP(4), size.y); #else - dc.DrawRectangle(0, 0, FromDIP(4), GetSize().y); - dc.DrawRectangle(GetSize().x - FromDIP(4), 0, FromDIP(4), GetSize().y); + dc.DrawRectangle(0, 0, FromDIP(4), size.y); + dc.DrawRectangle(size.x - FromDIP(4), 0, FromDIP(4), size.y); #endif // __APPLE__ } @@ -806,98 +861,52 @@ AmsHumidityTipPopup::AmsHumidityTipPopup(wxWindow* parent) { SetBackgroundColour(*wxWHITE); - wxBoxSizer* main_sizer; - main_sizer = new wxBoxSizer(wxVERTICAL); + wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL); + close_img = ScalableBitmap(this, "hum_popup_close", 24); - main_sizer->Add(0, 0, 0, wxTOP, 28); + m_staticText = new Label(this, _L("Current Cabin humidity")); + m_staticText->SetFont(::Label::Head_24); - wxBoxSizer* m_sizer_body; - m_sizer_body = new wxBoxSizer(wxHORIZONTAL); + humidity_level_list = new AmsHumidityLevelList(this); + curr_humidity_img = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("hum_level1_light", this, 132), wxDefaultPosition, wxSize(FromDIP(132), FromDIP(132)), 0); - m_img = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("ams_humidity_tips", this, 125), wxDefaultPosition, wxSize(FromDIP(125), FromDIP(145)), 0); - - m_sizer_body->Add(m_img, 0, wxEXPAND | wxALL, 2); - - - m_sizer_body->Add(0, 0, 0, wxEXPAND | wxLEFT, FromDIP(18)); - - wxBoxSizer* m_sizer_tips = new wxBoxSizer(wxVERTICAL); - - m_staticText1 = new Label(this, _L("Cabin humidity")); - m_staticText1->SetFont(::Label::Head_13); + m_staticText_note = new Label(this, _L("Please change the desiccant when it is too wet. The indicator may not represent accurately in following cases : when the lid is open or the desiccant pack is changed. it take hours to absorb the moisture, low temperatures also slow down the process.")); + m_staticText_note->SetMinSize(wxSize(FromDIP(680), -1)); + m_staticText_note->SetMaxSize(wxSize(FromDIP(680), -1)); + m_staticText_note->Wrap(FromDIP(680)); - m_staticText2 = new Label(this, _L("Green means that AMS humidity is normal, orange represent humidity is high, red represent humidity is too high.(Hygrometer: lower the better.)")); - m_staticText2->SetFont(::Label::Body_13); - m_staticText2->SetSize(wxSize(FromDIP(357), -1)); - m_staticText2->SetMinSize(wxSize(FromDIP(357), -1)); - m_staticText2->SetMaxSize(wxSize(FromDIP(357), -1)); - m_staticText2->Wrap(FromDIP(357)); - - - m_staticText3 = new Label(this, _L("Desiccant status")); - m_staticText3->SetFont(::Label::Head_13); - - - m_staticText4 = new Label(this, _L("A desiccant status lower than two bars indicates that desiccant may be inactive. Please change the desiccant.(The bars: higher the better.)")); - m_staticText4->SetFont(::Label::Body_13); - m_staticText4->SetSize(wxSize(FromDIP(357), -1)); - m_staticText4->SetMinSize(wxSize(FromDIP(357), -1)); - m_staticText4->SetMaxSize(wxSize(FromDIP(357), -1)); - m_staticText4->Wrap(FromDIP(357)); - - m_sizer_tips->Add(m_staticText1, 0, wxLEFT|wxRIGHT, 3); - m_sizer_tips->Add(0,0,0,wxTOP,2); - m_sizer_tips->Add(m_staticText2, 0, wxLEFT|wxRIGHT, 3); - m_sizer_tips->Add(0,0,0,wxTOP,8); - m_sizer_tips->Add(m_staticText3, 0, wxLEFT|wxRIGHT, 3); - m_sizer_tips->Add(0,0,0,wxTOP,2); - m_sizer_tips->Add(m_staticText4, 0, wxLEFT|wxRIGHT, 3); - - - m_sizer_body->Add(m_sizer_tips, 0, wxEXPAND, 0); - - - main_sizer->Add(m_sizer_body, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(20)); - - m_staticText_note = new Label(this, _L("Note: When the lid is open or the desiccant pack is changed, it can take hours or a night to absorb the moisture. Low temperatures also slow down the process. During this time, the indicator may not represent the chamber accurately.")); - m_staticText4->SetFont(::Label::Body_13); - m_staticText_note->SetMinSize(wxSize(FromDIP(523), -1)); - m_staticText_note->SetMaxSize(wxSize(FromDIP(523), -1)); - m_staticText_note->Wrap(FromDIP(523)); - main_sizer->Add(m_staticText_note, 0, wxALL | wxLEFT | wxRIGHT, 22); - - m_button_confirm = new Button(this, _L("OK")); - StateColor btn_bg_green(std::pair(wxColour(0, 150, 136), StateColor::Pressed), std::pair(wxColour(0, 150, 136), StateColor::Normal)); - m_button_confirm->SetBackgroundColor(btn_bg_green); - m_button_confirm->SetBorderColor(wxColour(0, 150, 136)); - m_button_confirm->SetTextColor(wxColour(0xFFFFFE)); - m_button_confirm->SetSize(wxSize(FromDIP(72), FromDIP(24))); - m_button_confirm->SetMinSize(wxSize(FromDIP(72), FromDIP(24))); - m_button_confirm->SetCornerRadius(FromDIP(12)); - - - m_button_confirm->Bind(wxEVT_LEFT_DOWN, [this](auto& e) { - Dismiss(); - }); - Bind(wxEVT_LEFT_UP, [this](auto& e) { + + auto rect = ClientToScreen(wxPoint(0, 0)); + + auto close_left = rect.x + GetSize().x - close_img.GetBmpWidth() - FromDIP(38); + auto close_right = close_left + close_img.GetBmpWidth(); + auto close_top = rect.y + FromDIP(24); + auto close_bottom = close_top + close_img.GetBmpHeight(); + auto mouse_pos = ClientToScreen(e.GetPosition()); - auto rect = m_button_confirm->ClientToScreen(wxPoint(0, 0)); - if (mouse_pos.x > rect.x && mouse_pos.y > rect.y - && mouse_pos.x < (rect.x + m_button_confirm->GetSize().x) - && mouse_pos.y < (rect.y + m_button_confirm->GetSize().y)) + if (mouse_pos.x > close_left + && mouse_pos.y > close_top + && mouse_pos.x < close_right + && mouse_pos.y < close_bottom + ) { Dismiss(); } - }); - main_sizer->Add(m_button_confirm, 0, wxALIGN_CENTER | wxALL, 0); - - - main_sizer->Add(0, 0, 0, wxEXPAND | wxTOP, 18); - + }); + main_sizer->Add(0, 0, 0, wxTOP, FromDIP(24)); + main_sizer->Add(m_staticText, 0, wxALIGN_CENTER, 0); + main_sizer->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(28)); + main_sizer->Add(curr_humidity_img, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT, FromDIP(35)); + main_sizer->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(15)); + main_sizer->Add(humidity_level_list, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT, FromDIP(35)); + main_sizer->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(6)); + main_sizer->Add(m_staticText_note, 0, wxALIGN_CENTER, 0); + main_sizer->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(5)); + main_sizer->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(25)); SetSizer(main_sizer); Layout(); Fit(); @@ -909,9 +918,7 @@ AmsHumidityTipPopup::AmsHumidityTipPopup(wxWindow* parent) void AmsHumidityTipPopup::paintEvent(wxPaintEvent& evt) { wxPaintDC dc(this); - dc.SetPen(wxColour(0xAC, 0xAC, 0xAC)); - dc.SetBrush(*wxTRANSPARENT_BRUSH); - dc.DrawRoundedRectangle(0, 0, GetSize().x, GetSize().y, 0); + render(dc); } void AmsHumidityTipPopup::OnDismiss() {} @@ -920,6 +927,50 @@ bool AmsHumidityTipPopup::ProcessLeftDown(wxMouseEvent& event) { return PopupWindow::ProcessLeftDown(event); } +void AmsHumidityTipPopup::set_humidity_level(int level) +{ + current_humidity_level = level; + if (current_humidity_level<= 0) {return;} + + std::string mode_string = wxGetApp().dark_mode()?"_dark":"_light"; + + curr_humidity_img->SetBitmap(create_scaled_bitmap("hum_level" + std::to_string(current_humidity_level) + mode_string, this, 132)); + curr_humidity_img->Refresh(); + curr_humidity_img->Update(); +} + +void AmsHumidityTipPopup::render(wxDC& dc) +{ +#ifdef __WXMSW__ + wxSize size = GetSize(); + wxMemoryDC memdc; + wxBitmap bmp(size.x, size.y); + memdc.SelectObject(bmp); + memdc.Blit({ 0, 0 }, size, &dc, { 0, 0 }); + + { + wxGCDC dc2(memdc); + doRender(dc2); + } + + memdc.SelectObject(wxNullBitmap); + dc.DrawBitmap(bmp, 0, 0); +#else + doRender(dc); +#endif +} + +void AmsHumidityTipPopup::doRender(wxDC& dc) +{ + //close + dc.DrawBitmap(close_img.bmp(), GetSize().x - close_img.GetBmpWidth() - FromDIP(38), FromDIP(24)); + + //background + dc.SetPen(wxColour(0xAC, 0xAC, 0xAC)); + dc.SetBrush(*wxTRANSPARENT_BRUSH); + dc.DrawRoundedRectangle(0, 0, GetSize().x, GetSize().y, 0); +} + AmsTutorialPopup::AmsTutorialPopup(wxWindow* parent) :PopupWindow(parent, wxBORDER_NONE) { @@ -1507,7 +1558,11 @@ void AmsRMGroup::doRender(wxDC& dc) int x = size.x / 2; int y = size.y / 2; - int radius = size.x / 2 - FromDIP(2); + int radius; + if (wxGetApp().dark_mode()) + radius = size.x / 2 - int(size.x * 0.02); + else + radius = size.x / 2; endAngle += ev_angle; @@ -1589,4 +1644,90 @@ void AmsRMGroup::doRender(wxDC& dc) dc.DrawText(m_group_index, (size.x - text_size.x) / 2, (size.y - text_size.y) / 2 + FromDIP(10)); } +AmsHumidityLevelList::AmsHumidityLevelList(wxWindow* parent) + : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize) +{ +#ifdef __WINDOWS__ + SetDoubleBuffered(true); +#endif //__WINDOWS__ + + SetSize(wxSize(FromDIP(680), FromDIP(104))); + SetMinSize(wxSize(FromDIP(680), FromDIP(104))); + SetMaxSize(wxSize(FromDIP(680), FromDIP(104))); + SetBackgroundColour(*wxWHITE); + + background_img = ScalableBitmap(this, "humidity_list_background", 104); + + for (int i = 5; i > 0; i--) { + hum_level_img_light.push_back(ScalableBitmap(this, ("hum_level" + std::to_string(i) + "_light"), 54)); + hum_level_img_dark.push_back(ScalableBitmap(this, ("hum_level" + std::to_string(i) + "_dark"), 54)); + } + + Bind(wxEVT_PAINT, &AmsHumidityLevelList::paintEvent, this); + wxGetApp().UpdateDarkUI(this); +} + +void AmsHumidityLevelList::msw_rescale() +{ + +} + +void AmsHumidityLevelList::paintEvent(wxPaintEvent& evt) +{ + wxPaintDC dc(this); + render(dc); +} + +void AmsHumidityLevelList::render(wxDC& dc) +{ +#ifdef __WXMSW__ + wxSize size = GetSize(); + wxMemoryDC memdc; + wxBitmap bmp(size.x, size.y); + memdc.SelectObject(bmp); + memdc.Blit({ 0, 0 }, size, &dc, { 0, 0 }); + + { + wxGCDC dc2(memdc); + doRender(dc2); + } + + memdc.SelectObject(wxNullBitmap); + dc.DrawBitmap(bmp, 0, 0); +#else + doRender(dc); +#endif +} + +void AmsHumidityLevelList::doRender(wxDC& dc) +{ + dc.DrawBitmap(background_img.bmp(), 0,0); + + auto width_center = GetSize().x / 2; + auto left = width_center - FromDIP(27) - FromDIP(46) * 2 - FromDIP(54) * 2; + + + //dry / wet + dc.SetTextForeground(wxColour(0x989898)); + dc.SetFont(::Label::Head_20); + + auto font_top = GetSize().y - dc.GetTextExtent(_L("DRY")).GetHeight(); + dc.DrawText(_L("DRY"), wxPoint(FromDIP(38), font_top / 2)); + dc.DrawText(_L("WET"), wxPoint(( GetSize().x - FromDIP(38) - dc.GetTextExtent(_L("DRY")).GetWidth()), font_top / 2)); + + + //level list + + for (int i = 0; i < hum_level_img_light.size(); i++) { + if (wxGetApp().dark_mode()) { + dc.DrawBitmap(hum_level_img_dark[i].bmp(), left, (GetSize().y - FromDIP(54)) / 2); + } + else { + dc.DrawBitmap(hum_level_img_light[i].bmp(), left, (GetSize().y - FromDIP(54)) / 2); + } + + left += FromDIP(46) + FromDIP(54); + } +} + }} // namespace Slic3r::GUI diff --git a/src/slic3r/GUI/AmsMappingPopup.hpp b/src/slic3r/GUI/AmsMappingPopup.hpp index acfc8cd3e9..e8e78b2578 100644 --- a/src/slic3r/GUI/AmsMappingPopup.hpp +++ b/src/slic3r/GUI/AmsMappingPopup.hpp @@ -55,9 +55,11 @@ struct TrayData { TrayType type; int id; + int ctype = 0; std::string name; std::string filament_type; wxColour colour; + std::vector material_cols = std::vector(); }; class MaterialItem: public wxPanel @@ -72,6 +74,8 @@ public: wxColour m_ams_coloul; wxString m_ams_name; + int m_ams_ctype = 0; + std::vector m_ams_cols = std::vector(); ScalableBitmap m_arraw_bitmap_gray; ScalableBitmap m_arraw_bitmap_white; @@ -81,7 +85,7 @@ public: bool m_warning{false}; void msw_rescale(); - void set_ams_info(wxColour col, wxString txt); + void set_ams_info(wxColour col, wxString txt, int ctype=0, std::vector cols= std::vector()); void disable(); void enable(); @@ -185,6 +189,33 @@ public: wxStaticText * m_tip_disable_ams; }; +class AmsHumidityLevelList : public wxPanel +{ +public: + AmsHumidityLevelList(wxWindow* parent); + ~AmsHumidityLevelList() {}; + + ScalableBitmap background_img; + ScalableBitmap hum_level1_img; + ScalableBitmap hum_level2_img; + ScalableBitmap hum_level3_img; + ScalableBitmap hum_level4_img; + + std::vector hum_level_img_light; + std::vector hum_level_img_dark; + + wxStaticBitmap* hum_level1_bitmap; + wxStaticBitmap* hum_level2_bitmap; + wxStaticBitmap* hum_level3_bitmap; + wxStaticBitmap* hum_level4_bitmap; + wxStaticBitmap* hum_level5_bitmap; + + void msw_rescale(); + void paintEvent(wxPaintEvent& evt); + void render(wxDC& dc); + void doRender(wxDC& dc); +}; + class AmsHumidityTipPopup : public PopupWindow { public: @@ -195,14 +226,19 @@ public: virtual void OnDismiss() wxOVERRIDE; virtual bool ProcessLeftDown(wxMouseEvent& event) wxOVERRIDE; + void set_humidity_level(int level); + void render(wxDC& dc); + void doRender(wxDC& dc); + public: + int current_humidity_level; + + ScalableBitmap close_img; + wxStaticBitmap* curr_humidity_img; + AmsHumidityLevelList* humidity_level_list{nullptr}; wxStaticBitmap* m_img; - Label* m_staticText1; - Label* m_staticText2; - Label* m_staticText3; - Label* m_staticText4; + Label* m_staticText;; Label* m_staticText_note; - Button* m_button_confirm; }; class AmsTutorialPopup : public PopupWindow diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.cpp b/src/slic3r/GUI/BackgroundSlicingProcess.cpp index 0ae0ef4ce8..b9347b9c1a 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.cpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.cpp @@ -238,12 +238,13 @@ void BackgroundSlicingProcess::process_fff() //BBS: add plate index into render params m_temp_output_path = this->get_current_plate()->get_tmp_gcode_path(); m_fff_print->export_gcode(m_temp_output_path, m_gcode_result, [this](const ThumbnailsParams& params) { return this->render_thumbnails(params); }); + finalize_gcode(); BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": export gcode finished"); } if (this->set_step_started(bspsGCodeFinalize)) { if (! m_export_path.empty()) { wxQueueEvent(GUI::wxGetApp().mainframe->m_plater, new wxCommandEvent(m_event_export_began_id)); - finalize_gcode(); + export_gcode(); } else if (! m_upload_job.empty()) { wxQueueEvent(GUI::wxGetApp().mainframe->m_plater, new wxCommandEvent(m_event_export_began_id)); prepare_upload(); @@ -767,44 +768,34 @@ bool BackgroundSlicingProcess::invalidate_all_steps() return m_step_state.invalidate_all([this](){ this->stop_internal(); }); } +//Call post-processing script for the last step during slicing +void BackgroundSlicingProcess::finalize_gcode() +{ + m_print->set_status(95, _utf8(L("Running post-processing scripts"))); + + run_post_process_scripts(m_temp_output_path, false, "File", m_temp_output_path, m_fff_print->full_print_config()); + + m_print->set_status(100, _utf8(L("Successfully executed post-processing script"))); +} + // G-code is generated in m_temp_output_path. // Optionally run a post-processing script on a copy of m_temp_output_path. // Copy the final G-code to target location (possibly a SD card, if it is a removable media, then verify that the file was written without an error). -void BackgroundSlicingProcess::finalize_gcode() +void BackgroundSlicingProcess::export_gcode() { - //BBS: don't support running user-defined post-processing scripts - //m_print->set_status(95, _utf8(L("Running post-processing scripts"))); - // Perform the final post-processing of the export path by applying the print statistics over the file name. std::string export_path = m_fff_print->print_statistics().finalize_output_path(m_export_path); std::string output_path = m_temp_output_path; - // Both output_path and export_path ar in-out parameters. - // If post processed, output_path will differ from m_temp_output_path as run_post_process_scripts() will make a copy of the G-code to not - // collide with the G-code viewer memory mapping of the unprocessed G-code. G-code viewer maps unprocessed G-code, because m_gcode_result - // is calculated for the unprocessed G-code and it references lines in the memory mapped G-code file by line numbers. - // export_path may be changed by the post-processing script as well if the post processing script decides so, see GH #6042. - bool post_processed = run_post_process_scripts(output_path, true, "File", export_path, m_fff_print->full_print_config()); - auto remove_post_processed_temp_file = [post_processed, &output_path]() { - if (post_processed) - try { - boost::filesystem::remove(output_path); - } catch (const std::exception &ex) { - BOOST_LOG_TRIVIAL(error) << "Failed to remove temp file " << output_path << ": " << ex.what(); - } - }; - //FIXME localize the messages std::string error_message; int copy_ret_val = CopyFileResult::SUCCESS; try { copy_ret_val = copy_file(output_path, export_path, error_message, m_export_path_on_removable_media); - remove_post_processed_temp_file(); } catch (...) { - remove_post_processed_temp_file(); throw Slic3r::ExportError(_utf8(L("Unknown error when export G-code."))); } switch (copy_ret_val) { @@ -840,7 +831,6 @@ void BackgroundSlicingProcess::finalize_gcode() // BBS: to be checked. Whether use export_path or output_path. gcode_add_line_number(export_path, m_fff_print->full_print_config()); - m_print->set_status(100, (boost::format(_utf8(L("Succeed to export G-code to %1%"))) % export_path).str()); } // A print host upload job has been scheduled, enqueue it to the printhost job queue diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.hpp b/src/slic3r/GUI/BackgroundSlicingProcess.hpp index b5b8ffcd7a..78e8971869 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.hpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.hpp @@ -287,6 +287,7 @@ private: // If the background processing stop was requested, throw CanceledException. void throw_if_canceled() const { if (m_print->canceled()) throw CanceledException(); } void finalize_gcode(); + void export_gcode(); void prepare_upload(); // To be executed at the background thread. ThumbnailsList render_thumbnails(const ThumbnailsParams ¶ms); diff --git a/src/slic3r/GUI/CaliHistoryDialog.cpp b/src/slic3r/GUI/CaliHistoryDialog.cpp index e1d0d8e073..ec3d76ecb9 100644 --- a/src/slic3r/GUI/CaliHistoryDialog.cpp +++ b/src/slic3r/GUI/CaliHistoryDialog.cpp @@ -14,6 +14,7 @@ namespace GUI { #define HISTORY_WINDOW_SIZE wxSize(FromDIP(700), FromDIP(600)) #define EDIT_HISTORY_DIALOG_INPUT_SIZE wxSize(FromDIP(160), FromDIP(24)) +#define NEW_HISTORY_DIALOG_INPUT_SIZE wxSize(FromDIP(250), FromDIP(24)) #define HISTORY_WINDOW_ITEMS_COUNT 5 static const wxString k_tips = "Please input a valid value (K in 0~0.3)"; @@ -71,6 +72,21 @@ HistoryWindow::HistoryWindow(wxWindow* parent, const std::vector& auto scroll_sizer = new wxBoxSizer(wxVERTICAL); scroll_window->SetSizer(scroll_sizer); + Button * mew_btn = new Button(scroll_window, _L("New")); + StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), + std::pair(wxColour(0, 174, 66), StateColor::Normal)); + mew_btn->SetBackgroundColour(*wxWHITE); + mew_btn->SetBackgroundColor(btn_bg_green); + mew_btn->SetBorderColor(wxColour(0, 174, 66)); + mew_btn->SetTextColor(wxColour("#FFFFFE")); + mew_btn->SetMinSize(wxSize(FromDIP(100), FromDIP(24))); + mew_btn->SetMaxSize(wxSize(FromDIP(100), FromDIP(24))); + mew_btn->SetCornerRadius(FromDIP(12)); + mew_btn->Bind(wxEVT_BUTTON, &HistoryWindow::on_click_new_button, this); + + scroll_sizer->Add(mew_btn, 0, wxLEFT, FromDIP(20)); + scroll_sizer->AddSpacer(FromDIP(15)); + wxPanel* comboBox_panel = new wxPanel(scroll_window); comboBox_panel->SetBackgroundColour(wxColour(238, 238, 238)); auto comboBox_sizer = new wxBoxSizer(wxVERTICAL); @@ -346,6 +362,11 @@ float HistoryWindow::get_nozzle_value() return nozzle_value; } +void HistoryWindow::on_click_new_button(wxCommandEvent& event) +{ + NewCalibrationHistoryDialog dlg(this, m_calib_results_history); + dlg.ShowModal(); +} EditCalibrationHistoryDialog::EditCalibrationHistoryDialog(wxWindow* parent, const PACalibResult& result) : DPIDialog(parent, wxID_ANY, _L("Edit Flow Dynamics Calibration"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE) @@ -434,13 +455,9 @@ PACalibResult EditCalibrationHistoryDialog::get_result() { void EditCalibrationHistoryDialog::on_save(wxCommandEvent& event) { wxString name = m_name_value->GetTextCtrl()->GetValue(); - if (name.IsEmpty()) + if (!CalibUtils::validate_input_name(name)) return; - if (name.Length() > 40) { - MessageDialog msg_dlg(nullptr, _L("The name cannot exceed 40 characters."), wxEmptyString, wxICON_WARNING | wxOK); - msg_dlg.ShowModal(); - return; - } + m_new_result.name = m_name_value->GetTextCtrl()->GetValue().ToUTF8().data(); float k = 0.0f; @@ -465,5 +482,255 @@ void EditCalibrationHistoryDialog::on_dpi_changed(const wxRect& suggested_rect) { } +wxArrayString NewCalibrationHistoryDialog::get_all_filaments(const MachineObject *obj) +{ + PresetBundle *preset_bundle = wxGetApp().preset_bundle; + + wxArrayString filament_items; + std::set filament_id_set; + std::set printer_names; + std::ostringstream stream; + stream << std::fixed << std::setprecision(1) << obj->nozzle_diameter; + std::string nozzle_diameter_str = stream.str(); + + for (auto printer_it = preset_bundle->printers.begin(); printer_it != preset_bundle->printers.end(); printer_it++) { + // filter by system preset + if (!printer_it->is_system) + continue; + // get printer_model + ConfigOption * printer_model_opt = printer_it->config.option("printer_model"); + ConfigOptionString *printer_model_str = dynamic_cast(printer_model_opt); + if (!printer_model_str) + continue; + + // use printer_model as printer type + if (printer_model_str->value != MachineObject::get_preset_printer_model_name(obj->printer_type)) + continue; + + if (printer_it->name.find(nozzle_diameter_str) != std::string::npos) + printer_names.insert(printer_it->name); + } + + if (preset_bundle) { + BOOST_LOG_TRIVIAL(trace) << "system_preset_bundle filament number=" << preset_bundle->filaments.size(); + for (auto filament_it = preset_bundle->filaments.begin(); filament_it != preset_bundle->filaments.end(); filament_it++) { + // filter by system preset + Preset &preset = *filament_it; + /*The situation where the user preset is not displayed is as follows: + 1. Not a root preset + 2. Not system preset and the printer firmware does not support user preset */ + if (preset_bundle->filaments.get_preset_base(*filament_it) != &preset || (!filament_it->is_system && ! obj->is_support_user_preset)) { continue; } + + ConfigOption * printer_opt = filament_it->config.option("compatible_printers"); + ConfigOptionStrings *printer_strs = dynamic_cast(printer_opt); + for (auto printer_str : printer_strs->values) { + if (printer_names.find(printer_str) != printer_names.end()) { + if (filament_id_set.find(filament_it->filament_id) != filament_id_set.end()) { + continue; + } else { + filament_id_set.insert(filament_it->filament_id); + // name matched + if (filament_it->is_system) { + filament_items.push_back(filament_it->alias); + FilamentInfos filament_infos; + filament_infos.filament_id = filament_it->filament_id; + filament_infos.setting_id = filament_it->setting_id; + map_filament_items[filament_it->alias] = filament_infos; + } else { + char target = '@'; + size_t pos = filament_it->name.find(target); + if (pos != std::string::npos) { + std::string user_preset_alias = filament_it->name.substr(0, pos - 1); + wxString wx_user_preset_alias = wxString(user_preset_alias.c_str(), wxConvUTF8); + user_preset_alias = wx_user_preset_alias.ToStdString(); + + filament_items.push_back(user_preset_alias); + FilamentInfos filament_infos; + filament_infos.filament_id = filament_it->filament_id; + filament_infos.setting_id = filament_it->setting_id; + map_filament_items[user_preset_alias] = filament_infos; + } + } + } + } + } + } + } + return filament_items; +} + +NewCalibrationHistoryDialog::NewCalibrationHistoryDialog(wxWindow *parent, const std::vector history_results) + : DPIDialog(parent, wxID_ANY, _L("New Flow Dynamics Calibration"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE) + , m_history_results(history_results) +{ + Slic3r::DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager(); + if (!dev) + return; + MachineObject *obj = dev->get_selected_machine(); + if (!obj) + return; + + this->SetBackgroundColour(*wxWHITE); + auto main_sizer = new wxBoxSizer(wxVERTICAL); + + auto top_panel = new wxPanel(this); + top_panel->SetBackgroundColour(*wxWHITE); + auto panel_sizer = new wxBoxSizer(wxVERTICAL); + top_panel->SetSizer(panel_sizer); + + auto flex_sizer = new wxFlexGridSizer(0, 2, FromDIP(15), FromDIP(30)); + flex_sizer->SetFlexibleDirection(wxBOTH); + flex_sizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED); + + Label *name_title = new Label(top_panel, _L("Name")); + m_name_value = new TextInput(top_panel, "", "", "", wxDefaultPosition, NEW_HISTORY_DIALOG_INPUT_SIZE, wxTE_PROCESS_ENTER); + + // Name + flex_sizer->Add(name_title); + flex_sizer->Add(m_name_value); + + Label * preset_name_title = new Label(top_panel, _L("Filament")); + m_comboBox_filament = new ::ComboBox(top_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, NEW_HISTORY_DIALOG_INPUT_SIZE, 0, nullptr, wxCB_READONLY); + + wxArrayString filament_items = get_all_filaments(obj); + m_comboBox_filament->Set(filament_items); + m_comboBox_filament->SetSelection(-1); + + // Filament + flex_sizer->Add(preset_name_title); + flex_sizer->Add(m_comboBox_filament); + + Label *nozzle_diameter_title = new Label(top_panel, _L("Nozzle Diameter")); + m_comboBox_nozzle_diameter = new ::ComboBox(top_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, NEW_HISTORY_DIALOG_INPUT_SIZE, 0, nullptr, wxCB_READONLY); + static std::array nozzle_diameter_list = {0.2f, 0.4f, 0.6f, 0.8f}; + for (int i = 0; i < nozzle_diameter_list.size(); i++) { + m_comboBox_nozzle_diameter->AppendString(wxString::Format("%1.1f mm", nozzle_diameter_list[i])); + if (abs(obj->nozzle_diameter - nozzle_diameter_list[i]) < 1e-3) { + m_comboBox_nozzle_diameter->SetSelection(i); + } + } + + // Nozzle Diameter + flex_sizer->Add(nozzle_diameter_title); + flex_sizer->Add(m_comboBox_nozzle_diameter); + + Label *k_title = new Label(top_panel, _L("Factor K")); + auto k_str = wxString::Format("%.3f", m_new_result.k_value); + m_k_value = new TextInput(top_panel, k_str, "", "", wxDefaultPosition, NEW_HISTORY_DIALOG_INPUT_SIZE, wxTE_PROCESS_ENTER); + + // Factor K + flex_sizer->Add(k_title); + flex_sizer->Add(m_k_value); + + panel_sizer->Add(flex_sizer); + + panel_sizer->AddSpacer(FromDIP(25)); + + auto btn_sizer = new wxBoxSizer(wxHORIZONTAL); + Button * ok_btn = new Button(top_panel, _L("Ok")); + StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), + std::pair(wxColour(0, 174, 66), StateColor::Normal)); + ok_btn->SetBackgroundColour(*wxWHITE); + ok_btn->SetBackgroundColor(btn_bg_green); + ok_btn->SetBorderColor(wxColour(0, 174, 66)); + ok_btn->SetTextColor(wxColour("#FFFFFE")); + ok_btn->SetMinSize(wxSize(-1, FromDIP(24))); + ok_btn->SetCornerRadius(FromDIP(12)); + Button *cancel_btn = new Button(top_panel, _L("Cancel")); + cancel_btn->SetBackgroundColour(*wxWHITE); + cancel_btn->SetMinSize(wxSize(-1, FromDIP(24))); + cancel_btn->SetCornerRadius(FromDIP(12)); + ok_btn->Bind(wxEVT_BUTTON, &NewCalibrationHistoryDialog::on_ok, this); + cancel_btn->Bind(wxEVT_BUTTON, &NewCalibrationHistoryDialog::on_cancel, this); + btn_sizer->AddStretchSpacer(); + btn_sizer->Add(ok_btn); + btn_sizer->AddSpacer(FromDIP(20)); + btn_sizer->Add(cancel_btn); + panel_sizer->Add(btn_sizer, 0, wxEXPAND, 0); + + main_sizer->Add(top_panel, 1, wxEXPAND | wxALL, FromDIP(20)); + + SetSizer(main_sizer); + Layout(); + Fit(); + CenterOnParent(); + + wxGetApp().UpdateDlgDarkUI(this); +} + +void NewCalibrationHistoryDialog::on_ok(wxCommandEvent &event) +{ + wxString name = m_name_value->GetTextCtrl()->GetValue(); + if (!CalibUtils::validate_input_name(name)) + return; + + float k = 0.0f; + if (!CalibUtils::validate_input_k_value(m_k_value->GetTextCtrl()->GetValue(), &k)) { + MessageDialog msg_dlg(nullptr, _L(k_tips), wxEmptyString, wxICON_WARNING | wxOK); + msg_dlg.ShowModal(); + return; + } + wxString k_str = wxString::Format("%.3f", k); + m_k_value->GetTextCtrl()->SetValue(k_str); + + double nozzle_value = 0.0; + wxString nozzle_value_str = m_comboBox_nozzle_diameter->GetValue(); + nozzle_value_str.ToDouble(&nozzle_value); + + std::string filament_name = m_comboBox_filament->GetValue().ToStdString(); + if (filament_name.empty()) { + MessageDialog msg_dlg(nullptr, _L("The filament must be selected."), wxEmptyString, wxICON_WARNING | wxOK); + msg_dlg.ShowModal(); + return; + } + + auto filament_item = map_filament_items[m_comboBox_filament->GetValue().ToStdString()]; + std::string filament_id = filament_item.filament_id; + std::string setting_id = filament_item.setting_id; + + m_new_result.name = name.ToUTF8().data(); + m_new_result.k_value = k; + m_new_result.tray_id = -1; + m_new_result.cali_idx = -1; + + m_new_result.nozzle_diameter = nozzle_value; + m_new_result.filament_id = filament_id; + m_new_result.setting_id = setting_id; + + // Check for duplicate names from history + { + struct PACalibResult + { + size_t operator()(const std::pair &item) const + { + return std::hash()(item.first) * std::hash()(item.second); + } + }; + std::unordered_set, PACalibResult> set; + set.insert({m_new_result.name, m_new_result.filament_id}); + + for (auto &result : m_history_results) { + if (!set.insert({result.name, result.filament_id}).second) { + MessageDialog msg_dlg(nullptr, + wxString::Format(_L("There is already a historical calibration result with the same name: %s. Only one of the results with the same name " + "is saved. Are you sure you want to override the historical result?"), + result.name), + wxEmptyString, wxICON_WARNING | wxYES_NO); + if (msg_dlg.ShowModal() != wxID_YES) + return; + } + } + } + + CalibUtils::set_PA_calib_result({m_new_result}, true); + + EndModal(wxID_OK); +} + +void NewCalibrationHistoryDialog::on_cancel(wxCommandEvent &event) +{ + EndModal(wxID_CANCEL); +} + } // namespace GUI } // namespace Slic3r diff --git a/src/slic3r/GUI/CaliHistoryDialog.hpp b/src/slic3r/GUI/CaliHistoryDialog.hpp index c44d4399e5..94b3a874aa 100644 --- a/src/slic3r/GUI/CaliHistoryDialog.hpp +++ b/src/slic3r/GUI/CaliHistoryDialog.hpp @@ -25,6 +25,8 @@ protected: void enbale_action_buttons(bool enable); float get_nozzle_value(); + void on_click_new_button(wxCommandEvent &event); + wxPanel* m_history_data_panel; ComboBox* m_comboBox_nozzle_dia; Label* m_tips; @@ -55,6 +57,38 @@ protected: TextInput* m_k_value{ nullptr }; }; +class NewCalibrationHistoryDialog : public DPIDialog +{ +public: + NewCalibrationHistoryDialog(wxWindow *parent, const std::vector history_results); + ~NewCalibrationHistoryDialog(){}; + void on_dpi_changed(const wxRect &suggested_rect) override{}; + +protected: + virtual void on_ok(wxCommandEvent &event); + virtual void on_cancel(wxCommandEvent &event); + + + wxArrayString get_all_filaments(const MachineObject *obj); + +protected: + PACalibResult m_new_result; + std::vector m_history_results; + + TextInput *m_name_value{nullptr}; + TextInput *m_k_value{nullptr}; + + ComboBox *m_comboBox_nozzle_diameter; + ComboBox *m_comboBox_filament; + + struct FilamentInfos + { + std::string filament_id; + std::string setting_id; + }; + std::map map_filament_items; +}; + } // namespace GUI } // namespace Slic3r diff --git a/src/slic3r/GUI/CalibrationWizard.cpp b/src/slic3r/GUI/CalibrationWizard.cpp index a96cc93f1d..cbeabeb3cd 100644 --- a/src/slic3r/GUI/CalibrationWizard.cpp +++ b/src/slic3r/GUI/CalibrationWizard.cpp @@ -19,21 +19,6 @@ static const float MIN_PA_K_VALUE = 0.0; static const float MAX_PA_K_VALUE = 0.3; static const float MIN_PA_K_VALUE_STEP = 0.001; -bool check_preset_name_valid(const wxString& name) { - wxString error_message; - if (name.IsEmpty()) { - error_message = _L("Please enter the name you want to save to printer."); - } else if (name.Length() > 40) { - error_message = _L("The name cannot exceed 40 characters."); - } - if (!error_message.IsEmpty()) { - MessageDialog error_msg_dlg(nullptr, error_message, wxEmptyString, wxICON_WARNING | wxOK); - error_msg_dlg.ShowModal(); - return false; - } - return true; -} - std::map get_cached_selected_filament(MachineObject* obj) { std::map selected_filament_map; if (!obj) return selected_filament_map; @@ -90,6 +75,28 @@ CalibrationWizard::CalibrationWizard(wxWindow* parent, CalibMode mode, wxWindowI main_sizer->Fit(this); Bind(EVT_CALIBRATION_JOB_FINISHED, &CalibrationWizard::on_cali_job_finished, this); + +#if !BBL_RELEASE_TO_PUBLIC + this->Bind(wxEVT_CHAR_HOOK, [this](auto& evt) { + const int keyCode = evt.GetKeyCode(); + switch (keyCode) + { + case WXK_PAGEUP: + { + show_step(m_curr_step->prev); + break; + } + case WXK_PAGEDOWN: + { + show_step(m_curr_step->next); + break; + } + default: + evt.Skip(); + break; + } + }); +#endif } CalibrationWizard::~CalibrationWizard() @@ -295,6 +302,7 @@ void CalibrationWizard::recover_preset_info(MachineObject *obj) obj->cali_finished = back_info.cali_finished; obj->cache_flow_ratio = back_info.cache_flow_ratio; obj->selected_cali_preset = back_info.selected_presets; + obj->flow_ratio_calibration_type = back_info.cache_flow_rate_calibration_type; } } } @@ -306,6 +314,7 @@ void CalibrationWizard::back_preset_info(MachineObject *obj, bool cali_finish, b printer_cali_info.cali_finished = cali_finish; printer_cali_info.cache_flow_ratio = obj->cache_flow_ratio; printer_cali_info.selected_presets = obj->selected_cali_preset; + printer_cali_info.cache_flow_rate_calibration_type = obj->flow_ratio_calibration_type; wxGetApp().app_config->save_printer_cali_infos(printer_cali_info, back_cali_flag); } @@ -698,34 +707,44 @@ void PressureAdvanceWizard::on_cali_save() msg_dlg.ShowModal(); } else if (curr_obj->get_printer_series() == PrinterSeries::SERIES_P1P) { - auto save_page = static_cast(save_step->page); - float new_k_value = 0.0f; - float new_n_value = 0.0f; - if (!save_page->get_p1p_result(&new_k_value, &new_n_value)) { - return; - } + if (curr_obj->cali_version >= 0) { + PACalibResult new_pa_cali_result; + auto save_page = static_cast(save_step->page); + if (!save_page->get_manual_result(new_pa_cali_result)) { + return; + } + CalibUtils::set_PA_calib_result({new_pa_cali_result}, false); + } else { + auto save_page = static_cast(save_step->page); + float new_k_value = 0.0f; + float new_n_value = 0.0f; + if (!save_page->get_p1p_result(&new_k_value, &new_n_value)) { + return; + } - float nozzle_dia = 0.4; - BedType plate_type = BedType::btDefault; - CalibrationPresetPage* preset_page = (static_cast(preset_step->page)); - preset_page->get_preset_info(nozzle_dia, plate_type); - std::map selected_filaments = get_cached_selected_filament(curr_obj); - if (selected_filaments.empty()) { - BOOST_LOG_TRIVIAL(error) << "CaliPreset: get selected filaments error"; - return; - } - int tray_id = selected_filaments.begin()->first; - std::string setting_id = selected_filaments.begin()->second->setting_id; + float nozzle_dia = 0.4; + BedType plate_type = BedType::btDefault; + CalibrationPresetPage *preset_page = (static_cast(preset_step->page)); + preset_page->get_preset_info(nozzle_dia, plate_type); + std::map selected_filaments = get_cached_selected_filament(curr_obj); + if (selected_filaments.empty()) { + BOOST_LOG_TRIVIAL(error) << "CaliPreset: get selected filaments error"; + return; + } + int tray_id = selected_filaments.begin()->first; + std::string setting_id = selected_filaments.begin()->second->setting_id; - int nozzle_temp = -1; - int bed_temp = -1; - float max_volumetric_speed = -1; - if (!get_preset_info(selected_filaments.begin()->second->config, plate_type, nozzle_temp, bed_temp, max_volumetric_speed)) { - BOOST_LOG_TRIVIAL(error) << "CaliPreset: get preset info error"; - return; - } + int nozzle_temp = -1; + int bed_temp = -1; + float max_volumetric_speed = -1; + if (!get_preset_info(selected_filaments.begin()->second->config, plate_type, nozzle_temp, bed_temp, max_volumetric_speed)) { + BOOST_LOG_TRIVIAL(error) << "CaliPreset: get preset info error"; + return; + } - curr_obj->command_extrusion_cali_set(tray_id, setting_id, "", new_k_value, new_n_value, bed_temp, nozzle_temp, max_volumetric_speed); + curr_obj->command_extrusion_cali_set(tray_id, setting_id, "", new_k_value, new_n_value, bed_temp, nozzle_temp, max_volumetric_speed); + + } MessageDialog msg_dlg(nullptr, _L("Flow Dynamics Calibration result has been saved to the printer"), wxEmptyString, wxOK); msg_dlg.ShowModal(); @@ -1098,7 +1117,7 @@ void FlowRateWizard::on_cali_save() return; } - if (!check_preset_name_valid(new_preset_name)) + if (!CalibUtils::validate_input_name(new_preset_name)) return; std::string old_preset_name; @@ -1385,7 +1404,7 @@ void MaxVolumetricSpeedWizard::on_cali_save() return; } - if (!check_preset_name_valid(new_preset_name)) + if (!CalibUtils::validate_input_name(new_preset_name)) return; std::map key_value_map; diff --git a/src/slic3r/GUI/CalibrationWizardCaliPage.cpp b/src/slic3r/GUI/CalibrationWizardCaliPage.cpp index 6279cc6048..d412146741 100644 --- a/src/slic3r/GUI/CalibrationWizardCaliPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardCaliPage.cpp @@ -21,6 +21,7 @@ CalibrationCaliPage::CalibrationCaliPage(wxWindow* parent, CalibMode cali_mode, create_page(this); this->SetSizer(m_top_sizer); + Layout(); m_top_sizer->Fit(this); } @@ -63,8 +64,6 @@ void CalibrationCaliPage::create_page(wxWindow* parent) m_printing_panel->get_pause_resume_button()->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(CalibrationCaliPage::on_subtask_pause_resume), NULL, this); m_printing_panel->get_abort_button()->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(CalibrationCaliPage::on_subtask_abort), NULL, this); - - Layout(); } void CalibrationCaliPage::on_subtask_pause_resume(wxCommandEvent& event) @@ -395,6 +394,7 @@ void CalibrationCaliPage::update_subtask(MachineObject* obj) } this->Layout(); + this->Fit(); } void CalibrationCaliPage::update_basic_print_data(bool def, float weight, int prediction) @@ -424,6 +424,7 @@ void CalibrationCaliPage::reset_printing_values() m_printing_panel->update_layers_num(true, wxString::Format(_L("Layer: %s"), NA_STR)); update_basic_print_data(false); this->Layout(); + this->Fit(); } void CalibrationCaliPage::on_device_connected(MachineObject* obj) diff --git a/src/slic3r/GUI/CalibrationWizardPresetPage.cpp b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp index b428110c75..e6941066c2 100644 --- a/src/slic3r/GUI/CalibrationWizardPresetPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp @@ -35,16 +35,16 @@ void CaliPresetCaliStagePanel::create_panel(wxWindow* parent) m_complete_radioBox = new wxRadioButton(parent, wxID_ANY, _L("Complete Calibration")); m_complete_radioBox->SetForegroundColour(*wxBLACK); + m_complete_radioBox->SetValue(true); m_stage = CALI_MANUAL_STAGE_1; m_top_sizer->Add(m_complete_radioBox); m_top_sizer->AddSpacer(FromDIP(10)); - m_fine_radioBox = new wxRadioButton(parent, wxID_ANY, _L("Fine Calibration based on flow ratio")); m_fine_radioBox->SetForegroundColour(*wxBLACK); m_top_sizer->Add(m_fine_radioBox); - auto input_panel = new wxPanel(parent); + input_panel = new wxPanel(parent); input_panel->Hide(); auto input_sizer = new wxBoxSizer(wxHORIZONTAL); input_panel->SetSizer(input_sizer); @@ -58,15 +58,16 @@ void CaliPresetCaliStagePanel::create_panel(wxWindow* parent) m_top_sizer->Add(input_panel); m_top_sizer->AddSpacer(PRESET_GAP); - // events - m_complete_radioBox->Bind(wxEVT_RADIOBUTTON, [this, input_panel](auto& e) { + m_complete_radioBox->Bind(wxEVT_RADIOBUTTON, [this](auto& e) { + m_stage_panel_parent->get_current_object()->flow_ratio_calibration_type = COMPLETE_CALIBRATION; input_panel->Show(false); m_stage = CALI_MANUAL_STAGE_1; GetParent()->Layout(); GetParent()->Fit(); }); - m_fine_radioBox->Bind(wxEVT_RADIOBUTTON, [this, input_panel](auto& e) { + m_fine_radioBox->Bind(wxEVT_RADIOBUTTON, [this](auto& e) { + m_stage_panel_parent->get_current_object()->flow_ratio_calibration_type = FINE_CALIBRATION; input_panel->Show(); m_stage = CALI_MANUAL_STAGE_2; GetParent()->Layout(); @@ -127,6 +128,21 @@ void CaliPresetCaliStagePanel::set_flow_ratio_value(float flow_ratio) m_flow_ratio_value = flow_ratio; } +void CaliPresetCaliStagePanel::set_flow_ratio_calibration_type(FlowRatioCalibrationType type) { + if (type == COMPLETE_CALIBRATION) { + m_complete_radioBox->SetValue(true); + m_stage = CaliPresetStage::CALI_MANUAL_STAGE_1; + input_panel->Hide(); + } + else if (type == FINE_CALIBRATION) { + m_fine_radioBox->SetValue(true); + m_stage = CaliPresetStage::CALI_MANUAL_STAGE_2; + input_panel->Show(); + } + GetParent()->Layout(); + GetParent()->Fit(); +} + CaliComboBox::CaliComboBox(wxWindow* parent, wxString title, wxArrayString values, @@ -285,7 +301,6 @@ void CaliPresetCustomRangePanel::create_panel(wxWindow* parent) { wxBoxSizer* horiz_sizer; horiz_sizer = new wxBoxSizer(wxHORIZONTAL); - for (size_t i = 0; i < m_input_value_nums; ++i) { if (i > 0) { horiz_sizer->Add(FromDIP(10), 0, 0, wxEXPAND, 0); @@ -299,6 +314,38 @@ void CaliPresetCustomRangePanel::create_panel(wxWindow* parent) item_sizer->Add(m_title_texts[i], 0, wxALL, 0); m_value_inputs[i] = new TextInput(parent, wxEmptyString, _L("\u2103"), "", wxDefaultPosition, CALIBRATION_FROM_TO_INPUT_SIZE, 0); m_value_inputs[i]->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); + m_value_inputs[i]->GetTextCtrl()->Bind(wxEVT_TEXT, [this, i](wxCommandEvent& event) { + std::string number = m_value_inputs[i]->GetTextCtrl()->GetValue().ToStdString(); + std::string decimal_point; + std::string expression = "^[-+]?[0-9]+([,.][0-9]+)?$"; + std::regex decimalRegex(expression); + int decimal_number; + if (std::regex_match(number, decimalRegex)) { + std::smatch match; + if (std::regex_search(number, match, decimalRegex)) { + std::string decimalPart = match[1].str(); + if (decimalPart != "") + decimal_number = decimalPart.length() - 1; + else + decimal_number = 0; + } + int max_decimal_length; + if (i <= 1) + max_decimal_length = 3; + else if (i >= 2) + max_decimal_length = 4; + if (decimal_number > max_decimal_length) { + int allowed_length = number.length() - decimal_number + max_decimal_length; + number = number.substr(0, allowed_length); + m_value_inputs[i]->GetTextCtrl()->SetValue(number); + m_value_inputs[i]->GetTextCtrl()->SetInsertionPointEnd(); + } + } + // input is not a number, invalid. + else + BOOST_LOG_TRIVIAL(trace) << "The K input string is not a valid number when calibrating. "; + + }); item_sizer->Add(m_value_inputs[i], 0, wxALL, 0); horiz_sizer->Add(item_sizer, 0, wxEXPAND, 0); } @@ -390,10 +437,8 @@ void CaliPresetTipsPanel::set_params(int nozzle_temp, int bed_temp, float max_vo wxString text_nozzle_temp = wxString::Format("%d", nozzle_temp); m_nozzle_temp->GetTextCtrl()->SetValue(text_nozzle_temp); - wxString bed_temp_text = wxString::Format("%d", bed_temp); - if (bed_temp == 0) - bed_temp_text = "-"; - m_bed_temp->SetLabel(bed_temp_text + _L(" \u2103")); + std::string bed_temp_text = bed_temp==0 ? "-": std::to_string(bed_temp); + m_bed_temp->SetLabel(wxString::FromUTF8(bed_temp_text + "°C")); wxString flow_val_text = wxString::Format("%0.2f", max_volumetric); m_max_volumetric_speed->GetTextCtrl()->SetValue(flow_val_text); @@ -676,6 +721,7 @@ void CalibrationPresetPage::create_page(wxWindow* parent) m_top_sizer->Add(m_step_panel, 0, wxEXPAND, 0); m_cali_stage_panel = new CaliPresetCaliStagePanel(parent); + m_cali_stage_panel->set_parent(this); m_top_sizer->Add(m_cali_stage_panel, 0); m_selection_panel = new wxPanel(parent); @@ -1040,11 +1086,6 @@ void CalibrationPresetPage::update_plate_type_collection(CalibrationMethod metho const ConfigOptionDef* bed_type_def = print_config_def.get("curr_bed_type"); if (bed_type_def && bed_type_def->enum_keys_map) { for (int i = 0; i < bed_type_def->enum_labels.size(); i++) { - if(btDefault + 1 + i == btPTE) { - if (method == CalibrationMethod::CALI_METHOD_AUTO) { - continue; - } - } m_comboBox_bed_type->AppendString(_L(bed_type_def->enum_labels[i])); } m_comboBox_bed_type->SetSelection(0); @@ -1458,6 +1499,8 @@ void CalibrationPresetPage::init_with_machine(MachineObject* obj) { if (!obj) return; + //set flow ratio calibration type + m_cali_stage_panel->set_flow_ratio_calibration_type(obj->flow_ratio_calibration_type); // set nozzle value from machine bool nozzle_is_set = false; for (int i = 0; i < NOZZLE_LIST_COUNT; i++) { @@ -1482,8 +1525,8 @@ void CalibrationPresetPage::init_with_machine(MachineObject* obj) } // set bed type collection from machine - if (m_cali_mode == CalibMode::Calib_PA_Line) - update_plate_type_collection(m_cali_method); + //if (m_cali_mode == CalibMode::Calib_PA_Line) + // update_plate_type_collection(m_cali_method); // init default for filament source // TODO if user change ams/ext, need to update diff --git a/src/slic3r/GUI/CalibrationWizardPresetPage.hpp b/src/slic3r/GUI/CalibrationWizardPresetPage.hpp index 9096c7a34a..4adcd858f3 100644 --- a/src/slic3r/GUI/CalibrationWizardPresetPage.hpp +++ b/src/slic3r/GUI/CalibrationWizardPresetPage.hpp @@ -16,6 +16,8 @@ enum FlowRatioCaliSource { FROM_COARSE_PAGE, }; +class CalibrationPresetPage; + class CaliPresetCaliStagePanel : public wxPanel { public: @@ -30,14 +32,17 @@ public: void get_cali_stage(CaliPresetStage& stage, float& value); void set_flow_ratio_value(float flow_ratio); - + void set_parent(CalibrationPresetPage* parent) { m_stage_panel_parent = parent; } + void set_flow_ratio_calibration_type(FlowRatioCalibrationType type); protected: CaliPresetStage m_stage; wxBoxSizer* m_top_sizer; wxRadioButton* m_complete_radioBox; wxRadioButton* m_fine_radioBox; TextInput * flow_ratio_input; + wxPanel* input_panel; float m_flow_ratio_value; + CalibrationPresetPage* m_stage_panel_parent; }; class CaliComboBox : public wxPanel @@ -162,6 +167,7 @@ public: void stripWhiteSpace(std::string& str); void update_priner_status_msg(wxString msg, bool is_warning); void update(MachineObject* obj) override; + void update_flow_ratio_type(FlowRatioCalibrationType type) { curr_obj->flow_ratio_calibration_type = type; } void on_device_connected(MachineObject* obj) override; @@ -206,7 +212,7 @@ public: CalibMode get_pa_cali_method(); CaliPresetPageStatus get_page_status() { return m_page_status; } - + MachineObject* get_current_object() { return curr_obj; } void msw_rescale() override; void on_sys_color_changed() override; @@ -306,4 +312,4 @@ public: }} // namespace Slic3r::GUI -#endif \ No newline at end of file +#endif diff --git a/src/slic3r/GUI/CalibrationWizardSavePage.cpp b/src/slic3r/GUI/CalibrationWizardSavePage.cpp index 77637bc10d..287fa61361 100644 --- a/src/slic3r/GUI/CalibrationWizardSavePage.cpp +++ b/src/slic3r/GUI/CalibrationWizardSavePage.cpp @@ -552,16 +552,8 @@ bool CaliPASaveManualPanel::get_result(PACalibResult& out_result) { } wxString name = m_save_name_input->GetTextCtrl()->GetValue(); - if (name.IsEmpty()) { - MessageDialog msg_dlg(nullptr, _L("Please enter the name you want to save to printer."), wxEmptyString, wxICON_WARNING | wxOK); - msg_dlg.ShowModal(); + if (!CalibUtils::validate_input_name(name)) return false; - } - else if (name.Length() > 40) { - MessageDialog msg_dlg(nullptr, _L("The name cannot exceed 40 characters."), wxEmptyString, wxICON_WARNING | wxOK); - msg_dlg.ShowModal(); - return false; - } out_result.k_value = k; out_result.name = into_u8(name); @@ -874,11 +866,11 @@ void CalibrationPASavePage::show_panels(CalibrationMethod method, const PrinterS } m_p1p_panel->Show(false); } - else if (printer_ser == PrinterSeries::SERIES_P1P) { + else if (curr_obj->cali_version >= 0) { m_auto_panel->Show(false); - m_manual_panel->Show(false); - m_p1p_panel->set_pa_cali_method(curr_obj->manual_pa_cali_method); - m_p1p_panel->Show(); + m_manual_panel->set_pa_cali_method(curr_obj->manual_pa_cali_method); + m_manual_panel->Show(); + m_p1p_panel->Show(false); } else { m_auto_panel->Show(false); m_manual_panel->Show(false); diff --git a/src/slic3r/GUI/CalibrationWizardStartPage.cpp b/src/slic3r/GUI/CalibrationWizardStartPage.cpp index 3857d0983e..c65ddb72ac 100644 --- a/src/slic3r/GUI/CalibrationWizardStartPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardStartPage.cpp @@ -161,19 +161,24 @@ void CalibrationPAStartPage::on_device_connected(MachineObject* obj) m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, false); m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, false); } + + // is support auto cali + bool is_support_pa_auto = (obj->home_flag >> 16 & 1) == 1; + if (!is_support_pa_auto) { + m_action_panel->show_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, false); + } } else if (obj->get_printer_series() == PrinterSeries::SERIES_P1P || obj->get_printer_arch() == PrinterArch::ARCH_I3) { - m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, false); + if (obj->cali_version >= 0) { + m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, true); + m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, false); + } + else + m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, false); m_action_panel->show_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, false); m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true); m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, false); } - - //is support auto cali - bool is_support_pa_auto = (obj->home_flag >> 16 & 1) == 1; - if (!is_support_pa_auto) { - m_action_panel->show_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, false); - } } void CalibrationPAStartPage::msw_rescale() diff --git a/src/slic3r/GUI/CameraPopup.cpp b/src/slic3r/GUI/CameraPopup.cpp index 08e4801372..6ee0711137 100644 --- a/src/slic3r/GUI/CameraPopup.cpp +++ b/src/slic3r/GUI/CameraPopup.cpp @@ -8,6 +8,7 @@ #include #include #include "GUI_App.hpp" +#include namespace Slic3r { namespace GUI { @@ -65,6 +66,24 @@ CameraPopup::CameraPopup(wxWindow *parent) top_sizer->Add(m_text_vcamera, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, FromDIP(5)); top_sizer->Add(m_switch_vcamera, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, FromDIP(5)); +#if !BBL_RELEASE_TO_PUBLIC + m_text_liveview_retry = new wxStaticText(m_panel, wxID_ANY, _L("Liveview Retry")); + m_text_liveview_retry->Wrap(-1); + m_text_liveview_retry->SetFont(Label::Head_14); + m_text_liveview_retry->SetForegroundColour(TEXT_COL); + m_switch_liveview_retry = new SwitchButton(m_panel); + bool auto_retry = wxGetApp().app_config->get("liveview", "auto_retry") != "false"; + m_switch_liveview_retry->SetValue(auto_retry); + + top_sizer->Add(m_text_liveview_retry, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, FromDIP(5)); + top_sizer->Add(m_switch_liveview_retry, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, FromDIP(5)); + + m_switch_liveview_retry->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent &e) { + wxGetApp().app_config->set("liveview", "auto_retry", e.IsChecked()); + e.Skip(); + }); +#endif + //resolution m_text_resolution = new wxStaticText(m_panel, wxID_ANY, _L("Resolution")); m_text_resolution->Wrap(-1); diff --git a/src/slic3r/GUI/CameraPopup.hpp b/src/slic3r/GUI/CameraPopup.hpp index 8135f41fa4..dbdb81a9cb 100644 --- a/src/slic3r/GUI/CameraPopup.hpp +++ b/src/slic3r/GUI/CameraPopup.hpp @@ -72,6 +72,8 @@ private: SwitchButton* m_switch_recording; wxStaticText* m_text_vcamera; SwitchButton* m_switch_vcamera; + wxStaticText* m_text_liveview_retry; + SwitchButton* m_switch_liveview_retry; wxStaticText* m_custom_camera_hint; TextInput* m_custom_camera_input; Button* m_custom_camera_input_confirm; diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index d9405e76b8..ddc9877cdf 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -56,24 +56,42 @@ void ConfigManipulation::toggle_line(const std::string& opt_key, const bool togg cb_toggle_line(opt_key, toggle); } +void ConfigManipulation::check_nozzle_recommended_temperature_range(DynamicPrintConfig *config) { + if (is_msg_dlg_already_exist) + return; + + int temperature_range_low, temperature_range_high; + if (!get_temperature_range(config, temperature_range_low, temperature_range_high)) return; + + wxString msg_text; + bool need_check = false; + if (temperature_range_low < 190 || temperature_range_high > 300) { + msg_text += _L("The recommended minimum temperature is less than 190 degree or the recommended maximum temperature is greater than 300 degree.\n"); + need_check = true; + } + if (temperature_range_low > temperature_range_high) { + msg_text += _L("The recommended minimum temperature cannot be higher than the recommended maximum temperature.\n"); + need_check = true; + } + if (need_check) { + msg_text += _L("Please check.\n"); + MessageDialog dialog(m_msg_dlg_parent, msg_text, "", wxICON_WARNING | wxOK); + is_msg_dlg_already_exist = true; + dialog.ShowModal(); + is_msg_dlg_already_exist = false; + } +} + void ConfigManipulation::check_nozzle_temperature_range(DynamicPrintConfig *config) { if (is_msg_dlg_already_exist) return; - int temperature_range_low = config->has("nozzle_temperature_range_low") ? - config->opt_int("nozzle_temperature_range_low", (unsigned int)0) : - 0; - int temperature_range_high = config->has("nozzle_temperature_range_high") ? - config->opt_int("nozzle_temperature_range_high", (unsigned int)0) : - 0; + int temperature_range_low, temperature_range_high; + if (!get_temperature_range(config, temperature_range_low, temperature_range_high)) return; - if (temperature_range_low != 0 && - temperature_range_high != 0 && - config->has("nozzle_temperature")) { - if (config->opt_int("nozzle_temperature", 0) < temperature_range_low || - config->opt_int("nozzle_temperature", 0) > temperature_range_high) - { + if (config->has("nozzle_temperature")) { + if (config->opt_int("nozzle_temperature", 0) < temperature_range_low || config->opt_int("nozzle_temperature", 0) > temperature_range_high) { wxString msg_text = _(L("Nozzle may be blocked when the temperature is out of recommended range.\n" "Please make sure whether to use the temperature to print.\n\n")); msg_text += wxString::Format(_L("Recommended nozzle temperature of this filament type is [%d, %d] degree centigrade"), temperature_range_low, temperature_range_high); @@ -90,16 +108,10 @@ void ConfigManipulation::check_nozzle_temperature_initial_layer_range(DynamicPri if (is_msg_dlg_already_exist) return; - int temperature_range_low = config->has("nozzle_temperature_range_low") ? - config->opt_int("nozzle_temperature_range_low", (unsigned int)0) : - 0; - int temperature_range_high = config->has("nozzle_temperature_range_high") ? - config->opt_int("nozzle_temperature_range_high", (unsigned int)0) : - 0; + int temperature_range_low, temperature_range_high; + if (!get_temperature_range(config, temperature_range_low, temperature_range_high)) return; - if (temperature_range_low != 0 && - temperature_range_high != 0 && - config->has("nozzle_temperature_initial_layer")) { + if (config->has("nozzle_temperature_initial_layer")) { if (config->opt_int("nozzle_temperature_initial_layer", 0) < temperature_range_low || config->opt_int("nozzle_temperature_initial_layer", 0) > temperature_range_high) { @@ -161,7 +173,7 @@ void ConfigManipulation::check_chamber_temperature(DynamicPrintConfig* config) } } -void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, const bool is_global_config) +void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, const bool is_global_config, const bool is_plate_config) { // #ys_FIXME_to_delete //! Temporary workaround for the correct updates of the TextCtrl (like "layer_height"): @@ -171,6 +183,8 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con if (is_msg_dlg_already_exist) return; + bool is_object_config = (!is_global_config && !is_plate_config); + // layer_height shouldn't be equal to zero auto layer_height = config->opt_float("layer_height"); auto gpreset = GUI::wxGetApp().preset_bundle->printers.get_edited_preset(); @@ -273,7 +287,8 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con double sparse_infill_density = config->option("sparse_infill_density")->value; auto timelapse_type = config->opt_enum("timelapse_type"); - if (config->opt_bool("spiral_mode") && + if (!is_plate_config && + config->opt_bool("spiral_mode") && ! (config->opt_int("wall_loops") == 1 && config->opt_int("top_shell_layers") == 0 && sparse_infill_density == 0 && @@ -284,24 +299,10 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con config->opt_enum("wall_direction") == WallDirection::Auto && config->opt_enum("timelapse_type") == TimelapseType::tlTraditional)) { - wxString msg_text = _(L("Spiral mode only works when wall loops is 1, support is disabled, top shell layers is 0, sparse infill density is 0 and timelapse type is traditional.")); - - auto printer_structure_opt = wxGetApp().preset_bundle->printers.get_edited_preset().config.option>("printer_structure"); - if (printer_structure_opt && printer_structure_opt->value == PrinterStructure::psI3) { - msg_text += _(L(" But machines with I3 structure will not generate timelapse videos.")); - } - - if (is_global_config) - msg_text += "\n\n" + _(L("Change these settings automatically? \n" - "Yes - Change these settings and enable spiral mode automatically\n" - "No - Give up using spiral mode this time")); - MessageDialog dialog(m_msg_dlg_parent, msg_text, "", - wxICON_WARNING | (is_global_config ? wxYES | wxNO : wxOK)); DynamicPrintConfig new_conf = *config; - is_msg_dlg_already_exist = true; - auto answer = dialog.ShowModal(); + auto answer = show_spiral_mode_settings_dialog(is_object_config); bool support = true; - if (!is_global_config || answer == wxID_YES) { + if (answer == wxID_YES) { new_conf.set_key_value("wall_loops", new ConfigOptionInt(1)); new_conf.set_key_value("top_shell_layers", new ConfigOptionInt(0)); new_conf.set_key_value("sparse_infill_density", new ConfigOptionPercent(0)); @@ -843,5 +844,42 @@ void ConfigManipulation::toggle_print_sla_options(DynamicPrintConfig* config) toggle_field("pad_object_connector_penetration", zero_elev); } +int ConfigManipulation::show_spiral_mode_settings_dialog(bool is_object_config) +{ + wxString msg_text = _(L("Spiral mode only works when wall loops is 1, support is disabled, top shell layers is 0, sparse infill density is 0 and timelapse type is traditional.")); + auto printer_structure_opt = wxGetApp().preset_bundle->printers.get_edited_preset().config.option>("printer_structure"); + if (printer_structure_opt && printer_structure_opt->value == PrinterStructure::psI3) { + msg_text += _(L(" But machines with I3 structure will not generate timelapse videos.")); + } + if (!is_object_config) + msg_text += "\n\n" + _(L("Change these settings automatically? \n" + "Yes - Change these settings and enable spiral mode automatically\n" + "No - Give up using spiral mode this time")); + + MessageDialog dialog(m_msg_dlg_parent, msg_text, "", + wxICON_WARNING | (!is_object_config ? wxYES | wxNO : wxOK)); + is_msg_dlg_already_exist = true; + auto answer = dialog.ShowModal(); + is_msg_dlg_already_exist = false; + if (is_object_config) + answer = wxID_YES; + return answer; +} + +bool ConfigManipulation::get_temperature_range(DynamicPrintConfig *config, int &range_low, int &range_high) +{ + bool range_low_exist = false, range_high_exist = false; + if (config->has("nozzle_temperature_range_low")) { + range_low = config->opt_int("nozzle_temperature_range_low", (unsigned int) 0); + range_low_exist = true; + } + if (config->has("nozzle_temperature_range_high")) { + range_high = config->opt_int("nozzle_temperature_range_high", (unsigned int) 0); + range_high_exist = true; + } + return range_low_exist && range_high_exist; +} + + } // GUI } // Slic3r diff --git a/src/slic3r/GUI/ConfigManipulation.hpp b/src/slic3r/GUI/ConfigManipulation.hpp index da856c416e..fec8d08f4d 100644 --- a/src/slic3r/GUI/ConfigManipulation.hpp +++ b/src/slic3r/GUI/ConfigManipulation.hpp @@ -69,11 +69,12 @@ public: void toggle_line(const std::string& field_key, const bool toggle); // FFF print - void update_print_fff_config(DynamicPrintConfig* config, const bool is_global_config = false); + void update_print_fff_config(DynamicPrintConfig* config, const bool is_global_config = false, const bool is_plate_config = false); void toggle_print_fff_options(DynamicPrintConfig* config, const bool is_global_config = false); void apply_null_fff_config(DynamicPrintConfig *config, std::vector const &keys, std::map const & configs); //BBS: FFF filament nozzle temperature range + void check_nozzle_recommended_temperature_range(DynamicPrintConfig *config); void check_nozzle_temperature_range(DynamicPrintConfig* config); void check_nozzle_temperature_initial_layer_range(DynamicPrintConfig* config); void check_filament_max_volumetric_speed(DynamicPrintConfig *config); @@ -89,10 +90,10 @@ public: m_is_initialized_support_material_overhangs_queried = true; m_support_material_overhangs_queried = queried; } + int show_spiral_mode_settings_dialog(bool is_object_config = false); private: - std::vector get_temperature_range_by_filament_type(const std::string &filament_type); - + bool get_temperature_range(DynamicPrintConfig *config, int &range_low, int &range_high); }; } // GUI diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index 91a0a62108..85bee59d5f 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -46,17 +46,6 @@ static const std::vector filament_types = {"PLA", "PLA+", "PLA "PETGCF", "PTBA", "PTBA90A", "PEEK", "TPU93A", "TPU75D", "TPU", "TPU92A", "TPU98A", "Misc", "TPE", "GLAZE", "Nylon", "CPE", "METAL", "ABST", "Carbon Fiber"}; -static const std::vector system_filament_types = {"PLA", "ABS", "TPU", "PC", "ASA", "PA-CF", "PA6-CF", "PET-CF", "PETG", "PETG-CF", - "PLA Aero", "PLA-CF", "PPA-CF", "PPA-GF", "PA", "HIPS", "PPS", "PPS-CF", "PVA"}; - -static std::unordered_map system_filament_types_map = {{"PLA", "PLA"}, {"ABS", "ABS"}, {"TPU", "TPU"}, - {"PC", "PC"}, {"ASA", "ASA"}, {"PA-CF", "PA-CF"}, - {"PA6-CF", "PA6-CF"}, {"PET-CF", "PET-CF"}, {"PETG", "PETG"}, - {"PETG-CF", "PETG-CF"}, {"PLA Aero", "PLA-AERO"}, {"PLA-CF", "PLA-CF"}, - {"PPA-CF", "PPA-CF"}, {"PPA-GF", "PPA-GF"}, {"PA", "PA"}, - {"HIPS", "HIPS"}, {"PPS", "PPS"}, {"PPS-CF", "PPS-CF"}, - {"PVA", "PVA"}}; - static const std::vector printer_vendors = {"Anycubic", "Artillery", "BIBO", "BIQU", "Creality ENDER", "Creality CR", "Creality SERMOON", "FLSun", "gCreate", "Geeetech", "INAT", "Infinity3D", "Jubilee", "LNL3D", "LulzBot", "MakerGear", "Original Prusa", "Papapiu", "Print4Taste", "RatRig", "Rigid3D", @@ -520,6 +509,20 @@ static char* read_json_file(const std::string &preset_path) return json_contents; } +static std::string get_printer_nozzle_diameter(std::string printer_name) { + + size_t index = printer_name.find(" nozzle"); + if (std::string::npos == index) { + return ""; + } + std::string nozzle = printer_name.substr(0, index); + size_t last_space_index = nozzle.find_last_of(" "); + if (std::string::npos == index) { + return ""; + } + return nozzle.substr(last_space_index + 1); +} + static void adjust_dialog_in_screen(DPIDialog* dialog) { wxSize screen_size = wxGetDisplaySize(); int pos_x, pos_y, size_x, size_y, screen_width, screen_height, dialog_x, dialog_y; @@ -547,6 +550,7 @@ CreateFilamentPresetDialog::CreateFilamentPresetDialog(wxWindow *parent) { m_create_type.base_filament = _L("Create Based on Current Filament"); m_create_type.base_filament_preset = _L("Copy Current Filament Preset "); + get_all_filament_presets(); this->SetBackgroundColour(*wxWHITE); this->SetSize(wxSize(FromDIP(600), FromDIP(480))); @@ -595,7 +599,6 @@ CreateFilamentPresetDialog::CreateFilamentPresetDialog(wxWindow *parent) m_main_sizer->Add(m_scrolled_preset_panel, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(10)); m_main_sizer->Add(create_button_item(), 0, wxEXPAND | wxALL, FromDIP(10)); - get_all_filament_presets(); get_all_visible_printer_name(); select_curr_radiobox(m_create_type_btns, 0); @@ -748,7 +751,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_type_item() horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5)); wxArrayString filament_type; - for (const wxString &filament : system_filament_types) { + for (const wxString &filament : m_system_filament_types_set) { filament_type.Add(filament); } @@ -851,13 +854,13 @@ wxBoxSizer *CreateFilamentPresetDialog::create_filament_preset_item() continue; } for (std::string &compatible_printer_name : compatible_printers->values) { - if (m_visible_printers.find(compatible_printer_name) == m_visible_printers.end()) continue; - size_t index = compatible_printer_name.find("nozzle"); - if (index < 4) { - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " compatible printer name encounter exception and name is: " << compatible_printer_name; + if (m_visible_printers.find(compatible_printer_name) == m_visible_printers.end()) { + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "there is a comppatible printer no exist: " << compatible_printer_name + << "and the preset name is: " << preset->name; continue; } - if (nozzle_diameter[compatible_printer_name.substr(index - 4, 3)] == 0) { + std::string nozzle = get_printer_nozzle_diameter(compatible_printer_name); + if (nozzle_diameter[nozzle] == 0) { BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " compatible printer nozzle encounter exception and name is: " << compatible_printer_name; continue; } @@ -1005,11 +1008,21 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item() return; } - std::string filament_preset_name = vendor_name + " " + type_name + " " + serial_name; + std::string filament_preset_name = vendor_name + " " + (type_name == "PLA-AERO" ? "PLA Aero" : type_name) + " " + serial_name; + PresetBundle *preset_bundle = wxGetApp().preset_bundle; + if (preset_bundle->filaments.is_alias_exist(filament_preset_name)) { + MessageDialog dlg(this, + wxString::Format(_L("The Filament name %s you created already exists. \nIf you continue creating, the preset created will be displayed with its " + "full name. Do you want to continue?"), + from_u8(filament_preset_name)), + wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES_NO | wxYES_DEFAULT | wxCENTRE); + if (wxID_YES != dlg.ShowModal()) { return; } + } + std::string user_filament_id = get_filament_id(filament_preset_name); const wxString &curr_create_type = curr_create_filament_type(); - PresetBundle * preset_bundle = wxGetApp().preset_bundle; + if (curr_create_type == m_create_type.base_filament) { BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":clone filament create type filament "; for (const std::pair<::CheckBox *, std::pair> &checkbox_preset : m_filament_preset) { @@ -1106,10 +1119,14 @@ wxArrayString CreateFilamentPresetDialog::get_filament_preset_choices() for (std::pair filament_presets : m_all_presets_map) { Preset *preset = filament_presets.second; auto inherit = preset->config.option("inherits"); - if (inherit && !inherit->value.empty()) continue; + if (inherit && !inherit->value.empty()) { + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " inherit user preset is:" << preset->name << " and inherits is: " << inherit->value; + continue; + } auto fila_type = preset->config.option("filament_type"); - if (!fila_type || fila_type->values.empty() || system_filament_types_map[type_name] != fila_type->values[0]) continue; + if (!fila_type || fila_type->values.empty() || type_name != fila_type->values[0]) continue; m_filament_choice_map[preset->filament_id].push_back(preset); + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " base user preset is:" << preset->name; } int suffix = 0; @@ -1119,10 +1136,10 @@ wxArrayString CreateFilamentPresetDialog::get_filament_preset_choices() for (Preset* filament_preset : preset.second) { std::string preset_name = filament_preset->name; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " filament_id: " << filament_preset->filament_id << " preset name: " << filament_preset->name; - size_t index_at = preset_name.find("@"); + size_t index_at = preset_name.find(" @"); if (std::string::npos != index_at) { - std::string cur_preset_name = preset_name.substr(0, index_at - 1); - preset_name_set.insert(wxString::FromUTF8(cur_preset_name)); + std::string cur_preset_name = preset_name.substr(0, index_at); + preset_name_set.insert(from_u8(cur_preset_name)); } } assert(1 == preset_name_set.size()); @@ -1261,12 +1278,8 @@ void CreateFilamentPresetDialog::get_filament_presets_by_machine() BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " preset type is not selected type and preset name is: " << preset->name; continue; } - size_t index = compatible_printer_name.find("nozzle"); - if (index < 4) { - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " compatible printer name encounter exception and name is: " << compatible_printer_name; - continue; - } - if (nozzle_diameter[compatible_printer_name.substr(index - 4, 3)] == 0) { + std::string nozzle = get_printer_nozzle_diameter(compatible_printer_name); + if (nozzle_diameter[nozzle] == 0) { BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " compatible printer nozzle encounter exception and name is: " << compatible_printer_name; continue; } @@ -1310,8 +1323,11 @@ void CreateFilamentPresetDialog::get_all_filament_presets() const std::deque &temp_filament_presets = preset_bundle->filaments.get_presets(); for (const Preset& preset : temp_filament_presets) { if (preset.filament_id.empty() || "null" == preset.filament_id) continue; - std::string filament_preset_name = preset.name; + auto filament_type = preset.config.option("filament_type"); + if (filament_type && filament_type->values.size()) + m_system_filament_types_set.insert(filament_type->values[0]); if (!preset.is_visible) continue; + std::string filament_preset_name = preset.name; Preset *filament_preset = new Preset(preset); m_all_presets_map[filament_preset_name] = filament_preset; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " loaded preset name is: " << filament_preset->name; @@ -1352,14 +1368,18 @@ void CreateFilamentPresetDialog::sort_printer_by_nozzle(std::vector nozzle_diameter = nozzle_diameter_map; std::sort(printer_name_to_filament_preset.begin(), printer_name_to_filament_preset.end(), [&nozzle_diameter](const std::pair &a, const std::pair &b) { - size_t nozzle_index_a = a.first.find("nozzle"); - size_t nozzle_index_b = b.first.find("nozzle"); + size_t nozzle_index_a = a.first.find(" nozzle"); + size_t nozzle_index_b = b.first.find(" nozzle"); if (nozzle_index_a == std::string::npos || nozzle_index_b == std::string::npos) return a.first < b.first; std::string nozzle_str_a; std::string nozzle_str_b; try { - nozzle_str_a = a.first.substr(nozzle_index_a - 4, 3); - nozzle_str_b = b.first.substr(nozzle_index_b - 4, 3); + nozzle_str_a = a.first.substr(0, nozzle_index_a); + nozzle_str_b = b.first.substr(0, nozzle_index_b); + size_t last_space_index = nozzle_str_a.find_last_of(" "); + nozzle_str_a = nozzle_str_a.substr(last_space_index + 1); + last_space_index = nozzle_str_b.find_last_of(" "); + nozzle_str_b = nozzle_str_b.substr(last_space_index + 1); } catch (...) { BOOST_LOG_TRIVIAL(info) << "substr filed, and printer name is: " << a.first << " and " << b.first; return a.first < b.first; @@ -2854,6 +2874,8 @@ bool CreatePrinterPresetDialog::data_init() void CreatePrinterPresetDialog::set_current_visible_printer() { + //The entire process of creating a custom printer only needs to be done once + if (m_printer_name_to_preset.size() > 0) return; PresetBundle *preset_bundle = wxGetApp().preset_bundle; const std::deque &printer_presets = preset_bundle->printers.get_presets(); wxArrayString printer_choice; @@ -2861,7 +2883,7 @@ void CreatePrinterPresetDialog::set_current_visible_printer() for (const Preset &printer_preset : printer_presets) { if (printer_preset.is_system || !printer_preset.is_visible) continue; if (preset_bundle->printers.get_preset_base(printer_preset)->name != printer_preset.name) continue; - printer_choice.push_back(wxString::FromUTF8(printer_preset.name)); + printer_choice.push_back(from_u8(printer_preset.name)); m_printer_name_to_preset[printer_preset.name] = std::make_shared(printer_preset); } m_select_printer->Set(printer_choice); @@ -3189,6 +3211,7 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con wxBoxSizer *success_text_sizer = new wxBoxSizer(wxVERTICAL); wxStaticText *success_text; wxStaticText *next_step_text; + bool sync_user_preset_need_enabled = wxGetApp().getAgent() && wxGetApp().app_config->get("sync_user_preset") == "false"; switch (create_success_type) { case PRINTER: success_text = new wxStaticText(this, wxID_ANY, _L("Printer Created")); @@ -3196,11 +3219,14 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con break; case FILAMENT: success_text = new wxStaticText(this, wxID_ANY, _L("Filament Created")); - next_step_text = new wxStaticText(this, wxID_ANY, _L("Please go to filament setting to edit your presets if you need.\nPlease note that nozzle temperature, hot bed temperature, and maximum volumetric speed have a significant impact on printing quality. Please set them carefully.")); + wxString prompt_text = _L("Please go to filament setting to edit your presets if you need.\nPlease note that nozzle temperature, hot bed temperature, and maximum " + "volumetric speed has a significant impact on printing quality. Please set them carefully."); + wxString sync_text = sync_user_preset_need_enabled ? _L("\n\nStudio has detected that your user presets synchronization function is not enabled, which may result in unsuccessful Filament settings on " + "the Device page. \nClick \"Sync user presets\" to enable the synchronization function.") : ""; + next_step_text = new wxStaticText(this, wxID_ANY, prompt_text + sync_text); break; } success_text->SetFont(Label::Head_18); - //next_step_text->SetFont(Label::Body_14); success_text_sizer->Add(success_text, 0, wxEXPAND, 0); success_text_sizer->Add(next_step_text, 0, wxEXPAND | wxTOP, FromDIP(5)); horizontal_sizer->Add(success_text_sizer, 0, wxEXPAND | wxALL, FromDIP(5)); @@ -3214,8 +3240,7 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con case PRINTER: m_button_ok = new Button(this, _L("Printer Setting")); break; - case FILAMENT: - m_button_ok = new Button(this, _L("OK")); + case FILAMENT: m_button_ok = sync_user_preset_need_enabled ? new Button(this, _L("Sync user presets")) : new Button(this, _L("OK")); break; } StateColor btn_bg_green(std::pair(wxColour(0, 137, 123), StateColor::Pressed), std::pair(wxColour(38, 166, 154), StateColor::Hovered), @@ -3232,9 +3257,15 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con m_button_ok->SetCornerRadius(FromDIP(12)); btn_sizer->Add(m_button_ok, 0, wxRIGHT, FromDIP(10)); - m_button_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_OK); }); + m_button_ok->Bind(wxEVT_LEFT_DOWN, [this, sync_user_preset_need_enabled](wxMouseEvent &e) { + if (sync_user_preset_need_enabled) { + wxGetApp().app_config->set("sync_user_preset", "true"); + wxGetApp().start_sync_user_preset(); + } + EndModal(wxID_OK); + }); - if (PRINTER == create_success_type) { + if (PRINTER == create_success_type || sync_user_preset_need_enabled) { m_button_cancel = new Button(this, _L("Cancel")); m_button_cancel->SetBackgroundColor(btn_bg_white); m_button_cancel->SetBorderColor(wxColour(38, 46, 48)); @@ -3339,6 +3370,10 @@ ExportConfigsDialog::~ExportConfigsDialog() } } } + + // Delete the Temp folder + boost::filesystem::path temp_folder(data_dir() + "/" + PRESET_USER_DIR + "/" + "Temp"); + if (boost::filesystem::exists(temp_folder)) boost::filesystem::remove_all(temp_folder); } void ExportConfigsDialog::on_dpi_changed(const wxRect &suggested_rect) { @@ -3394,6 +3429,26 @@ bool ExportConfigsDialog::has_check_box_selected() return false; } +bool ExportConfigsDialog::earse_preset_fields_for_safe(Preset *preset) +{ + if (preset->type != Preset::Type::TYPE_PRINTER) return true; + + boost::filesystem::path file_path(data_dir() + "/" + PRESET_USER_DIR + "/" + "Temp" + "/" + (preset->name + ".json")); + preset->file = file_path.make_preferred().string(); + + DynamicPrintConfig &config = preset->config; + config.erase("print_host"); + config.erase("print_host_webui"); + config.erase("printhost_apikey"); + config.erase("printhost_cafile"); + config.erase("printhost_user"); + config.erase("printhost_password"); + config.erase("printhost_port"); + + preset->save(nullptr); + return true; +} + std::string ExportConfigsDialog::initial_file_path(const wxString &path, const std::string &sub_file_path) { std::string export_path = into_u8(path); @@ -3655,11 +3710,15 @@ ExportConfigsDialog::ExportCase ExportConfigsDialog::archive_preset_bundle_to_fi std::string printer_preset_name_ = printer_preset->name; json bundle_structure; + NetworkAgent *agent = wxGetApp().getAgent(); std::string clock = get_curr_timestmp(); - bundle_structure["user_name"] = ""; - bundle_structure["user_id"] = ""; - bundle_structure["version"] = SoftFever_VERSION; - bundle_structure["bundle_id"] = printer_preset_name_ + "_" + clock; + if (agent) { + bundle_structure["version"] = agent->get_version(); + bundle_structure["bundle_id"] = agent->get_user_id() + "_" + printer_preset_name_ + "_" + clock; + } else { + bundle_structure["version"] = ""; + bundle_structure["bundle_id"] = "offline_" + printer_preset_name_ + "_" + clock; + } bundle_structure["bundle_type"] = "printer config bundle"; bundle_structure["printer_preset_name"] = printer_preset_name_; json printer_config = json::array(); @@ -3770,11 +3829,15 @@ ExportConfigsDialog::ExportCase ExportConfigsDialog::archive_filament_bundle_to_ std::string filament_name = checkbox_filament_name.second; json bundle_structure; + NetworkAgent *agent = wxGetApp().getAgent(); std::string clock = get_curr_timestmp(); - bundle_structure["user_name"] = ""; - bundle_structure["user_id"] = ""; - bundle_structure["version"] = SoftFever_VERSION; - bundle_structure["bundle_id"] = filament_name + "_" + clock; + if (agent) { + bundle_structure["version"] = agent->get_version(); + bundle_structure["bundle_id"] = agent->get_user_id() + "_" + filament_name + "_" + clock; + } else { + bundle_structure["version"] = ""; + bundle_structure["bundle_id"] = "offline_" + filament_name + "_" + clock; + } bundle_structure["bundle_type"] = "filament config bundle"; bundle_structure["filament_name"] = filament_name; std::unordered_map vendor_structure; @@ -4068,19 +4131,45 @@ wxBoxSizer *ExportConfigsDialog::create_select_printer(wxWindow *parent) void ExportConfigsDialog::data_init() { + // Delete the Temp folder + boost::filesystem::path folder(data_dir() + "/" + PRESET_USER_DIR + "/" + "Temp"); + if (boost::filesystem::exists(folder)) boost::filesystem::remove_all(folder); + + boost::system::error_code ec; + boost::filesystem::path user_folder(data_dir() + "/" + PRESET_USER_DIR); + bool temp_folder_exist = true; + if (!boost::filesystem::exists(user_folder)) { + if (!boost::filesystem::create_directories(user_folder, ec)) { + BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << " create directory failed: " << user_folder << " "< & printer_presets = preset_bundle.printers.get_presets(); for (const Preset &printer_preset : printer_presets) { std::string preset_name = printer_preset.name; - if (!printer_preset.is_visible || "Default Printer" == preset_name) continue; + if (!printer_preset.is_visible || printer_preset.is_default || printer_preset.is_project_embedded) continue; if (preset_bundle.printers.select_preset_by_name(preset_name, false)) { preset_bundle.update_compatible(PresetSelectCompatibleType::Always); const std::deque &filament_presets = preset_bundle.filaments.get_presets(); for (const Preset &filament_preset : filament_presets) { - if (filament_preset.is_system || filament_preset.is_default) continue; + if (filament_preset.is_system || filament_preset.is_default || filament_preset.is_project_embedded) continue; if (filament_preset.is_compatible) { Preset *new_filament_preset = new Preset(filament_preset); m_filament_presets[preset_name].push_back(new_filament_preset); @@ -4089,7 +4178,7 @@ void ExportConfigsDialog::data_init() const std::deque &process_presets = preset_bundle.prints.get_presets(); for (const Preset &process_preset : process_presets) { - if (process_preset.is_system || process_preset.is_default) continue; + if (process_preset.is_system || process_preset.is_default || process_preset.is_project_embedded) continue; if (process_preset.is_compatible) { Preset *new_prpcess_preset = new Preset(process_preset); m_process_presets[preset_name].push_back(new_prpcess_preset); @@ -4097,6 +4186,7 @@ void ExportConfigsDialog::data_init() } Preset *new_printer_preset = new Preset(printer_preset); + earse_preset_fields_for_safe(new_printer_preset); m_printer_presets[preset_name] = new_printer_preset; } } @@ -4159,9 +4249,10 @@ EditFilamentPresetDialog::EditFilamentPresetDialog(wxWindow *parent, FilamentInf if (vendor_names && !vendor_names->values.empty()) m_vendor_name = vendor_names->values[0]; auto filament_types = dynamic_cast(preset->config.option("filament_type")); if (filament_types && !filament_types->values.empty()) m_filament_type = filament_types->values[0]; - size_t index = m_filament_name.find(m_filament_type); - if (std::string::npos != index && index + m_filament_type.size() < m_filament_name.size()) { - m_filament_serial = m_filament_name.substr(index + m_filament_type.size()); + std::string filament_type = m_filament_type == "PLA-AERO" ? "PLA Aero" : m_filament_type; + size_t index = m_filament_name.find(filament_type); + if (std::string::npos != index && index + filament_type.size() < m_filament_name.size()) { + m_filament_serial = m_filament_name.substr(index + filament_type.size()); if (m_filament_serial.size() > 2 && m_filament_serial[0] == ' ') { m_filament_serial = m_filament_serial.substr(1); } @@ -4639,8 +4730,7 @@ void CreatePresetForPrinterDialog::get_visible_printer_and_compatible_filament_p if (filament_types && filament_types->values.empty()) continue; const std::string filament_type = filament_types->values[0]; - std::string filament_type_ = system_filament_types_map[m_filament_type]; - if (filament_type_.empty()) filament_type_ = m_filament_type; + std::string filament_type_ = m_filament_type == "PLA Aero" ? "PLA-AERO" : m_filament_type; if (filament_type == filament_type_) { m_printer_compatible_filament_presets[printer_preset.name].push_back(std::make_shared(filament_preset)); } diff --git a/src/slic3r/GUI/CreatePresetsDialog.hpp b/src/slic3r/GUI/CreatePresetsDialog.hpp index 9c79bc71f3..911caca5e1 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.hpp +++ b/src/slic3r/GUI/CreatePresetsDialog.hpp @@ -70,12 +70,13 @@ private: std::unordered_map> m_filament_choice_map; std::unordered_map m_public_name_to_filament_id_map; std::unordered_map m_all_presets_map; + std::unordered_set m_system_filament_types_set; std::set m_visible_printers; CreateType m_create_type; Button * m_button_create = nullptr; Button * m_button_cancel = nullptr; ComboBox * m_filament_vendor_combobox = nullptr; - ::CheckBox * m_can_not_find_vendor_checkbox = nullptr; + ::CheckBox * m_can_not_find_vendor_checkbox = nullptr; ComboBox * m_filament_type_combobox = nullptr; ComboBox * m_exist_vendor_combobox = nullptr; ComboBox * m_filament_preset_combobox = nullptr; @@ -262,6 +263,7 @@ private: void on_dpi_changed(const wxRect &suggested_rect) override; void show_export_result(const ExportCase &export_case); bool has_check_box_selected(); + bool earse_preset_fields_for_safe(Preset *preset); std::string initial_file_path(const wxString &path, const std::string &sub_file_path); std::string initial_file_name(const wxString &path, const std::string file_name); wxBoxSizer *create_export_config_item(wxWindow *parent); @@ -314,7 +316,6 @@ private: std::string m_filament_vendor; std::string m_filament_type; std::shared_ptr m_preset_bundle; - std::string m_filamnt_type; ComboBox * m_selected_printer = nullptr; ComboBox * m_selected_filament = nullptr; Button * m_ok_btn = nullptr; diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index f3ffa85bdc..b9a6b758b6 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -807,7 +807,9 @@ int MachineObject::ams_filament_mapping(std::vector filaments, std info.color = tray->second->color; info.type = tray->second->get_filament_type(); info.id = tray_index; - info.filament_id=tray->second->setting_id; + info.filament_id = tray->second->setting_id; + info.ctype = tray->second->ctype; + info.colors = tray->second->cols; tray_filaments.emplace(std::make_pair(tray_index, info)); } } @@ -824,6 +826,8 @@ int MachineObject::ams_filament_mapping(std::vector filaments, std info.tray_id = atoi(tray_it->first.c_str()) + atoi(it->first.c_str()) * 4; info.color = tray_it->second->color; info.type = tray_it->second->get_filament_type(); + info.ctype = tray_it->second->ctype; + info.colors = tray_it->second->cols; } else { info.id = -1; @@ -857,6 +861,9 @@ int MachineObject::ams_filament_mapping(std::vector filaments, std if (filaments[i].type == tray_it->second->get_filament_type()) { info.color = tray_it->second->color; info.type = tray_it->second->get_filament_type(); + info.ctype = tray_it->second->ctype; + std::vector cols; + info.colors = tray_it->second->cols; } else { info.tray_id = -1; info.mapping_result = (int)MappingResult::MAPPING_RESULT_TYPE_MISMATCH; @@ -944,7 +951,8 @@ int MachineObject::ams_filament_mapping(std::vector filaments, std picked_src_idx = i; picked_tar_idx = j; } - else if (min_val == distance_map[i][j].distance && filaments[i].filament_id == tray_filaments[j].filament_id) { + else if (min_val == distance_map[i][j].distance&& filaments[picked_src_idx].filament_id!= tray_filaments[picked_tar_idx].filament_id && filaments[i].filament_id == tray_filaments[j].filament_id) { + picked_src_idx = i; picked_tar_idx = j; } @@ -959,6 +967,8 @@ int MachineObject::ams_filament_mapping(std::vector filaments, std result[picked_src_idx].type = tray->second.type; result[picked_src_idx].distance = tray->second.distance; result[picked_src_idx].filament_id = tray->second.filament_id; + result[picked_src_idx].ctype = tray->second.ctype; + result[picked_src_idx].colors = tray->second.colors; } else { FilamentInfo info; @@ -998,6 +1008,8 @@ int MachineObject::ams_filament_mapping(std::vector filaments, std result[i].tray_id = tray_info_list[i].tray_id; result[i].color = tray_info_list[i].color; result[i].type = tray_info_list[i].type; + result[i].ctype = tray_info_list[i].ctype; + result[i].colors = tray_info_list[i].colors; } } } @@ -1132,24 +1144,26 @@ MachineObject::LIGHT_EFFECT MachineObject::light_effect_parse(std::string effect std::string MachineObject::get_firmware_type_str() { - if (firmware_type == PrinterFirmwareType::FIRMWARE_TYPE_ENGINEER) + /*if (firmware_type == PrinterFirmwareType::FIRMWARE_TYPE_ENGINEER) return "engineer"; else if (firmware_type == PrinterFirmwareType::FIRMWARE_TYPE_PRODUCTION) - return "product"; + return "product";*/ - // return engineer by default; - return "engineer"; + // return product by default; + // always return product, printer do not push this field + return "product"; } std::string MachineObject::get_lifecycle_type_str() { - if (lifecycle == PrinterFirmwareType::FIRMWARE_TYPE_ENGINEER) + /*if (lifecycle == PrinterFirmwareType::FIRMWARE_TYPE_ENGINEER) return "engineer"; else if (lifecycle == PrinterFirmwareType::FIRMWARE_TYPE_PRODUCTION) - return "product"; + return "product";*/ - // return engineer by default; - return "engineer"; + // return product by default; + // always return product, printer do not push this field + return "product"; } bool MachineObject::is_in_upgrading() @@ -1806,7 +1820,7 @@ int MachineObject::command_ams_calibrate(int ams_id) int MachineObject::command_ams_filament_settings(int ams_id, int tray_id, std::string filament_id, std::string setting_id, std::string tray_color, std::string tray_type, int nozzle_temp_min, int nozzle_temp_max) { BOOST_LOG_TRIVIAL(info) << "command_ams_filament_settings, ams_id = " << ams_id << ", tray_id = " << tray_id << ", tray_color = " << tray_color - << ", tray_type = " << tray_type << ", setting_id = " << setting_id; + << ", tray_type = " << tray_type << ", setting_id = " << setting_id << ", temp_min: = " << nozzle_temp_min << ", temp_max: = " << nozzle_temp_max; json j; j["print"]["command"] = "ams_filament_setting"; j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); @@ -1869,6 +1883,7 @@ int MachineObject::command_set_chamber_light(LIGHT_EFFECT effect, int on_time, i int MachineObject::command_set_printer_nozzle(std::string nozzle_type, float diameter) { + nozzle_setting_hold_count = HOLD_COUNT_MAX * 2; BOOST_LOG_TRIVIAL(info) << "command_set_printer_nozzle, nozzle_type = " << nozzle_type << " diameter = " << diameter; json j; j["system"]["command"] = "set_accessories"; @@ -2069,33 +2084,45 @@ int MachineObject::command_start_pa_calibration(const X1CCalibInfos &pa_data, in CNumericLocalesSetter locales_setter; pa_calib_results.clear(); - if (get_printer_series() == PrinterSeries::SERIES_X1) { - json j; - j["print"]["command"] = "extrusion_cali"; - j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); - j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(pa_data.calib_datas[0].nozzle_diameter); - j["print"]["mode"] = mode; + json j; + j["print"]["command"] = "extrusion_cali"; + j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); + j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(pa_data.calib_datas[0].nozzle_diameter); + j["print"]["mode"] = mode; - for (int i = 0; i < pa_data.calib_datas.size(); ++i) { - j["print"]["filaments"][i]["tray_id"] = pa_data.calib_datas[i].tray_id; - j["print"]["filaments"][i]["bed_temp"] = pa_data.calib_datas[i].bed_temp; - j["print"]["filaments"][i]["filament_id"] = pa_data.calib_datas[i].filament_id; - j["print"]["filaments"][i]["setting_id"] = pa_data.calib_datas[i].setting_id; - j["print"]["filaments"][i]["nozzle_temp"] = pa_data.calib_datas[i].nozzle_temp; - j["print"]["filaments"][i]["max_volumetric_speed"] = std::to_string(pa_data.calib_datas[i].max_volumetric_speed); - } + std::string filament_ids; + for (int i = 0; i < pa_data.calib_datas.size(); ++i) { + j["print"]["filaments"][i]["tray_id"] = pa_data.calib_datas[i].tray_id; + j["print"]["filaments"][i]["bed_temp"] = pa_data.calib_datas[i].bed_temp; + j["print"]["filaments"][i]["filament_id"] = pa_data.calib_datas[i].filament_id; + j["print"]["filaments"][i]["setting_id"] = pa_data.calib_datas[i].setting_id; + j["print"]["filaments"][i]["nozzle_temp"] = pa_data.calib_datas[i].nozzle_temp; + j["print"]["filaments"][i]["max_volumetric_speed"] = std::to_string(pa_data.calib_datas[i].max_volumetric_speed); - BOOST_LOG_TRIVIAL(trace) << "extrusion_cali: " << j.dump(); - return this->publish_json(j.dump()); + if (i > 0) filament_ids += ","; + filament_ids += pa_data.calib_datas[i].filament_id; } - return -1; + + BOOST_LOG_TRIVIAL(trace) << "extrusion_cali: " << j.dump(); + + try { + json js; + js["cali_type"] = "cali_pa_auto"; + js["nozzle_diameter"] = pa_data.calib_datas[0].nozzle_diameter; + js["filament_id"] = filament_ids; + js["printer_type"] = this->printer_type; + NetworkAgent *agent = GUI::wxGetApp().getAgent(); + if (agent) agent->track_event("cali", js.dump()); + } catch (...) {} + + return this->publish_json(j.dump()); } int MachineObject::command_set_pa_calibration(const std::vector &pa_calib_values, bool is_auto_cali) { CNumericLocalesSetter locales_setter; - if (get_printer_series() == PrinterSeries::SERIES_X1 && pa_calib_values.size() > 0) { + if (pa_calib_values.size() > 0) { json j; j["print"]["command"] = "extrusion_cali_set"; j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); @@ -2126,73 +2153,61 @@ int MachineObject::command_set_pa_calibration(const std::vector & int MachineObject::command_delete_pa_calibration(const PACalibIndexInfo& pa_calib) { - if (get_printer_series() == PrinterSeries::SERIES_X1) { - json j; - j["print"]["command"] = "extrusion_cali_del"; - j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); - j["print"]["filament_id"] = pa_calib.filament_id; - j["print"]["cali_idx"] = pa_calib.cali_idx; - j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(pa_calib.nozzle_diameter); + json j; + j["print"]["command"] = "extrusion_cali_del"; + j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); + j["print"]["filament_id"] = pa_calib.filament_id; + j["print"]["cali_idx"] = pa_calib.cali_idx; + j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(pa_calib.nozzle_diameter); - BOOST_LOG_TRIVIAL(trace) << "extrusion_cali_del: " << j.dump(); - return this->publish_json(j.dump()); - } - return -1; + BOOST_LOG_TRIVIAL(trace) << "extrusion_cali_del: " << j.dump(); + return this->publish_json(j.dump()); } int MachineObject::command_get_pa_calibration_tab(float nozzle_diameter, const std::string &filament_id) { reset_pa_cali_history_result(); - if (get_printer_series() == PrinterSeries::SERIES_X1) { - json j; - j["print"]["command"] = "extrusion_cali_get"; - j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); - j["print"]["filament_id"] = filament_id; - j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(nozzle_diameter); + json j; + j["print"]["command"] = "extrusion_cali_get"; + j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); + j["print"]["filament_id"] = filament_id; + j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(nozzle_diameter); - BOOST_LOG_TRIVIAL(trace) << "extrusion_cali_get: " << j.dump(); - return this->publish_json(j.dump()); - } - return -1; + BOOST_LOG_TRIVIAL(trace) << "extrusion_cali_get: " << j.dump(); + return this->publish_json(j.dump()); } int MachineObject::command_get_pa_calibration_result(float nozzle_diameter) { - if (get_printer_series() == PrinterSeries::SERIES_X1) { - json j; - j["print"]["command"] = "extrusion_cali_get_result"; - j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); - j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(nozzle_diameter); + json j; + j["print"]["command"] = "extrusion_cali_get_result"; + j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); + j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(nozzle_diameter); - BOOST_LOG_TRIVIAL(trace) << "extrusion_cali_get_result: " << j.dump(); - return this->publish_json(j.dump()); - } - return -1; + BOOST_LOG_TRIVIAL(trace) << "extrusion_cali_get_result: " << j.dump(); + return this->publish_json(j.dump()); } int MachineObject::commnad_select_pa_calibration(const PACalibIndexInfo& pa_calib_info) { - if (get_printer_series() == PrinterSeries::SERIES_X1) { - json j; - j["print"]["command"] = "extrusion_cali_sel"; - j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); - j["print"]["tray_id"] = pa_calib_info.tray_id; - j["print"]["cali_idx"] = pa_calib_info.cali_idx; - j["print"]["filament_id"] = pa_calib_info.filament_id; - j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(pa_calib_info.nozzle_diameter); + json j; + j["print"]["command"] = "extrusion_cali_sel"; + j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); + j["print"]["tray_id"] = pa_calib_info.tray_id; + j["print"]["cali_idx"] = pa_calib_info.cali_idx; + j["print"]["filament_id"] = pa_calib_info.filament_id; + j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(pa_calib_info.nozzle_diameter); - BOOST_LOG_TRIVIAL(trace) << "extrusion_cali_sel: " << j.dump(); - return this->publish_json(j.dump()); - } - return -1; + BOOST_LOG_TRIVIAL(trace) << "extrusion_cali_sel: " << j.dump(); + return this->publish_json(j.dump()); } int MachineObject::command_start_flow_ratio_calibration(const X1CCalibInfos& calib_data) { CNumericLocalesSetter locales_setter; - if (get_printer_series() == PrinterSeries::SERIES_X1 && calib_data.calib_datas.size() > 0) { + if (calib_data.calib_datas.size() > 0) { json j; j["print"]["command"] = "flowrate_cali"; j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); @@ -2217,16 +2232,13 @@ int MachineObject::command_start_flow_ratio_calibration(const X1CCalibInfos& cal int MachineObject::command_get_flow_ratio_calibration_result(float nozzle_diameter) { - if (get_printer_series() == PrinterSeries::SERIES_X1) { - json j; - j["print"]["command"] = "flowrate_get_result"; - j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); - j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(nozzle_diameter); + json j; + j["print"]["command"] = "flowrate_get_result"; + j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); + j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(nozzle_diameter); - BOOST_LOG_TRIVIAL(trace) << "flowrate_get_result: " << j.dump(); - return this->publish_json(j.dump()); - } - return -1; + BOOST_LOG_TRIVIAL(trace) << "flowrate_get_result: " << j.dump(); + return this->publish_json(j.dump()); } int MachineObject::command_ipcam_record(bool on_off) @@ -2678,6 +2690,7 @@ int MachineObject::parse_json(std::string payload) std::string access_code = j_pre["system"]["access_code"].get(); if (!access_code.empty()) { set_access_code(access_code); + set_user_access_code(access_code); } } } @@ -2690,6 +2703,8 @@ int MachineObject::parse_json(std::string payload) uint64_t t_utc = j.value("t_utc", 0ULL); if (t_utc > 0) last_utc_time = std::chrono::system_clock::time_point(t_utc * 1ms); + else + last_utc_time = last_update_time; BOOST_LOG_TRIVIAL(trace) << "parse_json: dev_id=" << dev_id << ", playload=" << j.dump(4); @@ -3341,14 +3356,21 @@ int MachineObject::parse_json(std::string payload) ; } #pragma endregion - try { if (jj.contains("nozzle_diameter")) { - if (jj["nozzle_diameter"].is_number_float()) { - nozzle_diameter = jj["nozzle_diameter"].get(); - } else if (jj["nozzle_diameter"].is_string()) { - nozzle_diameter = string_to_float(jj["nozzle_diameter"].get()); + + if (nozzle_setting_hold_count > 0) { + nozzle_setting_hold_count--; + } else { + if (jj["nozzle_diameter"].is_number_float()) { + nozzle_diameter = jj["nozzle_diameter"].get(); + } + else if (jj["nozzle_diameter"].is_string()) { + nozzle_diameter = string_to_float(jj["nozzle_diameter"].get()); + } } + + } } catch(...) { @@ -3357,8 +3379,14 @@ int MachineObject::parse_json(std::string payload) try { if (jj.contains("nozzle_type")) { - if (jj["nozzle_type"].is_string()) { - nozzle_type = jj["nozzle_type"].get(); + + if (nozzle_setting_hold_count > 0) { + nozzle_setting_hold_count--; + } + else { + if (jj["nozzle_type"].is_string()) { + nozzle_type = jj["nozzle_type"].get(); + } } } } @@ -3513,8 +3541,8 @@ int MachineObject::parse_json(std::string payload) camera_resolution_supported.swap(resolution_supported); } if (ipcam.contains("liveview")) { - char const *local_protos[] = { "none", "local", "rtsps", "rtsp" }; - liveview_local = enum_index_of(ipcam["liveview"].value("local", "none").c_str(), local_protos, 4, LiveviewLocal::LVL_None); + char const *local_protos[] = {"none", "disabled", "local", "rtsps", "rtsp"}; + liveview_local = enum_index_of(ipcam["liveview"].value("local", "none").c_str(), local_protos, 5, LiveviewLocal::LVL_None); liveview_remote = ipcam["liveview"].value("remote", "disabled") == "enabled"; } if (ipcam.contains("file")) { @@ -3526,7 +3554,7 @@ int MachineObject::parse_json(std::string payload) if (ipcam.contains("rtsp_url")) { local_rtsp_url = ipcam["rtsp_url"].get(); liveview_local = local_rtsp_url.empty() ? LVL_None : local_rtsp_url == "disable" - ? LVL_None : boost::algorithm::starts_with(local_rtsp_url, "rtsps") ? LVL_Rtsps : LVL_Rtsp; + ? LVL_Disable : boost::algorithm::starts_with(local_rtsp_url, "rtsps") ? LVL_Rtsps : LVL_Rtsp; } if (ipcam.contains("tutk_server")) { tutk_state = ipcam["tutk_server"].get(); @@ -3620,11 +3648,19 @@ int MachineObject::parse_json(std::string payload) if (jj.contains("cali_version")) { cali_version = jj["cali_version"].get(); } + else { + cali_version = -1; + } std::string str = jj.dump(); } catch (...) { ; } + PresetBundle *preset_bundle = Slic3r::GUI::wxGetApp().preset_bundle; + std::map> filament_list = preset_bundle->filaments.get_filament_presets(); + std::ostringstream stream; + stream << std::fixed << std::setprecision(1) << nozzle_diameter; + std::string nozzle_diameter_str = stream.str(); if (jj.contains("ams")) { if (jj["ams"].contains("ams")) { @@ -3701,6 +3737,7 @@ int MachineObject::parse_json(std::string payload) json j_ams = jj["ams"]["ams"]; std::set ams_id_set; + for (auto it = amsList.begin(); it != amsList.end(); it++) { ams_id_set.insert(it->first); } @@ -3785,6 +3822,17 @@ int MachineObject::parse_json(std::string payload) } else { curr_tray->type = type; } + if (filament_list.find(curr_tray->setting_id) == filament_list.end()) { + wxColour color = *wxWHITE; + char col_buf[10]; + sprintf(col_buf, "%02X%02X%02XFF", (int) color.Red(), (int) color.Green(), (int) color.Blue()); + try { + this->command_ams_filament_settings(std::stoi(ams_id), std::stoi(tray_id), "", "", std::string(col_buf), "", 0, 0); + continue; + } catch (...) { + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << " stoi error and ams_id: " << ams_id << " tray_id" << tray_id; + } + } } else { curr_tray->setting_id = ""; curr_tray->type = ""; @@ -3817,14 +3865,37 @@ int MachineObject::parse_json(std::string payload) curr_tray->bed_temp = (*tray_it)["bed_temp"].get(); else curr_tray->bed_temp = ""; - if (tray_it->contains("nozzle_temp_max")) + if (tray_it->contains("tray_color")) { + auto color = (*tray_it)["tray_color"].get(); + curr_tray->update_color_from_str(color); + } else { + curr_tray->color = ""; + } + if (tray_it->contains("nozzle_temp_max")) { curr_tray->nozzle_temp_max = (*tray_it)["nozzle_temp_max"].get(); + } else curr_tray->nozzle_temp_max = ""; if (tray_it->contains("nozzle_temp_min")) curr_tray->nozzle_temp_min = (*tray_it)["nozzle_temp_min"].get(); else curr_tray->nozzle_temp_min = ""; + if (curr_tray->nozzle_temp_min != "" && curr_tray->nozzle_temp_max != "") { + try { + std::string preset_setting_id; + bool is_equation = preset_bundle->check_filament_temp_equation_by_printer_type_and_nozzle_for_mas_tray( + MachineObject::get_preset_printer_model_name(this->printer_type), nozzle_diameter_str, curr_tray->setting_id, + curr_tray->tag_uid, curr_tray->nozzle_temp_min, curr_tray->nozzle_temp_max, preset_setting_id); + if (!is_equation) { + command_ams_filament_settings(std::stoi(ams_id), std::stoi(tray_id), curr_tray->setting_id, preset_setting_id, + curr_tray->color, curr_tray->type, + std::stoi(curr_tray->nozzle_temp_min), + std::stoi(curr_tray->nozzle_temp_max)); + } + } catch (...) { + BOOST_LOG_TRIVIAL(info) << "check fail and curr_tray ams_id" << ams_id << " curr_tray tray_id"<contains("xcam_info")) curr_tray->xcam_info = (*tray_it)["xcam_info"].get(); else @@ -3833,12 +3904,6 @@ int MachineObject::parse_json(std::string payload) curr_tray->uuid = (*tray_it)["tray_uuid"].get(); else curr_tray->uuid = "0"; - if (tray_it->contains("tray_color")) { - auto color = (*tray_it)["tray_color"].get(); - curr_tray->update_color_from_str(color); - } else { - curr_tray->color = ""; - } if (tray_it->contains("ctype")) curr_tray->ctype = (*tray_it)["ctype"].get(); @@ -3952,6 +4017,17 @@ int MachineObject::parse_json(std::string payload) else { vt_tray.type = type; } + if (filament_list.find(vt_tray.setting_id) == filament_list.end()) { + wxColour color = *wxWHITE; + char col_buf[10]; + sprintf(col_buf, "%02X%02X%02XFF", (int) color.Red(), (int) color.Green(), (int) color.Blue()); + try { + BOOST_LOG_TRIVIAL(info) << "no filament_id in filament_list and reset vt_tray and the filament_id is: " << vt_tray.setting_id; + this->command_ams_filament_settings(255, std::stoi(vt_tray.id), "", "", std::string(col_buf), "", 0, 0); + } catch (...) { + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << " stoi error and tray_id" << vt_tray.id; + } + } } else { vt_tray.setting_id = ""; @@ -3985,6 +4061,12 @@ int MachineObject::parse_json(std::string payload) vt_tray.bed_temp = jj["vt_tray"]["bed_temp"].get(); else vt_tray.bed_temp = ""; + if (jj["vt_tray"].contains("tray_color")) { + auto color = jj["vt_tray"]["tray_color"].get(); + vt_tray.update_color_from_str(color); + } else { + vt_tray.color = ""; + } if (jj["vt_tray"].contains("nozzle_temp_max")) vt_tray.nozzle_temp_max = jj["vt_tray"]["nozzle_temp_max"].get(); else @@ -3993,6 +4075,22 @@ int MachineObject::parse_json(std::string payload) vt_tray.nozzle_temp_min = jj["vt_tray"]["nozzle_temp_min"].get(); else vt_tray.nozzle_temp_min = ""; + if (vt_tray.nozzle_temp_min != "" && vt_tray.nozzle_temp_max != "") { + try { + std::string preset_setting_id; + bool is_equation = preset_bundle->check_filament_temp_equation_by_printer_type_and_nozzle_for_mas_tray( + MachineObject::get_preset_printer_model_name(this->printer_type), nozzle_diameter_str, vt_tray.setting_id, vt_tray.tag_uid, + vt_tray.nozzle_temp_min, vt_tray.nozzle_temp_max, preset_setting_id); + if (!is_equation) { + command_ams_filament_settings(255, std::stoi(vt_tray.id), vt_tray.setting_id, preset_setting_id, vt_tray.color, vt_tray.type, + std::stoi(vt_tray.nozzle_temp_min), std::stoi(vt_tray.nozzle_temp_max)); + } + } + catch(...) { + BOOST_LOG_TRIVIAL(info) << "check fail and vt_tray.id" << vt_tray.id; + } + + } if (jj["vt_tray"].contains("xcam_info")) vt_tray.xcam_info = jj["vt_tray"]["xcam_info"].get(); else @@ -4001,13 +4099,6 @@ int MachineObject::parse_json(std::string payload) vt_tray.uuid = jj["vt_tray"]["tray_uuid"].get(); else vt_tray.uuid = "0"; - if (jj["vt_tray"].contains("tray_color")) { - auto color = jj["vt_tray"]["tray_color"].get(); - vt_tray.update_color_from_str(color); - } - else { - vt_tray.color = ""; - } if (jj["vt_tray"].contains("cali_idx")) vt_tray.cali_idx = jj["vt_tray"]["cali_idx"].get(); @@ -5450,7 +5541,7 @@ std::vector DeviceManager::get_resolution_supported(std::string typ std::vector resolution_supported; std::string config_file = Slic3r::resources_dir() + "/printers/" + type_str + ".json"; - std::ifstream json_file(config_file.c_str()); + boost::nowide::ifstream json_file(config_file.c_str()); try { json jj; if (json_file.is_open()) { @@ -5472,7 +5563,7 @@ std::vector DeviceManager::get_compatible_machine(std::string type_ { std::vector compatible_machine; std::string config_file = Slic3r::resources_dir() + "/printers/" + type_str + ".json"; - std::ifstream json_file(config_file.c_str()); + boost::nowide::ifstream json_file(config_file.c_str()); try { json jj; if (json_file.is_open()) { @@ -5491,10 +5582,12 @@ std::vector DeviceManager::get_compatible_machine(std::string type_ } -bool DeviceManager::load_filaments_blacklist_config(std::string config_file) +bool DeviceManager::load_filaments_blacklist_config() { filaments_blacklist = json::object(); - std::ifstream json_file(config_file.c_str()); + + std::string config_file = Slic3r::resources_dir() + "/printers/filaments_blacklist.json"; + boost::nowide::ifstream json_file(config_file.c_str()); try { if (json_file.is_open()) { @@ -5593,4 +5686,10 @@ std::string DeviceManager::load_gcode(std::string type_str, std::string gcode_fi return ""; } +void change_the_opacity(wxColour& colour) +{ + if (colour.Alpha() == 255) { + colour = wxColour(colour.Red(), colour.Green(), colour.Blue(), 254); + } +} } // namespace Slic3r diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index 1c3c5881b9..b8e7f3d451 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -133,6 +133,7 @@ enum ManualPaCaliMethod { PA_PATTERN, }; + struct RatingInfo { bool request_successful; int http_code; @@ -289,6 +290,7 @@ public: unsigned reserved; HMSMessageLevel msg_level = HMS_UNKNOWN; int msg_code = 0; + bool already_read = false; bool parse_hms_info(unsigned attr, unsigned code); std::string get_long_error_code(); @@ -622,6 +624,7 @@ public: std::vector selected_cali_preset; float cache_flow_ratio { 0.0 }; bool cali_finished = true; + FlowRatioCalibrationType flow_ratio_calibration_type = FlowRatioCalibrationType::COMPLETE_CALIBRATION; ManualPaCaliMethod manual_pa_cali_method = ManualPaCaliMethod::PA_LINE; bool has_get_pa_calib_tab{ false }; @@ -694,6 +697,7 @@ public: std::string tutk_state; enum LiveviewLocal { LVL_None, + LVL_Disable, LVL_Local, LVL_Rtsps, LVL_Rtsp @@ -704,6 +708,8 @@ public: bool file_model_download{false}; bool virtual_camera{false}; + int nozzle_setting_hold_count = 0; + bool xcam_ai_monitoring{ false }; int xcam_ai_monitoring_hold_count = 0; std::string xcam_ai_monitoring_sensitivity; @@ -1026,11 +1032,13 @@ public: static bool get_printer_is_enclosed(std::string type_str); static std::vector get_resolution_supported(std::string type_str); static std::vector get_compatible_machine(std::string type_str); - static bool load_filaments_blacklist_config(std::string config_file); + static bool load_filaments_blacklist_config(); static void check_filaments_in_blacklist(std::string tag_vendor, std::string tag_type, bool& in_blacklist, std::string& ac, std::string& info); static std::string load_gcode(std::string type_str, std::string gcode_file); }; +// change the opacity +void change_the_opacity(wxColour& colour); } // namespace Slic3r #endif // slic3r_DeviceManager_hpp_ diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index aa366e20ec..0cbda20b45 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -82,7 +82,6 @@ wxString get_thumbnails_string(const std::vector& values) return ret_str; } - Field::~Field() { if (m_on_kill_focus) @@ -93,11 +92,6 @@ Field::~Field() m_back_to_initial_value = nullptr; if (m_back_to_sys_value) m_back_to_sys_value = nullptr; - if (getWindow()) { - wxWindow* win = getWindow(); - win->Destroy(); - win = nullptr; - } } void Field::PostInitialize() @@ -133,6 +127,8 @@ void Field::PostInitialize() if (getWindow()) { if (m_opt.readonly) { this->disable(); + } else { + this->enable(); } getWindow()->Bind(wxEVT_KEY_UP, [](wxKeyEvent& evt) { if ((evt.GetModifiers() & wxMOD_CONTROL) != 0) { @@ -161,7 +157,7 @@ void Field::PostInitialize() } evt.Skip(); - }); + }, getWindow()->GetId()); } } @@ -302,6 +298,7 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true m_value.clear(); break; } + std::string opt_key_without_idx = m_opt_id.substr(0, m_opt_id.find('#')); if (m_opt_id == "filament_flow_ratio") { if (m_value.empty() || boost::any_cast(m_value) != val) { wxString msg_text = format_wxstr(_L("Value %s is out of range, continue?"), str); @@ -318,6 +315,21 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true } } } + else if(m_opt_id == "filament_retraction_distances_when_cut" || opt_key_without_idx == "retraction_distances_when_cut"){ + if (m_value.empty() || boost::any_cast(m_value) != val) { + wxString msg_text = format_wxstr(_L("Value %s is out of range. The valid range is from %d to %d."), str, m_opt.min, m_opt.max); + WarningDialog dialog(m_parent, msg_text, _L("Parameter validation") + ": " + m_opt_id, wxYES); + if (dialog.ShowModal()) { + if (m_value.empty()) { + if (m_opt.min > val) val = m_opt.min; + if (val > m_opt.max) val = m_opt.max; + } + else + val = boost::any_cast(m_value); + set_value(double_to_string(val), true); + } + } + } else { show_error(m_parent, _L("Value is out of range.")); if (m_opt.min > val) val = m_opt.min; @@ -490,6 +502,101 @@ void Field::sys_color_changed() #endif } +std::vector**> spools; +std::vector*> spools2; + +void switch_window_pools() +{ + for (auto p : spools) { + spools2.push_back(*p); + *p = new std::deque; + } +} + +void release_window_pools() +{ + for (auto p : spools2) { + delete p; + } + spools2.clear(); +} + +template +struct Builder +{ + Builder() + { + pool_ = new std::deque; + spools.push_back(&pool_); + } + + template + T *build(wxWindow * p, Args ...args) + { + if (pool_->empty()) { + auto t = new T(p, args...); + t->SetClientData(pool_); + return t; + } + auto t = dynamic_cast(pool_->front()); + pool_->pop_front(); + t->Reparent(p); + t->Enable(); + t->Show(); + return t; + } + std::deque* pool_; +}; + +struct wxEventFunctorRef +{ + wxEventFunctor * func; +}; + +wxEventFunctor & wxMakeEventFunctor(const int, wxEventFunctorRef func) +{ + return *func.func; +} + +struct myEvtHandler : wxEvtHandler +{ + void UnbindAll() + { + size_t cookie; + for (wxDynamicEventTableEntry *entry = GetFirstDynamicEntry(cookie); + entry; + entry = GetNextDynamicEntry(cookie)) { + // In Field, All Bind has id, but for TextInput, ComboBox, SpinInput, all not + if (entry->m_id != wxID_ANY && entry->m_lastId == wxID_ANY) + Unbind(entry->m_eventType, + wxEventFunctorRef{entry->m_fn}, + entry->m_id, + entry->m_lastId, + entry->m_callbackUserData); + //DoUnbind(entry->m_id, entry->m_lastId, entry->m_eventType, *entry->m_fn, entry->m_callbackUserData); + } + } +}; + +static void unbind_events(wxEvtHandler *h) +{ + static_cast(h)->UnbindAll(); +} + +void free_window(wxWindow *win) +{ + unbind_events(win); + for (auto c : win->GetChildren()) + if (dynamic_cast(c)) + unbind_events(c); + win->Hide(); + if (auto sizer = win->GetContainingSizer()) + sizer->Clear(); + win->Reparent(wxGetApp().mainframe); + if (win->GetClientData()) + reinterpret_cast*>(win->GetClientData())->push_back(win); +} + template bool is_defined_input_value(wxWindow* win, const ConfigOptionType& type) { @@ -554,10 +661,15 @@ void TextCtrl::BUILD() { // BBS: new param ui style // const long style = m_opt.multiline ? wxTE_MULTILINE : wxTE_PROCESS_ENTER/*0*/; + static Builder builder1; + static Builder<::TextInput> builder2; auto temp = m_opt.multiline - ? (wxWindow *) new wxTextCtrl(m_parent, wxID_ANY, text_value, wxDefaultPosition, size, wxTE_MULTILINE) - : new ::TextInput(m_parent, text_value, _L(m_opt.sidetext), "", wxDefaultPosition, size, wxTE_PROCESS_ENTER); + ? (wxWindow*)builder1.build(m_parent, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE) + : builder2.build(m_parent, "", "", "", wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER); + temp->SetLabel(_L(m_opt.sidetext)); auto text_ctrl = m_opt.multiline ? (wxTextCtrl *)temp : ((TextInput *) temp)->GetTextCtrl(); + text_ctrl->SetLabel(text_value); + temp->SetSize(size); m_combine_side_text = !m_opt.multiline; if (parent_is_custom_ctrl && m_opt.height < 0) opt_height = (double) text_ctrl->GetSize().GetHeight() / m_em_unit; @@ -620,7 +732,7 @@ void TextCtrl::BUILD() { if (!bEnterPressed) propagate_value(); }), temp->GetId()); -/* + /* // select all text using Ctrl+A temp->Bind(wxEVT_CHAR, ([temp](wxKeyEvent& event) { @@ -789,7 +901,8 @@ void CheckBox::BUILD() { m_last_meaningful_value = static_cast(check_value); // BBS: use ::CheckBox - auto temp = new ::CheckBox(m_parent); + static Builder<::CheckBox> builder; + auto temp = builder.build(m_parent); if (!wxOSX) temp->SetBackgroundStyle(wxBG_STYLE_PAINT); //temp->SetBackgroundColour(*wxWHITE); temp->SetValue(check_value); @@ -908,8 +1021,14 @@ void SpinCtrl::BUILD() { ? 0 : m_opt.min; const int max_val = m_opt.max < 2147483647 ? m_opt.max : 2147483647; - auto temp = new SpinInput(m_parent, text_value, _L(m_opt.sidetext), wxDefaultPosition, size, - wxSP_ARROW_KEYS, min_val, max_val, default_value); + static Builder builder; + auto temp = builder.build(m_parent, "", "", wxDefaultPosition, wxDefaultSize, + wxSP_ARROW_KEYS); + temp->SetSize(size); + temp->SetLabel(_L(m_opt.sidetext)); + temp->GetTextCtrl()->SetLabel(text_value); + temp->SetRange(min_val, max_val); + temp->SetValue(default_value); m_combine_side_text = true; #ifdef __WXGTK3__ wxSize best_sz = temp->GetBestSize(); @@ -932,7 +1051,7 @@ void SpinCtrl::BUILD() { } propagate_value(); - })); + }), temp->GetId()); temp->Bind(wxEVT_SPINCTRL, ([this](wxCommandEvent e) { propagate_value(); }), temp->GetId()); @@ -1084,14 +1203,15 @@ void Choice::BUILD() if (m_opt.nullable) m_last_meaningful_value = dynamic_cast(m_opt.default_value.get())->get_at(0); - choice_ctrl* temp; + choice_ctrl * temp; auto dynamic_list = dynamic_lists.find(m_opt.opt_key); if (dynamic_list != dynamic_lists.end()) m_list = dynamic_list->second; if (m_opt.gui_type != ConfigOptionDef::GUIType::undefined && m_opt.gui_type != ConfigOptionDef::GUIType::select_open && m_list == nullptr) { m_is_editable = true; - temp = new choice_ctrl(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr, wxTE_PROCESS_ENTER); + static Builder builder1; + temp = builder1.build(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, wxDefaultSize, 0, nullptr, wxTE_PROCESS_ENTER); } else { #ifdef UNDEIFNED__WXOSX__ // __WXOSX__ // BBS @@ -1103,9 +1223,12 @@ void Choice::BUILD() temp->SetTextCtrlStyle(wxTE_READONLY); temp->Create(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr); #else - temp = new choice_ctrl(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr, wxCB_READONLY); + static Builder builder2; + temp = builder2.build(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY); #endif //__WXOSX__ } + temp->SetSize(size); + temp->Clear(); temp->GetDropDown().SetUseContentWidth(true); if (parent_is_custom_ctrl && m_opt.height < 0) opt_height = (double) temp->GetTextCtrl()->GetSize().GetHeight() / m_em_unit; @@ -1158,9 +1281,9 @@ void Choice::BUILD() e.StopPropagation(); else e.Skip(); - }); - temp->Bind(wxEVT_COMBOBOX_DROPDOWN, [this](wxCommandEvent&) { m_is_dropped = true; }); - temp->Bind(wxEVT_COMBOBOX_CLOSEUP, [this](wxCommandEvent&) { m_is_dropped = false; }); + }, temp->GetId()); + temp->Bind(wxEVT_COMBOBOX_DROPDOWN, [this](wxCommandEvent&) { m_is_dropped = true; }, temp->GetId()); + temp->Bind(wxEVT_COMBOBOX_CLOSEUP, [this](wxCommandEvent&) { m_is_dropped = false; }, temp->GetId()); temp->Bind(wxEVT_COMBOBOX, [this](wxCommandEvent&) { on_change_field(); }, temp->GetId()); @@ -1169,12 +1292,12 @@ void Choice::BUILD() e.Skip(); if (!bEnterPressed) propagate_value(); - } ); + }, temp->GetId() ); temp->Bind(wxEVT_TEXT_ENTER, [this](wxEvent& e) { EnterPressed enter(this); propagate_value(); - } ); + }, temp->GetId() ); } temp->SetToolTip(get_tooltip_text(temp->GetValue())); diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index cec2f1e405..1661eb003e 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -4080,16 +4080,19 @@ void GCodeViewer::render_all_plates_stats(const std::vectorget("use_inches") == "1"; float window_padding = 4.0f * m_scale; const float icon_size = ImGui::GetTextLineHeight() * 0.7; - std::vector offsets; + std::map offsets; std::map model_volume_of_extruders_all_plates; // map std::map flushed_volume_of_extruders_all_plates; // map std::map wipe_tower_volume_of_extruders_all_plates; // map + std::map support_volume_of_extruders_all_plates; // map std::vector model_used_filaments_m_all_plates; std::vector model_used_filaments_g_all_plates; std::vector flushed_filaments_m_all_plates; std::vector flushed_filaments_g_all_plates; std::vector wipe_tower_used_filaments_m_all_plates; std::vector wipe_tower_used_filaments_g_all_plates; + std::vector support_used_filaments_m_all_plates; + std::vector support_used_filaments_g_all_plates; float total_time_all_plates = 0.0f; float total_cost_all_plates = 0.0f; bool show_detailed_statistics_page = false; @@ -4098,6 +4101,7 @@ void GCodeViewer::render_all_plates_stats(const std::vector(m_time_estimate_mode)]; total_time_all_plates += plate_time_mode.time; @@ -4227,6 +4237,13 @@ void GCodeViewer::render_all_plates_stats(const std::vectorsecond, it->first); + if (support_filament_m != 0.0 || support_filament_g != 0.0) + displayed_columns |= ColumnData::Support; + support_used_filaments_m_all_plates.push_back(support_filament_m); + support_used_filaments_g_all_plates.push_back(support_filament_g); + } char buff[64]; double longest_str = 0.0; @@ -4236,21 +4253,30 @@ void GCodeViewer::render_all_plates_stats(const std::vector>> title_columns; + if (displayed_columns & ColumnData::Model) { + title_columns.push_back({ _u8L("Filament"), {""} }); + title_columns.push_back({ _u8L("Model"), {buff} }); } - else if (displayed_columns == (ColumnData::Model | ColumnData::Flushed)) { - offsets = calculate_offsets({ {_u8L("Filament"), {""}}, {_u8L("Model"), {buff}}, {_u8L("Flushed"), {buff}}, {_u8L("Total"), {buff}} }, icon_size); - append_headers({ {_u8L("Filament"), offsets[0]}, {_u8L("Model"), offsets[1]}, {_u8L("Flushed"), offsets[2]}, {_u8L("Total"), offsets[3]} }); + if (displayed_columns & ColumnData::Support) { + title_columns.push_back({ _u8L("Support"), {buff} }); } - else { - if (displayed_columns != (ColumnData::Model | ColumnData::Flushed | ColumnData::WipeTower)) - displayed_columns = (ColumnData::Model | ColumnData::Flushed | ColumnData::WipeTower); - - offsets = calculate_offsets({ {_u8L("Filament"), {""}}, {_u8L("Model"), {buff}}, {_u8L("Flushed"), {buff}}, {_u8L("Tower"), {buff}}, {_u8L("Total"), {buff}} }, icon_size); - append_headers({ {_u8L("Filament"), offsets[0]}, {_u8L("Model"), offsets[1]}, {_u8L("Flushed"), offsets[2]}, {_u8L("Tower"), offsets[3]}, {_u8L("Total"), offsets[4]} }); + if (displayed_columns & ColumnData::Flushed) { + title_columns.push_back({ _u8L("Flushed"), {buff} }); } + if (displayed_columns & ColumnData::WipeTower) { + title_columns.push_back({ _u8L("Tower"), {buff} }); + } + if ((displayed_columns & ~ColumnData::Model) > 0) { + title_columns.push_back({ _u8L("Total"), {buff} }); + } + auto offsets_ = calculate_offsets(title_columns, icon_size); + std::vector> title_offsets; + for (int i = 0; i < offsets_.size(); i++) { + title_offsets.push_back({ title_columns[i].first, offsets_[i] }); + offsets[title_columns[i].first] = offsets_[i]; + } + append_headers(title_offsets); } // item @@ -4259,39 +4285,43 @@ void GCodeViewer::render_all_plates_stats(const std::vector> columns_offsets; - columns_offsets.push_back({ std::to_string(it->first + 1), offsets[0] }); + columns_offsets.push_back({ std::to_string(it->first + 1), offsets[_u8L("Filament")]}); char buf[64]; double unit_conver = imperial_units ? GizmoObjectManipulation::oz_to_g : 1.0; - if (displayed_columns == ColumnData::Model) { - char buf[64]; - ::sprintf(buf, imperial_units ? "%.2f in %.2f oz" : "%.2f m %.2f g", model_used_filaments_m_all_plates[i], model_used_filaments_g_all_plates[i] / unit_conver); - columns_offsets.push_back({ buf, offsets[2] }); + + float column_sum_m = 0.0f; + float column_sum_g = 0.0f; + if (displayed_columns & ColumnData::Model) { + if ((displayed_columns & ~ColumnData::Model) > 0) + ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", model_used_filaments_m_all_plates[i], model_used_filaments_g_all_plates[i] / unit_conver); + else + ::sprintf(buf, imperial_units ? "%.2f in %.2f oz" : "%.2f m %.2f g", model_used_filaments_m_all_plates[i], model_used_filaments_g_all_plates[i] / unit_conver); + columns_offsets.push_back({ buf, offsets[_u8L("Model")] }); + column_sum_m += model_used_filaments_m_all_plates[i]; + column_sum_g += model_used_filaments_g_all_plates[i]; } - if (displayed_columns == (ColumnData::Model | ColumnData::Flushed)) { - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", model_used_filaments_m_all_plates[i], model_used_filaments_g_all_plates[i] / unit_conver); - columns_offsets.push_back({ buf, offsets[1] }); - - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", flushed_filaments_m_all_plates[i], flushed_filaments_g_all_plates[i] / unit_conver); - columns_offsets.push_back({ buf, offsets[2] }); - - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", (model_used_filaments_m_all_plates[i] + flushed_filaments_m_all_plates[i]), - (model_used_filaments_g_all_plates[i] + flushed_filaments_g_all_plates[i]) / unit_conver); - columns_offsets.push_back({ buf, offsets[3] }); + if (displayed_columns & ColumnData::Support) { + ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", support_used_filaments_m_all_plates[i], support_used_filaments_g_all_plates[i] / unit_conver); + columns_offsets.push_back({ buf, offsets[_u8L("Support")] }); + column_sum_m += support_used_filaments_m_all_plates[i]; + column_sum_g += support_used_filaments_g_all_plates[i]; } - if (displayed_columns == (ColumnData::Model | ColumnData::Flushed | ColumnData::WipeTower)) { - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", model_used_filaments_m_all_plates[i], model_used_filaments_g_all_plates[i] / unit_conver); - columns_offsets.push_back({ buf, offsets[1] }); - + if (displayed_columns & ColumnData::Flushed) { ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", flushed_filaments_m_all_plates[i], flushed_filaments_g_all_plates[i] / unit_conver); - columns_offsets.push_back({ buf, offsets[2] }); - + columns_offsets.push_back({ buf, offsets[_u8L("Flushed")] }); + column_sum_m += flushed_filaments_m_all_plates[i]; + column_sum_g += flushed_filaments_g_all_plates[i]; + } + if (displayed_columns & ColumnData::WipeTower) { ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", wipe_tower_used_filaments_m_all_plates[i], wipe_tower_used_filaments_g_all_plates[i] / unit_conver); - columns_offsets.push_back({ buf, offsets[3] }); - - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", (model_used_filaments_m_all_plates[i] + flushed_filaments_m_all_plates[i] + wipe_tower_used_filaments_m_all_plates[i]), - (model_used_filaments_g_all_plates[i] + flushed_filaments_g_all_plates[i] + wipe_tower_used_filaments_g_all_plates[i]) / unit_conver); - columns_offsets.push_back({ buf, offsets[4] }); + columns_offsets.push_back({ buf, offsets[_u8L("Tower")] }); + column_sum_m += wipe_tower_used_filaments_m_all_plates[i]; + column_sum_g += wipe_tower_used_filaments_g_all_plates[i]; + } + if ((displayed_columns & ~ColumnData::Model) > 0) { + ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", column_sum_m, column_sum_g / unit_conver); + columns_offsets.push_back({ buf, offsets[_u8L("Total")] }); } append_item(filament_colors[it->first], columns_offsets); @@ -4686,19 +4716,90 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv std::vector wipe_tower_used_filaments_m; std::vector wipe_tower_used_filaments_g; double total_wipe_tower_used_filament_m = 0, total_wipe_tower_used_filament_g = 0; + std::vector support_used_filaments_m; + std::vector support_used_filaments_g; + double total_support_used_filament_m = 0, total_support_used_filament_g = 0; struct ColumnData { enum { Model = 1, Flushed = 2, WipeTower = 4, + Support = 1 << 3, }; }; int displayed_columns = 0; + std::map color_print_offsets; const PrintStatistics& ps = wxGetApp().plater()->get_partplate_list().get_current_fff_print().print_statistics(); double koef = imperial_units ? GizmoObjectManipulation::in_to_mm : 1000.0; double unit_conver = imperial_units ? GizmoObjectManipulation::oz_to_g : 1; + // used filament statistics + for (size_t extruder_id : m_extruder_ids) { + if (m_print_statistics.volumes_per_extruder.find(extruder_id) == m_print_statistics.volumes_per_extruder.end()) { + model_used_filaments_m.push_back(0.0); + model_used_filaments_g.push_back(0.0); + } + else { + double volume = m_print_statistics.volumes_per_extruder.at(extruder_id); + auto [model_used_filament_m, model_used_filament_g] = get_used_filament_from_volume(volume, extruder_id); + model_used_filaments_m.push_back(model_used_filament_m); + model_used_filaments_g.push_back(model_used_filament_g); + total_model_used_filament_m += model_used_filament_m; + total_model_used_filament_g += model_used_filament_g; + displayed_columns |= ColumnData::Model; + } + } + + for (size_t extruder_id : m_extruder_ids) { + if (m_print_statistics.wipe_tower_volumes_per_extruder.find(extruder_id) == m_print_statistics.wipe_tower_volumes_per_extruder.end()) { + wipe_tower_used_filaments_m.push_back(0.0); + wipe_tower_used_filaments_g.push_back(0.0); + } + else { + double volume = m_print_statistics.wipe_tower_volumes_per_extruder.at(extruder_id); + auto [wipe_tower_used_filament_m, wipe_tower_used_filament_g] = get_used_filament_from_volume(volume, extruder_id); + wipe_tower_used_filaments_m.push_back(wipe_tower_used_filament_m); + wipe_tower_used_filaments_g.push_back(wipe_tower_used_filament_g); + total_wipe_tower_used_filament_m += wipe_tower_used_filament_m; + total_wipe_tower_used_filament_g += wipe_tower_used_filament_g; + displayed_columns |= ColumnData::WipeTower; + } + } + + for (size_t extruder_id : m_extruder_ids) { + if (m_print_statistics.flush_per_filament.find(extruder_id) == m_print_statistics.flush_per_filament.end()) { + flushed_filaments_m.push_back(0.0); + flushed_filaments_g.push_back(0.0); + } + else { + double volume = m_print_statistics.flush_per_filament.at(extruder_id); + auto [flushed_filament_m, flushed_filament_g] = get_used_filament_from_volume(volume, extruder_id); + flushed_filaments_m.push_back(flushed_filament_m); + flushed_filaments_g.push_back(flushed_filament_g); + total_flushed_filament_m += flushed_filament_m; + total_flushed_filament_g += flushed_filament_g; + displayed_columns |= ColumnData::Flushed; + } + } + + for (size_t extruder_id : m_extruder_ids) { + if (m_print_statistics.support_volumes_per_extruder.find(extruder_id) == m_print_statistics.support_volumes_per_extruder.end()) { + support_used_filaments_m.push_back(0.0); + support_used_filaments_g.push_back(0.0); + } + else { + double volume = m_print_statistics.support_volumes_per_extruder.at(extruder_id); + auto [used_filament_m, used_filament_g] = get_used_filament_from_volume(volume, extruder_id); + support_used_filaments_m.push_back(used_filament_m); + support_used_filaments_g.push_back(used_filament_g); + total_support_used_filament_m += used_filament_m; + total_support_used_filament_g += used_filament_g; + displayed_columns |= ColumnData::Support; + } + } + + // extrusion paths section -> title ImGui::Dummy({ window_padding, window_padding }); ImGui::SameLine(); @@ -4776,76 +4877,36 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv } case EViewType::ColorPrint: { - for (size_t extruder_id : m_extruder_ids) { - if (m_print_statistics.volumes_per_extruder.find(extruder_id) == m_print_statistics.volumes_per_extruder.end()) { - model_used_filaments_m.push_back(0.0); - model_used_filaments_g.push_back(0.0); - } - else { - double volume = m_print_statistics.volumes_per_extruder.at(extruder_id); - auto [model_used_filament_m, model_used_filament_g] = get_used_filament_from_volume(volume, extruder_id); - model_used_filaments_m.push_back(model_used_filament_m); - model_used_filaments_g.push_back(model_used_filament_g); - total_model_used_filament_m += model_used_filament_m; - total_model_used_filament_g += model_used_filament_g; - displayed_columns |= ColumnData::Model; - } - } - - for (size_t extruder_id : m_extruder_ids) { - if (m_print_statistics.wipe_tower_volumes_per_extruder.find(extruder_id) == m_print_statistics.wipe_tower_volumes_per_extruder.end()) { - wipe_tower_used_filaments_m.push_back(0.0); - wipe_tower_used_filaments_g.push_back(0.0); - } - else { - double volume = m_print_statistics.wipe_tower_volumes_per_extruder.at(extruder_id); - auto [wipe_tower_used_filament_m, wipe_tower_used_filament_g] = get_used_filament_from_volume(volume, extruder_id); - wipe_tower_used_filaments_m.push_back(wipe_tower_used_filament_m); - wipe_tower_used_filaments_g.push_back(wipe_tower_used_filament_g); - total_wipe_tower_used_filament_m += wipe_tower_used_filament_m; - total_wipe_tower_used_filament_g += wipe_tower_used_filament_g; - displayed_columns |= ColumnData::WipeTower; - } - } - - for (size_t extruder_id : m_extruder_ids) { - if (m_print_statistics.flush_per_filament.find(extruder_id) == m_print_statistics.flush_per_filament.end()) { - flushed_filaments_m.push_back(0.0); - flushed_filaments_g.push_back(0.0); - } - else { - double volume = m_print_statistics.flush_per_filament.at(extruder_id); - auto [flushed_filament_m, flushed_filament_g] = get_used_filament_from_volume(volume, extruder_id); - flushed_filaments_m.push_back(flushed_filament_m); - flushed_filaments_g.push_back(flushed_filament_g); - total_flushed_filament_m += flushed_filament_m; - total_flushed_filament_g += flushed_filament_g; - displayed_columns |= ColumnData::Flushed; - } - } - std::vector total_filaments; char buffer[64]; ::sprintf(buffer, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", ps.total_used_filament / /*1000*/koef, ps.total_weight / unit_conver); total_filaments.push_back(buffer); - if (displayed_columns == ColumnData::Model) { - offsets = calculate_offsets({ {_u8L("Filament"), {""}}, {_u8L("Model"), total_filaments}, {_u8L("Flushed"), total_filaments}, {_u8L("Total"), total_filaments} }, icon_size); - append_headers({ {_u8L("Filament"), offsets[0]}, {_u8L("Model"), offsets[2]}}); + std::vector>> title_columns; + if (displayed_columns & ColumnData::Model) { + title_columns.push_back({ _u8L("Filament"), {""} }); + title_columns.push_back({ _u8L("Model"), total_filaments }); } - else if (displayed_columns == (ColumnData::Model | ColumnData::Flushed)) { - offsets = calculate_offsets({ {_u8L("Filament"), {""}}, {_u8L("Model"), total_filaments}, {_u8L("Flushed"), total_filaments}, {_u8L("Total"), total_filaments} }, icon_size); - append_headers({ {_u8L("Filament"), offsets[0]}, {_u8L("Model"), offsets[1]}, {_u8L("Flushed"), offsets[2]}, {_u8L("Total"), offsets[3]} }); + if (displayed_columns & ColumnData::Support) { + title_columns.push_back({ _u8L("Support"), total_filaments }); } - else { - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "displayed_columns: " << displayed_columns; - if (displayed_columns != (ColumnData::Model | ColumnData::Flushed | ColumnData::WipeTower)) - displayed_columns = (ColumnData::Model | ColumnData::Flushed | ColumnData::WipeTower); - - offsets = calculate_offsets({ {_u8L("Filament"), {""}}, {_u8L("Model"), total_filaments}, {_u8L("Flushed"), total_filaments}, {_u8L("Tower"), total_filaments}, {_u8L("Total"), total_filaments} }, icon_size); - append_headers({ {_u8L("Filament"), offsets[0]}, {_u8L("Model"), offsets[1]}, {_u8L("Flushed"), offsets[2]}, {_u8L("Tower"), offsets[3]}, {_u8L("Total"), offsets[4]} }); + if (displayed_columns & ColumnData::Flushed) { + title_columns.push_back({ _u8L("Flushed"), total_filaments }); } + if (displayed_columns & ColumnData::WipeTower) { + title_columns.push_back({ _u8L("Tower"), total_filaments }); + } + if ((displayed_columns & ~ColumnData::Model) > 0) { + title_columns.push_back({ _u8L("Total"), total_filaments }); + } + auto offsets_ = calculate_offsets(title_columns, icon_size); + std::vector> title_offsets; + for (int i = 0; i < offsets_.size(); i++) { + title_offsets.push_back({ title_columns[i].first, offsets_[i] }); + color_print_offsets[title_columns[i].first] = offsets_[i]; + } + append_headers(title_offsets); break; } @@ -4986,40 +5047,42 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv const bool filament_visible = m_tools.m_tool_visibles[extruder_idx]; if (i < model_used_filaments_m.size() && i < model_used_filaments_g.size()) { std::vector> columns_offsets; - columns_offsets.push_back({ std::to_string(extruder_idx + 1), offsets[0] }); + columns_offsets.push_back({ std::to_string(extruder_idx + 1), color_print_offsets[_u8L("Filament")]}); char buf[64]; - if (displayed_columns == ColumnData::Model) { - char buf[64]; - ::sprintf(buf, imperial_units ? "%.2f in %.2f oz" : "%.2f m %.2f g", model_used_filaments_m[i], model_used_filaments_g[i] / unit_conver); - columns_offsets.push_back({ buf, offsets[2] }); + float column_sum_m = 0.0f; + float column_sum_g = 0.0f; + if (displayed_columns & ColumnData::Model) { + if ((displayed_columns & ~ColumnData::Model) > 0) + ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", model_used_filaments_m[i], model_used_filaments_g[i] / unit_conver); + else + ::sprintf(buf, imperial_units ? "%.2f in %.2f oz" : "%.2f m %.2f g", model_used_filaments_m[i], model_used_filaments_g[i] / unit_conver); + columns_offsets.push_back({ buf, color_print_offsets[_u8L("Model")] }); + column_sum_m += model_used_filaments_m[i]; + column_sum_g += model_used_filaments_g[i]; } - if (displayed_columns == (ColumnData::Model | ColumnData::Flushed)) { - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", model_used_filaments_m[i], model_used_filaments_g[i] / unit_conver); - columns_offsets.push_back({ buf, offsets[1] }); - - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", flushed_filaments_m[i], flushed_filaments_g[i] / unit_conver); - columns_offsets.push_back({ buf, offsets[2] }); - - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", (model_used_filaments_m[i] + flushed_filaments_m[i]), - (model_used_filaments_g[i] + flushed_filaments_g[i]) / unit_conver); - columns_offsets.push_back({ buf, offsets[3] }); + if (displayed_columns & ColumnData::Support) { + ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", support_used_filaments_m[i], support_used_filaments_g[i] / unit_conver); + columns_offsets.push_back({ buf, color_print_offsets[_u8L("Support")] }); + column_sum_m += support_used_filaments_m[i]; + column_sum_g += support_used_filaments_g[i]; } - if (displayed_columns == (ColumnData::Model | ColumnData::Flushed | ColumnData::WipeTower)) { - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", model_used_filaments_m[i], model_used_filaments_g[i] / unit_conver); - columns_offsets.push_back({ buf, offsets[1] }); - + if (displayed_columns & ColumnData::Flushed) { ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", flushed_filaments_m[i], flushed_filaments_g[i] / unit_conver); - columns_offsets.push_back({ buf, offsets[2] }); - + columns_offsets.push_back({ buf, color_print_offsets[_u8L("Flushed")]}); + column_sum_m += flushed_filaments_m[i]; + column_sum_g += flushed_filaments_g[i]; + } + if (displayed_columns & ColumnData::WipeTower) { ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", wipe_tower_used_filaments_m[i], wipe_tower_used_filaments_g[i] / unit_conver); - columns_offsets.push_back({ buf, offsets[3] }); - - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", (model_used_filaments_m[i] + flushed_filaments_m[i] + wipe_tower_used_filaments_m[i]), - (model_used_filaments_g[i] + flushed_filaments_g[i] + wipe_tower_used_filaments_g[i]) / unit_conver); - columns_offsets.push_back({ buf, offsets[4] }); + columns_offsets.push_back({ buf, color_print_offsets[_u8L("Tower")] }); + column_sum_m += wipe_tower_used_filaments_m[i]; + column_sum_g += wipe_tower_used_filaments_g[i]; + } + if ((displayed_columns & ~ColumnData::Model) > 0) { + ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", column_sum_m, column_sum_g / unit_conver); + columns_offsets.push_back({ buf, color_print_offsets[_u8L("Total")] }); } - append_item(EItemType::Rect, m_tools.m_tool_colors[extruder_idx], columns_offsets, false, filament_visible, [this, extruder_idx]() { m_tools.m_tool_visibles[extruder_idx] = !m_tools.m_tool_visibles[extruder_idx]; @@ -5035,6 +5098,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv if (need_scrollable) ImGui::EndChild(); + // Sum of all rows char buf[64]; if (m_extruder_ids.size() > 1) { // Separator @@ -5045,42 +5109,32 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv window->DrawList->AddLine(separator.Min, ImVec2(separator.Max.x, separator.Min.y), ImGui::GetColorU32(ImGuiCol_Separator)); std::vector> columns_offsets; - columns_offsets.push_back({ _u8L("Total"), offsets[0] }); - if (displayed_columns == ColumnData::Model) { - ::sprintf(buf, imperial_units ? "%.2f in %.2f oz" : "%.2f m %.2f g", total_model_used_filament_m, total_model_used_filament_g / unit_conver); - columns_offsets.push_back({ buf, offsets[2] }); - - append_item(EItemType::None, m_tools.m_tool_colors[0], columns_offsets); + columns_offsets.push_back({ _u8L("Total"), color_print_offsets[_u8L("Filament")]}); + if (displayed_columns & ColumnData::Model) { + if ((displayed_columns & ~ColumnData::Model) > 0) + ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_model_used_filament_m, total_model_used_filament_g / unit_conver); + else + ::sprintf(buf, imperial_units ? "%.2f in %.2f oz" : "%.2f m %.2f g", total_model_used_filament_m, total_model_used_filament_g / unit_conver); + columns_offsets.push_back({ buf, color_print_offsets[_u8L("Model")] }); } - if (displayed_columns == (ColumnData::Model | ColumnData::Flushed)) { - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_model_used_filament_m, total_model_used_filament_g / unit_conver); - columns_offsets.push_back({ buf, offsets[1] }); - - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_flushed_filament_m, total_flushed_filament_g / unit_conver); - columns_offsets.push_back({ buf, offsets[2] }); - - bool imperial_units = wxGetApp().app_config->get("use_inches") == "1"; - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_model_used_filament_m + total_flushed_filament_m , (total_model_used_filament_g + total_flushed_filament_g) / unit_conver); - columns_offsets.push_back({ buf, offsets[3] }); - - append_item(EItemType::None, m_tools.m_tool_colors[0], columns_offsets); + if (displayed_columns & ColumnData::Support) { + ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_support_used_filament_m, total_support_used_filament_g / unit_conver); + columns_offsets.push_back({ buf, color_print_offsets[_u8L("Support")] }); } - if (displayed_columns == (ColumnData::Model | ColumnData::Flushed | ColumnData::WipeTower)) { - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_model_used_filament_m, total_model_used_filament_g / unit_conver); - columns_offsets.push_back({ buf, offsets[1] }); - + if (displayed_columns & ColumnData::Flushed) { ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_flushed_filament_m, total_flushed_filament_g / unit_conver); - columns_offsets.push_back({ buf, offsets[2] }); - + columns_offsets.push_back({ buf, color_print_offsets[_u8L("Flushed")] }); + } + if (displayed_columns & ColumnData::WipeTower) { ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_wipe_tower_used_filament_m, total_wipe_tower_used_filament_g / unit_conver); - columns_offsets.push_back({ buf, offsets[3] }); - - bool imperial_units = wxGetApp().app_config->get("use_inches") == "1"; - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_model_used_filament_m + total_flushed_filament_m + total_wipe_tower_used_filament_m, (total_model_used_filament_g + total_flushed_filament_g + total_wipe_tower_used_filament_g) / unit_conver); - columns_offsets.push_back({ buf, offsets[4] }); - - append_item(EItemType::None, m_tools.m_tool_colors[0], columns_offsets); + columns_offsets.push_back({ buf, color_print_offsets[_u8L("Tower")] }); } + if ((displayed_columns & ~ColumnData::Model) > 0) { + ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_model_used_filament_m + total_support_used_filament_m + total_flushed_filament_m + total_wipe_tower_used_filament_m, + (total_model_used_filament_g + total_support_used_filament_g + total_flushed_filament_g + total_wipe_tower_used_filament_g) / unit_conver); + columns_offsets.push_back({ buf, color_print_offsets[_u8L("Total")] }); + } + append_item(EItemType::None, m_tools.m_tool_colors[0], columns_offsets); } //BBS display filament change times @@ -5521,7 +5575,8 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv ImGui::Dummy({ window_padding, window_padding }); ImGui::SameLine(); imgui.title(time_title); - std::string filament_str = _u8L("Filament"); + std::string total_filament_str = _u8L("Total Filament"); + std::string model_filament_str = _u8L("Model Filament"); std::string cost_str = _u8L("Cost"); std::string prepare_str = _u8L("Prepare time"); std::string print_str = _u8L("Model printing time"); @@ -5535,7 +5590,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv max_len += std::max(ImGui::CalcTextSize(cost_str.c_str()).x, std::max(ImGui::CalcTextSize(print_str.c_str()).x, std::max(std::max(ImGui::CalcTextSize(prepare_str.c_str()).x, ImGui::CalcTextSize(total_str.c_str()).x), - ImGui::CalcTextSize(filament_str.c_str()).x))); + std::max(ImGui::CalcTextSize(total_filament_str.c_str()).x, ImGui::CalcTextSize(model_filament_str.c_str()).x)))); else max_len += std::max(ImGui::CalcTextSize(print_str.c_str()).x, (std::max(ImGui::CalcTextSize(prepare_str.c_str()).x, ImGui::CalcTextSize(total_str.c_str()).x))); @@ -5545,24 +5600,34 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv //BBS display filament cost ImGui::Dummy({ window_padding, window_padding }); ImGui::SameLine(); - imgui.text(filament_str + ":"); + imgui.text(total_filament_str + ":"); ImGui::SameLine(max_len); - //BBS: use current plater's print statistics bool imperial_units = wxGetApp().app_config->get("use_inches") == "1"; char buf[64]; - ::sprintf(buf, imperial_units ? "%.2f in" : "%.2f m", ps.total_used_filament / /*1000*/koef); + ::sprintf(buf, imperial_units ? "%.2f in" : "%.2f m", ps.total_used_filament / koef); imgui.text(buf); ImGui::SameLine(); ::sprintf(buf, imperial_units ? " %.2f oz" : " %.2f g", ps.total_weight / unit_conver); imgui.text(buf); + ImGui::Dummy({ window_padding, window_padding }); + ImGui::SameLine(); + imgui.text(model_filament_str + ":"); + ImGui::SameLine(max_len); + auto exlude_m = total_support_used_filament_m + total_flushed_filament_m + total_wipe_tower_used_filament_m; + auto exlude_g = total_support_used_filament_g + total_flushed_filament_g + total_wipe_tower_used_filament_g; + ::sprintf(buf, imperial_units ? "%.2f in" : "%.2f m", ps.total_used_filament / koef - exlude_m); + imgui.text(buf); + ImGui::SameLine(); + ::sprintf(buf, imperial_units ? " %.2f oz" : " %.2f g", (ps.total_weight - exlude_g) / unit_conver); + imgui.text(buf); + //BBS: display cost of filaments ImGui::Dummy({ window_padding, window_padding }); ImGui::SameLine(); imgui.text(cost_str + ":"); ImGui::SameLine(max_len); - ::sprintf(buf, "%.2f", ps.total_cost); imgui.text(buf); } diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 26486c6259..29addc6738 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -657,7 +657,7 @@ void GLCanvas3D::LayersEditing::generate_layer_height_texture() bool level_of_detail_2nd_level = true; m_layers_texture.cells = Slic3r::generate_layer_height_texture( *m_slicing_parameters, - Slic3r::generate_object_layers(*m_slicing_parameters, m_layer_height_profile), + Slic3r::generate_object_layers(*m_slicing_parameters, m_layer_height_profile, false), m_layers_texture.data.data(), m_layers_texture.height, m_layers_texture.width, level_of_detail_2nd_level); m_layers_texture.valid = true; } @@ -1024,6 +1024,8 @@ wxDEFINE_EVENT(EVT_GLCANVAS_EDIT_COLOR_CHANGE, wxKeyEvent); wxDEFINE_EVENT(EVT_GLCANVAS_JUMP_TO, wxKeyEvent); wxDEFINE_EVENT(EVT_GLCANVAS_UNDO, SimpleEvent); wxDEFINE_EVENT(EVT_GLCANVAS_REDO, SimpleEvent); +wxDEFINE_EVENT(EVT_GLCANVAS_SWITCH_TO_OBJECT, SimpleEvent); +wxDEFINE_EVENT(EVT_GLCANVAS_SWITCH_TO_GLOBAL, SimpleEvent); wxDEFINE_EVENT(EVT_GLCANVAS_COLLAPSE_SIDEBAR, SimpleEvent); wxDEFINE_EVENT(EVT_GLCANVAS_RELOAD_FROM_DISK, SimpleEvent); wxDEFINE_EVENT(EVT_GLCANVAS_RENDER_TIMER, wxTimerEvent/*RenderTimerEvent*/); @@ -1096,6 +1098,25 @@ void GLCanvas3D::load_arrange_settings() m_arrange_settings_fff_seq_print.is_seq_print = true; } +GLCanvas3D::ArrangeSettings& GLCanvas3D::get_arrange_settings() +{ + PrinterTechnology ptech = current_printer_technology(); + + auto* ptr = &m_arrange_settings_fff; + + if (ptech == ptSLA) { + ptr = &m_arrange_settings_sla; + } + else if (ptech == ptFFF) { + if (wxGetApp().global_print_sequence() == PrintSequence::ByObject) + ptr = &m_arrange_settings_fff_seq_print; + else + ptr = &m_arrange_settings_fff; + } + + return *ptr; +} + int GLCanvas3D::GetHoverId() { if (m_hover_plate_idxs.size() == 0) { @@ -1152,7 +1173,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, Bed3D &bed) m_retina_helper.reset(new RetinaHelper(canvas)); #endif // ENABLE_RETINA_GL } - + m_timer_set_color.Bind(wxEVT_TIMER, &GLCanvas3D::on_set_color_timer, this); load_arrange_settings(); m_selection.set_volumes(&m_volumes.volumes); @@ -1347,7 +1368,36 @@ ModelInstanceEPrintVolumeState GLCanvas3D::check_volumes_outside_state() const return state; } -void GLCanvas3D::toggle_sla_auxiliaries_visibility(bool visible, const ModelObject* mo, int instance_idx) +void GLCanvas3D::toggle_selected_volume_visibility(bool selected_visible) +{ + m_render_sla_auxiliaries = !selected_visible; + if (selected_visible) { + const Selection::IndicesList &idxs = m_selection.get_volume_idxs(); + if (idxs.size() > 0) { + for (GLVolume *vol : m_volumes.volumes) { + if (vol->composite_id.object_id >= 1000 && vol->composite_id.object_id < 1000 + wxGetApp().plater()->get_partplate_list().get_plate_count()) + continue; // the wipe tower + if (vol->composite_id.volume_id >= 0) { + vol->is_active = false; + } + } + for (unsigned int idx : idxs) { + GLVolume *v = const_cast(m_selection.get_volume(idx)); + v->is_active = true; + } + } + } else { // show all + for (GLVolume *vol : m_volumes.volumes) { + if (vol->composite_id.object_id >= 1000 && vol->composite_id.object_id < 1000 + wxGetApp().plater()->get_partplate_list().get_plate_count()) + continue; // the wipe tower + if (vol->composite_id.volume_id >= 0) { + vol->is_active = true; + } + } + } +} + +void GLCanvas3D::toggle_sla_auxiliaries_visibility(bool visible, const ModelObject *mo, int instance_idx) { if (current_printer_technology() != ptSLA) return; @@ -1771,7 +1821,9 @@ void GLCanvas3D::render(bool only_init) if (!is_initialized() && !init()) return; - + if (m_canvas_type == ECanvasType::CanvasView3D && m_gizmos.get_current_type() == GLGizmosManager::Undefined) { + enable_return_toolbar(false); + } if (!m_main_toolbar.is_enabled()) m_gcode_viewer.init(wxGetApp().get_mode(), wxGetApp().preset_bundle); @@ -3170,15 +3222,25 @@ void GLCanvas3D::on_char(wxKeyEvent& evt) } // BBS: use keypad to change extruder - case '1': + case '1': { + if (!m_timer_set_color.IsRunning()) { + m_timer_set_color.StartOnce(500); + break; + } + } + case '0': //Color logic for material 10 case '2': case '3': case '4': case '5': - case '6': + case '6': case '7': case '8': case '9': { + if (m_timer_set_color.IsRunning()) { + if (keyCode < '7') keyCode += 10; + m_timer_set_color.Stop(); + } if (m_gizmos.get_current_type() != GLGizmosManager::MmuSegmentation) obj_list->set_extruder_for_selected_items(keyCode - '0'); break; @@ -3720,6 +3782,14 @@ void GLCanvas3D::on_render_timer(wxTimerEvent& evt) // wxWakeUpIdle(); } +void GLCanvas3D::on_set_color_timer(wxTimerEvent& evt) +{ + auto obj_list = wxGetApp().obj_list(); + if (m_gizmos.get_current_type() != GLGizmosManager::MmuSegmentation) + obj_list->set_extruder_for_selected_items(1); + m_timer_set_color.Stop(); +} + void GLCanvas3D::schedule_extra_frame(int miliseconds) { @@ -4026,6 +4096,13 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) m_mouse.position = Vec2d(-1.0, -1.0); m_dirty = true; } + else if (evt.LeftDClick()) { + // switch to object panel if double click on object, otherwise switch to global panel if double click on background + if (selected_object_idx >= 0) + post_event(SimpleEvent(EVT_GLCANVAS_SWITCH_TO_OBJECT)); + else + post_event(SimpleEvent(EVT_GLCANVAS_SWITCH_TO_GLOBAL)); + } else if (evt.LeftDown() || evt.RightDown() || evt.MiddleDown()) { //BBS: add orient deactivate logic if (!m_gizmos.on_mouse(evt)) { @@ -4988,8 +5065,10 @@ std::vector GLCanvas3D::get_empty_cells(const Vec2f start_point, const Ve Vec2d vmin(build_volume.min.x(), build_volume.min.y()), vmax(build_volume.max.x(), build_volume.max.y()); BoundingBoxf bbox(vmin, vmax); std::vector cells; - for (float x = bbox.min.x()+step(0)/2; x < bbox.max.x()-step(0)/2; x += step(0)) - for (float y = bbox.min.y()+step(1)/2; y < bbox.max.y()-step(1)/2; y += step(1)) + auto min_x = start_point.x() - step(0) * int((start_point.x() - bbox.min.x()) / step(0)); + auto min_y = start_point.y() - step(1) * int((start_point.y() - bbox.min.y()) / step(1)); + for (float x = min_x; x < bbox.max.x() - step(0) / 2; x += step(0)) + for (float y = min_y; y < bbox.max.y() - step(1) / 2; y += step(1)) { cells.emplace_back(x, y); } @@ -5125,7 +5204,14 @@ void GLCanvas3D::update_sequential_clearance() // the results are then cached for following displacements if (m_sequential_print_clearance_first_displacement) { m_sequential_print_clearance.m_hull_2d_cache.clear(); - float shrink_factor = static_cast(scale_(0.5 * fff_print()->config().extruder_clearance_radius.value - EPSILON)); + bool all_objects_are_short = std::all_of(fff_print()->objects().begin(), fff_print()->objects().end(), \ + [&](PrintObject* obj) { return obj->height() < scale_(fff_print()->config().nozzle_height.value - MARGIN_HEIGHT); }); + float shrink_factor; + if (all_objects_are_short) + shrink_factor = scale_(0.5 * MAX_OUTER_NOZZLE_DIAMETER - 0.1); + else + shrink_factor = static_cast(scale_(0.5 * fff_print()->config().extruder_clearance_radius.value - EPSILON)); + double mitter_limit = scale_(0.1); m_sequential_print_clearance.m_hull_2d_cache.reserve(m_model->objects.size()); for (size_t i = 0; i < m_model->objects.size(); ++i) { @@ -5435,7 +5521,7 @@ bool GLCanvas3D::_render_arrange_menu(float left, float right, float bottom, flo PrinterTechnology ptech = current_printer_technology(); bool settings_changed = false; - float dist_min = 0.1f; // should be larger than 0 so objects won't touch + float dist_min = 0.f; // 0 means auto std::string dist_key = "min_object_distance", rot_key = "enable_rotation"; std::string bed_shrink_x_key = "bed_shrink_x", bed_shrink_y_key = "bed_shrink_y"; std::string multi_material_key = "allow_multi_materials_on_same_plate"; @@ -5446,17 +5532,12 @@ bool GLCanvas3D::_render_arrange_menu(float left, float right, float bottom, flo bool seq_print = false; if (ptech == ptSLA) { - dist_min = 0.1f; postfix = "_sla"; } else if (ptech == ptFFF) { - auto co_opt = m_config->option>("print_sequence"); - if (co_opt && (co_opt->value == PrintSequence::ByObject)) { - dist_min = float(min_object_distance(*m_config)); + seq_print = &settings == &m_arrange_settings_fff_seq_print; + if (seq_print) { postfix = "_fff_seq_print"; - //BBS: - seq_print = true; } else { - dist_min = 0.0f; postfix = "_fff"; } } @@ -5481,6 +5562,8 @@ bool GLCanvas3D::_render_arrange_menu(float left, float right, float bottom, flo appcfg->set("arrange", dist_key.c_str(), float_to_string_decimal_point(settings_out.distance)); settings_changed = true; } + imgui->text(_L("0 means auto spacing.")); + ImGui::Separator(); if (imgui->bbl_checkbox(_L("Auto rotate for arrangement"), settings.enable_rotation)) { settings_out.enable_rotation = settings.enable_rotation; @@ -6346,7 +6429,7 @@ void GLCanvas3D::_update_select_plate_toolbar_stats_item(bool force_selected) { bool GLCanvas3D::_update_imgui_select_plate_toolbar() { bool result = true; - if (!m_sel_plate_toolbar.is_enabled()) return false; + if (!m_sel_plate_toolbar.is_enabled() || m_sel_plate_toolbar.is_render_finish) return false; _update_select_plate_toolbar_stats_item(); @@ -7926,6 +8009,7 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar() } imgui.end(); + m_sel_plate_toolbar.is_render_finish = true; } //BBS: GUI refactor: GLToolbar adjust diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index bed5ac3ae1..5af8ee8aa9 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -187,6 +187,8 @@ wxDECLARE_EVENT(EVT_GLCANVAS_EDIT_COLOR_CHANGE, wxKeyEvent); wxDECLARE_EVENT(EVT_GLCANVAS_JUMP_TO, wxKeyEvent); wxDECLARE_EVENT(EVT_GLCANVAS_UNDO, SimpleEvent); wxDECLARE_EVENT(EVT_GLCANVAS_REDO, SimpleEvent); +wxDECLARE_EVENT(EVT_GLCANVAS_SWITCH_TO_OBJECT, SimpleEvent); +wxDECLARE_EVENT(EVT_GLCANVAS_SWITCH_TO_GLOBAL, SimpleEvent); wxDECLARE_EVENT(EVT_GLCANVAS_COLLAPSE_SIDEBAR, SimpleEvent); wxDECLARE_EVENT(EVT_GLCANVAS_RELOAD_FROM_DISK, SimpleEvent); wxDECLARE_EVENT(EVT_GLCANVAS_RENDER_TIMER, wxTimerEvent/*RenderTimerEvent*/); @@ -515,6 +517,7 @@ private: unsigned int m_last_w, m_last_h; bool m_in_render; wxTimer m_timer; + wxTimer m_timer_set_color; LayersEditing m_layers_editing; Mouse m_mouse; GLGizmosManager m_gizmos; @@ -607,25 +610,6 @@ private: PrinterTechnology current_printer_technology() const; - template - static auto & get_arrange_settings(Self *self) { - PrinterTechnology ptech = self->current_printer_technology(); - - auto *ptr = &self->m_arrange_settings_fff; - - if (ptech == ptSLA) { - ptr = &self->m_arrange_settings_sla; - } else if (ptech == ptFFF) { - auto co_opt = self->m_config->template option>("print_sequence"); - if (co_opt && (co_opt->value == PrintSequence::ByObject)) - ptr = &self->m_arrange_settings_fff_seq_print; - else - ptr = &self->m_arrange_settings_fff; - } - - return *ptr; - } - //BBS:record key botton frequency @@ -651,7 +635,11 @@ public: } void load_arrange_settings(); - ArrangeSettings& get_arrange_settings() { return get_arrange_settings(this); } + ArrangeSettings& get_arrange_settings();// { return get_arrange_settings(this); } + ArrangeSettings& get_arrange_settings(PrintSequence print_seq) { + return (print_seq == PrintSequence::ByObject) ? m_arrange_settings_fff_seq_print + : m_arrange_settings_fff; + } class SequentialPrintClearance { @@ -774,6 +762,7 @@ public: const GCodeViewer::SequentialView& get_gcode_sequential_view() const { return m_gcode_viewer.get_sequential_view(); } void update_gcode_sequential_view_current(unsigned int first, unsigned int last) { m_gcode_viewer.update_sequential_view_current(first, last); } + void toggle_selected_volume_visibility(bool selected_visible); void toggle_sla_auxiliaries_visibility(bool visible, const ModelObject* mo = nullptr, int instance_idx = -1); void toggle_model_objects_visibility(bool visible, const ModelObject* mo = nullptr, int instance_idx = -1, const ModelVolume* mv = nullptr); void update_instance_printable_state_for_object(size_t obj_idx); @@ -960,6 +949,7 @@ public: void on_mouse_wheel(wxMouseEvent& evt); void on_timer(wxTimerEvent& evt); void on_render_timer(wxTimerEvent& evt); + void on_set_color_timer(wxTimerEvent& evt); void on_mouse(wxMouseEvent& evt); void on_gesture(wxGestureEvent& evt); void on_paint(wxPaintEvent& evt); @@ -1068,6 +1058,17 @@ public: void highlight_toolbar_item(const std::string& item_name); void highlight_gizmo(const std::string& gizmo_name); + ArrangeSettings get_arrange_settings() const { + const ArrangeSettings &settings = get_arrange_settings(); + ArrangeSettings ret = settings; + if (&settings == &m_arrange_settings_fff_seq_print) { + ret.distance = std::max(ret.distance, + float(min_object_distance(*m_config))); + } + + return ret; + } + // Timestamp for FPS calculation and notification fade-outs. static int64_t timestamp_now() { #ifdef _WIN32 diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 5284595e0b..1d9c558b6b 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -149,6 +149,40 @@ namespace GUI { class MainFrame; +void start_ping_test() +{ + wxArrayString output; + wxExecute("ping www.amazon.com", output, wxEXEC_NODISABLE); + + wxString output_i; + std::string output_temp; + + for (int i = 0; i < output.size(); i++) { + output_i = output[i].To8BitData(); + output_temp = output_i.ToStdString(wxConvUTF8); + BOOST_LOG_TRIVIAL(info) << "ping amazon:" << output_temp; + + } + wxExecute("ping www.apple.com", output, wxEXEC_NODISABLE); + for (int i = 0; i < output.size(); i++) { + output_i = output[i].To8BitData(); + output_temp = output_i.ToStdString(wxConvUTF8); + BOOST_LOG_TRIVIAL(info) << "ping www.apple.com:" << output_temp; + } + wxExecute("ping www.bambulab.com", output, wxEXEC_NODISABLE); + for (int i = 0; i < output.size(); i++) { + output_i = output[i].To8BitData(); + output_temp = output_i.ToStdString(wxConvUTF8); + BOOST_LOG_TRIVIAL(info) << "ping bambulab:" << output_temp; + } + //Get GateWay IP + wxExecute("ping 192.168.0.1", output, wxEXEC_NODISABLE); + for (int i = 0; i < output.size(); i++) { + output_i = output[i].To8BitData(); + output_temp = output_i.ToStdString(wxConvUTF8); + BOOST_LOG_TRIVIAL(info) << "ping 192.168.0.1:" << output_temp; + } +} std::string VersionInfo::convert_full_version(std::string short_version) { @@ -474,9 +508,11 @@ static const FileWildcards file_wildcards_by_type[FT_SIZE] = { /* FT_3MF */ { "3MF files"sv, { ".3mf"sv } }, /* FT_GCODE */ { "G-code files"sv, { ".gcode"sv, ".3mf"sv } }, #ifdef __APPLE__ - /* FT_MODEL */ { "Supported files"sv, { ".3mf"sv, ".stl"sv, ".stp"sv, ".step"sv, ".svg"sv, ".amf"sv, ".obj"sv , ".usd"sv, ".usda"sv, ".usdc"sv, ".usdz"sv, ".abc"sv, ".ply"sv} }, + /* FT_MODEL */ + {"Supported files"sv, {".3mf"sv, ".stl"sv, ".oltp"sv, ".stp"sv, ".step"sv, ".svg"sv, ".amf"sv, ".obj"sv, ".usd"sv, ".usda"sv, ".usdc"sv, ".usdz"sv, ".abc"sv, ".ply"sv}}, #else - /* FT_MODEL */ {"Supported files"sv, {".3mf"sv, ".stl"sv, ".stp"sv, ".step"sv, ".svg"sv, ".amf"sv, ".obj"sv }}, + /* FT_MODEL */ + {"Supported files"sv, {".3mf"sv, ".stl"sv, ".oltp"sv, ".stp"sv, ".step"sv, ".svg"sv, ".amf"sv, ".obj"sv}}, #endif /* FT_PROJECT */ { "Project files"sv, { ".3mf"sv} }, /* FT_GALLERY */ { "Known files"sv, { ".stl"sv, ".obj"sv } }, @@ -993,8 +1029,7 @@ void GUI_App::post_init() }); - std::string filaments_blacklist_config_file = Slic3r::resources_dir() + "/printers/filaments_blacklist.json"; - DeviceManager::load_filaments_blacklist_config(encode_path(filaments_blacklist_config_file.c_str())); + DeviceManager::load_filaments_blacklist_config(); // remove old log files over LOG_FILES_MAX_NUM std::string log_addr = data_dir(); @@ -1935,7 +1970,7 @@ std::map GUI_App::get_extra_header() extra_headers.insert(std::make_pair("X-BBL-OS-Version", os_version)); if (app_config) extra_headers.insert(std::make_pair("X-BBL-Device-ID", app_config->get("slicer_uuid"))); - extra_headers.insert(std::make_pair("X-BBL-Language", convert_studio_language_to_api(app_config->get("language")))); + extra_headers.insert(std::make_pair("X-BBL-Language", convert_studio_language_to_api(into_u8(current_language_code_safe())))); return extra_headers; } @@ -2114,9 +2149,6 @@ bool GUI_App::on_init_inner() d->EndModal(wxID_ABORT); }); - std::map extra_headers = get_extra_header(); - Slic3r::Http::set_extra_headers(extra_headers); - // Verify resources path const wxString resources_dir = from_u8(Slic3r::resources_dir()); wxCHECK_MSG(wxDirExists(resources_dir), false, @@ -2379,6 +2411,10 @@ bool GUI_App::on_init_inner() Bind(EVT_SHOW_IP_DIALOG, &GUI_App::show_ip_address_enter_dialog_handler, this); + + std::map extra_headers = get_extra_header(); + Slic3r::Http::set_extra_headers(extra_headers); + copy_network_if_available(); on_init_network(); @@ -2555,7 +2591,7 @@ void GUI_App::copy_network_if_available() { if (app_config->get("update_network_plugin") != "true") return; - std::string network_library, player_library, network_library_dst, player_library_dst; + std::string network_library, player_library, live555_library, network_library_dst, player_library_dst, live555_library_dst; std::string data_dir_str = data_dir(); boost::filesystem::path data_dir_path(data_dir_str); auto plugin_folder = data_dir_path / "plugins"; @@ -2563,19 +2599,25 @@ void GUI_App::copy_network_if_available() std::string changelog_file = cache_folder.string() + "/network_plugins.json"; #if defined(_MSC_VER) || defined(_WIN32) network_library = cache_folder.string() + "/bambu_networking.dll"; - player_library = cache_folder.string() + "/BambuSource.dll"; + player_library = cache_folder.string() + "/BambuSource.dll"; + live555_library = cache_folder.string() + "/live555.dll"; network_library_dst = plugin_folder.string() + "/bambu_networking.dll"; - player_library_dst = plugin_folder.string() + "/BambuSource.dll"; + player_library_dst = plugin_folder.string() + "/BambuSource.dll"; + live555_library_dst = plugin_folder.string() + "/live555.dll"; #elif defined(__WXMAC__) network_library = cache_folder.string() + "/libbambu_networking.dylib"; player_library = cache_folder.string() + "/libBambuSource.dylib"; + live555_library = cache_folder.string() + "/liblive555.dylib"; network_library_dst = plugin_folder.string() + "/libbambu_networking.dylib"; player_library_dst = plugin_folder.string() + "/libBambuSource.dylib"; + live555_library_dst = plugin_folder.string() + "/liblive555.dylib"; #else network_library = cache_folder.string() + "/libbambu_networking.so"; - player_library = cache_folder.string() + "/libBambuSource.so"; + player_library = cache_folder.string() + "/libBambuSource.so"; + live555_library = cache_folder.string() + "/liblive555.so"; network_library_dst = plugin_folder.string() + "/libbambu_networking.so"; - player_library_dst = plugin_folder.string() + "/libBambuSource.so"; + player_library_dst = plugin_folder.string() + "/libBambuSource.so"; + live555_library_dst = plugin_folder.string() + "/liblive555.so"; #endif BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< ": checking network_library " << network_library << ", player_library " << player_library; @@ -2609,6 +2651,19 @@ void GUI_App::copy_network_if_available() fs::remove(player_library); BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< ": Copying player library from" << player_library << " to " << player_library_dst<<" successfully."; } + + if (boost::filesystem::exists(live555_library)) { + CopyFileResult cfr = copy_file(live555_library, live555_library_dst, error_message, false); + if (cfr != CopyFileResult::SUCCESS) { + BOOST_LOG_TRIVIAL(error) << __FUNCTION__<< ": Copying failed(" << cfr << "): " << error_message; + return; + } + + static constexpr const auto perms = fs::owner_read | fs::owner_write | fs::group_read | fs::others_read; + fs::permissions(live555_library_dst, perms); + fs::remove(live555_library); + BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< ": Copying live555 library from" << live555_library << " to " << live555_library_dst<<" successfully."; + } if (boost::filesystem::exists(changelog_file)) fs::remove(changelog_file); app_config->set("update_network_plugin", "false"); @@ -3136,7 +3191,10 @@ void GUI_App::check_printer_presets() #endif } -void GUI_App::recreate_GUI(const wxString& msg_name) +void switch_window_pools(); +void release_window_pools(); + +void GUI_App::recreate_GUI(const wxString &msg_name) { BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "recreate_GUI enter"; m_is_recreating_gui = true; @@ -3144,12 +3202,18 @@ void GUI_App::recreate_GUI(const wxString& msg_name) update_http_extra_header(); mainframe->shutdown(); - ProgressDialog dlg(msg_name, msg_name, 100, nullptr, wxPD_AUTO_HIDE); dlg.Pulse(); dlg.Update(10, _L("Rebuild") + dots); MainFrame *old_main_frame = mainframe; + struct ClientData : wxClientData + { + ~ClientData() { release_window_pools(); } + }; + old_main_frame->SetClientObject(new ClientData); + + switch_window_pools(); mainframe = new MainFrame(); if (is_editor()) // hide settings tabs after first Layout @@ -3218,6 +3282,7 @@ void GUI_App::ShowUserGuide() { if (res) { load_current_presets(); update_publish_status(); + mainframe->refresh_plugin_tips(); // BBS: remove SLA related message } } catch (std::exception &e) { @@ -5934,6 +5999,15 @@ int GUI_App::filaments_cnt() const return preset_bundle->filament_presets.size(); } +PrintSequence GUI_App::global_print_sequence() const +{ + PrintSequence global_print_seq = PrintSequence::ByDefault; + auto curr_preset_config = preset_bundle->prints.get_edited_preset().config; + if (curr_preset_config.has("print_sequence")) + global_print_seq = curr_preset_config.option>("print_sequence")->value; + return global_print_seq; +} + wxString GUI_App::current_language_code_safe() const { // Translate the language code to a code, for which Prusa Research maintains translations. @@ -6007,6 +6081,7 @@ bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage if (res) { load_current_presets(); update_publish_status(); + mainframe->refresh_plugin_tips(); // BBS: remove SLA related message } diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index f7606c8a07..21a38862fb 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -587,6 +587,7 @@ private: // BBS int filaments_cnt() const; + PrintSequence global_print_sequence() const; std::vector tabs_list; std::vector model_tabs_list; diff --git a/src/slic3r/GUI/GUI_Factories.cpp b/src/slic3r/GUI/GUI_Factories.cpp index 386e36d469..14fa20763b 100644 --- a/src/slic3r/GUI/GUI_Factories.cpp +++ b/src/slic3r/GUI/GUI_Factories.cpp @@ -87,7 +87,9 @@ std::map> SettingsFactory::OBJECT_C {"seam_position", "",2}, {"slice_closing_radius", "",3}, {"resolution", "",4}, {"xy_hole_compensation", "",5}, {"xy_contour_compensation", "",6}, {"elefant_foot_compensation", "",7}, - {"make_overhang_printable_angle","", 8},{"make_overhang_printable_hole_size","",9}, {"wall_sequence","",10} + {"make_overhang_printable_angle","", 8},{"make_overhang_printable_hole_size","",9}, {"wall_sequence","",10}, + {"precise_z_height", "",10} + }}, { L("Support"), {{"brim_type", "",1},{"brim_width", "",2},{"brim_object_gap", "",3}, {"enable_support", "",4},{"support_type", "",5},{"support_threshold_angle", "",6},{"support_on_build_plate_only", "",7}, diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 0f1f753acb..1f3ae959eb 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -699,6 +699,9 @@ void ObjectList::update_filament_values_for_items(const size_t filaments_count) void ObjectList::update_plate_values_for_items() { +#ifdef __WXOSX__ + AssociateModel(nullptr); +#endif PartPlateList& list = wxGetApp().plater()->get_partplate_list(); for (size_t i = 0; i < m_objects->size(); ++i) { @@ -724,6 +727,9 @@ void ObjectList::update_plate_values_for_items() Expand(item); Select(item); } +#ifdef __WXOSX__ + AssociateModel(m_objects_model); +#endif } // BBS @@ -3627,7 +3633,7 @@ void ObjectList::add_object_to_list(size_t obj_idx, bool call_selection_changed, //BBS start add obj_idx for debug PartPlateList& list = wxGetApp().plater()->get_partplate_list(); if (notify_partplate) { - list.notify_instance_update(obj_idx, 0); + list.notify_instance_update(obj_idx, 0, true); } //int plate_idx = list.find_instance_belongs(obj_idx, 0); //std::string item_name_str = (boost::format("[P%1%][O%2%]%3%") % plate_idx % std::to_string(obj_idx) % model_object->name).str(); @@ -3869,16 +3875,10 @@ void ObjectList::update_lock_icons_for_model() void ObjectList::delete_all_objects_from_list() { -#ifdef __WXOSX__ - AssociateModel(nullptr); -#endif m_prevent_list_events = true; reload_all_plates(); m_prevent_list_events = false; part_selection_changed(); -#ifdef __WXOSX__ - AssociateModel(m_objects_model); -#endif } void ObjectList::increase_object_instances(const size_t obj_idx, const size_t num) @@ -5697,6 +5697,9 @@ void ObjectList::on_plate_deleted(int plate_idx) void ObjectList::reload_all_plates(bool notify_partplate) { m_prevent_canvas_selection_update = true; +#ifdef __WXOSX__ + AssociateModel(nullptr); +#endif // Unselect all objects before deleting them, so that no change of selection is emitted during deletion. @@ -5726,6 +5729,9 @@ void ObjectList::reload_all_plates(bool notify_partplate) update_selections(); +#ifdef __WXOSX__ + AssociateModel(m_objects_model); +#endif m_prevent_canvas_selection_update = false; // update scene @@ -5853,6 +5859,7 @@ void ObjectList::toggle_printable_state() // update scene wxGetApp().plater()->update(); + wxGetApp().plater()->reload_paint_after_background_process_apply(); } ModelObject* ObjectList::object(const int obj_idx) const diff --git a/src/slic3r/GUI/GUI_ObjectSettings.cpp b/src/slic3r/GUI/GUI_ObjectSettings.cpp index ff9521b584..09ca8c64a8 100644 --- a/src/slic3r/GUI/GUI_ObjectSettings.cpp +++ b/src/slic3r/GUI/GUI_ObjectSettings.cpp @@ -209,36 +209,36 @@ bool ObjectSettings::update_settings_list() ModelObject * parent_object = nullptr; for (auto item : items) { auto type = objects_model->GetItemType(item); - if (type == itPlate) { - is_plate_settings = true; - - int plate_id = objects_model->GetPlateIdByItem(item); - - static ModelConfig cfg; - PartPlateList& ppl = wxGetApp().plater()->get_partplate_list(); - - if (plate_id < 0 || plate_id >= ppl.get_plate_count()) { - plate_id = ppl.get_curr_plate_index(); - } - assert(plate_id >= 0 && plate_id < ppl.get_plate_count()); - - cfg.assign_config(*ppl.get_plate(plate_id)->config()); - plate_configs.emplace(ppl.get_plate(plate_id), &cfg); - } - if (type != itObject && type != itVolume && type != itLayerRoot && type != itLayer) { + if (type != itPlate && type != itObject && type != itVolume && type != itLayerRoot && type != itLayer) { continue; } + int plate_id = objects_model->GetPlateIdByItem(item); + PartPlateList& ppl = wxGetApp().plater()->get_partplate_list(); + if (plate_id < 0 || plate_id >= ppl.get_plate_count()) { + plate_id = ppl.get_curr_plate_index(); + } + assert(plate_id >= 0 && plate_id < ppl.get_plate_count()); + static ModelConfig cfg; + cfg.assign_config(*ppl.get_plate(plate_id)->config()); + if (type == itPlate) { + is_plate_settings = true; + plate_configs.emplace(ppl.get_plate(plate_id), &cfg); + break; + } + const int obj_idx = objects_model->GetObjectIdByItem(item); assert(obj_idx >= 0); auto object = wxGetApp().model().objects[obj_idx]; if (type == itObject) { is_object_settings = true; + plate_configs.emplace(ppl.get_plate(plate_id), &cfg); object_configs.emplace(object, &object->config); } else if(type == itVolume){ is_volume_settings = true; if (parent_object && parent_object != object) return false; + plate_configs.emplace(ppl.get_plate(plate_id), &cfg); parent_object = object; const int vol_idx = objects_model->GetVolumeIdByItem(item); assert(vol_idx >= 0); @@ -249,6 +249,7 @@ bool ObjectSettings::update_settings_list() is_layer_range_settings = true; if (parent_object && parent_object != object) return false; + plate_configs.emplace(ppl.get_plate(plate_id), &cfg); parent_object = object; t_layer_height_range height_range = objects_model->GetLayerRangeByItem(item); @@ -265,38 +266,38 @@ bool ObjectSettings::update_settings_list() auto tab_layer = dynamic_cast(wxGetApp().get_layer_tab()); if (is_plate_settings) { + tab_plate->set_model_config(plate_configs); tab_object->set_model_config({}); tab_volume->set_model_config({}); tab_layer->set_model_config({}); - tab_plate->set_model_config(plate_configs); ;// m_tab_active = tab_plate; } else if (is_object_settings) { + tab_plate->set_model_config(plate_configs); tab_object->set_model_config(object_configs); tab_volume->set_model_config({}); tab_layer->set_model_config({}); - tab_plate->set_model_config({}); //m_tab_active = tab_object; } else if (is_volume_settings) { + tab_plate->set_model_config(plate_configs); tab_object->set_model_config({ {parent_object, &parent_object->config} }); tab_volume->set_model_config(object_configs); tab_layer->set_model_config({}); - tab_plate->set_model_config({}); //m_tab_active = tab_volume; } else if (is_layer_range_settings) { + tab_plate->set_model_config(plate_configs); tab_object->set_model_config({ {parent_object, &parent_object->config} }); tab_volume->set_model_config({}); tab_layer->set_model_config(object_configs); - tab_plate->set_model_config({}); //m_tab_active = tab_layer; } else { + tab_plate->set_model_config({}); tab_object->set_model_config({}); tab_volume->set_model_config({}); tab_layer->set_model_config({}); - tab_plate->set_model_config({}); //m_tab_active = nullptr; } ((ParamsPanel*) tab_object->GetParent())->set_active_tab(nullptr); diff --git a/src/slic3r/GUI/GUI_ObjectTable.cpp b/src/slic3r/GUI/GUI_ObjectTable.cpp index dd2e90b84d..56c1550c46 100644 --- a/src/slic3r/GUI/GUI_ObjectTable.cpp +++ b/src/slic3r/GUI/GUI_ObjectTable.cpp @@ -345,10 +345,16 @@ void GridCellFilamentsRenderer::Draw(wxGrid &grid, wxGridCellAttr &attr, wxDC &d dc.SetPen(*wxTRANSPARENT_PEN); dc.SetBrush(wxBrush(attr.GetBackgroundColour())); dc.DrawRectangle(rect); - if ( grid_row->model_volume_type != ModelVolumeType::NEGATIVE_VOLUME) { + if ((grid_row->model_volume_type != ModelVolumeType::NEGATIVE_VOLUME) && \ + (grid_row->model_volume_type != ModelVolumeType::SUPPORT_BLOCKER) && \ + (grid_row->model_volume_type != ModelVolumeType::SUPPORT_ENFORCER) && \ + (grid_row->model_volume_type != ModelVolumeType::PARAMETER_MODIFIER)) { dc.DrawBitmap(*bitmap, wxPoint(rect.x + offset_x, rect.y + offset_y)); } - + else if (grid_row->model_volume_type == ModelVolumeType::PARAMETER_MODIFIER){ + dc.DrawText("Default", wxPoint(rect.x + offset_x, rect.y + offset_y)); + } + text_rect.x += bitmap_width + grid_cell_border_width * 2; text_rect.width -= (bitmap_width + grid_cell_border_width * 2); } @@ -693,40 +699,44 @@ void GridCellSupportRenderer::Draw(wxGrid& grid, auto width = grid.GetColSize(col); wxGridCellRenderer::Draw(grid, attr, dc, rect, row, col, isSelected); - if (cur_option.value) { + wxString value = table->GetValue(row, col); + if (grid_row->row_type != table->GridRowType::row_volume || col != table->GridColType::col_printable) { + if (cur_option.value) { - auto check_on = create_scaled_bitmap("check_on", nullptr, 18); - dc.SetPen(*wxTRANSPARENT_PEN); + auto check_on = create_scaled_bitmap("check_on", nullptr, 18); + dc.SetPen(*wxTRANSPARENT_PEN); - auto offsetx = 0; - auto offsety = 0; + auto offsetx = 0; + auto offsety = 0; - #ifdef __WXOSX_MAC__ - offsetx = (width - 18) / 2; - offsety = (height - 18) / 2; - #else - offsetx = (width - check_on.GetSize().x) / 2; - offsety = (height - check_on.GetSize().y) / 2; - #endif // __WXOSX_MAC__ + #ifdef __WXOSX_MAC__ + offsetx = (width - 18) / 2; + offsety = (height - 18) / 2; + #else + offsetx = (width - check_on.GetSize().x) / 2; + offsety = (height - check_on.GetSize().y) / 2; + #endif // __WXOSX_MAC__ - dc.DrawBitmap(check_on, rect.x + offsetx, rect.y + offsety); + dc.DrawBitmap(check_on, rect.x + offsetx, rect.y + offsety); } else { - auto check_off = create_scaled_bitmap("check_off_focused", nullptr, 18); - dc.SetPen(*wxTRANSPARENT_PEN); + auto check_off = create_scaled_bitmap("check_off_focused", nullptr, 18); + dc.SetPen(*wxTRANSPARENT_PEN); - auto offsetx = 0; - auto offsety = 0; + auto offsetx = 0; + auto offsety = 0; - #ifdef __WXOSX_MAC__ - offsetx = (width - 18) / 2; - offsety = (height - 18) / 2; - #else - offsetx = (width - check_off.GetSize().x) / 2; - offsety = (height - check_off.GetSize().y) / 2; - #endif // __WXOSX_MAC__ + #ifdef __WXOSX_MAC__ + offsetx = (width - 18) / 2; + offsety = (height - 18) / 2; + #else + offsetx = (width - check_off.GetSize().x) / 2; + offsety = (height - check_off.GetSize().y) / 2; + #endif // __WXOSX_MAC__ - dc.DrawBitmap(check_off, rect.x + offsetx, rect.y + offsety); + dc.DrawBitmap(check_off, rect.x + offsetx, rect.y + offsety); + } } + } wxSize GridCellSupportRenderer::GetBestSize(wxGrid& grid, @@ -2764,6 +2774,10 @@ ObjectTablePanel::ObjectTablePanel( wxWindow* parent, wxWindowID id, const wxPoi m_object_settings->Hide(); //m_page_sizer->Add(m_page_top_sizer, 0, wxALIGN_CENTER_HORIZONTAL, 0); m_page_sizer->Add(m_object_settings->get_sizer(), 1, wxEXPAND | wxALL, 2 ); + m_side_window->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& evt) { + m_object_grid->SetFocus(); + evt.Skip(); + }); auto m_line_left = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(2, -1), wxTAB_TRAVERSAL); m_line_left->SetBackgroundColour(wxColour(0xA6, 0xa9, 0xAA)); @@ -2962,7 +2976,9 @@ void ObjectTablePanel::load_data() break; case coEnum: if (col == ObjectGridTable::col_filaments) { - if (grid_row->model_volume_type != ModelVolumeType::NEGATIVE_VOLUME) { + if ((grid_row->model_volume_type != ModelVolumeType::NEGATIVE_VOLUME) && \ + (grid_row->model_volume_type != ModelVolumeType::SUPPORT_BLOCKER) && \ + (grid_row->model_volume_type != ModelVolumeType::SUPPORT_ENFORCER)) { GridCellFilamentsEditor* filament_editor = new GridCellFilamentsEditor(grid_col->choices, false, &m_color_bitmaps); m_object_grid->SetCellEditor(row, col, filament_editor); m_object_grid->SetCellRenderer(row, col, new GridCellFilamentsRenderer()); diff --git a/src/slic3r/GUI/GUI_Preview.hpp b/src/slic3r/GUI/GUI_Preview.hpp index 2ce7e67ec1..9cb20f6573 100644 --- a/src/slic3r/GUI/GUI_Preview.hpp +++ b/src/slic3r/GUI/GUI_Preview.hpp @@ -107,6 +107,7 @@ class Preview : public wxPanel const Slic3r::PrintBase* m_loaded_print { nullptr }; //BBS: add only gcode mode bool m_only_gcode { false }; + bool m_reload_paint_after_background_process_apply{false}; public: enum class OptionType : unsigned int @@ -160,6 +161,8 @@ public: void show_sliders(bool show = true); void show_moves_sliders(bool show = true); void show_layers_sliders(bool show = true); + void set_reload_paint_after_background_process_apply(bool flag) { m_reload_paint_after_background_process_apply = flag; } + bool get_reload_paint_after_background_process_apply() { return m_reload_paint_after_background_process_apply; } private: bool init(wxWindow* parent, Bed3D& bed, Model* model); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp b/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp index 81c6e8710c..35cc3c7700 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp @@ -1862,10 +1862,13 @@ bool GLGizmoAdvancedCut::render_slider_double_input(const std::string &label, fl // slider_with + item_in_gap + first_input_width + item_out_gap + slider_with + item_in_gap + second_input_width double slider_with = 0.24 * m_editing_window_width; // m_control_width * 0.35; double item_in_gap = 0.01 * m_editing_window_width; - double item_out_gap = 0.01 * m_editing_window_width; - double first_input_width = 0.29 * m_editing_window_width; - double second_input_width = 0.29 * m_editing_window_width; - + double item_out_gap = 0.04 * m_editing_window_width; + double first_input_width = 0.37 * m_editing_window_width; + double second_input_width = 0.37 * m_editing_window_width; +#ifdef __APPLE__ + first_input_width = 0.5 * m_editing_window_width; + second_input_width = 0.5 * m_editing_window_width; +#endif ImGui::AlignTextToFramePadding(); m_imgui->text(label); ImGui::SameLine(m_label_width); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp index 0471d02358..3a57a895d6 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp @@ -248,6 +248,8 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l const float on_overhangs_only_width = m_imgui->calc_text_size(m_desc["on_overhangs_only"]).x + m_imgui->scaled(1.5f); const float remove_btn_width = m_imgui->calc_text_size(m_desc.at("remove_all")).x + m_imgui->scaled(1.5f); const float filter_btn_width = m_imgui->calc_text_size(m_desc.at("perform")).x + m_imgui->scaled(1.5f); + const float gap_area_txt_width = m_imgui->calc_text_size(m_desc.at("gap_area")).x + m_imgui->scaled(1.5f); + const float smart_fill_angle_txt_width = m_imgui->calc_text_size(m_desc.at("smart_fill_angle")).x + m_imgui->scaled(1.5f); const float buttons_width = remove_btn_width + filter_btn_width + m_imgui->scaled(1.5f); const float empty_button_width = m_imgui->calc_button_size("").x; @@ -263,7 +265,7 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l total_text_max += caption_max + m_imgui->scaled(1.f); caption_max += m_imgui->scaled(1.f); - const float sliders_left_width = std::max(reset_button_slider_left, std::max(std::max(cursor_slider_left, clipping_slider_left), std::max(highlight_slider_left, gap_fill_slider_left))); + const float sliders_left_width = std::max(gap_area_txt_width, std::max(smart_fill_angle_txt_width, std::max(reset_button_slider_left, std::max(std::max(cursor_slider_left, clipping_slider_left), std::max(highlight_slider_left, gap_fill_slider_left))))); const float slider_icon_width = m_imgui->get_slider_icon_size().x; const float max_tooltip_width = ImGui::GetFontSize() * 20.0f; @@ -374,7 +376,7 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l m_cursor_type = TriangleSelector::CursorType::POINTER; ImGui::AlignTextToFramePadding(); - m_imgui->text(m_desc["gap_area"] + ":"); + m_imgui->text(m_desc["gap_area"]); ImGui::SameLine(sliders_left_width); ImGui::PushItemWidth(sliders_width); std::string format_str = std::string("%.2f") + I18N::translate_utf8("", "Triangle patch area threshold,""triangle patch will be merged to neighbor if its area is less than threshold"); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp index 11886c142a..bd91482f65 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp @@ -250,7 +250,7 @@ void GLGizmoMmuSegmentation::render_triangles(const Selection &selection) const bool GLGizmoMmuSegmentation::on_number_key_down(int number) { int extruder_idx = number - 1; - if (extruder_idx < m_extruders_colors.size()) + if (extruder_idx < m_extruders_colors.size() && extruder_idx >= 0) m_selected_extruder_idx = extruder_idx; return true; @@ -487,7 +487,7 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott color_button_high = ImGui::GetCursorPos().y - color_button - 2.0; if (color_picked) { m_selected_extruder_idx = extruder_idx; } - if (extruder_idx < 9 && ImGui::IsItemHovered()) m_imgui->tooltip(_L("Shortcut Key ") + std::to_string(extruder_idx + 1), max_tooltip_width); + if (extruder_idx < 16 && ImGui::IsItemHovered()) m_imgui->tooltip(_L("Shortcut Key ") + std::to_string(extruder_idx + 1), max_tooltip_width); // draw filament id float gray = 0.299 * extruder_color.r() + 0.587 * extruder_color.g() + 0.114 * extruder_color.b(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp index e653829bee..9df780d720 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp @@ -298,6 +298,12 @@ void GLGizmoPainterBase::render_cursor_height_range(const Transform3d& trafo) co const Selection& selection = m_parent.get_selection(); const ModelObject* model_object = wxGetApp().model().objects[selection.get_object_idx()]; const ModelInstance* mi = model_object->instances[selection.get_instance_idx()]; + + int volumes_count = model_object->volumes.size(); + if (m_cut_contours.size() != volumes_count * 2) { + m_cut_contours.resize(volumes_count * 2); + } + m_volumes_index = 0; for (const ModelVolume* mv : model_object->volumes) { TriangleMesh vol_mesh = mv->mesh(); if (m_parent.get_canvas_type() == GLCanvas3D::CanvasAssembleView) { @@ -310,15 +316,16 @@ void GLGizmoPainterBase::render_cursor_height_range(const Transform3d& trafo) co } for (int i = 0; i < zs.size(); i++) { - update_contours(vol_mesh, zs[i], max_z, min_z); + update_contours(m_volumes_index, vol_mesh, zs[i], max_z, min_z); const Camera& camera = wxGetApp().plater()->get_camera(); - Transform3d view_model_matrix = camera.get_view_matrix() * Geometry::assemble_transform(m_cut_contours.shift); + Transform3d view_model_matrix = camera.get_view_matrix() * Geometry::assemble_transform(m_cut_contours[m_volumes_index].shift); shader->set_uniform("view_model_matrix", view_model_matrix); shader->set_uniform("projection_matrix", camera.get_projection_matrix()); glsafe(::glLineWidth(2.0f)); - m_cut_contours.contours.render(); + m_cut_contours[m_volumes_index].contours.render(); + m_volumes_index++; } } @@ -339,7 +346,7 @@ BoundingBoxf3 GLGizmoPainterBase::bounding_box() const return ret; } -void GLGizmoPainterBase::update_contours(const TriangleMesh& vol_mesh, float cursor_z, float max_z, float min_z) const +void GLGizmoPainterBase::update_contours(int i, const TriangleMesh& vol_mesh, float cursor_z, float max_z, float min_z) const { const Selection& selection = m_parent.get_selection(); const GLVolume* first_glvolume = selection.get_first_volume(); @@ -349,31 +356,31 @@ void GLGizmoPainterBase::update_contours(const TriangleMesh& vol_mesh, float cur const int instance_idx = selection.get_instance_idx(); if (min_z < cursor_z && cursor_z < max_z) { - if (m_cut_contours.cut_z != cursor_z || m_cut_contours.object_id != model_object->id() || m_cut_contours.instance_idx != instance_idx) { - m_cut_contours.cut_z = cursor_z; + if (m_cut_contours[i].cut_z != cursor_z || m_cut_contours[i].object_id != model_object->id() || m_cut_contours[i].instance_idx != instance_idx) { + m_cut_contours[i].cut_z = cursor_z; - m_cut_contours.mesh = vol_mesh; + m_cut_contours[i].mesh = vol_mesh; - m_cut_contours.position = box.center(); - m_cut_contours.shift = Vec3d::Zero(); - m_cut_contours.object_id = model_object->id(); - m_cut_contours.instance_idx = instance_idx; - m_cut_contours.contours.reset(); + m_cut_contours[i].position = box.center(); + m_cut_contours[i].shift = Vec3d::Zero(); + m_cut_contours[i].object_id = model_object->id(); + m_cut_contours[i].instance_idx = instance_idx; + m_cut_contours[i].contours.reset(); MeshSlicingParams slicing_params; slicing_params.trafo = Transform3d::Identity().matrix(); - const Polygons polys = slice_mesh(m_cut_contours.mesh.its, cursor_z, slicing_params); + const Polygons polys = slice_mesh(m_cut_contours[i].mesh.its, cursor_z, slicing_params); if (!polys.empty()) { - m_cut_contours.contours.init_from(polys, static_cast(cursor_z)); - m_cut_contours.contours.set_color({ 1.0f, 1.0f, 1.0f, 1.0f }); + m_cut_contours[i].contours.init_from(polys, static_cast(cursor_z)); + m_cut_contours[i].contours.set_color({ 1.0f, 1.0f, 1.0f, 1.0f }); } } - else if (box.center() != m_cut_contours.position) { - m_cut_contours.shift = box.center() - m_cut_contours.position; + else if (box.center() != m_cut_contours[i].position) { + m_cut_contours[i].shift = box.center() - m_cut_contours[i].position; } } else - m_cut_contours.contours.reset(); + m_cut_contours[i].contours.reset(); } bool GLGizmoPainterBase::is_mesh_point_clipped(const Vec3d& point, const Transform3d& trafo) const diff --git a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp index da05fcfab4..2644c10098 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp @@ -355,10 +355,15 @@ private: ObjectID object_id; int instance_idx{ -1 }; }; - mutable CutContours m_cut_contours; - + mutable std::vector m_cut_contours; + mutable int m_volumes_index = 0; + mutable float m_cursor_z{0}; + mutable double m_height_start_z_in_imgui{0}; + mutable bool m_is_set_height_start_z_by_imgui{false}; + mutable Vec2i m_height_start_pos{0, 0}; + mutable bool m_is_cursor_in_imgui{false}; BoundingBoxf3 bounding_box() const; - void update_contours(const TriangleMesh& vol_mesh, float cursor_z, float max_z, float min_z) const; + void update_contours(int i, const TriangleMesh& vol_mesh, float cursor_z, float max_z, float min_z) const; protected: void on_set_state() override; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoText.cpp b/src/slic3r/GUI/Gizmos/GLGizmoText.cpp index 7034b0eb27..271368d9e6 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoText.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoText.cpp @@ -1123,10 +1123,8 @@ bool GLGizmoText::update_text_positions(const std::vector& texts) Polygons polys = union_(temp_polys); auto point_in_line_rectange = [](const Line &line, const Point &point, double& distance) { - distance = abs((point.x() - line.a.x()) * (line.b.y() - line.a.y()) - (line.b.x() - line.a.x()) * (point.y() - line.a.y())); - bool in_rectange = (std::min(line.a.x(), line.b.x()) - 1000) <= point.x() && point.x() <= (std::max(line.a.x(), line.b.x()) + 1000) && - (std::min(line.a.y(), line.b.y()) - 1000) <= point.y() && point.y() <= (std::max(line.a.y(), line.b.y()) + 1000); - return in_rectange; + distance = line.distance_to(point); + return distance < line.length() / 2; }; int index = 0; diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index 4a747ad963..a9d83df5ae 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -57,6 +57,7 @@ GLGizmosManager::GLGizmosManager(GLCanvas3D& parent) //BBS: GUI refactor: add object manipulation in gizmo , m_object_manipulation(parent) { + m_timer_set_color.Bind(wxEVT_TIMER, &GLGizmosManager::on_set_color_timer, this); } std::vector GLGizmosManager::get_selectable_idxs() const @@ -805,7 +806,7 @@ bool GLGizmosManager::on_char(wxKeyEvent& evt) bool GLGizmosManager::on_key(wxKeyEvent& evt) { - const int keyCode = evt.GetKeyCode(); + int keyCode = evt.GetKeyCode(); bool processed = false; if (evt.GetEventType() == wxEVT_KEY_UP) { @@ -887,8 +888,21 @@ bool GLGizmosManager::on_key(wxKeyEvent& evt) else if (m_current == MmuSegmentation) { GLGizmoMmuSegmentation* mmu_seg = dynamic_cast(get_current()); if (mmu_seg != nullptr) { - if (keyCode > '0' && keyCode <= '9') { - processed = mmu_seg->on_number_key_down(keyCode - '0'); + if (keyCode >= WXK_NUMPAD0 && keyCode <= WXK_NUMPAD9) { + keyCode = keyCode- WXK_NUMPAD0+'0'; + } + if (keyCode >= '0' && keyCode <= '9') { + if (keyCode == '1' && !m_timer_set_color.IsRunning()) { + m_timer_set_color.StartOnce(500); + processed = true; + } + else if (keyCode < '7' && m_timer_set_color.IsRunning()) { + processed = mmu_seg->on_number_key_down(keyCode - '0'+10); + m_timer_set_color.Stop(); + } + else { + processed = mmu_seg->on_number_key_down(keyCode - '0'); + } } else if (keyCode == 'F' || keyCode == 'T' || keyCode == 'S' || keyCode == 'C' || keyCode == 'H' || keyCode == 'G') { processed = mmu_seg->on_key_down_select_tool_type(keyCode); @@ -933,6 +947,15 @@ bool GLGizmosManager::on_key(wxKeyEvent& evt) return processed; } +void GLGizmosManager::on_set_color_timer(wxTimerEvent& evt) +{ + if (m_current == MmuSegmentation) { + GLGizmoMmuSegmentation* mmu_seg = dynamic_cast(get_current()); + mmu_seg->on_number_key_down(1); + m_parent.set_as_dirty(); + } +} + void GLGizmosManager::update_after_undo_redo(const UndoRedo::Snapshot& snapshot) { update_data(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.hpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.hpp index 19cf11a8ca..687b8de27c 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.hpp @@ -142,6 +142,10 @@ private: bool m_serializing; std::unique_ptr m_common_gizmos_data; + //When there are more than 9 colors, shortcut key coloring + wxTimer m_timer_set_color; + void on_set_color_timer(wxTimerEvent& evt); + // key MENU_ICON_NAME, value = ImtextureID std::map icon_list; diff --git a/src/slic3r/GUI/HMSPanel.cpp b/src/slic3r/GUI/HMSPanel.cpp index 9992e37af4..88afb2a456 100644 --- a/src/slic3r/GUI/HMSPanel.cpp +++ b/src/slic3r/GUI/HMSPanel.cpp @@ -5,6 +5,8 @@ #include #include "GUI.hpp" #include "GUI_App.hpp" +#include "MainFrame.hpp" +#include "Monitor.hpp" namespace Slic3r { namespace GUI { @@ -12,9 +14,12 @@ namespace GUI { #define HMS_NOTIFY_ITEM_TEXT_SIZE wxSize(FromDIP(730), -1) #define HMS_NOTIFY_ITEM_SIZE wxSize(-1, FromDIP(80)) +wxDEFINE_EVENT(EVT_ALREADY_READ_HMS, wxCommandEvent); + HMSNotifyItem::HMSNotifyItem(wxWindow *parent, HMSItem& item) : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL) , m_hms_item(item) + , long_error_code(item.get_long_error_code()) , m_url(get_hms_wiki_url(item.get_long_error_code())) { init_bitmaps(); @@ -114,6 +119,9 @@ HMSNotifyItem::HMSNotifyItem(wxWindow *parent, HMSItem& item) }); m_hms_content->Bind(wxEVT_LEFT_UP, [this](wxMouseEvent& e) { if (!m_url.empty()) wxLaunchDefaultBrowser(m_url); + wxCommandEvent evt(EVT_ALREADY_READ_HMS); + evt.SetString(long_error_code); + wxPostEvent(wxGetApp().mainframe->m_monitor, evt); }); #endif } @@ -193,6 +201,11 @@ void HMSPanel::delete_hms_panels() { m_scrolledWindow->DestroyChildren(); } +void HMSPanel::clear_hms_tag() +{ + temp_hms_list.clear(); +} + void HMSPanel::update(MachineObject *obj) { if (obj) { @@ -201,9 +214,35 @@ void HMSPanel::update(MachineObject *obj) wxString hms_text; for (auto item : obj->hms_list) { if (wxGetApp().get_hms_query()) { + + auto key = item.get_long_error_code(); + auto iter = temp_hms_list.find(key); + if (iter == temp_hms_list.end()) { + temp_hms_list[key] = item; + } + append_hms_panel(item); } } + + for (auto it = temp_hms_list.begin(); it != temp_hms_list.end(); ) { + auto key = it->second.get_long_error_code(); + bool inr = false; + for (auto hms : obj->hms_list) { + if (hms.get_long_error_code() == key) { + inr = true; + break; + } + } + + if (!inr) { + it = temp_hms_list.erase(it); + } + else { + ++it; + } + } + Layout(); this->Thaw(); } else { diff --git a/src/slic3r/GUI/HMSPanel.hpp b/src/slic3r/GUI/HMSPanel.hpp index f6fe003382..bafa043a69 100644 --- a/src/slic3r/GUI/HMSPanel.hpp +++ b/src/slic3r/GUI/HMSPanel.hpp @@ -16,6 +16,7 @@ class HMSNotifyItem : public wxPanel { HMSItem & m_hms_item; std::string m_url; + std::string long_error_code; wxPanel * m_panel_hms; wxStaticBitmap *m_bitmap_notify; @@ -39,6 +40,7 @@ public: void msw_rescale() {} }; + class HMSPanel : public wxPanel { protected: @@ -50,6 +52,7 @@ protected: void append_hms_panel(HMSItem &item); void delete_hms_panels(); + public: HMSPanel(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxTAB_TRAVERSAL); ~HMSPanel(); @@ -62,9 +65,14 @@ public: void show_status(int status); + void clear_hms_tag(); + MachineObject *obj { nullptr }; + std::map temp_hms_list; }; +wxDECLARE_EVENT(EVT_ALREADY_READ_HMS, wxCommandEvent); + } } diff --git a/src/slic3r/GUI/IMToolbar.cpp b/src/slic3r/GUI/IMToolbar.cpp index e14cdb2ffc..1dbfc9e613 100644 --- a/src/slic3r/GUI/IMToolbar.cpp +++ b/src/slic3r/GUI/IMToolbar.cpp @@ -58,6 +58,13 @@ void IMToolbar::del_stats_item() m_all_plates_stats_item = nullptr; } +void IMToolbar::set_enabled(bool enable) +{ + m_enabled = enable; + if (!m_enabled) + is_render_finish = false; +} + bool IMReturnToolbar::init() { bool compress = false; diff --git a/src/slic3r/GUI/IMToolbar.hpp b/src/slic3r/GUI/IMToolbar.hpp index 681045fdb8..add067d83a 100644 --- a/src/slic3r/GUI/IMToolbar.hpp +++ b/src/slic3r/GUI/IMToolbar.hpp @@ -49,7 +49,7 @@ public: float icon_height; bool is_display_scrollbar; bool show_stats_item{ false }; - + bool is_render_finish{false}; IMToolbar() { icon_width = DEFAULT_TOOLBAR_BUTTON_WIDTH; icon_height = DEFAULT_TOOLBAR_BUTTON_HEIGHT; @@ -63,7 +63,7 @@ public: float fontScale; bool is_enabled() const { return m_enabled; } - void set_enabled(bool enable) { m_enabled = enable; } + void set_enabled(bool enable); void set_icon_size(float width, float height) { icon_width = width; diff --git a/src/slic3r/GUI/ImageGrid.cpp b/src/slic3r/GUI/ImageGrid.cpp index 770d46ec00..15adf8c8ca 100644 --- a/src/slic3r/GUI/ImageGrid.cpp +++ b/src/slic3r/GUI/ImageGrid.cpp @@ -46,6 +46,8 @@ ImageGrid::ImageGrid(wxWindow * parent) , m_model_time_icon(this, "model_time", 14) , m_model_weight_icon(this, "model_weight", 14) { + m_cell_size.Set(396, 228); + SetBackgroundStyle(wxBG_STYLE_PAINT); SetBackgroundColour(0xEEEEEE); SetFont(Label::Head_20); @@ -293,9 +295,16 @@ void ImageGrid::mouseMoved(wxMouseEvent& event) if (hit != std::make_pair(m_hit_type, m_hit_item)) { m_hit_type = hit.first; m_hit_item = hit.second; - if (hit.first == HIT_ITEM) - SetToolTip(from_u8(m_file_sys->GetFile(hit.second).Title())); - else + if (hit.first == HIT_ITEM) { + SetToolTip({}); + auto & file = m_file_sys->GetFile(hit.second); + if (auto title = file.Title(); !title.empty()) { + auto tip = wxString::Format(_L("File: %s\nTitle: %s\n"), from_u8(file.name), from_u8(title)); + SetToolTip(tip); + } else { + SetToolTip(from_u8(file.name)); + } + } else SetToolTip({}); Refresh(); } @@ -732,7 +741,17 @@ void Slic3r::GUI::ImageGrid::renderText(wxDC &dc, wxString const &text, wxRect c dc.SetTextForeground(m_buttonTextColor.colorForStatesNoDark(states)); wxRect rc({0, 0}, dc.GetTextExtent(text)); rc = rc.CenterIn(rect); - dc.DrawText(text, rc.GetTopLeft()); + float fontScale = float(rect.width - 8) / rc.width; + if (fontScale < 1) { + auto font = dc.GetFont(); + dc.SetFont(font.Scaled(fontScale)); + wxRect rc({0, 0}, dc.GetTextExtent(text)); + rc = rc.CenterIn(rect); + dc.DrawText(text, rc.GetTopLeft()); + dc.SetFont(font); + } else { + dc.DrawText(text, rc.GetTopLeft()); + } } void Slic3r::GUI::ImageGrid::renderText2(wxDC &dc, wxString text, wxRect const &rect) diff --git a/src/slic3r/GUI/Jobs/ArrangeJob.cpp b/src/slic3r/GUI/Jobs/ArrangeJob.cpp index 538ffc4fa5..c7a9a016c8 100644 --- a/src/slic3r/GUI/Jobs/ArrangeJob.cpp +++ b/src/slic3r/GUI/Jobs/ArrangeJob.cpp @@ -96,6 +96,7 @@ void ArrangeJob::clear_input() m_unprintable.clear(); m_locked.clear(); m_unarranged.clear(); + m_uncompatible_plates.clear(); m_selected.reserve(count + 1 /* for optional wti */); m_unselected.reserve(count + 1 /* for optional wti */); m_unprintable.reserve(cunprint /* for optional wti */); @@ -189,10 +190,20 @@ void ArrangeJob::prepare_selected() { } void ArrangeJob::prepare_all() { - PartPlateList& plate_list = m_plater->get_partplate_list(); - clear_input(); + PartPlateList& plate_list = m_plater->get_partplate_list(); + for (size_t i = 0; i < plate_list.get_plate_count(); i++) { + PartPlate* plate = plate_list.get_plate(i); + bool same_as_global_print_seq = true; + plate->get_real_print_seq(&same_as_global_print_seq); + if (plate->is_locked() == false && !same_as_global_print_seq) { + plate->lock(true); + m_uncompatible_plates.push_back(i); + } + } + + Model &model = m_plater->model(); bool selected_is_locked = false; @@ -492,20 +503,21 @@ void ArrangeJob::prepare() void ArrangeJob::check_unprintable() { for (auto it = m_selected.begin(); it != m_selected.end();) { - if (it->poly.area() < 0.001) + if (it->poly.area() < 0.001 || it->height>params.printable_height) { #if SAVE_ARRANGE_POLY - SVG svg("SVG/arrange_unprintable_"+it->name+".svg", get_extents(it->poly)); + SVG svg(data_dir() + "/SVG/arrange_unprintable_"+it->name+".svg", get_extents(it->poly)); if (svg.is_opened()) svg.draw_outline(it->poly); #endif - + if (it->poly.area() < 0.001) { + auto msg = (boost::format( + _utf8("Object %s has zero size and can't be arranged.")) + % _utf8(it->name)).str(); + m_plater->get_notification_manager()->push_notification(NotificationType::BBLPlateInfo, + NotificationManager::NotificationLevel::WarningNotificationLevel, msg); + } m_unprintable.push_back(*it); - auto msg = (boost::format( - _utf8("Object %s has zero size and can't be arranged.")) - % _utf8(it->name)).str(); - m_plater->get_notification_manager()->push_notification(NotificationType::BBLPlateInfo, - NotificationManager::NotificationLevel::WarningNotificationLevel, msg); it = m_selected.erase(it); } else @@ -572,8 +584,6 @@ void ArrangeJob::process(Ctl &ctl) BOOST_LOG_TRIVIAL(debug) << item.name << ", bed: " << item.bed_idx << ", trans: " << item.translation.transpose(); } - arrangement::arrange(m_unprintable, {}, bedpts, params); - // put unpackable items to m_unprintable so they goes outside bool we_have_unpackable_items = false; for (auto item : m_selected) { @@ -717,6 +727,10 @@ void ArrangeJob::finalize(bool canceled, std::exception_ptr &eptr) { plate_list.rebuild_plates_after_arrangement(!only_on_partplate, true); } + // unlock the plates we just locked + for (int i : m_uncompatible_plates) + plate_list.get_plate(i)->lock(false); + // BBS: update slice context and gcode result. m_plater->update_slicing_context_to_current_partplate(); @@ -761,6 +775,7 @@ arrangement::ArrangeParams init_arrange_params(Plater *p) params.cleareance_radius = print_config.extruder_clearance_radius.value; params.printable_height = print_config.printable_height.value; params.allow_rotations = settings.enable_rotation; + params.nozzle_height = print.config().nozzle_height.value; params.align_center = print_config.best_object_pos.value; params.allow_multi_materials_on_same_plate = settings.allow_multi_materials_on_same_plate; params.avoid_extrusion_cali_region = settings.avoid_extrusion_cali_region; @@ -780,7 +795,6 @@ arrangement::ArrangeParams init_arrange_params(Plater *p) } if (params.is_seq_print) { - params.min_obj_distance = std::max(params.min_obj_distance, scaled(params.cleareance_radius + 0.001)); // +0.001mm to avoid clearance check fail due to rounding error params.bed_shrink_x = BED_SHRINK_SEQ_PRINT; params.bed_shrink_y = BED_SHRINK_SEQ_PRINT; } diff --git a/src/slic3r/GUI/Jobs/ArrangeJob.hpp b/src/slic3r/GUI/Jobs/ArrangeJob.hpp index 6b3364236d..005d386fee 100644 --- a/src/slic3r/GUI/Jobs/ArrangeJob.hpp +++ b/src/slic3r/GUI/Jobs/ArrangeJob.hpp @@ -28,6 +28,8 @@ class ArrangeJob : public Job ArrangePolygons m_selected, m_unselected, m_unprintable, m_locked; std::vector m_unarranged; std::map m_selected_groups; // groups of selected items for sequential printing + std::vector m_uncompatible_plates; // plate indices with different printing sequence than global + arrangement::ArrangeParams params; int current_plate_index = 0; Polygon bed_poly; diff --git a/src/slic3r/GUI/Jobs/FillBedJob.cpp b/src/slic3r/GUI/Jobs/FillBedJob.cpp index efcb556456..d671a70c91 100644 --- a/src/slic3r/GUI/Jobs/FillBedJob.cpp +++ b/src/slic3r/GUI/Jobs/FillBedJob.cpp @@ -239,7 +239,21 @@ void FillBedJob::process(Ctl &ctl) // final align用的是凸包,在有fixed item的情况下可能找到的参考点位置是错的,这里就不做了。见STUDIO-3265 params.do_final_align = !is_bbl; - arrangement::arrange(m_selected, m_unselected, m_bedpts, params); + if (m_selected.size() > 100){ + // too many items, just find grid empty cells to put them + Vec2f step = unscaled(get_extents(m_selected.front().poly).size()) + Vec2f(m_selected.front().brim_width, m_selected.front().brim_width); + std::vector empty_cells = Plater::get_empty_cells(step); + size_t n=std::min(m_selected.size(), empty_cells.size()); + for (size_t i = 0; i < n; i++) { + m_selected[i].translation = scaled(empty_cells[i]); + m_selected[i].bed_idx= 0; + } + for (size_t i = n; i < m_selected.size(); i++) { + m_selected[i].bed_idx = -1; + } + } + else + arrangement::arrange(m_selected, m_unselected, m_bedpts, params); // finalize just here. ctl.update_status(100, ctl.was_canceled() ? @@ -285,10 +299,12 @@ void FillBedJob::finalize(bool canceled, std::exception_ptr &eptr) else ap.bed_idx = cur_plate; - ap.row = ap.bed_idx / plate_cols; - ap.col = ap.bed_idx % plate_cols; - ap.translation(X) += bed_stride_x(m_plater) * ap.col; - ap.translation(Y) -= bed_stride_y(m_plater) * ap.row; + if (m_selected.size() <= 100) { + ap.row = ap.bed_idx / plate_cols; + ap.col = ap.bed_idx % plate_cols; + ap.translation(X) += bed_stride_x(m_plater) * ap.col; + ap.translation(Y) -= bed_stride_y(m_plater) * ap.row; + } ap.apply(); diff --git a/src/slic3r/GUI/Jobs/PrintJob.cpp b/src/slic3r/GUI/Jobs/PrintJob.cpp index 8ff354e7c7..0e7af93f36 100644 --- a/src/slic3r/GUI/Jobs/PrintJob.cpp +++ b/src/slic3r/GUI/Jobs/PrintJob.cpp @@ -281,15 +281,42 @@ void PrintJob::process(Ctl &ctl) } } + params.stl_design_id = 0; if (!wxGetApp().model().stl_design_id.empty()) { - int stl_design_id = 0; - try { - stl_design_id = std::stoi(wxGetApp().model().stl_design_id); + + auto country_code = wxGetApp().app_config->get_country_code(); + bool match_code = false; + + if (wxGetApp().model().stl_design_country == "DEV" && (country_code == "ENV_CN_DEV" || country_code == "NEW_ENV_DEV_HOST")) { + match_code = true; } - catch (const std::exception& e) { - stl_design_id = 0; + + if (wxGetApp().model().stl_design_country == "QA" && (country_code == "ENV_CN_QA" || country_code == "NEW_ENV_QAT_HOST")) { + match_code = true; + } + + if (wxGetApp().model().stl_design_country == "CN_PRE" && (country_code == "ENV_CN_PRE" || country_code == "NEW_ENV_PRE_HOST")) { + match_code = true; + } + + if (wxGetApp().model().stl_design_country == "US_PRE" && country_code == "ENV_US_PRE") { + match_code = true; + } + + if (country_code == wxGetApp().model().stl_design_country) { + match_code = true; + } + + if (match_code) { + int stl_design_id = 0; + try { + stl_design_id = std::stoi(wxGetApp().model().stl_design_id); + } + catch (const std::exception& e) { + stl_design_id = 0; + } + params.stl_design_id = stl_design_id; } - params.stl_design_id = stl_design_id; } if (params.preset_name.empty() && m_print_type == "from_normal") { params.preset_name = wxString::Format("%s_plate_%d", m_project_name, curr_plate_idx).ToStdString(); } diff --git a/src/slic3r/GUI/MediaFilePanel.cpp b/src/slic3r/GUI/MediaFilePanel.cpp index 3b23ee7632..944006f3c4 100644 --- a/src/slic3r/GUI/MediaFilePanel.cpp +++ b/src/slic3r/GUI/MediaFilePanel.cpp @@ -27,6 +27,7 @@ MediaFilePanel::MediaFilePanel(wxWindow * parent) , m_bmp_loading(this, "media_loading", 0) , m_bmp_failed(this, "media_failed", 0) , m_bmp_empty(this, "media_empty", 0) + , m_machine("") { SetBackgroundColour(0xEEEEEE); Hide(); @@ -104,7 +105,9 @@ MediaFilePanel::MediaFilePanel(wxWindow * parent) m_button_download->SetToolTip(_L("Download selected files from printer.")); m_button_management = new ::Button(m_manage_panel, _L("Select")); m_button_management->SetToolTip(_L("Batch manage files.")); - for (auto b : {m_button_delete, m_button_download, m_button_management}) { + m_button_refresh = new ::Button(m_manage_panel, _L("Refresh")); + m_button_refresh->SetToolTip(_L("Reload file list from printer.")); + for (auto b : {m_button_delete, m_button_download, m_button_refresh, m_button_management}) { b->SetFont(Label::Body_12); b->SetCornerRadius(12); b->SetPaddingSize({10, 6}); @@ -116,11 +119,16 @@ MediaFilePanel::MediaFilePanel(wxWindow * parent) m_button_management->SetBackgroundColorNormal(wxColor("#009688")); m_button_management->SetTextColorNormal(*wxWHITE); m_button_management->Enable(false); + m_button_refresh->SetBorderWidth(0); + m_button_refresh->SetBackgroundColorNormal(wxColor("#00AE42")); + m_button_refresh->SetTextColorNormal(*wxWHITE); + m_button_refresh->Enable(false); wxBoxSizer *manage_sizer = new wxBoxSizer(wxHORIZONTAL); manage_sizer->AddStretchSpacer(1); manage_sizer->Add(m_button_download, 0, wxALIGN_CENTER_VERTICAL)->Show(false); manage_sizer->Add(m_button_delete, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 24)->Show(false); + manage_sizer->Add(m_button_refresh, 0, wxALIGN_CENTER_VERTICAL); manage_sizer->Add(m_button_management, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 24); m_manage_panel->SetSizer(manage_sizer); top_sizer->Add(m_manage_panel, 1, wxEXPAND); @@ -171,6 +179,11 @@ MediaFilePanel::MediaFilePanel(wxWindow * parent) e.Skip(); SetSelecting(!m_image_grid->IsSelecting()); }); + m_button_refresh->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this](auto &e) { + e.Skip(); + if (auto fs = m_image_grid->GetFileSystem()) + fs->ListAllFiles(); + }); m_button_download->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this](auto &e) { m_image_grid->DoActionOnSelection(1); SetSelecting(false); @@ -198,9 +211,7 @@ MediaFilePanel::~MediaFilePanel() SetMachineObject(nullptr); } -wxString hide_id_middle_string(wxString const &str, size_t offset = 0, size_t length = -1); - - void MediaFilePanel::SetMachineObject(MachineObject* obj) +void MediaFilePanel::SetMachineObject(MachineObject* obj) { std::string machine = obj ? obj->dev_id : ""; if (obj) { @@ -208,6 +219,8 @@ wxString hide_id_middle_string(wxString const &str, size_t offset = 0, size_t le m_lan_ip = obj->dev_ip; m_lan_passwd = obj->get_access_code(); m_dev_ver = obj->get_ota_version(); + m_device_busy = obj->is_camera_busy_off(); + m_sdcard_exist = obj->has_sdcard(); m_local_support = obj->file_local; m_remote_support = obj->file_remote; m_model_download_support = obj->file_model_download; @@ -216,18 +229,21 @@ wxString hide_id_middle_string(wxString const &str, size_t offset = 0, size_t le m_lan_ip.clear(); m_lan_passwd.clear(); m_dev_ver.clear(); + m_sdcard_exist = false; + m_device_busy = false; m_local_support = false; m_remote_support = false; m_model_download_support = false; } - if (machine == m_machine && m_image_grid->GetFileSystem()) { - if (m_waiting_enable && IsEnabled()) { + Enable(obj && obj->is_connected() && obj->m_push_count > 0); + if (machine == m_machine) { + if ((m_waiting_enable && IsEnabled()) || (m_waiting_support && (m_local_support || m_remote_support))) { auto fs = m_image_grid->GetFileSystem(); if (fs) fs->Retry(); } return; } - m_machine = machine; + m_machine.swap(machine); m_last_errors.clear(); auto fs = m_image_grid->GetFileSystem(); if (fs) { @@ -235,12 +251,11 @@ wxString hide_id_middle_string(wxString const &str, size_t offset = 0, size_t le fs->Unbind(EVT_MODE_CHANGED, &MediaFilePanel::modeChanged, this); fs->Stop(true); } + m_button_refresh->Enable(false); m_button_management->Enable(false); SetSelecting(false); if (m_machine.empty()) { m_image_grid->SetStatus(m_bmp_failed, _L("No printers.")); - } else if (!m_local_support && !m_remote_support) { - m_image_grid->SetStatus(m_bmp_failed, _L("Initialize failed (Not supported on the current printer version)!")); } else { boost::shared_ptr fs(new PrinterFileSystem); fs->Attached(); @@ -253,6 +268,7 @@ wxString hide_id_middle_string(wxString const &str, size_t offset = 0, size_t le return; m_time_panel->Show(fs->GetFileType() < PrinterFileSystem::F_MODEL); //m_manage_panel->Show(fs->GetFileType() < PrinterFileSystem::F_MODEL); + m_button_refresh->Enable(fs->GetStatus() == PrinterFileSystem::ListReady); m_button_management->Enable(fs->GetCount() > 0); bool download_support = fs->GetFileType() < PrinterFileSystem::F_MODEL || m_model_download_support; m_image_grid->ShowDownload(download_support); @@ -282,27 +298,21 @@ wxString hide_id_middle_string(wxString const &str, size_t offset = 0, size_t le case PrinterFileSystem::Connecting: icon = m_bmp_loading; msg = _L("Connecting..."); break; case PrinterFileSystem::Failed: icon = m_bmp_failed; if (extra != 1) msg = _L("Connect failed [%d]!"); break; case PrinterFileSystem::ListSyncing: icon = m_bmp_loading; msg = _L("Loading file list..."); break; - case PrinterFileSystem::ListReady: icon = extra == 0 ? m_bmp_empty : m_bmp_failed; msg = extra == 0 ? _L("No files [%d]") : _L("Load failed [%d]"); break; + case PrinterFileSystem::ListReady: icon = extra == 0 ? m_bmp_empty : m_bmp_failed; msg = extra == 0 ? _L("No files") : _L("Load failed"); break; } - if (!e.GetString().IsEmpty()) msg = e.GetString(); + int err = fs->GetLastError(); + if (!e.GetString().IsEmpty()) + msg = e.GetString(); + if (err != 0) + msg += " [%d]"; if (fs->GetCount() == 0 && !msg.empty()) m_image_grid->SetStatus(icon, msg); if (e.GetInt() == PrinterFileSystem::Initializing) fetchUrl(boost::weak_ptr(fs)); - int err = fs->GetLastError(); + err = fs->GetLastError(); if ((status == PrinterFileSystem::Failed && m_last_errors.find(err) == m_last_errors.end()) || status == PrinterFileSystem::ListReady) { - json j; - j["code"] = err; - j["dev_id"] = m_machine; - j["dev_ip"] = m_lan_ip; - NetworkAgent* agent = wxGetApp().getAgent(); - if (status == PrinterFileSystem::Failed && err != 0) { - j["result"] = "failed"; - } else if (status == PrinterFileSystem::ListReady) { - j["result"] = "success"; - } m_last_errors.insert(fs->GetLastError()); } }); @@ -314,7 +324,9 @@ wxString hide_id_middle_string(wxString const &str, size_t offset = 0, size_t le int result = e.GetExtraLong(); if (result > 1 && !e.GetString().IsEmpty()) - MessageDialog(this, e.GetString(), _L("Download failed"), wxOK | wxICON_ERROR).ShowModal(); + CallAfter([this, m = e.GetString()] { + MessageDialog(this, m, _L("Download failed"), wxOK | wxICON_ERROR).ShowModal(); + }); NetworkAgent* agent = wxGetApp().getAgent(); if (result > 1 || result == 0) { @@ -373,6 +385,7 @@ void MediaFilePanel::Rescale() m_button_download->Rescale(); m_button_delete->Rescale(); + m_button_refresh->Rescale(); m_button_management->Rescale(); m_image_grid->Rescale(); @@ -386,6 +399,7 @@ void MediaFilePanel::SetSelecting(bool selecting) bool download_support = fs && fs->GetFileType() < PrinterFileSystem::F_MODEL || m_model_download_support; m_manage_panel->GetSizer()->Show(m_button_download, selecting && download_support); m_manage_panel->GetSizer()->Show(m_button_delete, selecting); + m_manage_panel->GetSizer()->Show(m_button_refresh, !selecting); m_manage_panel->Layout(); } @@ -420,31 +434,60 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr wfs) } m_waiting_enable = false; if (!m_local_support && !m_remote_support) { - m_image_grid->SetStatus(m_bmp_failed, _L("Initialize failed (Not supported on the current printer version)!")); + m_waiting_support = true; + m_image_grid->SetStatus(m_bmp_failed, _L("Browsing file in SD card is not supported in current firmware. Please update the printer firmware.")); fs->SetUrl("0"); return; } + if (!m_sdcard_exist) { + m_image_grid->SetStatus(m_bmp_failed, _L("Initialize failed (Storage unavailable, insert SD card.)!")); + fs->SetUrl("0"); + return; + } + if (m_device_busy) { + m_image_grid->SetStatus(m_bmp_failed, _L("The printer is currently busy downloading. Please try again after it finishes.")); + fs->SetUrl("0"); + return; + } + m_waiting_support = false; + NetworkAgent *agent = wxGetApp().getAgent(); + std::string agent_version = agent ? agent->get_version() : ""; if ((m_lan_mode || !m_remote_support) && m_local_support && !m_lan_ip.empty()) { - std::string url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd + - "&device=" + m_machine + "&dev_ver=" + m_dev_ver; + std::string url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd; + url += "&device=" + m_machine; + url += "&net_ver=" + agent_version; + url += "&dev_ver=" + m_dev_ver; + url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid"); + url += "&cli_ver=" + std::string(SLIC3R_VERSION); fs->SetUrl(url); return; } + if (!m_remote_support && m_local_support) { // not support tutk + m_image_grid->SetStatus(m_bmp_failed, _L("Please enter the IP of printer to connect.")); + fs->SetUrl("0"); + fs.reset(); + if (wxGetApp().show_modal_ip_address_enter_dialog(_L("LAN Connection Failed (Failed to view sdcard)"))) { + if (auto fs = wfs.lock()) + fs->Retry(); + } + return; + } if (m_lan_mode) { - m_image_grid->SetStatus(m_bmp_failed, _L("Initialize failed (Not accessible in LAN-only mode)!")); + m_image_grid->SetStatus(m_bmp_failed, _L("Browsing file in SD card is not supported in LAN Only Mode.")); fs->SetUrl("0"); return; } - if (!m_remote_support && m_local_support) { // not support tutk - m_image_grid->SetStatus(m_bmp_failed, _L("Initialize failed (Missing LAN ip of printer)!")); - fs->SetUrl("1"); - return; - } - NetworkAgent *agent = wxGetApp().getAgent(); if (agent) { agent->get_camera_url(m_machine, - [this, wfs, m = m_machine, v = m_dev_ver](std::string url) { - BOOST_LOG_TRIVIAL(info) << "MediaFilePanel::fetchUrl: camera_url: " << hide_id_middle_string(hide_passwd(url, {"authkey=", "passwd="}), 9, 20); + [this, wfs, m = m_machine, v = agent->get_version(), dv = m_dev_ver](std::string url) { + if (boost::algorithm::starts_with(url, "bambu:///")) { + url += "&device=" + m; + url += "&net_ver=" + v; + url += "&dev_ver=" + dv; + url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid"); + url += "&cli_ver=" + std::string(SLIC3R_VERSION); + } + BOOST_LOG_TRIVIAL(info) << "MediaFilePanel::fetchUrl: camera_url: " << hide_passwd(url, {"?uid=", "authkey=", "passwd="}); CallAfter([=] { boost::shared_ptr fs(wfs.lock()); if (!fs || fs != m_image_grid->GetFileSystem()) return; @@ -498,9 +541,11 @@ void MediaFilePanel::doAction(size_t index, int action) if (result == PrinterFileSystem::ERROR_CANCEL) return; if (result != 0) { - MessageDialog(this, - _L("Failed to fetching model infomations from printer."), - _L("Error"), wxOK).ShowModal(); + wxString msg = data.empty() ? _L("Failed to fetch model information from printer.") : + from_u8(data); + CallAfter([this, msg] { + MessageDialog(this, msg, _L("Print"), wxOK).ShowModal(); + }); return; } Slic3r::DynamicPrintConfig config; @@ -511,8 +556,8 @@ void MediaFilePanel::doAction(size_t index, int action) if (!Slic3r::load_gcode_3mf_from_stream(is, &config, &model, &plate_data_list, &file_version) || plate_data_list.empty()) { MessageDialog(this, - _L("Failed to parse model infomations."), - _L("Error"), wxOK).ShowModal(); + _L("Failed to parse model information."), + _L("Print"), wxOK).ShowModal(); return; } diff --git a/src/slic3r/GUI/MediaFilePanel.h b/src/slic3r/GUI/MediaFilePanel.h index 1ae5df7916..0b64cdb5d6 100644 --- a/src/slic3r/GUI/MediaFilePanel.h +++ b/src/slic3r/GUI/MediaFilePanel.h @@ -69,6 +69,7 @@ private: ::StaticBox *m_manage_panel = nullptr; ::Button * m_button_delete = nullptr; ::Button *m_button_download = nullptr; + ::Button *m_button_refresh = nullptr; ::Button *m_button_management = nullptr; ImageGrid * m_image_grid = nullptr; @@ -81,10 +82,13 @@ private: std::string m_lan_passwd; std::string m_dev_ver; bool m_lan_mode = false; + bool m_sdcard_exist = false; bool m_local_support = false; bool m_remote_support = false; bool m_model_download_support = false; + bool m_device_busy = false; bool m_waiting_enable = false; + bool m_waiting_support = false; int m_last_mode = 0; int m_last_type = 0; diff --git a/src/slic3r/GUI/MediaPlayCtrl.cpp b/src/slic3r/GUI/MediaPlayCtrl.cpp index b5ab46647e..bdc3de924e 100644 --- a/src/slic3r/GUI/MediaPlayCtrl.cpp +++ b/src/slic3r/GUI/MediaPlayCtrl.cpp @@ -22,6 +22,16 @@ #endif #include +#include "wx/evtloop.h" + +static std::map error_messages = { + {1, L("The device cannot handle more conversations. Please retry later.")}, + {2, L("Player is malfunctioning. Please reinstall the system player.")}, + {100, L("The player is not loaded, please click \"play\" button to retry.")}, + {101, L("The player is not loaded, please click \"play\" button to retry.")}, + {102, L("The player is not loaded, please click \"play\" button to retry.")}, + {103, L("The player is not loaded, please click \"play\" button to retry.")} +}; namespace Slic3r { namespace GUI { @@ -30,6 +40,7 @@ MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl2 *media_ctrl, const w : wxPanel(parent, wxID_ANY, pos, size) , m_media_ctrl(media_ctrl) { + SetLabel("MediaPlayCtrl"); SetBackgroundColour(*wxWHITE); m_media_ctrl->Bind(wxEVT_MEDIA_STATECHANGED, &MediaPlayCtrl::onStateChanged, this); @@ -39,6 +50,39 @@ MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl2 *media_ctrl, const w m_label_status = new Label(this, ""); m_label_status->SetForegroundColour(wxColour("#323A3C")); + m_label_stat = new Label(this, ""); + m_label_stat->SetForegroundColour(wxColour("#323A3C")); + m_media_ctrl->Bind(EVT_MEDIA_CTRL_STAT, [this](auto & e) { +#if !BBL_RELEASE_TO_PUBLIC + wxSize size = m_media_ctrl->GetVideoSize(); + m_label_stat->SetLabel(e.GetString() + wxString::Format(" VS:%ix%i", size.x, size.y)); +#endif + wxString str = e.GetString(); + m_stat.clear(); + for (auto k : {"FPS:", "BPS:", "T:", "B:"}) { + auto ik = str.Find(k); + double value = 0; + if (ik != wxString::npos) { + ik += strlen(k); + auto ip = str.find(' ', ik); + if (ip == wxString::npos) ip = str.Length(); + auto v = str.Mid(ik, ip - ik); + if (k == "T:" && v.Length() == 8) { + long h = 0,m = 0,s = 0; + v.Left(2).ToLong(&h); + v.Mid(3, 2).ToLong(&m); + v.Mid(6, 2).ToLong(&s); + value = h * 3600. + m * 60 + s; + } else { + v.ToDouble(&value); + if (v.Right(1) == "K") value *= 1024; + else if (v.Right(1) == "%") value *= 0.01; + } + } + m_stat.push_back(value); + } + }); + m_button_play->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this](auto &e) { TogglePlay(); }); m_button_play->Bind(wxEVT_RIGHT_UP, [this](auto & e) { m_media_ctrl->Play(); }); // m_label_status->Bind(wxEVT_LEFT_UP, [this](auto &e) { @@ -66,6 +110,7 @@ MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl2 *media_ctrl, const w wxBoxSizer * sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(m_button_play, 0, wxEXPAND | wxALL, 0); + sizer->Add(m_label_stat, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(25)); sizer->AddStretchSpacer(1); sizer->Add(m_label_status, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(25)); SetSizer(sizer); @@ -92,16 +137,9 @@ MediaPlayCtrl::~MediaPlayCtrl() m_tasks.push_back(""); m_cond.notify_all(); } - m_thread.join(); -} - -wxString hide_id_middle_string(wxString const &str, size_t offset = 0, size_t length = -1) -{ - if (length == size_t(-1)) - length = str.Length() - offset; - if (length <= 8) - return str; - return str.Left(offset + 4) + wxString(length - 8, '*') + str.Mid(offset + length - 4); + while (!m_thread.try_join_for(boost::chrono::milliseconds(10))) { + wxEventLoopBase::GetActive()->Yield(); + } } void MediaPlayCtrl::SetMachineObject(MachineObject* obj) @@ -128,13 +166,21 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj) m_remote_support = true; m_device_busy = false; } + Enable(obj && obj->is_connected() && obj->m_push_count > 0); if (machine == m_machine) { if (m_last_state == MEDIASTATE_IDLE && IsEnabled()) Play(); + else if (m_last_state == MEDIASTATE_LOADING && m_tutk_state == "disable" + && m_last_user_play + wxTimeSpan::Seconds(3) < wxDateTime::Now()) { + // resend ttcode to printer + if (auto agent = wxGetApp().getAgent()) + agent->get_camera_url(machine, [](auto) {}); + m_last_user_play = wxDateTime::Now(); + } return; } m_machine = machine; - BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl switch machine: " << hide_id_middle_string(m_machine); + BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl switch machine: " << m_machine; m_disable_lan = false; m_failed_retry = 0; m_last_failed_codes.clear(); @@ -153,6 +199,17 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj) SetStatus("", false); } +wxString hide_id_middle_string(wxString const &str, size_t offset = 0, size_t length = -1) +{ +#if BBL_RELEASE_TO_PUBLIC + if (length == size_t(-1)) length = str.Length() - offset; + if (length <= 8) return str; + return str.Left(offset + 4) + wxString(length - 8, '*') + str.Mid(offset + length - 4); +#else + return str; +#endif +} + wxString hide_passwd(wxString url, std::vector const &passwords) { for (auto &p : passwords) { @@ -166,7 +223,9 @@ wxString hide_passwd(wxString url, std::vector const &passwords) if (j == wxString::npos) j = url.length(); } auto l = size_t(j - i); - if (j == url.length() || url[j] == '@' || url[j] == '&') + if (p[0] == '?' || p[0] == '&') + url = hide_id_middle_string(url, i, l); + else if (j == url.length() || url[j] == '@' || url[j] == '&') url.replace(i, l, l, wxUniChar('*')); } return url; @@ -183,83 +242,98 @@ void MediaPlayCtrl::Play() } m_failed_code = 0; if (m_machine.empty()) { - Stop(_L("Initialize failed (No Device)!")); + Stop(_L("Please confirm if the printer is connected.")); return; } if (!IsEnabled()) { - Stop(_L("Initialize failed (Device connection not ready)!")); - return; - } - if (!m_camera_exists) { - Stop(_L("Initialize failed (No Camera Device)!")); + Stop(_L("Please confirm if the printer is connected.")); return; } if (m_device_busy) { - Stop(_L("Printer is busy downloading, Please wait for the downloading to finish.")); + Stop(_L("The printer is currently busy downloading. Please try again after it finishes.")); m_failed_retry = 0; return; } + if (!m_camera_exists) { + Stop(_L("Printer camera is malfunctioning.")); + return; + } - m_last_state = MEDIASTATE_INITIALIZING; m_button_play->SetIcon("media_stop"); NetworkAgent *agent = wxGetApp().getAgent(); std::string agent_version = agent ? agent->get_version() : ""; - if (m_lan_proto > MachineObject::LVL_None && (m_lan_mode || !m_remote_support) && !m_disable_lan && !m_lan_ip.empty()) { + if (m_lan_proto > MachineObject::LVL_Disable && (m_lan_mode || !m_remote_support) && !m_disable_lan && !m_lan_ip.empty()) { m_disable_lan = m_remote_support && !m_lan_mode; // try remote next time + std::string url; if (m_lan_proto == MachineObject::LVL_Local) - m_url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd; + url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd; else if (m_lan_proto == MachineObject::LVL_Rtsps) - m_url = "bambu:///rtsps___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?proto=rtsps"; + url = "bambu:///rtsps___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?proto=rtsps"; else if (m_lan_proto == MachineObject::LVL_Rtsp) - m_url = "bambu:///rtsp___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?proto=rtsp"; - m_url += "&device=" + hide_id_middle_string(m_machine); - m_url += "&version=" + agent_version; - m_url += "&dev_ver=" + m_dev_ver; - BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: " << hide_passwd(m_url, {m_lan_passwd} ); + url = "bambu:///rtsp___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?proto=rtsp"; + url += "&device=" + m_machine; + url += "&net_ver=" + agent_version; + url += "&dev_ver=" + m_dev_ver; + url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid"); + url += "&cli_ver=" + std::string(SLIC3R_VERSION); + BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: " << hide_passwd(hide_id_middle_string(url, url.find(m_lan_ip), m_lan_ip.length()), {m_lan_passwd}); + m_url = url; load(); return; } - m_disable_lan = false; - if (m_lan_ip.empty()) - m_failed_code = -1; + // m_lan_mode && m_lan_proto > LVL_Disable (use local tunnel) + // m_lan_mode && m_lan_proto == LVL_Disable (*) + // m_lan_mode && m_lan_proto == LVL_None (x) + // !m_lan_mode && m_remote_support (go on) + // !m_lan_mode && !m_remote_support && m_lan_proto > LVL_None (use local tunnel) + // !m_lan_mode && !m_remote_support && m_lan_proto == LVL_Disable (*) + // !m_lan_mode && !m_remote_support && m_lan_proto == LVL_None (x) - if (m_lan_mode) { - Stop(m_lan_proto < 0 - ? _L("Initialize failed (Not supported on the current printer version)!") - : _L("Initialize failed (Not accessible in LAN-only mode)!")); + if (m_lan_proto <= MachineObject::LVL_Disable && (m_lan_mode || !m_remote_support)) { + Stop(m_lan_proto == MachineObject::LVL_None + ? _L("Problem occured. Please update the printer firmware and try again.") + : _L("LAN Only Liveview is off. Please turn on the liveview on printer screen.")); return; } + + m_disable_lan = false; + m_failed_code = 0; + m_last_state = MEDIASTATE_INITIALIZING; if (!m_remote_support) { // not support tutk - Stop(m_lan_ip.empty() - ? _L("Initialize failed (Missing LAN ip of printer)!") - : _L("Initialize failed (Not supported on the current printer version)!")); + m_failed_code = -1; + m_url = "bambu:///local/"; + Stop(_L("Please enter the IP of printer to connect.")); return; } - m_failed_code = 0; + m_label_stat->SetLabel({}); SetStatus(_L("Initializing...")); if (agent) { - agent->get_camera_url(m_machine, [this, m = m_machine, v = agent_version, dv = m_dev_ver](std::string url) { + agent->get_camera_url(m_machine, + [this, m = m_machine, v = agent_version, dv = m_dev_ver](std::string url) { if (boost::algorithm::starts_with(url, "bambu:///")) { - url += "&device=" + into_u8(hide_id_middle_string(m)); - url += "&version=" + v; + url += "&device=" + into_u8(m); + url += "&net_ver=" + v; url += "&dev_ver=" + dv; + url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid"); + url += "&cli_ver=" + std::string(SLIC3R_VERSION); } - BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: " << hide_id_middle_string(hide_passwd(url, {"authkey=", "passwd="}), 9, 20); + BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: " << hide_passwd(url, + {"?uid=", "authkey=", "passwd=", "license=", "token="}); CallAfter([this, m, url] { if (m != m_machine) { BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl drop late ttcode for machine: " << m; return; } - m_url = url; if (m_last_state == MEDIASTATE_INITIALIZING) { if (url.empty() || !boost::algorithm::starts_with(url, "bambu:///")) { m_failed_code = 3; - Stop(wxString::Format(_L("Initialize failed (%s)!"), url.empty() ? _L("Network unreachable") : from_u8(url))); + Stop(_L("Connection Failed. Please check the network and try again")); } else { + m_url = url; load(); } } else { @@ -270,6 +344,8 @@ void MediaPlayCtrl::Play() } } +void start_ping_test(); + void MediaPlayCtrl::Stop(wxString const &msg) { int last_state = m_last_state; @@ -280,23 +356,41 @@ void MediaPlayCtrl::Stop(wxString const &msg) boost::unique_lock lock(m_mutex); m_tasks.push_back(""); m_cond.notify_all(); - m_last_state = MEDIASTATE_IDLE; if (!msg.IsEmpty()) - SetStatus(msg, false); - else if (m_failed_code) - SetStatus(_L("Stopped [%d]!"), true); - else + SetStatus(msg); + else if (m_failed_code) { + auto iter = error_messages.find(m_failed_code); + auto msg2 = iter == error_messages.end() + ? _L("Please check the network and try again, You can restart or update the printer if the issue persists.") + : _L(iter->second.c_str()); + if (m_failed_code == 1) { + if (m_last_state == wxMEDIASTATE_PLAYING) + msg2 = _L("The printer has been logged out and cannot connect."); + } +#if !BBL_RELEASE_TO_PUBLIC && defined(__WINDOWS__) + if (m_failed_code < 0) + boost::thread ping_thread = Slic3r::create_thread([] { + start_ping_test(); + }); +#endif + SetStatus(msg2); + } else SetStatus(_L("Stopped."), false); - if (m_failed_code >= 100) // not keep retry on local error + m_last_state = MEDIASTATE_IDLE; + bool auto_retry = wxGetApp().app_config->get("liveview", "auto_retry") != "false"; + if (!auto_retry || m_failed_code >= 100 || m_failed_code == 1) // not keep retry on local error or EOS m_next_retry = wxDateTime(); } else if (!msg.IsEmpty()) { SetStatus(msg, false); + return; } else { m_failed_code = 0; + return; } - - bool remote = m_url.find("/local/") == wxString::npos && m_url.find("/rtsp") == wxString::npos; + auto tunnel = m_url.empty() ? "" : into_u8(wxURI(m_url).GetPath()).substr(1); + if (auto n = tunnel.find_first_of('/_'); n != std::string::npos) + tunnel = tunnel.substr(0, n); if (last_state != wxMEDIASTATE_PLAYING && m_failed_code != 0 && m_last_failed_codes.find(m_failed_code) == m_last_failed_codes.end() && (m_user_triggered || m_failed_retry > 3)) { @@ -305,7 +399,9 @@ void MediaPlayCtrl::Stop(wxString const &msg) m_url.clear(); ++m_failed_retry; - if (m_failed_code < 0 && last_state != wxMEDIASTATE_PLAYING && !remote && (m_failed_retry > 1 || m_user_triggered)) { + bool local = tunnel == "local" || tunnel == "rtsp" || + tunnel == "rtsps"; + if (m_failed_code < 0 && last_state != wxMEDIASTATE_PLAYING && local && (m_failed_retry > 1 || m_user_triggered)) { m_next_retry = wxDateTime(); // stop retry if (wxGetApp().show_modal_ip_address_enter_dialog(_L("LAN Connection Failed (Failed to start liveview)"))) { m_failed_retry = 0; @@ -369,13 +465,13 @@ void MediaPlayCtrl::ToggleStream() DownloadProgressDialog2(MediaPlayCtrl *ctrl) : DownloadProgressDialog(_L("Downloading Virtual Camera Tools")), ctrl(ctrl) {} struct UpgradeNetworkJob2 : UpgradeNetworkJob { - UpgradeNetworkJob2() { + UpgradeNetworkJob2(std::shared_ptr pri) : UpgradeNetworkJob() { name = "cameratools"; package_name = "camera_tools.zip"; } }; - std::unique_ptr make_job() override - { return std::make_unique(); } + std::shared_ptr make_job(std::shared_ptr pri) + { return std::make_shared(pri); } void on_finish() override { ctrl->CallAfter([ctrl = this->ctrl] { ctrl->ToggleStream(); }); @@ -397,7 +493,7 @@ void MediaPlayCtrl::ToggleStream() wxGetApp().app_config->set("not_show_vcamera_stop_prev", "1"); if (res == wxID_CANCEL) return; } - if (m_lan_proto > MachineObject::LVL_None && (m_lan_mode || !m_remote_support) && !m_disable_lan && !m_lan_ip.empty()) { + if (m_lan_proto > MachineObject::LVL_Disable && (m_lan_mode || !m_remote_support) && !m_disable_lan && !m_lan_ip.empty()) { std::string url; if (m_lan_proto == MachineObject::LVL_Local) url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd; @@ -405,9 +501,9 @@ void MediaPlayCtrl::ToggleStream() url = "bambu:///rtsps___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?proto=rtsps"; else if (m_lan_proto == MachineObject::LVL_Rtsp) url = "bambu:///rtsp___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?proto=rtsp"; - url += "&device=" + into_u8(hide_id_middle_string(m_machine)); + url += "&device=" + into_u8(m_machine); url += "&dev_ver=" + m_dev_ver; - BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::ToggleStream: " << hide_passwd(url, {m_lan_passwd}); + BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::ToggleStream: " << hide_passwd(hide_id_middle_string(url, url.find(m_lan_ip), m_lan_ip.length()), {m_lan_passwd}); std::string file_url = data_dir() + "/cameratools/url.txt"; boost::nowide::ofstream file(file_url); auto url2 = encode_path(url.c_str()); @@ -421,10 +517,13 @@ void MediaPlayCtrl::ToggleStream() agent->get_camera_url(m_machine, [this, m = m_machine, v = agent->get_version(), dv = m_dev_ver](std::string url) { if (boost::algorithm::starts_with(url, "bambu:///")) { url += "&device=" + m; - url += "&version=" + v; + url += "&net_ver=" + v; url += "&dev_ver=" + dv; + url += "&cli_id=" + wxGetApp().app_config->get("slicer_uuid"); + url += "&cli_ver=" + std::string(SLIC3R_VERSION); } - BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::ToggleStream: " << hide_id_middle_string(hide_passwd(url, {"authkey=", "passwd="}), 9, 20); + BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::ToggleStream: " << hide_passwd(url, + {"?uid=", "authkey=", "passwd=", "license=", "token="}); CallAfter([this, m, url] { if (m != m_machine) return; if (url.empty() || !boost::algorithm::starts_with(url, "bambu:///")) { @@ -484,7 +583,7 @@ void MediaPlayCtrl::onStateChanged(wxMediaEvent &event) } else if (event.GetId()) { if (m_failed_code == 0) m_failed_code = 2; - Stop(_L("Load failed [%d]!")); + Stop(); } } else { m_last_state = state; @@ -493,14 +592,20 @@ void MediaPlayCtrl::onStateChanged(wxMediaEvent &event) void MediaPlayCtrl::SetStatus(wxString const &msg2, bool hyperlink) { - auto msg = wxString::Format(msg2, m_failed_code); - BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::SetStatus: " << msg.ToUTF8().data(); + auto msg = msg2; + if (m_failed_code != 0) { + int state2 = m_last_state >= MEDIASTATE_IDLE ? m_last_state - MEDIASTATE_IDLE : + m_last_state + MEDIASTATE_BUFFERING - MEDIASTATE_IDLE; + msg += wxString::Format(" [%d:%d]", state2, m_failed_code); + } + BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::SetStatus: " << msg.ToUTF8().data() << " tutk_state: " << m_tutk_state; #ifdef __WXMSW__ OutputDebugStringA("MediaPlayCtrl::SetStatus: "); OutputDebugStringA(msg.ToUTF8().data()); OutputDebugStringA("\n"); #endif // __WXMSW__ m_label_status->SetLabel(msg); + m_label_status->Wrap(GetSize().GetWidth() - 120 - m_label_stat->GetSize().GetWidth()); long style = m_label_status->GetWindowStyle() & ~LB_HYPERLINK; if (hyperlink) { style |= LB_HYPERLINK; @@ -550,7 +655,7 @@ void MediaPlayCtrl::media_proc() } wxString url = m_tasks.front(); if (m_tasks.size() >= 2 && !url.IsEmpty() && url[0] != '<' && m_tasks[1] == "") { - BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: busy skip url: " << hide_id_middle_string(hide_passwd(url, {"authkey=", "passwd=", m_lan_passwd}), 9, 20); + BOOST_LOG_TRIVIAL(trace) << "MediaPlayCtrl: busy skip url: " << url; m_tasks.pop_front(); m_tasks.pop_front(); continue; @@ -586,13 +691,15 @@ void MediaPlayCtrl::media_proc() bool MediaPlayCtrl::start_stream_service(bool *need_install) { #ifdef __WIN32__ - std::string file_source = data_dir() + "\\cameratools\\bambu_source.exe"; - std::string file_ffmpeg = data_dir() + "\\cameratools\\ffmpeg.exe"; - std::string file_ff_cfg = data_dir() + "\\cameratools\\ffmpeg.cfg"; + auto tools_dir = boost::nowide::widen(data_dir()) + L"\\cameratools\\"; + auto file_source = tools_dir + L"bambu_source.exe"; + auto file_ffmpeg = tools_dir + L"ffmpeg.exe"; + auto file_ff_cfg = tools_dir + L"ffmpeg.cfg"; #else - std::string file_source = data_dir() + "/cameratools/bambu_source"; - std::string file_ffmpeg = data_dir() + "/cameratools/ffmpeg"; - std::string file_ff_cfg = data_dir() + "/cameratools/ffmpeg.cfg"; + auto tools_dir = data_dir() + "/cameratools/"; + auto file_source = tools_dir + "bambu_source"; + auto file_ffmpeg = tools_dir + "ffmpeg"; + auto file_ff_cfg = tools_dir + "ffmpeg.cfg"; #endif if (!boost::filesystem::exists(file_source) || !boost::filesystem::exists(file_ffmpeg) || !boost::filesystem::exists(file_ff_cfg)) { if (need_install) *need_install = true; @@ -615,14 +722,15 @@ bool MediaPlayCtrl::start_stream_service(bool *need_install) boost::process::pipe intermediate; boost::filesystem::path start_dir(boost::filesystem::path(data_dir()) / "plugins"); #ifdef __WXMSW__ - start_dir = boost::filesystem::path(data_dir()) / "cameratools"; - std::string file_dll = data_dir() + "/cameratools/BambuSource.dll"; - std::string file_dll2 = data_dir() + "/plugins/BambuSource.dll"; - if (!boost::filesystem::exists(file_dll) || boost::filesystem::last_write_time(file_dll) != boost::filesystem::last_write_time(file_dll2)) - boost::filesystem::copy_file(file_dll2, file_dll, boost::filesystem::copy_option::overwrite_if_exists); - static std::locale tmp = std::locale(std::locale(), new boost::nowide::utf8_codecvt()); - boost::process::imbue(tmp); - boost::process::child process_source(file_source, into_u8(file_url2), boost::process::start_dir(start_dir), boost::process::windows::create_no_window, + auto plugins_dir = boost::nowide::widen(data_dir()) + L"\\plugins\\"; + for (auto dll : {L"BambuSource.dll", L"live555.dll"}) { + auto file_dll = tools_dir + dll; + auto file_dll2 = plugins_dir + dll; + if (!boost::filesystem::exists(file_dll) || boost::filesystem::last_write_time(file_dll) != boost::filesystem::last_write_time(file_dll2)) + boost::filesystem::copy_file(file_dll2, file_dll, boost::filesystem::copy_option::overwrite_if_exists); + } + boost::process::child process_source(file_source, file_url2.ToStdWstring(), boost::process::start_dir(tools_dir), + boost::process::windows::create_no_window, boost::process::std_out > intermediate, boost::process::limit_handles); boost::process::child process_ffmpeg(file_ffmpeg, configss, boost::process::windows::create_no_window, boost::process::std_in < intermediate, boost::process::limit_handles); @@ -636,7 +744,7 @@ bool MediaPlayCtrl::start_stream_service(bool *need_install) process_source.detach(); process_ffmpeg.detach(); } catch (std::exception &e) { - BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl failed to start camera stream: " << e.what(); + BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl failed to start camera stream: " << decode_path(e.what()); return false; } return true; @@ -687,20 +795,18 @@ void wxMediaCtrl2::DoSetSize(int x, int y, int width, int height, int sizeFlags) #else wxMediaCtrl::DoSetSize(x, y, width, height, sizeFlags); #endif - //if (sizeFlags & wxSIZE_USE_EXISTING) return; - //wxSize size = GetVideoSize(); - //if (size.GetWidth() <= 0) - // size = wxSize{16, 9}; - //int maxHeight = (width * size.GetHeight() + size.GetHeight() - 1) / size.GetWidth(); - //if (maxHeight != GetMaxHeight()) { - // // BOOST_LOG_TRIVIAL(info) << "wxMediaCtrl2::DoSetSize: width: " << width << ", height: " << height << ", maxHeight: " << maxHeight; - // SetMaxSize({-1, maxHeight}); - // CallAfter([this] { - // if (auto p = GetParent()) { - // p->Layout(); - // p->Refresh(); - // } - // }); - //} + if (sizeFlags & wxSIZE_USE_EXISTING) return; + wxSize size = m_video_size; + int maxHeight = (width * size.GetHeight() + size.GetHeight() - 1) / size.GetWidth(); + if (maxHeight != GetMaxHeight()) { + // BOOST_LOG_TRIVIAL(info) << "wxMediaCtrl2::DoSetSize: width: " << width << ", height: " << height << ", maxHeight: " << maxHeight; + SetMaxSize({-1, maxHeight}); + CallAfter([this] { + if (auto p = GetParent()) { + p->Layout(); + p->Refresh(); + } + }); + } } diff --git a/src/slic3r/GUI/MediaPlayCtrl.h b/src/slic3r/GUI/MediaPlayCtrl.h index 79ce3a4b9c..c4e088876c 100644 --- a/src/slic3r/GUI/MediaPlayCtrl.h +++ b/src/slic3r/GUI/MediaPlayCtrl.h @@ -95,11 +95,13 @@ private: bool m_user_triggered = false; int m_failed_retry = 0; int m_failed_code = 0; + std::vector m_stat; std::set m_last_failed_codes; wxDateTime m_last_user_play; wxDateTime m_next_retry; ::Button *m_button_play; + ::Label * m_label_stat; ::Label * m_label_status; }; diff --git a/src/slic3r/GUI/Monitor.cpp b/src/slic3r/GUI/Monitor.cpp index 8985e0d3a4..dfb3ef974c 100644 --- a/src/slic3r/GUI/Monitor.cpp +++ b/src/slic3r/GUI/Monitor.cpp @@ -121,6 +121,17 @@ AddMachinePanel::~AddMachinePanel() { m_select_machine.Bind(EVT_FINISHED_UPDATE_MACHINE_LIST, [this](wxCommandEvent& e) { m_side_tools->start_interval(); }); + + Bind(EVT_ALREADY_READ_HMS, [this](wxCommandEvent& e) { + auto key = e.GetString().ToStdString(); + auto iter = m_hms_panel->temp_hms_list.find(key); + if (iter != m_hms_panel->temp_hms_list.end()) { + m_hms_panel->temp_hms_list[key].already_read = true; + } + + update_hms_tag(); + e.Skip(); + }); } MonitorPanel::~MonitorPanel() @@ -252,17 +263,20 @@ void MonitorPanel::select_machine(std::string machine_sn) void MonitorPanel::on_update_all(wxMouseEvent &event) { - update_all(); - Layout(); - Refresh(); + if (update_flag) { + update_all(); + Layout(); + Refresh(); + } } void MonitorPanel::on_timer(wxTimerEvent& event) { - update_all(); - - Layout(); - Refresh(); + if (update_flag) { + update_all(); + Layout(); + Refresh(); + } } void MonitorPanel::on_select_printer(wxCommandEvent& event) @@ -270,6 +284,10 @@ void MonitorPanel::on_update_all(wxMouseEvent &event) Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); if (!dev) return; + if ( dev->get_selected_machine() && (dev->get_selected_machine()->dev_id != event.GetString().ToStdString()) && m_hms_panel) { + m_hms_panel->clear_hms_tag(); + } + if (!dev->set_selected_machine(event.GetString().ToStdString())) return; @@ -348,13 +366,15 @@ void MonitorPanel::update_all() } m_status_info_panel->obj = obj; - m_status_info_panel->m_media_play_ctrl->SetMachineObject(obj); m_upgrade_panel->update(obj); + m_status_info_panel->m_media_play_ctrl->SetMachineObject(obj); m_media_file_panel->SetMachineObject(obj); m_side_tools->update_status(obj); if (!obj) { show_status((int)MONITOR_NO_PRINTER); + m_hms_panel->clear_hms_tag(); + m_tabpanel->GetBtnsListCtrl()->showNewTag(3, false); return; } @@ -380,7 +400,7 @@ void MonitorPanel::update_all() m_status_info_panel->update(obj); } - if (m_hms_panel->IsShown()) { + if (m_hms_panel->IsShown() || (obj->hms_list.size() != m_hms_panel->temp_hms_list.size())) { m_hms_panel->update(obj); } @@ -389,6 +409,21 @@ void MonitorPanel::update_all() m_upgrade_panel->update(obj); } #endif + + update_hms_tag(); +} + +void MonitorPanel::update_hms_tag() +{ + for (auto hmsitem : m_hms_panel->temp_hms_list) { + if (!hmsitem.second.already_read) { + //show HMS new tag + m_tabpanel->GetBtnsListCtrl()->showNewTag(3, true); + return; + } + } + + m_tabpanel->GetBtnsListCtrl()->showNewTag(3, false); } bool MonitorPanel::Show(bool show) @@ -400,6 +435,8 @@ bool MonitorPanel::Show(bool show) NetworkAgent* m_agent = wxGetApp().getAgent(); DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); if (show) { + start_update(); + m_refresh_timer->Stop(); m_refresh_timer->SetOwner(this); m_refresh_timer->Start(REFRESH_INTERVAL); @@ -418,6 +455,7 @@ bool MonitorPanel::Show(bool show) } } } else { + stop_update(); m_refresh_timer->Stop(); } return wxPanel::Show(show); @@ -470,7 +508,6 @@ Freeze(); m_status_info_panel->show_status(status); m_hms_panel->show_status(status); m_upgrade_panel->show_status(status); - m_media_file_panel->Enable(status == MonitorStatus::MONITOR_NORMAL); if ((status & (int)MonitorStatus::MONITOR_NO_PRINTER) != 0) { set_default(); diff --git a/src/slic3r/GUI/Monitor.hpp b/src/slic3r/GUI/Monitor.hpp index cb5615b044..715e3e0c17 100644 --- a/src/slic3r/GUI/Monitor.hpp +++ b/src/slic3r/GUI/Monitor.hpp @@ -104,6 +104,7 @@ private: int last_wifi_signal = -1; int last_status; bool m_initialized { false }; + bool update_flag{false}; wxTimer* m_refresh_timer = nullptr; public: @@ -141,6 +142,7 @@ public: //void update_ams(MachineObject* obj); void update_all(); + void update_hms_tag(); bool Show(bool show); void update_side_panel(); @@ -148,6 +150,9 @@ public: MachineObject *obj { nullptr }; std::string last_conn_type = "undedefined"; + + void stop_update() {update_flag = false;}; + void start_update() {update_flag = true;}; }; diff --git a/src/slic3r/GUI/Mouse3DController.cpp b/src/slic3r/GUI/Mouse3DController.cpp index c8efc1b9eb..c5e0881ec8 100644 --- a/src/slic3r/GUI/Mouse3DController.cpp +++ b/src/slic3r/GUI/Mouse3DController.cpp @@ -146,11 +146,13 @@ static std::string format_device_string(int vid, int pid) static std::string detect_attached_device() { std::string ret; - // Initialize the hidapi library int res = hid_init(); if (res != 0) BOOST_LOG_TRIVIAL(error) << "Unable to initialize hidapi library"; + else if (wxGetApp().app_config->get("skip_3dmouse_detect") == "true") { + BOOST_LOG_TRIVIAL(info) << "do not detect 3d Mouse"; + } else { // Enumerates devices hid_device_info* devices = hid_enumerate(0, 0); @@ -927,7 +929,7 @@ void Mouse3DController::run() bool Mouse3DController::connect_device() { - if (m_stop) + if (m_stop || wxGetApp().app_config->get("skip_3dmouse_detect") == "true") return false; { diff --git a/src/slic3r/GUI/MsgDialog.cpp b/src/slic3r/GUI/MsgDialog.cpp index ed323417aa..daac8b18c8 100644 --- a/src/slic3r/GUI/MsgDialog.cpp +++ b/src/slic3r/GUI/MsgDialog.cpp @@ -543,6 +543,126 @@ DeleteConfirmDialog::~DeleteConfirmDialog() {} void DeleteConfirmDialog::on_dpi_changed(const wxRect &suggested_rect) {} +Newer3mfVersionDialog::Newer3mfVersionDialog(wxWindow *parent, const Semver *file_version, const Semver *cloud_version, wxString new_keys) + : DPIDialog(parent ? parent : nullptr, wxID_ANY, wxString(SLIC3R_APP_FULL_NAME " - ") + _L("Newer 3mf version"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX) + , m_file_version(file_version) + , m_cloud_version(cloud_version) + , m_new_keys(new_keys) +{ + this->SetBackgroundColour(*wxWHITE); + std::string icon_path = (boost::format("%1%/images/BambuStudioTitle.ico") % resources_dir()).str(); + SetIcon(wxIcon(encode_path(icon_path.c_str()), wxBITMAP_TYPE_ICO)); + + wxBoxSizer *main_sizer = new wxBoxSizer(wxVERTICAL); + // top line + auto m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL); + m_line_top->SetBackgroundColour(wxColour(0xA6, 0xa9, 0xAA)); + main_sizer->Add(m_line_top, 0, wxEXPAND, 0); + main_sizer->Add(0, 0, 0, wxTOP, FromDIP(5)); + + wxBoxSizer * content_sizer = new wxBoxSizer(wxHORIZONTAL); + wxStaticBitmap *info_bitmap = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("info", nullptr, 60), wxDefaultPosition, wxSize(FromDIP(70), FromDIP(70)), 0); + wxBoxSizer * msg_sizer = get_msg_sizer(); + content_sizer->Add(info_bitmap, 0, wxEXPAND | wxALL, FromDIP(5)); + content_sizer->Add(msg_sizer, 0, wxEXPAND | wxALL, FromDIP(5)); + main_sizer->Add(content_sizer, 0, wxEXPAND | wxALL, FromDIP(5)); + main_sizer->Add(get_btn_sizer(), 0, wxEXPAND | wxALL, FromDIP(5)); + + this->SetSizer(main_sizer); + Layout(); + Fit(); + wxGetApp().UpdateDlgDarkUI(this); +} + +wxBoxSizer *Newer3mfVersionDialog::get_msg_sizer() +{ + wxBoxSizer *vertical_sizer = new wxBoxSizer(wxVERTICAL); + bool file_version_newer = (*m_file_version) > (*m_cloud_version); + wxStaticText *text1; + wxBoxSizer * horizontal_sizer = new wxBoxSizer(wxHORIZONTAL); + wxString msg_str; + if (file_version_newer) { + text1 = new wxStaticText(this, wxID_ANY, _L("The 3mf file version is in Beta and it is newer than the current Bambu Studio version.")); + wxStaticText * text2 = new wxStaticText(this, wxID_ANY, _L("If you would like to try Bambu Studio Beta, you may click to")); + wxHyperlinkCtrl *github_link = new wxHyperlinkCtrl(this, wxID_ANY, _L("Download Beta Version"), "https://github.com/bambulab/BambuStudio/releases"); + horizontal_sizer->Add(text2, 0, wxEXPAND, 0); + horizontal_sizer->Add(github_link, 0, wxEXPAND | wxLEFT, 5); + + } else { + text1 = new wxStaticText(this, wxID_ANY, _L("The 3mf file version is newer than the current Bambu Studio version.")); + wxStaticText *text2 = new wxStaticText(this, wxID_ANY, _L("Update your Bambu Studio could enable all functionality in the 3mf file.")); + horizontal_sizer->Add(text2, 0, wxEXPAND, 0); + } + Semver app_version = *(Semver::parse(SLIC3R_VERSION)); + wxStaticText *cur_version = new wxStaticText(this, wxID_ANY, _L("Current Version: ") + app_version.to_string()); + + vertical_sizer->Add(text1, 0, wxEXPAND | wxTOP, FromDIP(5)); + vertical_sizer->Add(horizontal_sizer, 0, wxEXPAND | wxTOP, FromDIP(5)); + vertical_sizer->Add(cur_version, 0, wxEXPAND | wxTOP, FromDIP(5)); + if (!file_version_newer) { + wxStaticText *latest_version = new wxStaticText(this, wxID_ANY, _L("Latest Version: ") + m_cloud_version->to_string()); + vertical_sizer->Add(latest_version, 0, wxEXPAND | wxTOP, FromDIP(5)); + } + + wxStaticText *unrecognized_keys = new wxStaticText(this, wxID_ANY, m_new_keys); + vertical_sizer->Add(unrecognized_keys, 0, wxEXPAND | wxTOP, FromDIP(10)); + + return vertical_sizer; +} + +wxBoxSizer *Newer3mfVersionDialog::get_btn_sizer() +{ + wxBoxSizer *horizontal_sizer = new wxBoxSizer(wxHORIZONTAL); + horizontal_sizer->Add(0, 0, 1, wxEXPAND, 0); + StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), + std::pair(wxColour(0, 174, 66), StateColor::Normal)); + StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), + std::pair(*wxWHITE, StateColor::Normal)); + bool file_version_newer = (*m_file_version) > (*m_cloud_version); + if (!file_version_newer) { + m_update_btn = new Button(this, _L("Update")); + m_update_btn->SetBackgroundColor(btn_bg_green); + m_update_btn->SetBorderColor(*wxWHITE); + m_update_btn->SetTextColor(wxColour(0xFFFFFE)); + m_update_btn->SetFont(Label::Body_12); + m_update_btn->SetSize(wxSize(FromDIP(58), FromDIP(24))); + m_update_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); + m_update_btn->SetCornerRadius(FromDIP(12)); + horizontal_sizer->Add(m_update_btn, 0, wxRIGHT, FromDIP(10)); + + m_update_btn->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { + EndModal(wxID_OK); + if (wxGetApp().app_config->has("app", "cloud_software_url")) { + std::string download_url = wxGetApp().app_config->get("app", "cloud_software_url"); + wxLaunchDefaultBrowser(download_url); + } else { + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "Bambu Studio conf has no cloud_software_url and file_version: " << m_file_version->to_string() + << " and cloud_version: " << m_cloud_version->to_string(); + } + }); + } + + if (!file_version_newer) { + m_later_btn = new Button(this, _L("Not for now")); + m_later_btn->SetBackgroundColor(btn_bg_white); + m_later_btn->SetBorderColor(wxColour(38, 46, 48)); + } else { + m_later_btn = new Button(this, _L("OK")); + m_later_btn->SetBackgroundColor(btn_bg_green); + m_later_btn->SetBorderColor(*wxWHITE); + m_later_btn->SetTextColor(wxColour(0xFFFFFE)); + } + m_later_btn->SetFont(Label::Body_12); + m_later_btn->SetSize(wxSize(FromDIP(58), FromDIP(24))); + m_later_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); + m_later_btn->SetCornerRadius(FromDIP(12)); + horizontal_sizer->Add(m_later_btn, 0, wxRIGHT, FromDIP(10)); + m_later_btn->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { + EndModal(wxID_OK); + }); + return horizontal_sizer; +} + } // namespace GUI } // namespace Slic3r diff --git a/src/slic3r/GUI/MsgDialog.hpp b/src/slic3r/GUI/MsgDialog.hpp index 58e113acbe..a7acc42de2 100644 --- a/src/slic3r/GUI/MsgDialog.hpp +++ b/src/slic3r/GUI/MsgDialog.hpp @@ -1,7 +1,3 @@ -///|/ Copyright (c) Prusa Research 2018 - 2022 Oleksandra Iushchenko @YuSanka, Lukáš Matěna @lukasmatena, David Kocík @kocikdav, Lukáš Hejl @hejllukas, Vojtěch Bubník @bubnikv, Vojtěch Král @vojtechkral -///|/ -///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher -///|/ #ifndef slic3r_MsgDialog_hpp_ #define slic3r_MsgDialog_hpp_ @@ -20,6 +16,7 @@ #include "Widgets/TextInput.hpp" #include "BBLStatusBar.hpp" #include "BBLStatusBarSend.hpp" +#include "libslic3r/Semver.hpp" class wxBoxSizer; class wxCheckBox; @@ -392,6 +389,27 @@ private: wxStaticText *m_msg_text = nullptr; }; +class Newer3mfVersionDialog : public DPIDialog +{ +public: + Newer3mfVersionDialog(wxWindow *parent, const Semver* file_version, const Semver* cloud_version, wxString new_keys); + ~Newer3mfVersionDialog(){}; + virtual void on_dpi_changed(const wxRect &suggested_rect){}; + +private: + wxBoxSizer *get_msg_sizer(); + wxBoxSizer *get_btn_sizer(); + + +private: + const Semver *m_file_version; + const Semver *m_cloud_version; + wxString m_new_keys; + Button * m_update_btn = nullptr; + Button * m_later_btn = nullptr; + wxStaticText *m_msg_text = nullptr; +}; + } } diff --git a/src/slic3r/GUI/ObjectDataViewModel.cpp b/src/slic3r/GUI/ObjectDataViewModel.cpp index b320ea4f4a..fdf4f765b8 100644 --- a/src/slic3r/GUI/ObjectDataViewModel.cpp +++ b/src/slic3r/GUI/ObjectDataViewModel.cpp @@ -1532,7 +1532,10 @@ void ObjectDataViewModel::assembly_name(ObjectDataViewModelNode* item, wxString auto type = this->GetItemType(wxDataViewItem(item)); if (type != itPlate) { wxString str = name + ":" + item->GetName(); - assembly_name_list.push_back(std::make_pair(item, str)); + assembly_name_list.push_back(std::make_tuple(item, str, str)); + } + else { + assembly_name_list.push_back(std::make_tuple(item, name, name)); } for (size_t i = 0; i < item->GetChildCount(); ++i) { wxString str_name = name + ":" + item->GetName(); @@ -1552,18 +1555,27 @@ void ObjectDataViewModel::search_object(wxString search_text) search_found_list.clear(); search_text = search_text.MakeLower(); - for (auto pair : assembly_name_list) { - wxString need_str = pair.second.AfterFirst(':'); - need_str = need_str.MakeLower(); - size_t pos = need_str.find(search_text); - if ( pos != wxString::npos) { - size_t len = search_text.length(); - size_t before_size = pair.second.BeforeFirst(':').length(); - wxString new_search_str = "" + pair.second.Mid(before_size + pos + 1, len) + ""; - wxString new_str = pair.second.Mid(0, before_size + pos + 1) + new_search_str + pair.second.Mid(before_size + pos + len + 1, wxString::npos); + for (const auto& [model_node, name, tip] : assembly_name_list) { + wxString sub_str = name; + sub_str = sub_str.MakeLower(); - search_found_list.push_back(std::make_pair(pair.first, new_str)); + wxString new_str = ""; + size_t search_text_len = search_text.length(); + size_t curr_str_len = 0; + size_t pos = sub_str.find(search_text); + while (pos != wxString::npos) { + wxString new_search_str = "" + name.Mid(curr_str_len + pos, search_text_len) + ""; + new_str += name.Mid(curr_str_len, pos) + new_search_str; + curr_str_len += search_text_len + pos; + sub_str = sub_str.substr(pos + search_text_len); + pos = sub_str.find(search_text); } + + if (curr_str_len > 0 && curr_str_len < name.length()) { + new_str += name.substr(curr_str_len); + } + if (!new_str.empty()) + search_found_list.push_back(std::tuple(model_node, new_str, tip)); } } } diff --git a/src/slic3r/GUI/ObjectDataViewModel.hpp b/src/slic3r/GUI/ObjectDataViewModel.hpp index 47ac80d3d3..83131dc5e0 100644 --- a/src/slic3r/GUI/ObjectDataViewModel.hpp +++ b/src/slic3r/GUI/ObjectDataViewModel.hpp @@ -341,8 +341,8 @@ class ObjectDataViewModel :public wxDataViewModel ObjectDataViewModelNode* m_plate_outside; wxDataViewCtrl* m_ctrl { nullptr }; - std::vector> assembly_name_list; - std::vector> search_found_list; + std::vector> assembly_name_list; + std::vector> search_found_list; std::map m_ui_and_3d_volume_map; public: @@ -518,9 +518,9 @@ public: void assembly_name(ObjectDataViewModelNode* item, wxString name); void assembly_name(); - std::vector> get_assembly_name_list() { return assembly_name_list; } + std::vector> get_assembly_name_list() const { return assembly_name_list; } void search_object(wxString search_text); - std::vector> get_found_list() { return search_found_list; } + std::vector> get_found_list() const { return search_found_list; } void sys_color_changed(); diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index eb25999cc8..110d91d9ce 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -289,7 +289,7 @@ void OptionsGroup::activate_line(Line& line) // Set sidetext width for a better alignment of options in line // "m_show_modified_btns==true" means that options groups are in tabs if (option_set.size() > 1 && m_use_custom_ctrl) { - // sublabel_width = Field::def_width(); + sublabel_width = Field::def_width() + 1; sidetext_width = Field::def_width_thinner(); } @@ -532,6 +532,9 @@ bool OptionsGroup::activate(std::function throw_if_canceled/* = [](){}*/ return true; } + +void free_window(wxWindow *win); + // delete all controls from the option group void OptionsGroup::clear(bool destroy_custom_ctrl) { @@ -560,8 +563,10 @@ void OptionsGroup::clear(bool destroy_custom_ctrl) if (custom_ctrl) { for (auto const &item : m_fields) { wxWindow* win = item.second.get()->getWindow(); - if (win) + if (win) { + free_window(win); win = nullptr; + } } //BBS: custom_ctrl already destroyed from sizer->clear(), no need to destroy here anymore if (destroy_custom_ctrl) @@ -1048,6 +1053,11 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config ret = 0; break; } + if (!config.has("other_layers_sequence_choice") && opt_key == "other_layers_sequence_choice") { + // reset to Auto value + ret = 0; + break; + } if (!config.has("curr_bed_type") && opt_key == "curr_bed_type") { // reset to global value DynamicConfig& global_cfg = wxGetApp().preset_bundle->project_config; diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index 61480e49af..119e3394ef 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -282,11 +282,7 @@ PrintSequence PartPlate::get_print_seq() const PrintSequence PartPlate::get_real_print_seq(bool* plate_same_as_global) const { - PrintSequence global_print_seq = PrintSequence::ByDefault; - auto curr_preset_config = wxGetApp().preset_bundle->prints.get_edited_preset().config; - if (curr_preset_config.has("print_sequence")) - global_print_seq = curr_preset_config.option>("print_sequence")->value; - + PrintSequence global_print_seq = wxGetApp().global_print_sequence(); PrintSequence curr_plate_seq = get_print_seq(); if (curr_plate_seq == PrintSequence::ByDefault) { curr_plate_seq = global_print_seq; @@ -323,8 +319,20 @@ void PartPlate::set_spiral_vase_mode(bool spiral_mode, bool as_global) std::string key = "spiral_mode"; if (as_global) m_config.erase(key); - else - m_config.set_key_value(key, new ConfigOptionBool(spiral_mode)); + else { + if (spiral_mode) { + if (get_spiral_vase_mode()) + return; + // Secondary confirmation + auto answer = static_cast(wxGetApp().plate_tab)->show_spiral_mode_settings_dialog(false); + if (answer == wxID_YES) { + m_config.set_key_value(key, new ConfigOptionBool(true)); + set_vase_mode_related_object_config(); + } + } + else + m_config.set_key_value(key, new ConfigOptionBool(false)); + } } bool PartPlate::valid_instance(int obj_id, int instance_id) @@ -1020,16 +1028,17 @@ void PartPlate::render_icons(bool bottom, bool only_name, int hover_id) else render_icon_texture(m_plate_name_edit_icon.model, m_partplate_list->m_plate_name_edit_texture); - if (m_partplate_list->render_plate_settings) { + if (m_partplate_list->render_plate_settings) { + bool has_plate_settings = get_bed_type() != BedType::btDefault || get_print_seq() != PrintSequence::ByDefault || !get_first_layer_print_sequence().empty() || !get_other_layers_print_sequence().empty() || has_spiral_mode_config(); if (hover_id == 5) { - if (get_bed_type() == BedType::btDefault && get_print_seq() == PrintSequence::ByDefault && get_first_layer_print_sequence().empty()) + if (!has_plate_settings) render_icon_texture(m_plate_settings_icon.model, m_partplate_list->m_plate_settings_hovered_texture); else render_icon_texture(m_plate_settings_icon.model, m_partplate_list->m_plate_settings_changed_hovered_texture); show_tooltip(_u8L("Customize current plate")); } else { - if (get_bed_type() == BedType::btDefault && get_print_seq() == PrintSequence::ByDefault && get_first_layer_print_sequence().empty()) + if (!has_plate_settings) render_icon_texture(m_plate_settings_icon.model, m_partplate_list->m_plate_settings_texture); else render_icon_texture(m_plate_settings_icon.model, m_partplate_list->m_plate_settings_changed_texture); @@ -1569,11 +1578,19 @@ std::vector PartPlate::get_used_extruders() if (!result) return used_extruders; + std::set used_extruders_set; PrintEstimatedStatistics& ps = result->print_statistics; - for (auto it = ps.volumes_per_extruder.begin(); it != ps.volumes_per_extruder.end(); it++) { - used_extruders.push_back(it->first + 1); - } - return used_extruders; + // model usage + for (const auto&item:ps.volumes_per_extruder) + used_extruders_set.emplace(item.first + 1); + // support usage + for (const auto&item:ps.support_volumes_per_extruder) + used_extruders_set.emplace(item.first + 1); + // wipe tower usage + for (const auto&item:ps.wipe_tower_volumes_per_extruder) + used_extruders_set.emplace(item.first + 1); + + return std::vector(used_extruders_set.begin(), used_extruders_set.end()); } Vec3d PartPlate::estimate_wipe_tower_size(const DynamicPrintConfig & config, const double w, const double d, int plate_extruder_size, bool use_global_objects) const @@ -1900,6 +1917,16 @@ bool PartPlate::is_valid_gcode_file() return true; } +ModelObjectPtrs PartPlate::get_objects_on_this_plate() { + ModelObjectPtrs objects_ptr; + int obj_id; + for (auto it = obj_to_instance_set.begin(); it != obj_to_instance_set.end(); it++) { + obj_id = it->first; + objects_ptr.push_back(m_model->objects[obj_id]); + } + return objects_ptr; +} + ModelInstance* PartPlate::get_instance(int obj_id, int instance_id) { if (!contain_instance(obj_id, instance_id)) @@ -1969,13 +1996,10 @@ bool PartPlate::check_outside(int obj_id, int instance_id, BoundingBoxf3* boundi ModelInstance* instance = object->instances[instance_id]; BoundingBoxf3 instance_box = bounding_box? *bounding_box: object->instance_convex_hull_bounding_box(instance_id); - Vec3d up_point = m_bounding_box.max + Vec3d(Slic3r::BuildVolume::SceneEpsilon, Slic3r::BuildVolume::SceneEpsilon, - m_origin.z() + m_height + Slic3r::BuildVolume::SceneEpsilon); - Vec3d low_point = m_bounding_box.min + Vec3d(-Slic3r::BuildVolume::SceneEpsilon, -Slic3r::BuildVolume::SceneEpsilon, - m_origin.z() - Slic3r::BuildVolume::SceneEpsilon); - Polygon hull = instance->convex_hull_2d(); - if (instance_box.max.z() > low_point.z()) low_point.z() += instance_box.min.z(); // not considering outsize if sinking - BoundingBoxf3 plate_box(low_point, up_point); + Polygon hull = instance->convex_hull_2d(); + BoundingBoxf3 plate_box = get_plate_box(); + if (instance_box.max.z() > plate_box.min.z()) + plate_box.min.z() += instance_box.min.z(); // not considering outsize if sinking if (plate_box.contains(instance_box)) { @@ -2018,15 +2042,7 @@ bool PartPlate::intersect_instance(int obj_id, int instance_id, BoundingBoxf3* b ModelObject* object = m_model->objects[obj_id]; ModelInstance* instance = object->instances[instance_id]; BoundingBoxf3 instance_box = bounding_box? *bounding_box: object->instance_convex_hull_bounding_box(instance_id); - Vec3d up_point = - m_bounding_box.max + Vec3d(Slic3r::BuildVolume::SceneEpsilon, Slic3r::BuildVolume::SceneEpsilon, - m_origin.z() + m_height + Slic3r::BuildVolume::SceneEpsilon); - Vec3d low_point = - m_bounding_box.min + Vec3d(-Slic3r::BuildVolume::SceneEpsilon, -Slic3r::BuildVolume::SceneEpsilon, - m_origin.z() - Slic3r::BuildVolume::SceneEpsilon); - BoundingBoxf3 plate_box(low_point, up_point); - - result = plate_box.intersects(instance_box); + result = get_plate_box().intersects(instance_box); } else { @@ -2069,7 +2085,7 @@ int PartPlate::add_instance(int obj_id, int instance_id, bool move_position, Bou ModelInstance* instance = object->instances[instance_id]; std::pair pair(obj_id, instance_id); - obj_to_instance_set.insert(pair); + obj_to_instance_set.insert(pair); BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": plate_id %1%, add instance obj_id %2%, instance_id %3%, move_position %4%") % m_plate_index % obj_id % instance_id % move_position; @@ -2267,6 +2283,43 @@ void PartPlate::update_object_index(int obj_idx_removed, int obj_idx_max) } +void PartPlate::set_vase_mode_related_object_config(int obj_id) { + ModelObjectPtrs obj_ptrs; + if (obj_id != -1) { + ModelObject* object = m_model->objects[obj_id]; + obj_ptrs.push_back(object); + } + else + obj_ptrs = get_objects_on_this_plate(); + + DynamicPrintConfig* global_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config; + DynamicPrintConfig new_conf; + new_conf.set_key_value("wall_loops", new ConfigOptionInt(1)); + new_conf.set_key_value("top_shell_layers", new ConfigOptionInt(0)); + new_conf.set_key_value("sparse_infill_density", new ConfigOptionPercent(0)); + new_conf.set_key_value("enable_support", new ConfigOptionBool(false)); + new_conf.set_key_value("enforce_support_layers", new ConfigOptionInt(0)); + new_conf.set_key_value("detect_thin_wall", new ConfigOptionBool(false)); + new_conf.set_key_value("timelapse_type", new ConfigOptionEnum(tlTraditional)); + new_conf.set_key_value("overhang_reverse", new ConfigOptionBool(false)); + new_conf.set_key_value("wall_direction", new ConfigOptionEnum(WallDirection::Auto)); + auto applying_keys = global_config->diff(new_conf); + + for (ModelObject* object : obj_ptrs) { + ModelConfigObject& config = object->config; + + for (auto opt_key : applying_keys) { + config.set_key_value(opt_key, new_conf.option(opt_key)->clone()); + } + + applying_keys = config.get().diff(new_conf); + for (auto opt_key : applying_keys) { + config.set_key_value(opt_key, new_conf.option(opt_key)->clone()); + } + } + //wxGetApp().obj_list()->update_selections(); +} + int PartPlate::printable_instance_size() { int size = 0; @@ -2512,7 +2565,7 @@ void PartPlate::generate_exclude_polygon(ExPolygon &exclude_polygon) bool PartPlate::set_shape(const Pointfs& shape, const Pointfs& exclude_areas, Vec2d position, float height_to_lid, float height_to_rod) { Pointfs new_shape, new_exclude_areas; - + m_raw_shape = shape; for (const Vec2d& p : shape) { new_shape.push_back(Vec2d(p.x() + position.x(), p.y() + position.y())); } @@ -2889,6 +2942,20 @@ std::vector PartPlate::get_first_layer_print_sequence() const return std::vector(); } +std::vector PartPlate::get_other_layers_print_sequence() const +{ + const ConfigOptionInts* other_layers_print_sequence_op = m_config.option("other_layers_print_sequence"); + const ConfigOptionInt* other_layers_print_sequence_nums_op = m_config.option("other_layers_print_sequence_nums"); + if (other_layers_print_sequence_op && other_layers_print_sequence_nums_op) { + const std::vector& print_sequence = other_layers_print_sequence_op->values; + int sequence_nums = other_layers_print_sequence_nums_op->value; + auto other_layers_seqs = Slic3r::get_other_layers_print_sequence(sequence_nums, print_sequence); + return other_layers_seqs; + } + else + return {}; +} + void PartPlate::set_first_layer_print_sequence(const std::vector& sorted_filaments) { if (sorted_filaments.size() > 0) { @@ -2908,8 +2975,52 @@ void PartPlate::set_first_layer_print_sequence(const std::vector& sorted_fi } } +void PartPlate::set_other_layers_print_sequence(const std::vector& layer_seq_list) +{ + if (layer_seq_list.empty()) { + m_config.erase("other_layers_print_sequence"); + m_config.erase("other_layers_print_sequence_nums"); + return; + } + + int sequence_nums; + std::vector other_layers_seqs; + Slic3r::get_other_layers_print_sequence(layer_seq_list, sequence_nums, other_layers_seqs); + ConfigOptionInts* other_layers_print_sequence_op = m_config.option("other_layers_print_sequence"); + ConfigOptionInt* other_layers_print_sequence_nums_op = m_config.option("other_layers_print_sequence_nums"); + if (other_layers_print_sequence_op) + other_layers_print_sequence_op->values = other_layers_seqs; + else + m_config.set_key_value("other_layers_print_sequence", new ConfigOptionInts(other_layers_seqs)); + if (other_layers_print_sequence_nums_op) + other_layers_print_sequence_nums_op->value = sequence_nums; + else + m_config.set_key_value("other_layers_print_sequence_nums", new ConfigOptionInt(sequence_nums)); +} + void PartPlate::update_first_layer_print_sequence(size_t filament_nums) { + auto other_layers_seqs = get_other_layers_print_sequence(); + if (!other_layers_seqs.empty()) { + bool need_update_data = false; + for (auto& other_layers_seq : other_layers_seqs) { + std::vector& orders = other_layers_seq.second; + if (orders.size() > filament_nums) { + orders.erase(std::remove_if(orders.begin(), orders.end(), [filament_nums](int n) { return n > filament_nums; }), orders.end()); + need_update_data = true; + } + if (orders.size() < filament_nums) { + for (size_t extruder_id = orders.size(); extruder_id < filament_nums; ++extruder_id) { + orders.push_back(extruder_id + 1); + need_update_data = true; + } + } + } + if (need_update_data) + set_other_layers_print_sequence(other_layers_seqs); + } + + ConfigOptionInts * op_print_sequence_1st = m_config.option("first_layer_print_sequence"); if (!op_print_sequence_1st) { return; @@ -3957,7 +4068,7 @@ int PartPlateList::find_instance_belongs(int obj_id, int instance_id) //notify instance's update, need to refresh the instance in plates //newly added or modified -int PartPlateList::notify_instance_update(int obj_id, int instance_id) +int PartPlateList::notify_instance_update(int obj_id, int instance_id, bool is_new) { int ret = 0, index; PartPlate* plate = NULL; @@ -4028,6 +4139,21 @@ int PartPlateList::notify_instance_update(int obj_id, int instance_id) } } + auto is_object_config_compatible_with_spiral_vase = [](ModelObject* object) { + const DynamicPrintConfig& config = object->config.get(); + if (config.has("wall_loops") && config.opt_int("wall_loops") == 1 && + config.has("top_shell_layers") && config.opt_int("top_shell_layers") == 0 && + config.has("sparse_infill_density") && config.option("sparse_infill_density")->value == 0 && + config.has("enable_support") && !config.opt_bool("enable_support") && + config.has("enforce_support_layers") && config.opt_int("enforce_support_layers") == 0 && + config.has("ensure_vertical_shell_thickness") && config.opt_bool("ensure_vertical_shell_thickness") && + config.has("detect_thin_wall") && !config.opt_bool("detect_thin_wall") && + config.has("timelapse_type") && config.opt_enum("timelapse_type") == TimelapseType::tlTraditional) + return true; + else + return false; + }; + //try to find a new plate for (unsigned int i = 0; i < (unsigned int)m_plate_list.size(); ++i) { @@ -4038,6 +4164,20 @@ int PartPlateList::notify_instance_update(int obj_id, int instance_id) { //found a new plate, add it to plate plate->add_instance(obj_id, instance_id, false, &boundingbox); + + // spiral mode, update object setting + if (plate->config()->has("spiral_mode") && plate->config()->opt_bool("spiral_mode") && !is_object_config_compatible_with_spiral_vase(object)) { + if (!is_new) { + auto answer = static_cast(wxGetApp().plate_tab)->show_spiral_mode_settings_dialog(true); + if (answer == wxID_YES) { + plate->set_vase_mode_related_object_config(obj_id); + } + } + else { + plate->set_vase_mode_related_object_config(obj_id); + } + } + plate->update_slice_result_valid_state(); plate->thumbnail_data.reset(); plate->top_thumbnail_data.reset(); diff --git a/src/slic3r/GUI/PartPlate.hpp b/src/slic3r/GUI/PartPlate.hpp index b6c5d430ff..8a9f9436b7 100644 --- a/src/slic3r/GUI/PartPlate.hpp +++ b/src/slic3r/GUI/PartPlate.hpp @@ -22,6 +22,7 @@ #include "GLModel.hpp" #include "3DBed.hpp" #include "MeshUtils.hpp" +#include "libslic3r/ParameterUtils.hpp" class GLUquadric; typedef class GLUquadric GLUquadricObject; @@ -116,6 +117,7 @@ private: friend class PartPlateList; + Pointfs m_raw_shape; Pointfs m_shape; Pointfs m_exclude_area; BoundingBoxf3 m_bounding_box; @@ -291,6 +293,7 @@ public: // BBS Vec2d get_size() const { return Vec2d(m_width, m_depth); } ModelObjectPtrs get_objects() { return m_model->objects; } + ModelObjectPtrs get_objects_on_this_plate(); ModelInstance* get_instance(int obj_id, int instance_id); Vec3d get_origin() { return m_origin; } @@ -335,6 +338,9 @@ public: //update object's index caused by original object deleted void update_object_index(int obj_idx_removed, int obj_idx_max); + // set objects configs when enabling spiral vase mode. + void set_vase_mode_related_object_config(int obj_id = -1); + //whether it is empty bool empty() { return obj_to_instance_set.empty(); } @@ -362,10 +368,18 @@ public: void set_hover_id(int id) { m_hover_id = id; } const BoundingBoxf3& get_bounding_box(bool extended = false) { return extended ? m_extended_bounding_box : m_bounding_box; } const BoundingBox get_bounding_box_crd(); + BoundingBoxf3 get_plate_box() {return get_build_volume();} BoundingBoxf3 get_build_volume() { - Vec3d up_point = m_bounding_box.max + Vec3d(0, 0, m_origin.z() + m_height); - Vec3d low_point = m_bounding_box.min + Vec3d(0, 0, m_origin.z()); + auto eps=Slic3r::BuildVolume::SceneEpsilon; + Vec3d up_point = Vec3d(m_origin.x() + m_width + eps, m_origin.y() + m_depth + eps, m_origin.z() + m_height + eps); + Vec3d low_point = Vec3d(m_origin.x() - eps, m_origin.y() - eps, m_origin.z() - eps); + if (m_raw_shape.size() > 0) { + up_point.x() += m_raw_shape[0].x(); + up_point.y() += m_raw_shape[0].y(); + low_point.x() += m_raw_shape[0].x(); + low_point.y() += m_raw_shape[0].y(); + } BoundingBoxf3 plate_box(low_point, up_point); return plate_box; } @@ -460,7 +474,9 @@ public: int load_pattern_box_data(std::string filename); std::vector get_first_layer_print_sequence() const; + std::vector get_other_layers_print_sequence() const; void set_first_layer_print_sequence(const std::vector &sorted_filaments); + void set_other_layers_print_sequence(const std::vector& layer_seq_list); void update_first_layer_print_sequence(size_t filament_nums); void print() const; @@ -733,7 +749,7 @@ public: int find_instance_belongs(int obj_id, int instance_id); //notify instance's update, need to refresh the instance in plates - int notify_instance_update(int obj_id, int instance_id); + int notify_instance_update(int obj_id, int instance_id, bool is_new = false); //notify instance is removed int notify_instance_removed(int obj_id, int instance_id); diff --git a/src/slic3r/GUI/PlateSettingsDialog.cpp b/src/slic3r/GUI/PlateSettingsDialog.cpp index d45c93091d..88f9391773 100644 --- a/src/slic3r/GUI/PlateSettingsDialog.cpp +++ b/src/slic3r/GUI/PlateSettingsDialog.cpp @@ -1,11 +1,368 @@ #include "PlateSettingsDialog.hpp" - +#include "MsgDialog.hpp" namespace Slic3r { namespace GUI { +static constexpr int MIN_LAYER_VALUE = 2; +static constexpr int MAX_LAYER_VALUE = INT_MAX - 1; wxDEFINE_EVENT(EVT_SET_BED_TYPE_CONFIRM, wxCommandEvent); +wxDEFINE_EVENT(EVT_NEED_RESORT_LAYERS, wxCommandEvent); -PlateSettingsDialog::PlateSettingsDialog(wxWindow* parent, const wxString& title, bool only_first_layer_seq, const wxPoint& pos, const wxSize& size, long style) +bool LayerSeqInfo::operator<(const LayerSeqInfo& another) const +{ + if (this->begin_layer_number < MIN_LAYER_VALUE) + return false; + if (another.begin_layer_number < MIN_LAYER_VALUE) + return true; + if (this->begin_layer_number == another.begin_layer_number) { + if (this->end_layer_number < MIN_LAYER_VALUE) + return false; + if (another.end_layer_number < MIN_LAYER_VALUE) + return true; + return this->end_layer_number < another.end_layer_number; + } + return this->begin_layer_number < another.begin_layer_number; +} + +LayerNumberTextInput::LayerNumberTextInput(wxWindow* parent, int layer_number, wxSize size, Type type, ValueType value_type) + :ComboBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, size, 0, NULL) + , m_layer_number(layer_number) + , m_type(type) + , m_value_type(value_type) +{ + GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_DIGITS)); + GetTextCtrl()->SetFont(::Label::Body_14); + Append(_L("End")); + Append(_L("Customize")); + if (m_value_type == ValueType::End) + SetSelection(0); + if (m_value_type == ValueType::Custom) { + SetSelection(1); + update_label(); + } + + Bind(wxEVT_TEXT, [this](auto& evt) { + if (m_value_type == ValueType::End) { + // TextCtrl->SetValue() will generate a wxEVT_TEXT event + GetTextCtrl()->ChangeValue(_L("End")); + return; + } + evt.Skip(); + }); + + auto validate_input_value = [this](int gui_value) { + // value should not be less than MIN_LAYER_VALUE, and should not be greater than MAX_LAYER_VALUE + gui_value = std::clamp(gui_value, MIN_LAYER_VALUE, MAX_LAYER_VALUE); + + int begin_value; + int end_value; + LayerNumberTextInput* end_layer_input = nullptr; + if (this->m_type == Type::Begin) { + begin_value = gui_value; + end_value = m_another_layer_input->get_layer_number(); + end_layer_input = m_another_layer_input; + } + if (this->m_type == Type::End) { + begin_value = m_another_layer_input->get_layer_number(); + end_value = gui_value; + end_layer_input = this; + } + + // end value should not be less than begin value + if (begin_value > end_value) { + // set new value for end_layer_input + if (this->m_type == Type::Begin) { + if (end_layer_input->is_layer_number_valid()) { + end_layer_input->set_layer_number(begin_value); + } + } + if (this->m_type == Type::End) { + if (!this->is_layer_number_valid()) { + this->set_layer_number(begin_value); + wxCommandEvent evt(EVT_NEED_RESORT_LAYERS); + wxPostEvent(m_parent, evt); + } + else { + // do nothing + // reset to the last value for end_layer_input + } + return; + } + } + m_layer_number = gui_value; + wxCommandEvent evt(EVT_NEED_RESORT_LAYERS); + wxPostEvent(m_parent, evt); + }; + auto commit_layer_number_from_gui = [this, validate_input_value]() { + if (m_value_type == ValueType::End) + return; + + auto gui_str = GetTextCtrl()->GetValue().ToStdString(); + if (gui_str.empty()) { + m_layer_number = -1; + wxCommandEvent evt(EVT_NEED_RESORT_LAYERS); + wxPostEvent(m_parent, evt); + } + if (!gui_str.empty()) { + int gui_value = atoi(gui_str.c_str()); + validate_input_value(gui_value); + } + update_label(); + }; + Bind(wxEVT_TEXT_ENTER, [commit_layer_number_from_gui](wxEvent& evt) { + commit_layer_number_from_gui(); + evt.Skip(); + }); + Bind(wxEVT_KILL_FOCUS, [commit_layer_number_from_gui](wxFocusEvent& evt) { + commit_layer_number_from_gui(); + evt.Skip(); + }); + + Bind(wxEVT_COMBOBOX, [this](auto& e) { + if (e.GetSelection() == 0) { + m_value_type = ValueType::End; + } + else if (e.GetSelection() == 1) { + m_value_type = ValueType::Custom; + m_layer_number = -1; + update_label(); + } + e.Skip(); + }); +} + +void LayerNumberTextInput::update_label() +{ + if (m_value_type == ValueType::End) + return; + + if (!is_layer_number_valid()) { + SetLabel(""); + } + else + SetLabel(std::to_string(m_layer_number)); +} + +void LayerNumberTextInput::set_layer_number(int layer_number) +{ + m_layer_number = layer_number; + if (layer_number == MAX_LAYER_VALUE) + m_value_type = ValueType::End; + else + m_value_type = ValueType::Custom; + + if (m_value_type == ValueType::End) + SetSelection(0); + if (m_value_type == ValueType::Custom) { + SetSelection(1); + update_label(); + } +} + +int LayerNumberTextInput::get_layer_number() +{ + return m_value_type == ValueType::End ? MAX_LAYER_VALUE : m_layer_number; +} + +bool LayerNumberTextInput::is_layer_number_valid() +{ + if (m_value_type == ValueType::End) + return true; + return m_layer_number >= MIN_LAYER_VALUE; +} + +OtherLayersSeqPanel::OtherLayersSeqPanel(wxWindow* parent) + :wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize) +{ + m_bmp_delete = ScalableBitmap(this, "delete_filament"); + m_bmp_add = ScalableBitmap(this, "add_filament"); + + SetBackgroundColour(*wxWHITE); + + wxBoxSizer* top_sizer = new wxBoxSizer(wxVERTICAL); + + wxBoxSizer* title_sizer = new wxBoxSizer(wxHORIZONTAL); + m_other_layer_print_seq_choice = new ComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(240), -1), 0, NULL, wxCB_READONLY); + m_other_layer_print_seq_choice->Append(_L("Auto")); + m_other_layer_print_seq_choice->Append(_L("Customize")); + m_other_layer_print_seq_choice->SetSelection(0); + wxStaticText* other_layer_txt = new wxStaticText(this, wxID_ANY, _L("Other layer filament sequence")); + other_layer_txt->SetFont(Label::Body_14); + title_sizer->Add(other_layer_txt, 0, wxALIGN_CENTER | wxALIGN_LEFT, 0); + title_sizer->AddStretchSpacer(); + title_sizer->Add(m_other_layer_print_seq_choice, 0, wxALIGN_CENTER | wxALIGN_RIGHT, 0); + + wxBoxSizer* buttons_sizer = new wxBoxSizer(wxHORIZONTAL); + ScalableButton* add_layers_btn = new ScalableButton(this, wxID_ANY, m_bmp_add); + add_layers_btn->SetBackgroundColour(GetBackgroundColour()); + ScalableButton* delete_layers_btn = new ScalableButton(this, wxID_ANY, m_bmp_delete); + delete_layers_btn->SetBackgroundColour(GetBackgroundColour()); + buttons_sizer->Add(add_layers_btn, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER, FromDIP(5)); + buttons_sizer->Add(delete_layers_btn, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER, FromDIP(5)); + buttons_sizer->Show(false); + + m_layer_input_panel = new wxPanel(this); + wxBoxSizer* layer_panel_sizer = new wxBoxSizer(wxVERTICAL); + m_layer_input_panel->SetSizer(layer_panel_sizer); + m_layer_input_panel->Hide(); + append_layer(); + + top_sizer->Add(title_sizer, 0, wxEXPAND, 0); + top_sizer->Add(buttons_sizer, 0, wxALIGN_CENTER, 0); + top_sizer->Add(m_layer_input_panel, 0, wxEXPAND, 0); + + SetSizer(top_sizer); + Layout(); + top_sizer->Fit(this); + + + m_other_layer_print_seq_choice->Bind(wxEVT_COMBOBOX, [this, buttons_sizer](auto& e) { + if (e.GetSelection() == 0) { + m_layer_input_panel->Show(false); + buttons_sizer->Show(false); + } + else if (e.GetSelection() == 1) { + m_layer_input_panel->Show(true); + buttons_sizer->Show(true); + } + m_parent->Layout(); + m_parent->Fit(); + }); + add_layers_btn->Bind(wxEVT_BUTTON, [this](wxEvent&) { + Freeze(); + append_layer(); + m_parent->Layout(); + m_parent->Fit(); + Thaw(); + }); + delete_layers_btn->Bind(wxEVT_BUTTON, [this](wxEvent&) { + popup_layer(); + m_parent->Layout(); + m_parent->Fit(); + }); + Bind(EVT_NEED_RESORT_LAYERS, [this](auto& evt) { + std::vector result; + for (int i = 0; i < m_layer_input_sizer_list.size(); i++) { + int begin_layer_number = m_begin_layer_input_list[i]->get_layer_number(); + int end_layer_number = m_end_layer_input_list[i]->get_layer_number(); + result.push_back({ begin_layer_number, end_layer_number, m_drag_canvas_list[i]->get_shape_list_order() }); + } + if (!std::is_sorted(result.begin(), result.end())) { + std::sort(result.begin(), result.end()); + sync_layers_print_seq(1, result); + } + result.swap(m_layer_seq_infos); + }); + Bind(EVT_SET_BED_TYPE_CONFIRM, [this](auto& evt) { + std::vector result; + for (int i = 0; i < m_layer_input_sizer_list.size(); i++) { + int begin_layer_number = m_begin_layer_input_list[i]->get_layer_number(); + int end_layer_number = m_end_layer_input_list[i]->get_layer_number(); + + if (!m_begin_layer_input_list[i]->is_layer_number_valid() || !m_end_layer_input_list[i]->is_layer_number_valid()) { + MessageDialog msg_dlg(nullptr, _L("Please input layer value (>= 2)."), wxEmptyString, wxICON_WARNING | wxOK); + msg_dlg.ShowModal(); + evt.SetString("Invalid"); + return; + } + + result.push_back({ begin_layer_number, end_layer_number, m_drag_canvas_list[i]->get_shape_list_order() }); + } + result.swap(m_layer_seq_infos); + }); +} + +void OtherLayersSeqPanel::append_layer(const LayerSeqInfo* layer_info) +{ + wxBoxSizer* layer_panel_sizer = static_cast(m_layer_input_panel->GetSizer()); + + wxStaticText* choose_layer_head_txt = new wxStaticText(m_layer_input_panel, wxID_ANY, _L("Layer")); + choose_layer_head_txt->SetFont(Label::Body_14); + + LayerNumberTextInput* begin_layer_input = new LayerNumberTextInput(m_layer_input_panel, -1, wxSize(FromDIP(100), -1), LayerNumberTextInput::Type::Begin, LayerNumberTextInput::ValueType::Custom); + + wxStaticText* choose_layer_to_txt = new wxStaticText(m_layer_input_panel, wxID_ANY, _L("to")); + choose_layer_to_txt->SetFont(Label::Body_14); + + LayerNumberTextInput* end_layer_input = new LayerNumberTextInput(m_layer_input_panel, -1, wxSize(FromDIP(100), -1), LayerNumberTextInput::Type::End, LayerNumberTextInput::ValueType::End); + + begin_layer_input->link(end_layer_input); + if (m_begin_layer_input_list.size() == 0) { + begin_layer_input->set_layer_number(MIN_LAYER_VALUE); + end_layer_input->set_layer_number(MAX_LAYER_VALUE); + } + + const std::vector extruder_colours = wxGetApp().plater()->get_extruder_colors_from_plater_config(); + std::vector order(extruder_colours.size()); + for (int i = 0; i < order.size(); i++) { + order[i] = i + 1; + } + auto drag_canvas = new DragCanvas(m_layer_input_panel, extruder_colours, order); + + if (layer_info) { + begin_layer_input->set_layer_number(layer_info->begin_layer_number); + end_layer_input->set_layer_number(layer_info->end_layer_number); + drag_canvas->set_shape_list(extruder_colours, layer_info->print_sequence); + } + + wxBoxSizer* single_layer_input_sizer = new wxBoxSizer(wxHORIZONTAL); + single_layer_input_sizer->Add(choose_layer_head_txt, 0, wxRIGHT | wxALIGN_CENTER, FromDIP(5)); + single_layer_input_sizer->Add(begin_layer_input, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER, FromDIP(5)); + single_layer_input_sizer->Add(choose_layer_to_txt, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER, 0); + single_layer_input_sizer->Add(end_layer_input, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER, FromDIP(5)); + single_layer_input_sizer->AddStretchSpacer(); + single_layer_input_sizer->Add(drag_canvas, 0, wxLEFT | wxALIGN_CENTER, FromDIP(5)); + layer_panel_sizer->Add(single_layer_input_sizer, 0, wxEXPAND | wxALIGN_CENTER | wxBOTTOM, FromDIP(10)); + m_layer_input_sizer_list.push_back(single_layer_input_sizer); + m_begin_layer_input_list.push_back(begin_layer_input); + m_end_layer_input_list.push_back(end_layer_input); + m_drag_canvas_list.push_back(drag_canvas); +} + +void OtherLayersSeqPanel::popup_layer() +{ + if (m_layer_input_sizer_list.size() > 1) { + m_layer_input_sizer_list.back()->Clear(true); + m_layer_input_sizer_list.pop_back(); + m_begin_layer_input_list.pop_back(); + m_end_layer_input_list.pop_back(); + m_drag_canvas_list.pop_back(); + } +} + +void OtherLayersSeqPanel::clear_all_layers() +{ + for (auto sizer : m_layer_input_sizer_list) { + sizer->Clear(true); + } + m_layer_input_sizer_list.clear(); + m_begin_layer_input_list.clear(); + m_end_layer_input_list.clear(); + m_drag_canvas_list.clear(); +} + +void OtherLayersSeqPanel::sync_layers_print_seq(int selection, const std::vector& seq) +{ + if (m_other_layer_print_seq_choice != nullptr) { + if (selection == 1) { + clear_all_layers(); + Freeze(); + for (int i = 0; i < seq.size(); i++) { + append_layer(&seq[i]); + } + Thaw(); + } + m_other_layer_print_seq_choice->SetSelection(selection); + + wxCommandEvent event(wxEVT_COMBOBOX); + event.SetInt(selection); + event.SetEventObject(m_other_layer_print_seq_choice); + wxPostEvent(m_other_layer_print_seq_choice, event); + } +} + + +PlateSettingsDialog::PlateSettingsDialog(wxWindow* parent, const wxString& title, bool only_layer_seq, const wxPoint& pos, const wxSize& size, long style) :DPIDialog(parent, wxID_ANY, title, pos, size, style) { std::string icon_path = (boost::format("%1%/images/OrcaSlicerTitle.ico") % resources_dir()).str(); @@ -13,10 +370,9 @@ PlateSettingsDialog::PlateSettingsDialog(wxWindow* parent, const wxString& title SetBackgroundColour(*wxWHITE); wxBoxSizer* m_sizer_main = new wxBoxSizer(wxVERTICAL); - auto m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(400), -1)); + auto m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(650), -1)); m_line_top->SetBackgroundColour(wxColour(166, 169, 170)); m_sizer_main->Add(m_line_top, 0, wxEXPAND, 0); - m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(5)); wxFlexGridSizer* top_sizer = new wxFlexGridSizer(0, 2, FromDIP(5), 0); top_sizer->AddGrowableCol(0,1); @@ -40,10 +396,10 @@ PlateSettingsDialog::PlateSettingsDialog(wxWindow* parent, const wxString& title wxStaticText* m_bed_type_txt = new wxStaticText(this, wxID_ANY, _L("Bed type")); m_bed_type_txt->SetFont(Label::Body_14); - top_sizer->Add(m_bed_type_txt, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, FromDIP(5)); - top_sizer->Add(m_bed_type_choice, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT |wxALL, FromDIP(5)); + top_sizer->Add(m_bed_type_txt, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxTOP | wxBOTTOM, FromDIP(5)); + top_sizer->Add(m_bed_type_choice, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxTOP | wxBOTTOM, FromDIP(5)); - wxBoxSizer* m_sizer_selectbox = new wxBoxSizer(wxHORIZONTAL); + // Print Sequence m_print_seq_choice = new ComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(240),-1), 0, NULL, wxCB_READONLY ); m_print_seq_choice->Append(_L("Same as Global Print Sequence")); for (auto i = PrintSequence::ByLayer; i < PrintSequence::ByDefault; i = PrintSequence(int(i) + 1)) { @@ -51,9 +407,21 @@ PlateSettingsDialog::PlateSettingsDialog(wxWindow* parent, const wxString& title } wxStaticText* m_print_seq_txt = new wxStaticText(this, wxID_ANY, _L("Print sequence")); m_print_seq_txt->SetFont(Label::Body_14); - top_sizer->Add(m_print_seq_txt, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT |wxALL, FromDIP(5)); - top_sizer->Add(m_print_seq_choice, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT |wxALL, FromDIP(5)); + top_sizer->Add(m_print_seq_txt, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxTOP | wxBOTTOM, FromDIP(5)); + top_sizer->Add(m_print_seq_choice, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxTOP | wxBOTTOM, FromDIP(5)); + // Spiral mode + m_spiral_mode_choice = new ComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(240), -1), 0, NULL, wxCB_READONLY); + m_spiral_mode_choice->Append(_L("Same as Global")); + m_spiral_mode_choice->Append(_L("Enable")); + m_spiral_mode_choice->Append(_L("Disable")); + m_spiral_mode_choice->SetSelection(0); + wxStaticText* spiral_mode_txt = new wxStaticText(this, wxID_ANY, _L("Spiral vase")); + spiral_mode_txt->SetFont(Label::Body_14); + top_sizer->Add(spiral_mode_txt, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxTOP | wxBOTTOM, FromDIP(5)); + top_sizer->Add(m_spiral_mode_choice, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxTOP | wxBOTTOM, FromDIP(5)); + + // First layer filament sequence m_first_layer_print_seq_choice = new ComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(240), -1), 0, NULL, wxCB_READONLY); m_first_layer_print_seq_choice->Append(_L("Auto")); m_first_layer_print_seq_choice->Append(_L("Customize")); @@ -70,22 +438,26 @@ PlateSettingsDialog::PlateSettingsDialog(wxWindow* parent, const wxString& title }); wxStaticText* first_layer_txt = new wxStaticText(this, wxID_ANY, _L("First layer filament sequence")); first_layer_txt->SetFont(Label::Body_14); - top_sizer->Add(first_layer_txt, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, FromDIP(5)); - top_sizer->Add(m_first_layer_print_seq_choice, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, FromDIP(5)); + top_sizer->Add(first_layer_txt, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxTOP | wxBOTTOM, FromDIP(5)); + top_sizer->Add(m_first_layer_print_seq_choice, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxTOP | wxBOTTOM, FromDIP(5)); const std::vector extruder_colours = wxGetApp().plater()->get_extruder_colors_from_plater_config(); - std::vector order; - if (order.empty()) { - for (int i = 1; i <= extruder_colours.size(); i++) { - order.push_back(i); - } + std::vector order(extruder_colours.size()); + for (int i = 0; i < order.size(); i++) { + order[i] = i + 1; } m_drag_canvas = new DragCanvas(this, extruder_colours, order); m_drag_canvas->Hide(); - top_sizer->Add(0, 0, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, FromDIP(5)); - top_sizer->Add(m_drag_canvas, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, FromDIP(5)); + top_sizer->Add(0, 0, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, 0); + top_sizer->Add(m_drag_canvas, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxBOTTOM, FromDIP(10)); + + m_sizer_main->Add(top_sizer, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, FromDIP(30)); + + // Other layer filament sequence + m_other_layers_seq_panel = new OtherLayersSeqPanel(this); + m_sizer_main->AddSpacer(FromDIP(5)); + m_sizer_main->Add(m_other_layers_seq_panel, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30)); - m_sizer_main->Add(top_sizer, 0, wxEXPAND | wxALL, FromDIP(30)); auto sizer_button = new wxBoxSizer(wxHORIZONTAL); StateColor btn_bg_green(std::pair(wxColour(0, 137, 123), StateColor::Pressed), std::pair(wxColour(38, 166, 154), StateColor::Hovered), @@ -102,10 +474,12 @@ PlateSettingsDialog::PlateSettingsDialog(wxWindow* parent, const wxString& title m_button_ok->SetSize(wxSize(FromDIP(58), FromDIP(24))); m_button_ok->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); m_button_ok->SetCornerRadius(FromDIP(12)); - m_button_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) { + m_button_ok->Bind(wxEVT_BUTTON, [this](auto& e) { wxCommandEvent evt(EVT_SET_BED_TYPE_CONFIRM, GetId()); - e.SetEventObject(this); + static_cast(m_other_layers_seq_panel)->ProcessEvent(evt); GetEventHandler()->ProcessEvent(evt); + if (evt.GetString() == "Invalid") + return; if (this->IsModal()) EndModal(wxID_YES); else @@ -119,7 +493,7 @@ PlateSettingsDialog::PlateSettingsDialog(wxWindow* parent, const wxString& title m_button_cancel->SetSize(wxSize(FromDIP(58), FromDIP(24))); m_button_cancel->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); m_button_cancel->SetCornerRadius(FromDIP(12)); - m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) { + m_button_cancel->Bind(wxEVT_BUTTON, [this](auto& e) { if (this->IsModal()) EndModal(wxID_NO); else @@ -131,7 +505,7 @@ PlateSettingsDialog::PlateSettingsDialog(wxWindow* parent, const wxString& title sizer_button->Add(m_button_cancel, 0, wxALL, FromDIP(5)); sizer_button->Add(FromDIP(30),0, 0, 0); - m_sizer_main->Add(sizer_button, 0, wxEXPAND, FromDIP(20)); + m_sizer_main->Add(sizer_button, 0, wxEXPAND | wxTOP | wxBOTTOM, FromDIP(20)); SetSizer(m_sizer_main); Layout(); @@ -141,7 +515,7 @@ PlateSettingsDialog::PlateSettingsDialog(wxWindow* parent, const wxString& title wxGetApp().UpdateDlgDarkUI(this); - if (only_first_layer_seq) { + if (only_layer_seq) { for (auto item : top_sizer->GetChildren()) { if (item->GetWindow()) item->GetWindow()->Show(false); @@ -149,6 +523,7 @@ PlateSettingsDialog::PlateSettingsDialog(wxWindow* parent, const wxString& title first_layer_txt->Show(); m_first_layer_print_seq_choice->Show(); m_drag_canvas->Show(); + m_other_layers_seq_panel->Show(); Layout(); Fit(); } @@ -189,6 +564,21 @@ void PlateSettingsDialog::sync_first_layer_print_seq(int selection, const std::v } } +void PlateSettingsDialog::sync_other_layers_print_seq(int selection, const std::vector& seq) { + if (selection == 1) { + std::vector sequences; + sequences.reserve(seq.size()); + for (int i = 0; i < seq.size(); i++) { + LayerSeqInfo info{ seq[i].first.first, seq[i].first.second, seq[i].second }; + sequences.push_back(info); + } + m_other_layers_seq_panel->sync_layers_print_seq(selection, sequences); + } + else { + m_other_layers_seq_panel->sync_layers_print_seq(selection, {}); + } +} + void PlateSettingsDialog::sync_spiral_mode(bool spiral_mode, bool as_global) { if (m_spiral_mode_choice) { @@ -349,4 +739,6 @@ void PlateNameEditDialog::set_plate_name(const wxString &name) { m_ti_plate_name->GetTextCtrl()->SetInsertionPointEnd(); } -}} // namespace Slic3r::GUI \ No newline at end of file + +} +} // namespace Slic3r::GUI \ No newline at end of file diff --git a/src/slic3r/GUI/PlateSettingsDialog.hpp b/src/slic3r/GUI/PlateSettingsDialog.hpp index debad2a7f6..00dbbe4011 100644 --- a/src/slic3r/GUI/PlateSettingsDialog.hpp +++ b/src/slic3r/GUI/PlateSettingsDialog.hpp @@ -7,10 +7,78 @@ #include "Widgets/RadioBox.hpp" #include "Widgets/ComboBox.hpp" #include "DragCanvas.hpp" +#include "libslic3r/ParameterUtils.hpp" namespace Slic3r { namespace GUI { wxDECLARE_EVENT(EVT_SET_BED_TYPE_CONFIRM, wxCommandEvent); +wxDECLARE_EVENT(EVT_NEED_RESORT_LAYERS, wxCommandEvent); + +struct LayerSeqInfo { + int begin_layer_number; + int end_layer_number; + std::vector print_sequence; + + bool operator<(const LayerSeqInfo& another) const; +}; + +class LayerNumberTextInput : public ComboBox { +public: + enum class Type { + Begin, + End + }; + enum class ValueType { + Custom, + End + }; + LayerNumberTextInput(wxWindow* parent, int layer_number, wxSize size, Type type, ValueType value_type = ValueType::Custom); + void link(LayerNumberTextInput* layer_input) { + if (m_another_layer_input) return; + m_another_layer_input = layer_input; + layer_input->link(this); } + void set_layer_number(int layer_number); + int get_layer_number(); + Type get_input_type() { return m_type; } + ValueType get_value_type() { return m_value_type; } + bool is_layer_number_valid(); + +protected: + void update_label(); + +private: + LayerNumberTextInput* m_another_layer_input{ nullptr }; + int m_layer_number; + Type m_type; + ValueType m_value_type; +}; + +class OtherLayersSeqPanel : public wxPanel { +public: + OtherLayersSeqPanel(wxWindow* parent); + + void sync_layers_print_seq(int selection, const std::vector& seq); + + int get_layers_print_seq_choice() { return m_other_layer_print_seq_choice->GetSelection(); }; + + std::vector get_layers_print_seq_infos() { return m_layer_seq_infos; } + +protected: + void append_layer(const LayerSeqInfo* layer_info = nullptr); + void popup_layer(); + void clear_all_layers(); + +private: + ScalableBitmap m_bmp_delete; + ScalableBitmap m_bmp_add; + ComboBox* m_other_layer_print_seq_choice{ nullptr }; + wxPanel* m_layer_input_panel{ nullptr }; + std::vector m_layer_input_sizer_list; + std::vector m_begin_layer_input_list; + std::vector m_end_layer_input_list; + std::vector m_drag_canvas_list; + std::vector m_layer_seq_infos; +}; class PlateSettingsDialog : public DPIDialog { @@ -23,7 +91,7 @@ public: PlateSettingsDialog( wxWindow* parent, const wxString& title = wxEmptyString, - bool only_first_layer_seq = false, + bool only_layer_seq = false, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCLOSE_BOX | wxCAPTION @@ -33,6 +101,7 @@ public: void sync_bed_type(BedType type); void sync_print_seq(int print_seq = 0); void sync_first_layer_print_seq(int selection, const std::vector& seq = std::vector()); + void sync_other_layers_print_seq(int selection, const std::vector& seq); void sync_spiral_mode(bool spiral_mode, bool as_global); wxString to_bed_type_name(BedType bed_type); wxString to_print_sequence_name(PrintSequence print_seq); @@ -62,8 +131,25 @@ public: return choice; }; + int get_other_layers_print_seq_choice() { + if (m_other_layers_seq_panel) + return m_other_layers_seq_panel->get_layers_print_seq_choice(); + return 0; + }; + std::vector get_first_layer_print_seq(); + std::vector get_other_layers_print_seq_infos() { + const std::vector& layer_seq_infos = m_other_layers_seq_panel->get_layers_print_seq_infos(); + std::vector result; + result.reserve(layer_seq_infos.size()); + for (int i = 0; i < layer_seq_infos.size(); i++) { + LayerPrintSequence item = std::make_pair(std::make_pair(layer_seq_infos[i].begin_layer_number, layer_seq_infos[i].end_layer_number), layer_seq_infos[i].print_sequence); + result.push_back(item); + } + return result; + } + int get_spiral_mode_choice() { int choice = 0; if (m_spiral_mode_choice != nullptr) @@ -76,11 +162,16 @@ public: } protected: - DragCanvas* m_drag_canvas; - ComboBox* m_first_layer_print_seq_choice { nullptr }; - ComboBox* m_print_seq_choice { nullptr }; + void add_layers(); + void delete_layers(); + +protected: ComboBox* m_bed_type_choice { nullptr }; + ComboBox* m_print_seq_choice { nullptr }; + ComboBox* m_first_layer_print_seq_choice { nullptr }; ComboBox* m_spiral_mode_choice { nullptr }; + DragCanvas* m_drag_canvas; + OtherLayersSeqPanel* m_other_layers_seq_panel; Button* m_button_ok; Button* m_button_cancel; TextInput *m_ti_plate_name; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 22868af0cb..384c6f0b74 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -491,6 +491,45 @@ void Sidebar::priv::hide_rich_tip(wxButton* btn) } #endif +std::vector get_min_flush_volumes() +{ + std::vectorextra_flush_volumes; + const auto& full_config = wxGetApp().preset_bundle->full_config(); + auto& printer_config = wxGetApp().preset_bundle->printers.get_edited_preset().config; + + ConfigOption* nozzle_volume_opt = printer_config.option("nozzle_volume"); + int nozzle_volume_val = nozzle_volume_opt ? (int)nozzle_volume_opt->getFloat() : 0; + + int machine_enabled_level = printer_config.option("enable_long_retraction_when_cut")->value; + bool machine_activated = printer_config.option("long_retractions_when_cut")->values[0] == 1; + + auto filament_retraction_distance_when_cut = full_config.option("filament_retraction_distances_when_cut"); + auto printer_retraction_distance_when_cut = full_config.option("retraction_distances_when_cut"); + auto filament_long_retractions_when_cut = full_config.option("filament_long_retractions_when_cut"); + + size_t filament_size = filament_retraction_distance_when_cut->values.size(); + for (size_t idx = 0; idx < filament_size; ++idx) { + int extra_flush_volume = nozzle_volume_val; + int retract_length = machine_enabled_level && machine_activated ? printer_retraction_distance_when_cut->values[0] : 0; + + char filament_activated = filament_long_retractions_when_cut->values[idx]; + double filament_retract_length = filament_retraction_distance_when_cut->values[idx]; + + if (filament_activated == 0) + retract_length = 0; + else if (filament_activated == 1 && machine_enabled_level == LongRectrationLevel::EnableFilament) { + if (!std::isnan(filament_retract_length)) + retract_length = (int)filament_retraction_distance_when_cut->values[idx]; + else + retract_length = printer_retraction_distance_when_cut->values[0]; + } + + extra_flush_volume -= PI * 1.75 * 1.75 / 4 * retract_length; + extra_flush_volumes.emplace_back(extra_flush_volume); + } + return extra_flush_volumes; +} + // Sidebar / public static struct DynamicFilamentList : DynamicList @@ -804,18 +843,14 @@ Sidebar::Sidebar(Plater *parent) p->m_flushing_volume_btn->Bind(wxEVT_BUTTON, ([parent](wxCommandEvent &e) { auto& project_config = wxGetApp().preset_bundle->project_config; - auto& printer_config = wxGetApp().preset_bundle->printers.get_edited_preset().config; const std::vector& init_matrix = (project_config.option("flush_volumes_matrix"))->values; const std::vector& init_extruders = (project_config.option("flush_volumes_vector"))->values; - ConfigOption* extra_flush_volume_opt = printer_config.option("nozzle_volume"); - int extra_flush_volume = extra_flush_volume_opt ? (int)extra_flush_volume_opt->getFloat() : 0; ConfigOptionFloat* flush_multi_opt = project_config.option("flush_multiplier"); float flush_multiplier = flush_multi_opt ? flush_multi_opt->getFloat() : 1.f; const std::vector extruder_colours = wxGetApp().plater()->get_extruder_colors_from_plater_config(); - - WipingDialog dlg(parent, cast(init_matrix), cast(init_extruders), extruder_colours, extra_flush_volume, flush_multiplier); - + const auto& extra_flush_volumes = get_min_flush_volumes(); + WipingDialog dlg(parent, cast(init_matrix), cast(init_extruders), extruder_colours, extra_flush_volumes, flush_multiplier); if (dlg.ShowModal() == wxID_OK) { std::vector matrix = dlg.get_matrix(); std::vector extruders = dlg.get_extruders(); @@ -1864,12 +1899,12 @@ void Sidebar::auto_calc_flushing_volumes(const int modify_id) const std::vector& init_matrix = (project_config.option("flush_volumes_matrix"))->values; const std::vector& init_extruders = (project_config.option("flush_volumes_vector"))->values; - ConfigOption* extra_flush_volume_opt = printer_config.option("nozzle_volume"); - int extra_flush_volume = extra_flush_volume_opt ? (int)extra_flush_volume_opt->getFloat() : 0; + + const std::vector& min_flush_volumes= get_min_flush_volumes(); + ConfigOptionFloat* flush_multi_opt = project_config.option("flush_multiplier"); float flush_multiplier = flush_multi_opt ? flush_multi_opt->getFloat() : 1.f; std::vector matrix = init_matrix; - int m_min_flush_volume = extra_flush_volume; int m_max_flush_volume = Slic3r::g_max_flush_volume; unsigned int m_number_of_extruders = (int)(sqrt(init_matrix.size()) + 0.001); @@ -1896,12 +1931,10 @@ void Sidebar::auto_calc_flushing_volumes(const int modify_id) if (modify_id >= 0 && modify_id < multi_colours.size()) { for (int i = 0; i < multi_colours.size(); ++i) { - - Slic3r::FlushVolCalculator calculator(m_min_flush_volume, m_max_flush_volume); - // from to modify int from_idx = i; if (from_idx != modify_id) { + Slic3r::FlushVolCalculator calculator(min_flush_volumes[from_idx], m_max_flush_volume); int flushing_volume = 0; bool is_from_support = is_support_filament(from_idx); bool is_to_support = is_support_filament(modify_id); @@ -1926,6 +1959,7 @@ void Sidebar::auto_calc_flushing_volumes(const int modify_id) // modify to to int to_idx = i; if (to_idx != modify_id) { + Slic3r::FlushVolCalculator calculator(min_flush_volumes[modify_id], m_max_flush_volume); bool is_from_support = is_support_filament(modify_id); bool is_to_support = is_support_filament(to_idx); int flushing_volume = 0; @@ -2592,7 +2626,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) //BBS: add bed_exclude_area , config(Slic3r::DynamicPrintConfig::new_from_defaults_keys({ "printable_area", "bed_exclude_area", "bed_custom_texture", "bed_custom_model", "print_sequence", - "extruder_clearance_radius", "extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod", "skirt_loops", "skirt_speed", "skirt_distance", + "extruder_clearance_radius", "extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod", + "nozzle_height", "skirt_loops", "skirt_speed", "skirt_distance", "brim_width", "brim_object_gap", "brim_type", "nozzle_diameter", "single_extruder_multi_material", "preferred_orientation", "enable_prime_tower", "wipe_tower_x", "wipe_tower_y", "prime_tower_width", "prime_tower_brim_width", "prime_volume", "extruder_colour", "filament_colour", "material_colour", "printable_height", "printer_model", "printer_technology", @@ -2855,6 +2890,16 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) //preview_canvas->Bind(EVT_GLTOOLBAR_PRINT_PLATE, &priv::on_action_print_plate, this); //preview_canvas->Bind(EVT_GLTOOLBAR_PRINT_ALL, &priv::on_action_print_all, this); //review_canvas->Bind(EVT_GLTOOLBAR_EXPORT_GCODE, &priv::on_action_export_gcode, this); + view3D_canvas->Bind(EVT_GLCANVAS_SWITCH_TO_OBJECT, [main_frame](SimpleEvent&) { + if (main_frame->m_param_panel) { + main_frame->m_param_panel->switch_to_object(false); + } + }); + view3D_canvas->Bind(EVT_GLCANVAS_SWITCH_TO_GLOBAL, [main_frame](SimpleEvent&) { + if (main_frame->m_param_panel) { + main_frame->m_param_panel->switch_to_global(); + } + }); } view3D_canvas->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [q](SimpleEvent&) { q->set_bed_shape(); }); @@ -3349,53 +3394,70 @@ BoundingBox Plater::priv::scaled_bed_shape_bb() const return printable_area.bounding_box(); } -std::string read_binary_stl(const std::string& filename) { - std::string model_id; - std::ifstream file(filename, std::ios::binary); + +void read_binary_stl(const std::string& filename, std::string& model_id, std::string& code) { + std::ifstream file( encode_path(filename.c_str()), std::ios::binary); if (!file) { - return model_id; + return; } - try{ + try { // Read the first 80 bytes char data[80]; file.read(data, 80); if (!file) { file.close(); - return model_id; + return; } if (data[0] == '\0' || data[0] == ' ') { file.close(); - return model_id; + return; } char magic[2] = { data[0], data[1] }; if (magic[0] != 'M' || magic[1] != 'W') { file.close(); - return model_id; + return; } if (data[2] != ' ') { file.close(); - return model_id; + return; } char protocol_version[3] = { data[3], data[4], data[5] }; - //version - if (protocol_version[0] == '1' && protocol_version[1] == '.' && protocol_version[2] == '0') { - model_id = std::string(&data[7], &data[80]); + //version + if (protocol_version[0] != '1' || protocol_version[1] != '.' || protocol_version[2] != '0') { + file.close(); + return; } + std::vector tokens; + std::istringstream iss(data); + std::string token; + while (std::getline(iss, token, ' ')) { + char* tokenPtr = new char[token.length() + 1]; + std::strcpy(tokenPtr, token.c_str()); + tokens.push_back(tokenPtr); + } + + //model id + if (tokens.size() < 4) { + file.close(); + return; + } + + model_id = tokens[2]; + code = tokens[3]; file.close(); } - catch (...){ + catch (...) { } - return model_id; + return; } - // BBS: backup & restore std::vector Plater::priv::load_files(const std::vector& input_files, LoadStrategy strategy, bool ask_multi) { @@ -3438,6 +3500,7 @@ std::vector Plater::priv::load_files(const std::vector& input_ std::vector obj_idxs; std::string designer_model_id; + std::string designer_country_code; int answer_convert_from_meters = wxOK_DEFAULT; int answer_convert_from_imperial_units = wxOK_DEFAULT; @@ -3881,9 +3944,11 @@ std::vector Plater::priv::load_files(const std::vector& input_ model = Slic3r::Model::read_from_file( path.string(), nullptr, nullptr, strategy, &plate_data, &project_presets, &is_xxx, &file_version, nullptr, - [this, &dlg, real_filename, &progress_percent, &file_percent, INPUT_FILES_RATIO, total_files, i, &designer_model_id](int current, int total, bool &cancel, std::string &mode_id) + [this, &dlg, real_filename, &progress_percent, &file_percent, INPUT_FILES_RATIO, total_files, i, &designer_model_id, &designer_country_code](int current, int total, bool &cancel, std::string &mode_id, std::string &code) { designer_model_id = mode_id; + designer_country_code = code; + bool cont = true; float percent_float = (100.0f * (float)i / (float)total_files) + INPUT_FILES_RATIO * 100.0f * ((float)current / (float)total) / (float)total_files; BOOST_LOG_TRIVIAL(trace) << "load_stl_file: percent(float)=" << percent_float << ", curr = " << current << ", total = " << total; @@ -3910,7 +3975,7 @@ std::vector Plater::priv::load_files(const std::vector& input_ if (designer_model_id.empty() && boost::algorithm::iends_with(path.string(), ".stl")) { - designer_model_id = read_binary_stl(path.string()); + read_binary_stl(path.string(), designer_model_id, designer_country_code); } if (type_any_amf && is_xxx) imperial_units = true; @@ -4080,10 +4145,11 @@ std::vector Plater::priv::load_files(const std::vector& input_ q->model().load_from(model); load_auxiliary_files(); } + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":" << __LINE__ << boost::format(", before load_model_objects, count %1%")%model.objects.size(); auto loaded_idxs = load_model_objects(model.objects, is_project_file); obj_idxs.insert(obj_idxs.end(), loaded_idxs.begin(), loaded_idxs.end()); - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":" << __LINE__ << boost::format("import 3mf IMPORT_LOAD_MODEL_OBJECTS \n"); + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":" << __LINE__ << boost::format(", finished load_model_objects"); wxString msg = wxString::Format(_L("Loading file: %s"), from_path(real_filename)); dlg_cont = dlg.Update(progress_percent, msg); if (!dlg_cont) { @@ -4095,7 +4161,7 @@ std::vector Plater::priv::load_files(const std::vector& input_ for (const ModelObject *model_object : model.objects) { new_model->add_object(*model_object); - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":" << __LINE__ << boost::format("import 3mf IMPORT_ADD_MODEL_OBJECTS \n"); + BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ":" << __LINE__ << boost::format(", added object %1%")%model_object->name; wxString msg = wxString::Format(_L("Loading file: %s"), from_path(real_filename)); dlg_cont = dlg.Update(progress_percent, msg); if (!dlg_cont) { @@ -4213,9 +4279,16 @@ std::vector Plater::priv::load_files(const std::vector& input_ obj_idxs, model.objects, *notification_manager); //set designer_model_id - if (!designer_model_id.empty() && q->model().stl_design_id.empty()) { - q->model().stl_design_id = designer_model_id; - } + q->model().stl_design_id = designer_model_id; + q->model().stl_design_country = designer_country_code; + //if (!designer_model_id.empty() && q->model().stl_design_id.empty() && !designer_country_code.empty()) { + // q->model().stl_design_id = designer_model_id; + // q->model().stl_design_country = designer_country_code; + //} + //else { + // q->model().stl_design_id = ""; + // q->model().stl_design_country = ""; + //} if (tolal_model_count <= 0 && !q->m_exported_file) { dlg.Hide(); @@ -4309,6 +4382,7 @@ std::vector Plater::priv::load_model_objects(const ModelObjectPtrs& mode } } + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":" << __LINE__ << boost::format(", loaded objects, begin to auto placement"); #ifdef AUTOPLACEMENT_ON_LOAD #if 0 // FIXME distance should be a config value ///////////////////////////////// @@ -4353,9 +4427,19 @@ std::vector Plater::priv::load_model_objects(const ModelObjectPtrs& mode // _L("Object too large?")); //} + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":" << __LINE__ << boost::format(", finished auto placement, before add_objects_to_list"); notification_manager->close_notification_of_type(NotificationType::UpdatedItemsInfo); - wxGetApp().obj_list()->add_objects_to_list(obj_idxs); + if (obj_idxs.size() > 1) { + std::vector obj_idxs_1 (obj_idxs.begin(), obj_idxs.end() - 1); + + wxGetApp().obj_list()->add_objects_to_list(obj_idxs_1, false); + wxGetApp().obj_list()->add_object_to_list(obj_idxs[obj_idxs.size() - 1]); + } + else + wxGetApp().obj_list()->add_objects_to_list(obj_idxs); + + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":" << __LINE__ << boost::format(", after add_objects_to_list"); update(); // Update InfoItems in ObjectList after update() to use of a correct value of the GLCanvas3D::is_sinking(), // which is updated after a view3D->reload_scene(false, flags & (unsigned int)UpdateParams::FORCE_FULL_SCREEN_REFRESH) call @@ -4388,7 +4472,14 @@ fs::path Plater::priv::get_export_file_path(GUI::FileType file_type) if (file_type == FT_3MF) // for 3mf take the path from the project filename, if any output_file = into_path(get_project_filename(".3mf")); - + else if (file_type == FT_STL) { + if (obj_idx > 0 && obj_idx < this->model.objects.size() && selection.is_single_full_object()) { + output_file = this->model.objects[obj_idx]->get_export_filename(); + } + else { + output_file = into_path(get_project_name()); + } + } //bbs name the project using the part name if (output_file.empty()) { if (get_project_name() != _L("Untitled")) { @@ -4540,7 +4631,11 @@ void Plater::priv::selection_changed() } // forces a frame render to update the view (to avoid a missed update if, for example, the context menu appears) - view3D->render(); + if (get_current_canvas3D()->get_canvas_type() == GLCanvas3D::CanvasAssembleView) { + assemble_view->render(); + } else { + view3D->render(); + } } void Plater::priv::object_list_changed() @@ -4965,6 +5060,12 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool notification_manager->set_slicing_progress_hidden(); } + else { + if (preview && preview->get_reload_paint_after_background_process_apply()) { + preview->set_reload_paint_after_background_process_apply(false); + preview->reload_print(); + } + } if ((invalidated != Print::APPLY_STATUS_UNCHANGED || force_validation) && ! background_process.empty()) { // The delayed error message is no more valid. @@ -5919,17 +6020,18 @@ void Plater::priv::set_current_panel(wxPanel* panel, bool no_slice) }; //BBS: add the collapse logic - if (panel == view3D || panel == preview) { - this->enable_sidebar(!q->only_gcode_mode()); - } - if (panel == preview && q->only_gcode_mode()) { - preview->get_canvas3d()->enable_select_plate_toolbar(false); - } - else if (panel == preview && q->using_exported_file() && (q->m_valid_plates_count <= 1)) { - preview->get_canvas3d()->enable_select_plate_toolbar(false); + if (panel == preview) { + if (q->only_gcode_mode()) { + this->sidebar->collapse(true); + preview->get_canvas3d()->enable_select_plate_toolbar(false); + } else if (q->using_exported_file() && (q->m_valid_plates_count <= 1)) { + preview->get_canvas3d()->enable_select_plate_toolbar(false); + } else { + preview->get_canvas3d()->enable_select_plate_toolbar(true); + } } else { - preview->get_canvas3d()->enable_select_plate_toolbar(true); + preview->get_canvas3d()->enable_select_plate_toolbar(false); } if (current_panel == panel) @@ -6002,6 +6104,18 @@ void Plater::priv::set_current_panel(wxPanel* panel, bool no_slice) else if (old_panel == assemble_view) assemble_view->get_canvas3d()->unbind_event_handlers(); + GLCanvas3D* assemble_canvas = assemble_view->get_canvas3d(); + Selection::IndicesList select_idxs = assemble_canvas->get_selection().get_volume_idxs(); + Selection& view3d_selection = view3D->get_canvas3d()->get_selection(); + view3d_selection.clear(); + for (unsigned int idx : select_idxs) { + auto v = assemble_canvas->get_selection().get_volume(idx); + auto real_idx = view3d_selection.query_real_volume_idx_from_other_view(v->object_idx(), v->instance_idx(), v->volume_idx()); + if (real_idx >= 0) { + view3d_selection.add(real_idx, false); + } + } + view3D->get_canvas3d()->bind_event_handlers(); if (view3D->is_reload_delayed()) { @@ -6080,6 +6194,20 @@ void Plater::priv::set_current_panel(wxPanel* panel, bool no_slice) assemble_view->get_canvas3d()->bind_event_handlers(); assemble_view->reload_scene(true); + if (old_panel == view3D) { + GLCanvas3D* view3D_canvas = view3D->get_canvas3d(); + Selection::IndicesList select_idxs = view3D_canvas->get_selection().get_volume_idxs(); + Selection& assemble_selection = assemble_view->get_canvas3d()->get_selection(); + assemble_selection.clear(); + for (unsigned int idx : select_idxs) { + auto v = view3D_canvas->get_selection().get_volume(idx); + auto real_idx = assemble_selection.query_real_volume_idx_from_other_view(v->object_idx(), v->instance_idx(), v->volume_idx()); + if (real_idx >= 0) { + assemble_selection.add(real_idx, false); + } + } + } + // BBS set default view and zoom if (first_enter_assemble) { wxGetApp().plater()->get_camera().requires_zoom_to_volumes = true; @@ -6260,6 +6388,12 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt) view3D->deselect_all(); } +#if 0 // do not toggle auto calc when change printer + // update flush matrix + size_t filament_size = wxGetApp().plater()->get_extruder_colors_from_plater_config().size(); + for (size_t idx = 0; idx < filament_size; ++idx) + wxGetApp().plater()->sidebar().auto_calc_flushing_volumes(idx); +#endif } #ifdef __WXMSW__ @@ -6268,6 +6402,10 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt) // So, set the focus to the combobox explicitly combo->SetFocus(); #endif + if (preset_type == Preset::TYPE_FILAMENT && wxGetApp().app_config->get("auto_calculate_when_filament_change") == "true") { + wxGetApp().plater()->sidebar().auto_calc_flushing_volumes(idx); + } + // BBS: log modify of filament selection Slic3r::put_other_changes(); @@ -7007,13 +7145,14 @@ void Plater::priv::on_filament_color_changed(wxCommandEvent &event) //q->update_all_plate_thumbnails(true); //q->get_preview_canvas3D()->update_plate_thumbnails(); int modify_id = event.GetInt(); - if (wxGetApp().app_config->get("auto_calculate") == "true") { - sidebar->auto_calc_flushing_volumes(modify_id); - } auto& ams_multi_color_filment = wxGetApp().preset_bundle->ams_multi_color_filment; if (modify_id >= 0 && modify_id < ams_multi_color_filment.size()) ams_multi_color_filment[modify_id].clear(); + + if (wxGetApp().app_config->get("auto_calculate") == "true") { + sidebar->auto_calc_flushing_volumes(modify_id); + } } void Plater::priv::install_network_plugin(wxCommandEvent &event) @@ -10026,7 +10165,7 @@ void ProjectDropDialog::on_dpi_changed(const wxRect& suggested_rect) //BBS: remove GCodeViewer as seperate APP logic bool Plater::load_files(const wxArrayString& filenames) { - const std::regex pattern_drop(".*[.](stp|step|stl|obj|amf|3mf|svg)", std::regex::icase); + const std::regex pattern_drop(".*[.](stp|step|stl|oltp|obj|amf|3mf|svg)", std::regex::icase); const std::regex pattern_gcode_drop(".*[.](gcode|g)", std::regex::icase); std::vector normal_paths; @@ -10342,6 +10481,10 @@ void Plater::select_view(const std::string& direction) { p->select_view(directio //BBS: add no_slice logic void Plater::select_view_3D(const std::string& name, bool no_slice) { p->select_view_3D(name, no_slice); } +void Plater::reload_paint_after_background_process_apply() { + p->preview->set_reload_paint_after_background_process_apply(true); +} + bool Plater::is_preview_shown() const { return p->is_preview_shown(); } bool Plater::is_preview_loaded() const { return p->is_preview_loaded(); } bool Plater::is_view3D_shown() const { return p->is_view3D_shown(); } @@ -10863,12 +11006,24 @@ TriangleMesh Plater::combine_mesh_fff(const ModelObject& mo, int instance_id, st csgmesh.reserve(2 * mo.volumes.size()); bool has_splitable_volume = csg::model_to_csgmesh(mo, Transform3d::Identity(), std::back_inserter(csgmesh), csg::mpartsPositive | csg::mpartsNegative); - - if (csg::check_csgmesh_booleans(Range{ std::begin(csgmesh), std::end(csgmesh) }) == csgmesh.end()) { + + std::string fail_msg = _u8L("Unable to perform boolean operation on model meshes. " + "Only positive parts will be kept. You may fix the meshes and try agian."); + if (auto fail_reason_name = csg::check_csgmesh_booleans(Range{ std::begin(csgmesh), std::end(csgmesh) }); std::get<0>(fail_reason_name) != csg::BooleanFailReason::OK) { + std::string name = std::get<1>(fail_reason_name); + std::map fail_reasons = { + {csg::BooleanFailReason::OK, "OK"}, + {csg::BooleanFailReason::MeshEmpty, Slic3r::format( _u8L("Reason: part \"%1%\" is empty."), name)}, + {csg::BooleanFailReason::NotBoundAVolume, Slic3r::format(_u8L("Reason: part \"%1%\" does not bound a volume."), name)}, + {csg::BooleanFailReason::SelfIntersect, Slic3r::format(_u8L("Reason: part \"%1%\" has self intersection."), name)}, + {csg::BooleanFailReason::NoIntersection, Slic3r::format(_u8L("Reason: \"%1%\" and another part have no intersection."), name)} }; + fail_msg += " " + fail_reasons[std::get<0>(fail_reason_name)]; + } + else { try { MeshBoolean::mcut::McutMeshPtr meshPtr = csg::perform_csgmesh_booleans_mcut(Range{ std::begin(csgmesh), std::end(csgmesh) }); mesh = MeshBoolean::mcut::mcut_to_triangle_mesh(*meshPtr); - } + } catch (...) {} #if 0 // if mcut fails, try again with CGAL @@ -10884,8 +11039,7 @@ TriangleMesh Plater::combine_mesh_fff(const ModelObject& mo, int instance_id, st if (mesh.empty()) { if (notify_func) - notify_func(_u8L("Unable to perform boolean operation on model meshes. " - "Only positive parts will be exported.")); + notify_func(fail_msg); for (const ModelVolume* v : mo.volumes) if (v->is_model_part()) { @@ -12616,6 +12770,38 @@ void Plater::clone_selection() selection.clone(res); } +std::vector Plater::get_empty_cells(const Vec2f step) +{ + PartPlate* plate = wxGetApp().plater()->get_partplate_list().get_curr_plate(); + BoundingBoxf3 build_volume = plate->get_build_volume(); + Vec2d vmin(build_volume.min.x(), build_volume.min.y()), vmax(build_volume.max.x(), build_volume.max.y()); + BoundingBoxf bbox(vmin, vmax); + std::vector cells; + auto min_x = step(0)/2;// start_point.x() - step(0) * int((start_point.x() - bbox.min.x()) / step(0)); + auto min_y = step(1)/2;// start_point.y() - step(1) * int((start_point.y() - bbox.min.y()) / step(1)); + auto& exclude_box3s = plate->get_exclude_areas(); + std::vector exclude_boxs; + for (auto& box : exclude_box3s) { + Vec2d vmin(box.min.x(), box.min.y()), vmax(box.max.x(), box.max.y()); + exclude_boxs.emplace_back(vmin, vmax); + } + for (float x = min_x + bbox.min.x(); x < bbox.max.x() - step(0) / 2; x += step(0)) + for (float y = min_y + bbox.min.y(); y < bbox.max.y() - step(1) / 2; y += step(1)) { + bool in_exclude = false; + BoundingBoxf cell(Vec2d(x - step(0) / 2, y - step(1) / 2), Vec2d(x + step(0) / 2, y + step(1) / 2)); + for (auto& box : exclude_boxs) { + if (box.overlap(cell)) { + in_exclude = true; + break; + } + } + if(in_exclude) + continue; + cells.emplace_back(x, y); + } + return cells; +} + void Plater::search(bool plater_is_active, Preset::Type type, wxWindow *tag, TextInput *etag, wxWindow *stag) { if (plater_is_active) { @@ -12936,7 +13122,7 @@ void Plater::validate_current_plate(bool& model_fits, bool& validate_error) void Plater::open_platesettings_dialog(wxCommandEvent& evt) { int plate_index = evt.GetInt(); - PlateSettingsDialog dlg(this, _L("Plate Settings"), evt.GetString() == "only_first_layer_sequence"); + PlateSettingsDialog dlg(this, _L("Plate Settings"), evt.GetString() == "only_layer_sequence"); PartPlate* curr_plate = p->partplate_list.get_curr_plate(); dlg.sync_bed_type(curr_plate->get_bed_type()); @@ -12953,6 +13139,13 @@ void Plater::open_platesettings_dialog(wxCommandEvent& evt) { else dlg.sync_first_layer_print_seq(1, curr_plate->get_first_layer_print_sequence()); + auto other_layers_print_seq = curr_plate->get_other_layers_print_sequence(); + if (other_layers_print_seq.empty()) + dlg.sync_other_layers_print_seq(0, {}); + else { + dlg.sync_other_layers_print_seq(1, curr_plate->get_other_layers_print_sequence()); + } + dlg.sync_spiral_mode(curr_plate->get_spiral_vase_mode(), !curr_plate->has_spiral_mode_config()); dlg.Bind(EVT_SET_BED_TYPE_CONFIRM, [this, plate_index, &dlg](wxCommandEvent& e) { @@ -12971,6 +13164,11 @@ void Plater::open_platesettings_dialog(wxCommandEvent& evt) { else curr_plate->set_first_layer_print_sequence({}); + if (dlg.get_other_layers_print_seq_choice() != 0) + curr_plate->set_other_layers_print_sequence(dlg.get_other_layers_print_seq_infos()); + else + curr_plate->set_other_layers_print_sequence({}); + int ps_sel = dlg.get_print_seq_choice(); if (ps_sel != 0) curr_plate->set_print_seq(PrintSequence(ps_sel - 1)); @@ -13348,13 +13546,13 @@ void Plater::post_process_string_object_exception(StringObjectException &err) filament_name = filament_it->alias; } else { auto preset = preset_bundle->filaments.get_preset_base(*filament_it); - if (!preset->alias.empty()) { + if (preset && !preset->alias.empty()) { filament_name = preset->alias; } else { char target = '@'; - size_t pos = preset->name.find(target); + size_t pos = filament_name.find(target); if (pos != std::string::npos) { - filament_name = preset->name.substr(0, pos - 1); + filament_name = filament_name.substr(0, pos - 1); } } } diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 681db56703..acc896b07c 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -72,6 +72,7 @@ class Ams; using ModelInstancePtrs = std::vector; + namespace UndoRedo { class Stack; enum class SnapshotType : unsigned char; @@ -342,6 +343,7 @@ public: //BBS: add no_slice logic void select_view_3D(const std::string& name, bool no_slice = true); + void reload_paint_after_background_process_apply(); bool is_preview_shown() const; bool is_preview_loaded() const; bool is_view3D_shown() const; @@ -536,6 +538,8 @@ public: void split_object(); void split_volume(); void optimize_rotation(); + // find all empty cells on the plate and won't overlap with exclusion areas + static std::vector get_empty_cells(const Vec2f step); //BBS: void fill_color(int extruder_id); @@ -823,6 +827,7 @@ private: bool m_was_scheduled; }; +std::vector get_min_flush_volumes(); } // namespace GUI } // namespace Slic3r diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 919e79bd98..525686e770 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -866,6 +866,8 @@ PreferencesDialog::PreferencesDialog(wxWindow *parent, wxWindowID id, const wxSt std::string value; value = wxGetApp().app_config->get("auto_calculate"); j["auto_flushing"] = value; + value = wxGetApp().app_config->get("auto_calculate_when_filament_change"); + j["auto_calculate_when_filament_change"] = value; agent->track_event("preferences_changed", j.dump()); } } catch(...) {} @@ -1030,6 +1032,7 @@ wxWindow* PreferencesDialog::create_general_page() auto item_hints = create_item_checkbox(_L("Show \"Tip of the day\" notification after start"), page, _L("If enabled, useful hints are displayed at startup."), 50, "show_hints"); auto item_calc_mode = create_item_checkbox(_L("Flushing volumes: Auto-calculate everytime the color changed."), page, _L("If enabled, auto-calculate everytime the color changed."), 50, "auto_calculate"); + auto item_calc_in_long_retract = create_item_checkbox(_L("Flushing volumes: Auto-calculate every time when the filament is changed."), page, _L("If enabled, auto-calculate every time when filament is changed"), 50, "auto_calculate_when_filament_change"); auto item_remember_printer_config = create_item_checkbox(_L("Remember printer configuration"), page, _L("If enabled, Orca will remember and switch filament/process configuration for each printer automatically."), 50, "remember_printer_config"); auto title_presets = create_item_title(_L("Presets"), page, _L("Presets")); auto title_network = create_item_title(_L("Network"), page, _L("Network")); @@ -1094,6 +1097,7 @@ wxWindow* PreferencesDialog::create_general_page() sizer_page->Add(reverse_mouse_zoom, 0, wxTOP, FromDIP(3)); sizer_page->Add(item_show_splash_screen, 0, wxTOP, FromDIP(3)); sizer_page->Add(item_hints, 0, wxTOP, FromDIP(3)); + sizer_page->Add(item_calc_in_long_retract, 0, wxTOP, FromDIP(3)); sizer_page->Add(title_presets, 0, wxTOP | wxEXPAND, FromDIP(20)); sizer_page->Add(item_calc_mode, 0, wxTOP, FromDIP(3)); sizer_page->Add(item_user_sync, 0, wxTOP, FromDIP(3)); diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index d037a62394..4b53c0e359 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -625,6 +625,37 @@ bool PresetComboBox::selection_is_changed_according_to_physical_printers() return true; } +void PlaterPresetComboBox::save_custom_color_to_config(const std::vector& colors) +{ + auto set_colors = [](std::map &data, const std::vector &colors) { + for (size_t i = 0; i < colors.size(); i++) { + data[std::to_string(10 + i)] = colors[i]; //for map sort:10 begin + } + }; + if (colors.size() > 0) { + if (!wxGetApp().app_config->has_section("custom_color_list")) { + std::map data; + set_colors(data,colors); + wxGetApp().app_config->set_section("custom_color_list", data); + } else { + auto data = wxGetApp().app_config->get_section("custom_color_list"); + auto data_modify = const_cast *>(&data); + set_colors(*data_modify, colors); + wxGetApp().app_config->set_section("custom_color_list", *data_modify); + } + } +} + +std::vector PlaterPresetComboBox::get_custom_color_from_config() { + std::vector colors; + if (wxGetApp().app_config->has_section("custom_color_list")) { + auto data = wxGetApp().app_config->get_section("custom_color_list"); + for (auto iter : data) { + colors.push_back(iter.second); + } + } + return colors; +} // --------------------------------- // *** PlaterPresetComboBox *** // --------------------------------- @@ -673,13 +704,35 @@ PlaterPresetComboBox::PlaterPresetComboBox(wxWindow *parent, Preset::Type preset m_clrData.SetColour(clr_picker->GetBackgroundColour()); m_clrData.SetChooseFull(true); m_clrData.SetChooseAlpha(false); - + auto color_to_string = [](const wxColour& color) { + std::string str = std::to_string(color.Red()) + "," + std::to_string(color.Green()) + "," + std::to_string(color.Blue()) + "," + std::to_string(color.Alpha()); + return str; + }; + auto string_to_wxColor = [](const std::string& str) { + wxColour color; + std::vector result; + boost::split(result, str, boost::is_any_of(",")); + if (result.size() == 4) { + color = wxColour(std::stoi(result[0]), std::stoi(result[1]), std::stoi(result[2]), std::stoi(result[3])); + } + return color; + }; + std::vector colors=get_custom_color_from_config(); + for (int i = 0; i < colors.size(); i++) { + m_clrData.SetCustomColour(i, string_to_wxColor(colors[i])); + } wxColourDialog dialog(this, &m_clrData); dialog.SetTitle(_L("Please choose the filament colour")); if ( dialog.ShowModal() == wxID_OK ) { m_clrData = dialog.GetColourData(); - + const int custom_color_count = 15; + if (colors.size() != custom_color_count) { + colors.resize(custom_color_count); } + for (int i = 0; i < custom_color_count; i++) { + colors[i] = color_to_string(m_clrData.GetCustomColour(i)); + } + save_custom_color_to_config(colors); // get current color DynamicPrintConfig* cfg = &wxGetApp().preset_bundle->project_config; auto colors = static_cast(cfg->option("filament_colour")->clone()); diff --git a/src/slic3r/GUI/PresetComboBoxes.hpp b/src/slic3r/GUI/PresetComboBoxes.hpp index 954c06862f..6431354643 100644 --- a/src/slic3r/GUI/PresetComboBoxes.hpp +++ b/src/slic3r/GUI/PresetComboBoxes.hpp @@ -164,6 +164,8 @@ public: PlaterPresetComboBox(wxWindow *parent, Preset::Type preset_type); ~PlaterPresetComboBox(); + void save_custom_color_to_config(const std::vector &colors); + std::vector get_custom_color_from_config(); ScalableButton* edit_btn { nullptr }; // BBS diff --git a/src/slic3r/GUI/PrintOptionsDialog.cpp b/src/slic3r/GUI/PrintOptionsDialog.cpp index 67d8f4fd52..42667173c6 100644 --- a/src/slic3r/GUI/PrintOptionsDialog.cpp +++ b/src/slic3r/GUI/PrintOptionsDialog.cpp @@ -385,4 +385,185 @@ bool PrintOptionsDialog::Show(bool show) return DPIDialog::Show(show); } +PrinterPartsDialog::PrinterPartsDialog(wxWindow* parent) +: DPIDialog(parent, wxID_ANY, _L("Printer Parts"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX) +{ + nozzle_type_map[0] = "hardened_steel"; + nozzle_type_map[1] = "stainless_steel"; + + nozzle_stainless_diameter_map[0] = 0.2; + nozzle_stainless_diameter_map[1] = 0.4; + + nozzle_hard_diameter_map[0] = 0.4; + nozzle_hard_diameter_map[1] = 0.6; + nozzle_hard_diameter_map[2] = 0.8; + + SetBackgroundColour(*wxWHITE); + wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); + + + auto m_line = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL); + m_line->SetBackgroundColour(wxColour(166, 169, 170)); + + //nozzle type + wxBoxSizer* line_sizer_nozzle_type = new wxBoxSizer(wxHORIZONTAL); + + auto nozzle_type = new Label(this, _L("Nozzle Type")); + nozzle_type->SetFont(Label::Body_14); + nozzle_type->SetMinSize(wxSize(FromDIP(180), -1)); + nozzle_type->SetMaxSize(wxSize(FromDIP(180), -1)); + nozzle_type->SetForegroundColour(STATIC_TEXT_CAPTION_COL); + nozzle_type->Wrap(-1); + + nozzle_type_checkbox = new ComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(140), -1), 0, NULL, wxCB_READONLY); + nozzle_type_checkbox->Append(_L("Stainless Steel")); + nozzle_type_checkbox->Append(_L("Hardened Steel")); + nozzle_type_checkbox->SetSelection(0); + + + line_sizer_nozzle_type->Add(nozzle_type, 0, wxALIGN_CENTER, 5); + line_sizer_nozzle_type->Add(0, 0, 1, wxEXPAND, 5); + line_sizer_nozzle_type->Add(nozzle_type_checkbox, 0, wxALIGN_CENTER, 5); + + + //nozzle diameter + wxBoxSizer* line_sizer_nozzle_diameter = new wxBoxSizer(wxHORIZONTAL); + auto nozzle_diameter = new Label(this, _L("Nozzle Diameter")); + nozzle_diameter->SetFont(Label::Body_14); + nozzle_diameter->SetMinSize(wxSize(FromDIP(180), -1)); + nozzle_diameter->SetMaxSize(wxSize(FromDIP(180), -1)); + nozzle_diameter->SetForegroundColour(STATIC_TEXT_CAPTION_COL); + nozzle_diameter->Wrap(-1); + + nozzle_diameter_checkbox = new ComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(140), -1), 0, NULL, wxCB_READONLY); + + + line_sizer_nozzle_diameter->Add(nozzle_diameter, 0, wxALIGN_CENTER, 5); + line_sizer_nozzle_diameter->Add(0, 0, 1, wxEXPAND, 5); + line_sizer_nozzle_diameter->Add(nozzle_diameter_checkbox, 0, wxALIGN_CENTER, 5); + + sizer->Add(m_line, 0, wxEXPAND, 0); + sizer->Add(0, 0, 0, wxTOP, FromDIP(24)); + sizer->Add(line_sizer_nozzle_type, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT, FromDIP(18)); + sizer->Add(0, 0, 0, wxTOP, FromDIP(20)); + sizer->Add(line_sizer_nozzle_diameter, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT, FromDIP(18)); + sizer->Add(0, 0, 0, wxTOP, FromDIP(24)); + + + nozzle_type_checkbox->Connect( wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_type), NULL, this ); + nozzle_diameter_checkbox->Connect( wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_diameter), NULL, this ); + + SetSizer(sizer); + Layout(); + Fit(); + wxGetApp().UpdateDlgDarkUI(this); +} + +PrinterPartsDialog::~PrinterPartsDialog() +{ + nozzle_type_checkbox->Disconnect(wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_type), NULL, this); + nozzle_diameter_checkbox->Disconnect(wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_diameter), NULL, this); +} + +void PrinterPartsDialog::set_nozzle_type(wxCommandEvent& evt) +{ + auto type = nozzle_type_map[nozzle_type_checkbox->GetSelection()]; + + if (type == last_nozzle_type) { + return; + } + + std::map diameter_list; + if (type == "hardened_steel") { + diameter_list = nozzle_hard_diameter_map; + } + else if (type == "stainless_steel") { + diameter_list = nozzle_stainless_diameter_map; + } + + nozzle_diameter_checkbox->Clear(); + for (int i = 0; i < diameter_list.size(); i++) + { + nozzle_diameter_checkbox->Append(wxString::Format(_L("%.1f"), diameter_list[i])); + } + nozzle_diameter_checkbox->SetSelection(0); + last_nozzle_type = type; + set_nozzle_diameter(evt); +} + +void PrinterPartsDialog::set_nozzle_diameter(wxCommandEvent& evt) +{ + if (obj) { + try + { + auto nozzle_type = nozzle_type_map[nozzle_type_checkbox->GetSelection()]; + auto nozzle_diameter = std::stof(nozzle_diameter_checkbox->GetStringSelection().ToStdString()); + nozzle_diameter = round(nozzle_diameter * 10) / 10; + + obj->nozzle_diameter = nozzle_diameter; + obj->nozzle_type = nozzle_type; + + obj->command_set_printer_nozzle(nozzle_type, nozzle_diameter); + } + catch (...) {} + } +} + +void PrinterPartsDialog::on_dpi_changed(const wxRect& suggested_rect) +{ + Fit(); +} + +void PrinterPartsDialog::update_machine_obj(MachineObject* obj_) +{ + obj = obj_; +} + +bool PrinterPartsDialog::Show(bool show) +{ + if (show) { + wxGetApp().UpdateDlgDarkUI(this); + CentreOnParent(); + + auto type = obj->nozzle_type; + auto diameter = round(obj->nozzle_diameter * 10) / 10; + + nozzle_type_checkbox->Clear(); + nozzle_diameter_checkbox->Clear(); + + if (type.empty()) { + nozzle_type_checkbox->Disable(); + nozzle_diameter_checkbox->Disable(); + return DPIDialog::Show(show); + } + + last_nozzle_type = type; + + for (int i=0; i < nozzle_type_map.size(); i++) + { + nozzle_type_checkbox->Append( nozzle_type_map[i] ); + if (nozzle_type_map[i] == type) { + nozzle_type_checkbox->SetSelection(i); + } + } + + std::map diameter_list; + if (type == "hardened_steel") { + diameter_list = nozzle_hard_diameter_map; + } + else if (type == "stainless_steel") { + diameter_list = nozzle_stainless_diameter_map; + } + + for (int i = 0; i < diameter_list.size(); i++) + { + nozzle_diameter_checkbox->Append( wxString::Format(_L("%.1f"), diameter_list[i])); + if (diameter_list[i] == diameter) { + nozzle_diameter_checkbox->SetSelection(i); + } + } + } + return DPIDialog::Show(show); +} + }} // namespace Slic3r::GUI diff --git a/src/slic3r/GUI/PrintOptionsDialog.hpp b/src/slic3r/GUI/PrintOptionsDialog.hpp index 21865bda3c..ce67b76720 100644 --- a/src/slic3r/GUI/PrintOptionsDialog.hpp +++ b/src/slic3r/GUI/PrintOptionsDialog.hpp @@ -18,6 +18,27 @@ namespace Slic3r { namespace GUI { +class PrinterPartsDialog : public DPIDialog +{ +protected: + MachineObject* obj{ nullptr }; + ComboBox* nozzle_type_checkbox; + ComboBox* nozzle_diameter_checkbox; + std::string last_nozzle_type; + std::map nozzle_type_map; + std::map nozzle_stainless_diameter_map; + std::map nozzle_hard_diameter_map; +public: + PrinterPartsDialog(wxWindow* parent); + ~PrinterPartsDialog(); + void set_nozzle_type(wxCommandEvent& evt); + void set_nozzle_diameter(wxCommandEvent& evt); + void on_dpi_changed(const wxRect& suggested_rect) override; + void update_machine_obj(MachineObject* obj_); + bool Show(bool show) override; +}; + + class PrintOptionsDialog : public DPIDialog { protected: diff --git a/src/slic3r/GUI/Printer/BambuTunnel.h b/src/slic3r/GUI/Printer/BambuTunnel.h index bd00bdce9c..f578fa0cab 100644 --- a/src/slic3r/GUI/Printer/BambuTunnel.h +++ b/src/slic3r/GUI/Printer/BambuTunnel.h @@ -19,6 +19,8 @@ #ifdef __cplusplus extern "C" { +#else +#include #endif // __cplusplus #ifdef _WIN32 @@ -117,7 +119,9 @@ BAMBU_EXPORT void BAMBU_FUNC(Bambu_SetLogger)(Bambu_Tunnel tunnel, Logger logger BAMBU_EXPORT int BAMBU_FUNC(Bambu_Open)(Bambu_Tunnel tunnel); -BAMBU_EXPORT int BAMBU_FUNC(Bambu_StartStream)(Bambu_Tunnel tunnel, int video); +BAMBU_EXPORT int BAMBU_FUNC(Bambu_StartStream)(Bambu_Tunnel tunnel, bool video); + +BAMBU_EXPORT int BAMBU_FUNC(Bambu_StartStreamEx)(Bambu_Tunnel tunnel, int type); BAMBU_EXPORT int BAMBU_FUNC(Bambu_GetStreamCount)(Bambu_Tunnel tunnel); diff --git a/src/slic3r/GUI/Printer/PrinterFileSystem.cpp b/src/slic3r/GUI/Printer/PrinterFileSystem.cpp index 886421c65f..2da83ed62d 100644 --- a/src/slic3r/GUI/Printer/PrinterFileSystem.cpp +++ b/src/slic3r/GUI/Printer/PrinterFileSystem.cpp @@ -45,9 +45,9 @@ wxDEFINE_EVENT(EVT_FILE_CALLBACK, wxCommandEvent); static wxBitmap default_thumbnail; static std::map error_messages = { - {PrinterFileSystem::ERROR_PIPE, L("Connection lost. Please retry.")}, - {PrinterFileSystem::ERROR_RES_BUSY, L("The device cannot handle more conversations. Please retry later.")}, - {PrinterFileSystem::FILE_NO_EXIST, L("File not exists.")}, + {PrinterFileSystem::ERROR_PIPE, L("Reconnecting the printer, the operation cannot be completed immediately, please try again later.")}, + {PrinterFileSystem::ERROR_RES_BUSY, L("Over 4 studio/handy are using remote access, you can close some and try again.")}, + {PrinterFileSystem::FILE_NO_EXIST, L("File does not exist.")}, {PrinterFileSystem::FILE_CHECK_ERR, L("File checksum error. Please retry.")}, {PrinterFileSystem::FILE_TYPE_ERR, L("Not supported on the current printer version.")}, {PrinterFileSystem::STORAGE_UNAVAILABLE, L("Storage unavailable, insert SD card.")} @@ -203,6 +203,7 @@ void PrinterFileSystem::ListAllFiles() } BuildGroups(); UpdateGroupSelect(); + m_last_error = 0; m_status = Status::ListReady; SendChangedEvent(EVT_STATUS_CHANGED, m_status); SendChangedEvent(EVT_FILE_CHANGED); @@ -357,6 +358,13 @@ void PrinterFileSystem::FetchModel(size_t index, std::functionsecond.c_str()); + else + file_data->clear(); + } callback(result, *file_data); }); } @@ -376,7 +384,7 @@ size_t PrinterFileSystem::GetCount() const int PrinterFileSystem::File::DownloadProgress() const { return download ? download->progress : !local_path.empty() ? 100 : -2; } -std::string PrinterFileSystem::File::Title() const { return Metadata("Title", name); } +std::string PrinterFileSystem::File::Title() const { return Metadata("Title", ""); } std::string PrinterFileSystem::File::Metadata(std::string const &key, std::string const &dflt) const { @@ -981,7 +989,7 @@ void PrinterFileSystem::FileRemoved(std::pair type, size_ m_group_flags.erase(m_group_flags.begin() + index2); } } - m_file_list.erase(file_index.first.begin() + index); + file_index.first.erase(file_index.first.begin() + index); } struct CallbackEvent : wxCommandEvent @@ -1025,10 +1033,7 @@ void PrinterFileSystem::DumpLog(void * thiz, int, tchar const *msg) boost::uint32_t PrinterFileSystem::SendRequest(int type, json const &req, callback_t2 const &callback) { if (m_session.tunnel == nullptr) { - { - boost::unique_lock l(m_mutex); - m_cond.notify_all(); - } + Retry(); callback(ERROR_PIPE, json(), nullptr); return 0; } @@ -1223,7 +1228,7 @@ void PrinterFileSystem::Reconnect(boost::unique_lock &l, int resul if (m_session.tunnel) { auto tunnel = m_session.tunnel; m_session.tunnel = nullptr; - wxLogMessage("PrinterFileSystem::Reconnect close"); + wxLogMessage("PrinterFileSystem::Reconnect close %d", result); l.unlock(); Bambu_Close(tunnel); Bambu_Destroy(tunnel); @@ -1258,6 +1263,8 @@ void PrinterFileSystem::Reconnect(boost::unique_lock &l, int resul if (url.size() < 2) { wxLogMessage("PrinterFileSystem::Reconnect Initialize failed: %s", wxString::FromUTF8(url)); m_last_error = atoi(url.c_str()); + if (m_last_error == 0) + m_stopped = true; } else { wxLogMessage("PrinterFileSystem::Reconnect Initialized: %s", Slic3r::GUI::hide_passwd(wxString::FromUTF8(url), {"authkey=", "passwd="})); l.unlock(); @@ -1271,7 +1278,11 @@ void PrinterFileSystem::Reconnect(boost::unique_lock &l, int resul ret = Bambu_Open(tunnel); } if (ret == 0) - ret = Bambu_StartStream(tunnel, false); + do { + ret = Bambu_StartStreamEx + ? Bambu_StartStreamEx(tunnel, CTRL_TYPE) + : Bambu_StartStream(tunnel, false); + } while (ret == Bambu_would_block); l.lock(); if (ret == 0) { m_session.tunnel = tunnel; @@ -1352,6 +1363,7 @@ StaticBambuLib &StaticBambuLib::get() GET_FUNC(Bambu_Create); GET_FUNC(Bambu_Open); GET_FUNC(Bambu_StartStream); + GET_FUNC(Bambu_StartStreamEx); GET_FUNC(Bambu_GetStreamCount); GET_FUNC(Bambu_GetStreamInfo); GET_FUNC(Bambu_SendMessage); diff --git a/src/slic3r/GUI/ReleaseNote.cpp b/src/slic3r/GUI/ReleaseNote.cpp index 539f9c08e9..85d1d276e1 100644 --- a/src/slic3r/GUI/ReleaseNote.cpp +++ b/src/slic3r/GUI/ReleaseNote.cpp @@ -30,6 +30,7 @@ namespace Slic3r { namespace GUI { wxDEFINE_EVENT(EVT_SECONDARY_CHECK_CONFIRM, wxCommandEvent); wxDEFINE_EVENT(EVT_SECONDARY_CHECK_CANCEL, wxCommandEvent); wxDEFINE_EVENT(EVT_SECONDARY_CHECK_DONE, wxCommandEvent); +wxDEFINE_EVENT(EVT_SECONDARY_CHECK_RESUME, wxCommandEvent); wxDEFINE_EVENT(EVT_CHECKBOX_CHANGE, wxCommandEvent); wxDEFINE_EVENT(EVT_ENTER_IP_ADDRESS, wxCommandEvent); wxDEFINE_EVENT(EVT_CLOSE_IPADDRESS_DLG, wxCommandEvent); @@ -649,6 +650,21 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons e.Skip(); }); + m_button_resume = new Button(this, _L("resume")); + m_button_resume->SetBackgroundColor(btn_bg_white); + m_button_resume->SetBorderColor(wxColour(38, 46, 48)); + m_button_resume->SetFont(Label::Body_12); + m_button_resume->SetSize(wxSize(FromDIP(58), FromDIP(24))); + m_button_resume->SetMinSize(wxSize(-1, FromDIP(24))); + m_button_resume->SetMaxSize(wxSize(-1, FromDIP(24))); + m_button_resume->SetCornerRadius(FromDIP(12)); + + m_button_resume->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) { + post_event(wxCommandEvent(EVT_SECONDARY_CHECK_RESUME)); + e.Skip(); + }); + m_button_resume->Hide(); + if (btn_style == CONFIRM_AND_CANCEL) { m_button_cancel->Show(); m_button_fn->Hide(); @@ -673,6 +689,7 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons } sizer_button->AddStretchSpacer(); + sizer_button->Add(m_button_resume, 0, wxALL, FromDIP(5)); sizer_button->Add(m_button_retry, 0, wxALL, FromDIP(5)); sizer_button->Add(m_button_fn, 0, wxALL, FromDIP(5)); sizer_button->Add(m_button_ok, 0, wxALL, FromDIP(5)); @@ -776,26 +793,39 @@ void SecondaryCheckDialog::update_title_style(wxString title, SecondaryCheckDial m_button_cancel->Show(); m_button_fn->Hide(); m_button_retry->Hide(); + m_button_resume->Hide(); } else if (style == CONFIRM_AND_DONE) { m_button_cancel->Hide(); m_button_fn->Show(); m_button_retry->Hide(); + m_button_resume->Hide(); } else if (style == CONFIRM_AND_RETRY) { m_button_retry->Show(); m_button_cancel->Hide(); m_button_fn->Hide(); + m_button_resume->Hide(); } else if (style == DONE_AND_RETRY) { m_button_retry->Show(); m_button_fn->Show(); m_button_cancel->Hide(); + m_button_resume->Hide(); + } + else if(style == CONFIRM_AND_RESUME) + { + m_button_retry->Hide(); + m_button_fn->Hide(); + m_button_cancel->Hide(); + m_button_resume->Show(); } else { m_button_retry->Hide(); m_button_cancel->Hide(); m_button_fn->Hide(); + m_button_resume->Hide(); + } @@ -965,16 +995,46 @@ void ConfirmBeforeSendDialog::update_text(wxString text) sizer_text_release_note->Add(bottom_blank_sizer, 0, wxALIGN_CENTER | wxALL, FromDIP(5)); m_vebview_release_note->SetSizer(sizer_text_release_note); } - m_staticText_release_note->SetMaxSize(wxSize(FromDIP(330), -1)); - m_staticText_release_note->SetMinSize(wxSize(FromDIP(330), -1)); + m_staticText_release_note->SetMaxSize(wxSize(FromDIP(380), -1)); + m_staticText_release_note->SetMinSize(wxSize(FromDIP(380), -1)); m_staticText_release_note->SetLabelText(text); m_vebview_release_note->Layout(); auto text_size = m_staticText_release_note->GetBestSize(); - if (text_size.y < FromDIP(360)) - m_vebview_release_note->SetMinSize(wxSize(FromDIP(360), text_size.y + FromDIP(25))); + if (text_size.y < FromDIP(380)) + m_vebview_release_note->SetMinSize(wxSize(FromDIP(400), text_size.y + FromDIP(25))); else { - m_vebview_release_note->SetMinSize(wxSize(FromDIP(360), FromDIP(360))); + m_vebview_release_note->SetMinSize(wxSize(FromDIP(400), FromDIP(380))); + } + + Layout(); + Fit(); +} + +void ConfirmBeforeSendDialog::update_text(std::vector texts) +{ + wxBoxSizer* sizer_text_release_note = new wxBoxSizer(wxVERTICAL); + m_vebview_release_note->SetSizer(sizer_text_release_note); + + auto height = 0; + for (auto text : texts) { + auto label_item = new Label(m_vebview_release_note, text.text, LB_AUTO_WRAP); + if (text.level == ConfirmBeforeSendInfo::InfoLevel::Warning) { + label_item->SetForegroundColour(wxColour(0xFF, 0x6F, 0x00)); + } + label_item->SetMaxSize(wxSize(FromDIP(380), -1)); + label_item->SetMinSize(wxSize(FromDIP(380), -1)); + label_item->Wrap(FromDIP(380)); + label_item->Layout(); + sizer_text_release_note->Add(label_item, 0, wxALIGN_CENTER | wxALL, FromDIP(3)); + height += label_item->GetSize().y; + } + + m_vebview_release_note->Layout(); + if (height < FromDIP(380)) + m_vebview_release_note->SetMinSize(wxSize(FromDIP(400), height + FromDIP(25))); + else { + m_vebview_release_note->SetMinSize(wxSize(FromDIP(400), FromDIP(380))); } Layout(); @@ -1035,12 +1095,38 @@ void ConfirmBeforeSendDialog::on_dpi_changed(const wxRect& suggested_rect) rescale(); } -void ConfirmBeforeSendDialog::show_update_nozzle_button() +void ConfirmBeforeSendDialog::show_update_nozzle_button(bool show) { - m_button_update_nozzle->Show(true); + m_button_update_nozzle->Show(show); Layout(); } +void ConfirmBeforeSendDialog::hide_button_ok() +{ + m_button_ok->Hide(); +} + +void ConfirmBeforeSendDialog::edit_cancel_button_txt(wxString txt) +{ + m_button_cancel->SetLabel(txt); +} + +void ConfirmBeforeSendDialog::disable_button_ok() +{ + m_button_ok->Disable(); + m_button_ok->SetBackgroundColor(wxColour(0x90, 0x90, 0x90)); + m_button_ok->SetBorderColor(wxColour(0x90, 0x90, 0x90)); +} + +void ConfirmBeforeSendDialog::enable_button_ok() +{ + m_button_ok->Enable(); + StateColor btn_bg_green(std::pair(wxColour(61, 203, 115), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), + std::pair(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal)); + m_button_ok->SetBackgroundColor(btn_bg_green); + m_button_ok->SetBorderColor(btn_bg_green); +} + void ConfirmBeforeSendDialog::rescale() { m_button_ok->Rescale(); diff --git a/src/slic3r/GUI/ReleaseNote.hpp b/src/slic3r/GUI/ReleaseNote.hpp index 98d42b964c..80727df552 100644 --- a/src/slic3r/GUI/ReleaseNote.hpp +++ b/src/slic3r/GUI/ReleaseNote.hpp @@ -46,6 +46,7 @@ wxDECLARE_EVENT(EVT_SECONDARY_CHECK_CONFIRM, wxCommandEvent); wxDECLARE_EVENT(EVT_SECONDARY_CHECK_CANCEL, wxCommandEvent); wxDECLARE_EVENT(EVT_SECONDARY_CHECK_RETRY, wxCommandEvent); wxDECLARE_EVENT(EVT_SECONDARY_CHECK_DONE, wxCommandEvent); +wxDECLARE_EVENT(EVT_SECONDARY_CHECK_RESUME, wxCommandEvent); wxDECLARE_EVENT(EVT_UPDATE_NOZZLE, wxCommandEvent); class ReleaseNoteDialog : public DPIDialog @@ -116,8 +117,9 @@ public: CONFIRM_AND_CANCEL = 1, CONFIRM_AND_DONE = 2, CONFIRM_AND_RETRY = 3, - DONE_AND_RETRY = 4, - MAX_STYLE_NUM = 5 + CONFIRM_AND_RESUME = 4, + DONE_AND_RETRY = 5, + MAX_STYLE_NUM = 6 }; SecondaryCheckDialog( wxWindow* parent, @@ -150,12 +152,25 @@ public: Button* m_button_retry { nullptr }; Button* m_button_cancel { nullptr }; Button* m_button_fn { nullptr }; + Button* m_button_resume { nullptr }; wxCheckBox* m_show_again_checkbox; ButtonStyle m_button_style; bool not_show_again = false; std::string show_again_config_text = ""; }; + +struct ConfirmBeforeSendInfo +{ + enum InfoLevel { + Normal = 0, + Warning = 1 + }; + InfoLevel level; + wxString text; + ConfirmBeforeSendInfo(wxString txt, InfoLevel lev = Normal) : text(txt), level(lev) {} +}; + class ConfirmBeforeSendDialog : public DPIDialog { public: @@ -175,12 +190,17 @@ public: bool not_show_again_check = false ); void update_text(wxString text); + void update_text(std::vector texts); void on_show(); void on_hide(); void update_btn_label(wxString ok_btn_text, wxString cancel_btn_text); void rescale(); void on_dpi_changed(const wxRect& suggested_rect); - void show_update_nozzle_button(); + void show_update_nozzle_button(bool show = false); + void hide_button_ok(); + void edit_cancel_button_txt(wxString txt); + void disable_button_ok(); + void enable_button_ok(); wxString format_text(wxString str, int warp); ~ConfirmBeforeSendDialog(); diff --git a/src/slic3r/GUI/Search.cpp b/src/slic3r/GUI/Search.cpp index 6184086dc0..5579fb7bcf 100644 --- a/src/slic3r/GUI/Search.cpp +++ b/src/slic3r/GUI/Search.cpp @@ -395,7 +395,7 @@ void OptionsSearcher::add_key(const std::string &opt_key, Preset::Type type, con // SearchItem //------------------------------------------ -SearchItem::SearchItem(wxWindow *parent, wxString text, int index, SearchDialog* sdialog, SearchObjectDialog* search_dialog) +SearchItem::SearchItem(wxWindow *parent, wxString text, int index, SearchDialog* sdialog, SearchObjectDialog* search_dialog, wxString tooltip) : wxWindow(parent, wxID_ANY, wxDefaultPosition, wxSize(parent->GetSize().GetWidth(), 3 * GUI::wxGetApp().em_unit())) { m_sdialog = sdialog; @@ -403,6 +403,8 @@ SearchItem::SearchItem(wxWindow *parent, wxString text, int index, SearchDialog* m_text = text; m_index = index; + this->SetToolTip(tooltip); + SetBackgroundColour(StateColor::darkModeColorFor(wxColour("#FFFFFF"))); Bind(wxEVT_ENTER_WINDOW, &SearchItem::on_mouse_enter, this); Bind(wxEVT_LEAVE_WINDOW, &SearchItem::on_mouse_leave, this); @@ -997,13 +999,11 @@ void SearchObjectDialog::update_list() m_listPanel->SetBackgroundColour(StateColor::darkModeColorFor(m_bg_color)); m_listPanel->SetSize(wxSize(m_scrolledWindow->GetSize().GetWidth(), -1)); - const std::vector>& found = m_object_list->GetModel()->get_found_list(); + const std::vector>& found = m_object_list->GetModel()->get_found_list(); auto index = 0; - for (const auto& item : found) { - GUI::ObjectDataViewModelNode* data_item = item.first; - wxString data_str = item.second; - auto tmp = new SearchItem(m_listPanel, data_str, index, nullptr, this); - tmp->m_item = data_item; + for (const auto& [model_node, name, tip] : found) { + auto tmp = new SearchItem(m_listPanel, name, index, nullptr, this, tip); + tmp->m_item = model_node; m_listsizer->Add(tmp, 0, wxEXPAND, 0); index++; } diff --git a/src/slic3r/GUI/Search.hpp b/src/slic3r/GUI/Search.hpp index 8d20a14e1c..31b83b8cf3 100644 --- a/src/slic3r/GUI/Search.hpp +++ b/src/slic3r/GUI/Search.hpp @@ -166,7 +166,7 @@ public: SearchObjectDialog* m_search_object_dialog{ nullptr }; GUI::ObjectDataViewModelNode* m_item{ nullptr }; - SearchItem(wxWindow *parent, wxString text, int index, SearchDialog *sdialog = nullptr, SearchObjectDialog* search_dialog = nullptr); + SearchItem(wxWindow *parent, wxString text, int index, SearchDialog *sdialog = nullptr, SearchObjectDialog* search_dialog = nullptr, wxString tooltip = ""); ~SearchItem(){}; wxSize DrawTextString(wxDC &dc, const wxString &text, const wxPoint &pt, bool bold); diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 9c9bfb259a..62f602c27b 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -1800,8 +1800,11 @@ void SelectMachineDialog::sync_ams_mapping_result(std::vector &res // default color ams_col = wxColour(0xCE, 0xCE, 0xCE); } - - m->set_ams_info(ams_col, ams_id); + std::vector cols; + for (auto col : f->colors) { + cols.push_back(AmsTray::decode_color(col)); + } + m->set_ams_info(ams_col, ams_id,f->ctype, cols); break; } iter++; @@ -2141,9 +2144,39 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vectorget_selected_machine(); + if (obj_ == nullptr) return; + auto sourcet_print_name = obj_->get_printer_type_display_str(); + sourcet_print_name.Replace(wxT("Bambu Lab "), wxEmptyString); + + //target print + std::string target_model_id; + if (m_print_type == PrintFromType::FROM_NORMAL){ + PresetBundle* preset_bundle = wxGetApp().preset_bundle; + target_model_id = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle); + } + else if (m_print_type == PrintFromType::FROM_SDCARD_VIEW) { + if (m_required_data_plate_data_list.size() > 0) { + target_model_id = m_required_data_plate_data_list[m_print_plate_idx]->printer_model_id; + } + } + + auto target_print_name = wxString(obj_->get_preset_printer_model_name(target_model_id)); + target_print_name.Replace(wxT("Bambu Lab "), wxEmptyString); + msg_text = wxString::Format(_L("The selected printer (%s) is incompatible with the chosen printer profile in the slicer (%s)."), sourcet_print_name, target_print_name); + + update_print_status_msg(msg_text, true, true); + } + catch (...){} + Enable_Send_Button(false); Enable_Refresh_Button(true); }else if (status == PrintDialogStatus::PrintStatusTimelapseNoSdcard) { @@ -2217,10 +2250,19 @@ bool SelectMachineDialog::is_blocking_printing(MachineObject* obj_) { DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); if (!dev) return true; - - PresetBundle* preset_bundle = wxGetApp().preset_bundle; - auto source_model = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle); auto target_model = obj_->printer_type; + std::string source_model = ""; + + if (m_print_type == PrintFromType::FROM_NORMAL) { + PresetBundle* preset_bundle = wxGetApp().preset_bundle; + source_model = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle); + + + }else if (m_print_type == PrintFromType::FROM_SDCARD_VIEW) { + if (m_required_data_plate_data_list.size() > 0) { + source_model = m_required_data_plate_data_list[m_print_plate_idx]->printer_model_id; + } + } if (source_model != target_model) { std::vector compatible_machine = dev->get_compatible_machine(target_model); @@ -2378,7 +2420,7 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) { bool has_slice_warnings = false; - bool has_update_nozzle = false; + bool is_printing_block = false; DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); if (!dev) return; @@ -2386,14 +2428,13 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) if (!obj_) return; - std::vector confirm_text; - confirm_text.push_back(_L("Please check the following:") + "\n\n"); + std::vector confirm_text; + confirm_text.push_back(ConfirmBeforeSendInfo(_L("Please check the following:"))); //Check Printer Model Id bool is_same_printer_type = is_same_printer_model(); if (!is_same_printer_type && (m_print_type == PrintFromType::FROM_NORMAL)) { - confirm_text.push_back(_L("The printer type selected when generating G-Code is not consistent with the currently selected printer. It is recommended that you use the same printer type for slicing.") + "\n"); - + confirm_text.push_back(ConfirmBeforeSendInfo(_L("The printer type selected when generating G-Code is not consistent with the currently selected printer. It is recommended that you use the same printer type for slicing."))); has_slice_warnings = true; } @@ -2421,7 +2462,7 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) if (in_blacklist && action == "warning") { wxString prohibited_error = wxString::FromUTF8(info); - confirm_text.push_back(prohibited_error + "\n"); + confirm_text.push_back(ConfirmBeforeSendInfo(prohibited_error)); has_slice_warnings = true; } } @@ -2437,20 +2478,20 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) } else if (warning.msg == NOT_SUPPORT_TRADITIONAL_TIMELAPSE) { if (obj_->get_printer_arch() == PrinterArch::ARCH_I3 && m_checkbox_list["timelapse"]->GetValue()) { - confirm_text.push_back(Plater::get_slice_warning_string(warning) + "\n"); + confirm_text.push_back(ConfirmBeforeSendInfo(Plater::get_slice_warning_string(warning))); has_slice_warnings = true; } } else if (warning.msg == NOT_GENERATE_TIMELAPSE) { continue; } - else { + else if(warning.msg == NOZZLE_HRC_CHECKER){ wxString error_info = Plater::get_slice_warning_string(warning); if (error_info.IsEmpty()) { error_info = wxString::Format("%s\n", warning.msg); - confirm_text.push_back(error_info + "\n"); - } else - confirm_text.push_back(error_info + "\n"); + } + + confirm_text.push_back(ConfirmBeforeSendInfo(error_info)); has_slice_warnings = true; } } @@ -2508,7 +2549,7 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) if (has_unknown_filament) { has_slice_warnings = true; - confirm_text.push_back(_L("There are some unknown filaments in the AMS mappings. Please check whether they are the required filaments. If they are okay, press \"Confirm\" to start printing.") + "\n"); + confirm_text.push_back(ConfirmBeforeSendInfo(_L("There are some unknown filaments in the AMS mappings. Please check whether they are the required filaments. If they are okay, press \"Confirm\" to start printing."))); } std::string nozzle_diameter; @@ -2518,23 +2559,24 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) if (!obj_->nozzle_type.empty() && (m_print_type == PrintFromType::FROM_NORMAL)) { if (!is_same_nozzle_diameters(tag_nozzle_type, nozzle_diameter)) { has_slice_warnings = true; - has_update_nozzle = true; + is_printing_block = true; wxString nozzle_in_preset = wxString::Format(_L("nozzle in preset: %s %s"),nozzle_diameter, ""); wxString nozzle_in_printer = wxString::Format(_L("nozzle memorized: %.1f %s"), obj_->nozzle_diameter, ""); - confirm_text.push_back(_L("Your nozzle diameter in preset is not consistent with memorized nozzle diameter. Did you change your nozzle lately?") + confirm_text.push_back(ConfirmBeforeSendInfo(_L("Your nozzle diameter in sliced file is not consistent with memorized nozzle. If you changed your nozzle lately, please go to Device > Printer Parts to change settings.") + "\n " + nozzle_in_preset + "\n " + nozzle_in_printer - + "\n"); + + "\n", ConfirmBeforeSendInfo::InfoLevel::Warning)); } - else if (!is_same_nozzle_type(filament_type, tag_nozzle_type)){ + + if (!is_same_nozzle_type(filament_type, tag_nozzle_type)){ has_slice_warnings = true; - has_update_nozzle = true; + is_printing_block = true; nozzle_diameter = wxString::Format("%.1f", obj_->nozzle_diameter).ToStdString(); - wxString nozzle_in_preset = wxString::Format(_L("*Printing %s material with %s may cause nozzle damage"), filament_type, format_steel_name(obj_->nozzle_type)); - confirm_text.push_back(nozzle_in_preset + "\n"); + wxString nozzle_in_preset = wxString::Format(_L("Printing high temperature material(%s material) with %s may cause nozzle damage"), filament_type, format_steel_name(obj_->nozzle_type)); + confirm_text.push_back(ConfirmBeforeSendInfo(nozzle_in_preset, ConfirmBeforeSendInfo::InfoLevel::Warning)); } } @@ -2543,7 +2585,14 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) wxString confirm_title = _L("Warning"); ConfirmBeforeSendDialog confirm_dlg(this, wxID_ANY, confirm_title); - if(has_update_nozzle){confirm_dlg.show_update_nozzle_button();} + if(is_printing_block){ + confirm_dlg.hide_button_ok(); + confirm_dlg.edit_cancel_button_txt(_L("Close")); + confirm_text.push_back(ConfirmBeforeSendInfo(_L("Please fix the error above, otherwise printing cannot continue."), ConfirmBeforeSendInfo::InfoLevel::Warning)); + } + else { + confirm_text.push_back(ConfirmBeforeSendInfo(_L("Please click the confirm button if you still want to proceed with printing."))); + } confirm_dlg.Bind(EVT_SECONDARY_CHECK_CONFIRM, [this, &confirm_dlg](wxCommandEvent& e) { confirm_dlg.on_hide(); @@ -2555,34 +2604,34 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) } }); - confirm_dlg.Bind(EVT_UPDATE_NOZZLE, [this, obj_, tag_nozzle_type, nozzle_diameter, &confirm_dlg](wxCommandEvent& e) { - if (obj_ && !tag_nozzle_type.empty() && !nozzle_diameter.empty()) { - try - { - float diameter = std::stof(nozzle_diameter); - diameter = round(diameter * 10) / 10; - obj_->command_set_printer_nozzle(tag_nozzle_type, diameter); - } - catch (...) {} - } - }); + //confirm_dlg.Bind(EVT_UPDATE_NOZZLE, [this, obj_, tag_nozzle_type, nozzle_diameter, &confirm_dlg](wxCommandEvent& e) { + // if (obj_ && !tag_nozzle_type.empty() && !nozzle_diameter.empty()) { + // try + // { + // float diameter = std::stof(nozzle_diameter); + // diameter = round(diameter * 10) / 10; + // obj_->command_set_printer_nozzle(tag_nozzle_type, diameter); + // } + // catch (...) {} + // } + // }); - confirm_text.push_back(_L("Please click the confirm button if you still want to proceed with printing.") + "\n"); + wxString info_msg = wxEmptyString; for (auto i = 0; i < confirm_text.size(); i++) { if (i == 0) { - info_msg += confirm_text[i]; + //info_msg += confirm_text[i]; } else if (i == confirm_text.size() - 1) { - info_msg += confirm_text[i]; + //info_msg += confirm_text[i]; } else { - info_msg += wxString::Format("%d. %s\n",i, confirm_text[i]); + confirm_text[i].text = wxString::Format("%d. %s",i, confirm_text[i].text); } } - confirm_dlg.update_text(info_msg); + confirm_dlg.update_text(confirm_text); confirm_dlg.on_show(); } else { @@ -2882,15 +2931,32 @@ void SelectMachineDialog::on_set_finish_mapping(wxCommandEvent &evt) BOOST_LOG_TRIVIAL(info) << "The ams mapping selection result: data is " << selection_data; if (selection_data_arr.size() == 6) { - for (auto i = 0; i < m_ams_mapping_result.size(); i++) { + int ctype = 0; + std::vector material_cols; + std::vector tray_cols; + for (auto mapping_item : m_mapping_popup.m_mapping_item_list) { + if (mapping_item->m_tray_data.id == evt.GetInt()) { + ctype = mapping_item->m_tray_data.ctype; + material_cols = mapping_item->m_tray_data.material_cols; + for (auto col : mapping_item->m_tray_data.material_cols) { + wxString color = wxString::Format("#%02X%02X%02X%02X", col.Red(), col.Green(), col.Blue(), col.Alpha()); + tray_cols.push_back(color.ToStdString()); + } + break; + } + } + + for (auto i = 0; i < m_ams_mapping_result.size(); i++) { if (m_ams_mapping_result[i].id == wxAtoi(selection_data_arr[5])) { m_ams_mapping_result[i].tray_id = evt.GetInt(); - auto ams_colour = wxColour(wxAtoi(selection_data_arr[0]), wxAtoi(selection_data_arr[1]), wxAtoi(selection_data_arr[2]), wxAtoi(selection_data_arr[3])); - wxString color = wxString::Format("#%02X%02X%02X%02X", ams_colour.Red(), ams_colour.Green(), ams_colour.Blue(), ams_colour.Alpha()); - m_ams_mapping_result[i].color = color.ToStdString(); + auto ams_colour = wxColour(wxAtoi(selection_data_arr[0]), wxAtoi(selection_data_arr[1]), wxAtoi(selection_data_arr[2]), wxAtoi(selection_data_arr[3])); + wxString color = wxString::Format("#%02X%02X%02X%02X", ams_colour.Red(), ams_colour.Green(), ams_colour.Blue(), ams_colour.Alpha()); + m_ams_mapping_result[i].color = color.ToStdString(); + m_ams_mapping_result[i].ctype = ctype; + m_ams_mapping_result[i].colors = tray_cols; } BOOST_LOG_TRIVIAL(trace) << "The ams mapping result: id is " << m_ams_mapping_result[i].id << "tray_id is " << m_ams_mapping_result[i].tray_id; - } + } MaterialHash::iterator iter = m_materialList.begin(); while (iter != m_materialList.end()) { @@ -2898,7 +2964,7 @@ void SelectMachineDialog::on_set_finish_mapping(wxCommandEvent &evt) MaterialItem *m = item->item; if (item->id == m_current_filament_id) { auto ams_colour = wxColour(wxAtoi(selection_data_arr[0]), wxAtoi(selection_data_arr[1]), wxAtoi(selection_data_arr[2]), wxAtoi(selection_data_arr[3])); - m->set_ams_info(ams_colour, selection_data_arr[4]); + m->set_ams_info(ams_colour, selection_data_arr[4], ctype, material_cols); } iter++; } @@ -3157,7 +3223,7 @@ void SelectMachineDialog::on_rename_enter() m_current_project_name = new_file_name; m_rename_switch_panel->SetSelection(0); - m_rename_text->SetLabel(m_current_project_name); + m_rename_text->SetLabelText(m_current_project_name); m_rename_normal_panel->Layout(); } @@ -3282,12 +3348,7 @@ void SelectMachineDialog::update_flow_cali_check(MachineObject* obj) if (obj && obj->get_printer_arch() == PrinterArch::ARCH_I3) { show_cali_tips = false; } - if (bed_type == BedType::btPTE) { - set_flow_calibration_state(false, show_cali_tips); - } - else { - set_flow_calibration_state(true, show_cali_tips); - } + set_flow_calibration_state(true, show_cali_tips); } void SelectMachineDialog::update_ams_check(MachineObject* obj) @@ -3416,7 +3477,7 @@ void SelectMachineDialog::update_show_status() } } - if (m_print_type == PrintFromType::FROM_NORMAL && is_blocking_printing(obj_)) { + if (is_blocking_printing(obj_)) { show_status(PrintDialogStatus::PrintStatusUnsupportedPrinter); return; } @@ -3774,7 +3835,23 @@ void SelectMachineDialog::set_default() } fs::path filename_path(filename.c_str()); - m_current_project_name = wxString::FromUTF8(filename_path.filename().string()); + std::string file_name = filename_path.filename().string(); + if (from_u8(file_name).find(_L("Untitled")) != wxString::npos) { + PartPlate *part_plate = m_plater->get_partplate_list().get_plate(m_print_plate_idx); + if (part_plate) { + if (std::vector objects = part_plate->get_objects_on_this_plate(); objects.size() > 0) { + file_name = objects[0]->name; + for (int i = 1; i < objects.size(); i++) { + file_name += (" + " + objects[i]->name); + } + } + if (file_name.size() > 100) { + file_name = file_name.substr(0, 97) + "..."; + } + } + } + m_current_project_name = wxString::FromUTF8(file_name); + //unsupported character filter m_current_project_name = from_u8(filter_characters(m_current_project_name.ToUTF8().data(), "<>[]:/\\|?*\"")); @@ -4051,10 +4128,13 @@ void SelectMachineDialog::set_default_from_sdcard() update_page_turn_state(true); ThumbnailData& data = m_required_data_plate_data_list[m_print_plate_idx]->plate_thumbnail; - wxMemoryInputStream mis((unsigned char*)data.pixels.data(), data.pixels.size()); - wxImage image = wxImage(mis); - image = image.Rescale(FromDIP(256), FromDIP(256)); - m_thumbnailPanel->set_thumbnail(image); + + if (data.pixels.size() > 0) { + wxMemoryInputStream mis((unsigned char*)data.pixels.data(), data.pixels.size()); + wxImage image = wxImage(mis); + image = image.Rescale(FromDIP(256), FromDIP(256)); + m_thumbnailPanel->set_thumbnail(image); + } //for black list std::vector materials; @@ -4158,14 +4238,7 @@ void SelectMachineDialog::set_default_from_sdcard() m_scrollable_view->SetMinSize(m_scrollable_region->GetSize()); m_scrollable_view->SetMaxSize(m_scrollable_region->GetSize()); - //disable pei bed - auto bed_type = m_plater->get_partplate_list().get_curr_plate()->get_bed_type(true); - if (bed_type == BedType::btPTE) { - set_flow_calibration_state(false); - } - else { - set_flow_calibration_state(true); - } + set_flow_calibration_state(true); wxSize screenSize = wxGetDisplaySize(); auto dialogSize = this->GetSize(); @@ -4479,7 +4552,7 @@ void EditDevNameDialog::on_edit_name(wxCommandEvent &e) dc.DrawBitmap(m_background_bitmap.bmp(), 0, 0); dc.DrawBitmap(m_bitmap, 0, 0); dc.SelectObject(wxNullBitmap); - + Refresh(); } void ThumbnailPanel::OnPaint(wxPaintEvent& event) { diff --git a/src/slic3r/GUI/SelectMachine.hpp b/src/slic3r/GUI/SelectMachine.hpp index 160c21592a..d9ea4cb8f4 100644 --- a/src/slic3r/GUI/SelectMachine.hpp +++ b/src/slic3r/GUI/SelectMachine.hpp @@ -64,6 +64,34 @@ enum PrintFromType { FROM_SDCARD_VIEW, }; +static int get_brightness_value(wxImage image) { + + wxImage grayImage = image.ConvertToGreyscale(); + + int width = grayImage.GetWidth(); + int height = grayImage.GetHeight(); + + int totalLuminance = 0; + unsigned char alpha; + int num_none_transparent = 0; + for (int y = 0; y < height; y += 2) { + + for (int x = 0; x < width; x += 2) { + + alpha = image.GetAlpha(x, y); + if (alpha != 0) { + wxColour pixelColor = grayImage.GetRed(x, y); + totalLuminance += pixelColor.Red(); + num_none_transparent = num_none_transparent + 1; + } + } + } + if (totalLuminance <= 0 || num_none_transparent <= 0) { + return 0; + } + return totalLuminance / num_none_transparent; +} + class Material { public: @@ -288,7 +316,7 @@ private: int m_print_plate_idx{0}; int m_print_plate_total{0}; int m_timeout_count{0}; - int m_print_error_code; + int m_print_error_code{0}; bool m_is_in_sending_mode{ false }; bool m_ams_mapping_res{ false }; bool m_ams_mapping_valid{ false }; diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 01f1c06502..4b06c543b8 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -147,6 +147,17 @@ void Selection::set_model(Model* model) update_valid(); } +int Selection::query_real_volume_idx_from_other_view(unsigned int object_idx, unsigned int instance_idx, unsigned int model_volume_idx) +{ + for (int i = 0; i < m_volumes->size(); i++) { + auto v = (*m_volumes)[i]; + if (v->object_idx() == object_idx && instance_idx == v->instance_idx() && model_volume_idx == v->volume_idx()) { + return i; + } + } + return -1; +} + void Selection::add(unsigned int volume_idx, bool as_single_selection, bool check_for_already_contained) { if (!m_valid || (unsigned int)m_volumes->size() <= volume_idx) @@ -1988,6 +1999,13 @@ void Selection::copy_to_clipboard() m_clipboard.reset(); + // sort as the object list order + std::vector selected_list; + selected_list.assign(m_list.begin(), m_list.end()); + std::sort(selected_list.begin(), selected_list.end(), [this](unsigned int left, unsigned int right) { + return (*m_volumes)[left]->volume_idx() < (*m_volumes)[right]->volume_idx(); + }); + for (const ObjectIdxsToInstanceIdxsMap::value_type& object : m_cache.content) { ModelObject* src_object = m_model->objects[object.first]; ModelObject* dst_object = m_clipboard.add_object(); @@ -2005,7 +2023,7 @@ void Selection::copy_to_clipboard() dst_object->add_instance(*src_object->instances[i]); } - for (unsigned int i : m_list) { + for (unsigned int i : selected_list) { // Copy the ModelVolumes only for the selected GLVolumes of the 1st selected instance. const GLVolume* volume = (*m_volumes)[i]; if (volume->object_idx() == object.first && volume->instance_idx() == *object.second.begin()) { @@ -3078,7 +3096,7 @@ void Selection::paste_objects_from_clipboard() if (src_objects.size() > 1) { BoundingBoxf3 bbox_all; for (const ModelObject *src_object : src_objects) { - BoundingBoxf3 bbox = src_object->instance_convex_hull_bounding_box(0); + BoundingBoxf3 bbox = src_object->instance_convex_hull_bounding_box(size_t(0)); bbox_all.merge(bbox); } auto bsize = bbox_all.size(); @@ -3094,7 +3112,7 @@ void Selection::paste_objects_from_clipboard() ModelObject* dst_object = m_model->add_object(*src_object); // BBS: find an empty cell to put the copied object - BoundingBoxf3 bbox = src_object->instance_convex_hull_bounding_box(0); + BoundingBoxf3 bbox = src_object->instance_convex_hull_bounding_box(size_t(0)); Vec3d displacement; bool in_current = plate->intersects(bbox); diff --git a/src/slic3r/GUI/Selection.hpp b/src/slic3r/GUI/Selection.hpp index c506a1a6fa..10954488df 100644 --- a/src/slic3r/GUI/Selection.hpp +++ b/src/slic3r/GUI/Selection.hpp @@ -212,6 +212,7 @@ public: EMode get_mode() const { return m_mode; } void set_mode(EMode mode) { m_mode = mode; } + int query_real_volume_idx_from_other_view(unsigned int object_idx, unsigned int instance_idx, unsigned int model_volume_idx); void add(unsigned int volume_idx, bool as_single_selection = true, bool check_for_already_contained = false); void remove(unsigned int volume_idx); diff --git a/src/slic3r/GUI/SendToPrinter.hpp b/src/slic3r/GUI/SendToPrinter.hpp index b084a382f3..9f477be993 100644 --- a/src/slic3r/GUI/SendToPrinter.hpp +++ b/src/slic3r/GUI/SendToPrinter.hpp @@ -50,7 +50,7 @@ private: int m_print_plate_idx; int m_current_filament_id; - int m_print_error_code; + int m_print_error_code = 0; int timeout_count = 0; bool m_is_in_sending_mode{ false }; bool m_is_rename_mode{ false }; diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index 53394895f6..6c55a27b4f 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -85,7 +85,6 @@ static std::vector message_containing_retry{ "07FF 8012", "07FF 8013", "12FF 8007" - }; static std::vector message_containing_done{ @@ -93,6 +92,10 @@ static std::vector message_containing_done{ "12FF 8007" }; +static std::vector message_containing_resume{ + "0300 8013" +}; + static wxImage fail_image; @@ -492,7 +495,7 @@ void PrintingTaskPanel::create_panel(wxWindow* parent) static_score_sizer->Add(static_score_text, 1, wxEXPAND | wxALL, FromDIP(10)); m_has_rated_prompt = new wxStaticText(m_score_subtask_info, wxID_ANY, _L("(The model has already been rated. Your rating will overwrite the previous rating.)"), wxDefaultPosition, wxDefaultSize, 0); m_has_rated_prompt->Wrap(-1); - m_has_rated_prompt->SetForegroundColour(*wxRED); + m_has_rated_prompt->SetForegroundColour(*wxBLACK); m_has_rated_prompt->SetFont(::Label::Body_10); m_has_rated_prompt->Hide(); @@ -1093,6 +1096,13 @@ wxBoxSizer *StatusBasePanel::create_machine_control_page(wxWindow *parent) std::pair(wxColour(38, 166, 154), StateColor::Hovered), std::pair(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal)); StateColor btn_bd_green(std::pair(AMS_CONTROL_WHITE_COLOUR, StateColor::Disabled), std::pair(AMS_CONTROL_BRAND_COLOUR, StateColor::Enabled)); + m_parts_btn = new Button(m_panel_control_title, _L("Printer Parts")); + m_parts_btn->SetBackgroundColor(btn_bg_green); + m_parts_btn->SetBorderColor(btn_bd_green); + m_parts_btn->SetTextColor(wxColour("#FFFFFE")); + m_parts_btn->SetSize(wxSize(FromDIP(128), FromDIP(26))); + m_parts_btn->SetMinSize(wxSize(-1, FromDIP(26))); + m_options_btn = new Button(m_panel_control_title, _L("Print Options")); m_options_btn->SetBackgroundColor(btn_bg_green); m_options_btn->SetBorderColor(btn_bd_green); @@ -1110,6 +1120,7 @@ wxBoxSizer *StatusBasePanel::create_machine_control_page(wxWindow *parent) bSizer_control_title->Add(m_staticText_control, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, PAGE_TITLE_LEFT_MARGIN); bSizer_control_title->Add(0, 0, 1, wxEXPAND, 0); + bSizer_control_title->Add(m_parts_btn, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(10)); bSizer_control_title->Add(m_options_btn, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(10)); bSizer_control_title->Add(m_calibration_btn, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(10)); @@ -1767,10 +1778,12 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co Bind(EVT_AMS_RETRY, &StatusPanel::on_ams_retry, this); Bind(EVT_FAN_CHANGED, &StatusPanel::on_fan_changed, this); Bind(EVT_SECONDARY_CHECK_DONE, &StatusPanel::on_print_error_done, this); + Bind(EVT_SECONDARY_CHECK_RESUME, &StatusPanel::on_subtask_pause_resume, this); m_switch_speed->Connect(wxEVT_LEFT_DOWN, wxCommandEventHandler(StatusPanel::on_switch_speed), NULL, this); m_calibration_btn->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_start_calibration), NULL, this); m_options_btn->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_show_print_options), NULL, this); + m_parts_btn->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_show_parts_options), NULL, this); } StatusPanel::~StatusPanel() @@ -1803,6 +1816,7 @@ StatusPanel::~StatusPanel() m_switch_speed->Disconnect(wxEVT_LEFT_DOWN, wxCommandEventHandler(StatusPanel::on_switch_speed), NULL, this); m_calibration_btn->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_start_calibration), NULL, this); m_options_btn->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_show_print_options), NULL, this); + m_parts_btn->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_show_parts_options), NULL, this); m_button_unload->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_start_unload), NULL, this); // remove warning dialogs @@ -1917,6 +1931,10 @@ void StatusPanel::on_subtask_pause_resume(wxCommandEvent &event) BOOST_LOG_TRIVIAL(info) << "monitor: pause current print task dev_id =" << obj->dev_id; obj->command_task_pause(); } + if (m_print_error_dlg) { + m_print_error_dlg->on_hide(); + } + } } @@ -1925,7 +1943,7 @@ void StatusPanel::on_subtask_abort(wxCommandEvent &event) if (abort_dlg == nullptr) { abort_dlg = new SecondaryCheckDialog(this->GetParent(), wxID_ANY, _L("Cancel print")); abort_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent &e) { - if (obj) { + if (obj) { BOOST_LOG_TRIVIAL(info) << "monitor: stop current print task dev_id =" << obj->dev_id; obj->command_task_abort(); } @@ -1956,10 +1974,12 @@ void StatusPanel::on_webrequest_state(wxWebRequestEvent &evt) BOOST_LOG_TRIVIAL(trace) << "monitor: monitor_panel web request state = " << evt.GetState(); switch (evt.GetState()) { case wxWebRequest::State_Completed: { - wxImage img(*evt.GetResponse().GetStream()); - img_list.insert(std::make_pair(m_request_url, img)); - wxImage resize_img = img.Scale(m_project_task_panel->get_bitmap_thumbnail()->GetSize().x, m_project_task_panel->get_bitmap_thumbnail()->GetSize().y, wxIMAGE_QUALITY_HIGH); - m_project_task_panel->set_thumbnail_img(resize_img); + if (m_current_print_mode != PrintingTaskType::CALIBRATION ||(m_calib_mode == CalibMode::Calib_Flow_Rate && m_calib_method == CalibrationMethod::CALI_METHOD_MANUAL)) { + wxImage img(*evt.GetResponse().GetStream()); + img_list.insert(std::make_pair(m_request_url, img)); + wxImage resize_img = img.Scale(m_project_task_panel->get_bitmap_thumbnail()->GetSize().x, m_project_task_panel->get_bitmap_thumbnail()->GetSize().y, wxIMAGE_QUALITY_HIGH); + m_project_task_panel->set_thumbnail_img(resize_img); + } if (obj) { m_project_task_panel->set_plate_index(obj->m_plate_index); } else { @@ -2022,7 +2042,6 @@ bool StatusPanel::is_task_changed(MachineObject* obj) void StatusPanel::update(MachineObject *obj) { if (!obj) return; - m_project_task_panel->Freeze(); update_subtask(obj); m_project_task_panel->Thaw(); @@ -2080,6 +2099,8 @@ void StatusPanel::update(MachineObject *obj) m_options_btn->Hide(); } + m_parts_btn->Show(); + //support edit chamber temp if (obj->is_support_chamber_edit) { m_tempCtrl_chamber->SetReadOnly(false); @@ -2144,6 +2165,7 @@ void StatusPanel::show_error_message(MachineObject* obj, wxString msg, std::stri auto it_retry = std::find(message_containing_retry.begin(), message_containing_retry.end(), print_error_str); auto it_done = std::find(message_containing_done.begin(), message_containing_done.end(), print_error_str); + auto it_resume = std::find(message_containing_resume.begin(), message_containing_resume.end(), print_error_str); BOOST_LOG_TRIVIAL(info) << "show print error! error_msg = " << msg; if (m_print_error_dlg == nullptr) { @@ -2158,10 +2180,15 @@ void StatusPanel::show_error_message(MachineObject* obj, wxString msg, std::stri } else if (it_retry != message_containing_retry.end()) { m_print_error_dlg->update_title_style(_L("Warning"), SecondaryCheckDialog::ButtonStyle::CONFIRM_AND_RETRY, this); - }else { + } + else if (it_resume!= message_containing_resume.end()) { + m_print_error_dlg->update_title_style(_L("Warning"), SecondaryCheckDialog::ButtonStyle::CONFIRM_AND_RESUME, this); + } + else { m_print_error_dlg->update_title_style(_L("Warning"), SecondaryCheckDialog::ButtonStyle::ONLY_CONFIRM, this); } m_print_error_dlg->update_text(msg); + m_print_error_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this, obj](wxCommandEvent& e) { if (obj) { obj->command_clean_print_error(obj->subtask_id_, obj->print_error); @@ -2500,7 +2527,7 @@ void StatusPanel::update_ams(MachineObject *obj) m_ams_setting_dlg->obj = obj; if (obj && m_ams_setting_dlg->IsShown()) { - m_ams_setting_dlg->update_insert_material_read_mode(obj->ams_insert_flag); + update_ams_insert_material(obj); m_ams_setting_dlg->update_starting_read_mode(obj->ams_power_on_flag); m_ams_setting_dlg->update_remain_mode(obj->ams_calibrate_remain_flag); m_ams_setting_dlg->update_switch_filament(obj->ams_auto_switch_filament_flag); @@ -2508,7 +2535,7 @@ void StatusPanel::update_ams(MachineObject *obj) } if (m_filament_setting_dlg) { m_filament_setting_dlg->obj = obj; } - if ( (obj->get_printer_series() == PrinterSeries::SERIES_X1) && last_cali_version != obj->cali_version) { + if (obj->cali_version != -1 && last_cali_version != obj->cali_version) { last_cali_version = obj->cali_version; CalibUtils::emit_get_PA_calib_info(obj->nozzle_diameter, ""); } @@ -2754,6 +2781,18 @@ void StatusPanel::update_ams(MachineObject *obj) update_ams_control_state(is_curr_tray_selected); } +void StatusPanel::update_ams_insert_material(MachineObject* obj) { + std::string extra_ams_str = (boost::format("ams_f1/%1%") % 0).str(); + auto extra_ams_it = obj->module_vers.find(extra_ams_str); + if (extra_ams_it != obj->module_vers.end()) { + m_ams_setting_dlg->update_insert_material_read_mode(obj->ams_insert_flag, extra_ams_it->second.sw_ver); + } + else { + m_ams_setting_dlg->update_insert_material_read_mode(obj->ams_insert_flag, ""); + } +} + + void StatusPanel::update_ams_control_state(bool is_curr_tray_selected) { // set default value to true @@ -2796,13 +2835,58 @@ void StatusPanel::update_ams_control_state(bool is_curr_tray_selected) } if (obj->ams_exist_bits == 0) { - if (obj->is_in_printing() && !obj->can_resume()) { - enable[ACTION_BTN_LOAD] = false; - enable[ACTION_BTN_UNLOAD] = false; + if (obj->is_in_printing()) { + if (!obj->can_resume()) { + enable[ACTION_BTN_LOAD] = false; + enable[ACTION_BTN_UNLOAD] = false; + } + else{ + if (obj->m_tray_now == "255") { + enable[ACTION_BTN_LOAD] = true; + enable[ACTION_BTN_UNLOAD] = false; + } + else if (obj->m_tray_now == std::to_string(VIRTUAL_TRAY_ID)) { + enable[ACTION_BTN_LOAD] = false; + enable[ACTION_BTN_UNLOAD] = true; + } + } } - else { - enable[ACTION_BTN_LOAD] = true; - enable[ACTION_BTN_UNLOAD] = true; + + } + else { + if (obj->is_in_printing() /*&& obj->can_resume() && obj->m_tray_now != std::to_string(VIRTUAL_TRAY_ID) */) { + + if (!obj->can_resume()) { + enable[ACTION_BTN_LOAD] = false; + enable[ACTION_BTN_UNLOAD] = false; + } + else { + if (obj->m_tray_now == "255") { + + if ( m_ams_control->GetCurentAms() == std::to_string(VIRTUAL_TRAY_ID) ) { + enable[ACTION_BTN_LOAD] = true; + enable[ACTION_BTN_UNLOAD] = false; + } + else if (!m_ams_control->GetCurrentCan(m_ams_control->GetCurentAms()).empty()) { + enable[ACTION_BTN_LOAD] = false; + enable[ACTION_BTN_UNLOAD] = false; + } + } + else if (obj->m_tray_now == std::to_string(VIRTUAL_TRAY_ID)) { + if (m_ams_control->GetCurentAms() == std::to_string(VIRTUAL_TRAY_ID)) { + enable[ACTION_BTN_LOAD] = false; + enable[ACTION_BTN_UNLOAD] = true; + } + else if (!m_ams_control->GetCurrentCan(m_ams_control->GetCurentAms()).empty()) { + enable[ACTION_BTN_LOAD] = false; + enable[ACTION_BTN_UNLOAD] = false; + } + } + else { + enable[ACTION_BTN_LOAD] = false; + enable[ACTION_BTN_UNLOAD] = false; + } + } } } @@ -2836,6 +2920,14 @@ void StatusPanel::update_cali(MachineObject *obj) } } +void StatusPanel::update_calib_bitmap() { + m_current_print_mode = PrintingTaskType::NOT_CLEAR; //printing task might be changed when updating. + if (calib_bitmap != nullptr) { + delete calib_bitmap; + calib_bitmap = nullptr; + } +} + void StatusPanel::update_basic_print_data(bool def) { if (def) { @@ -2881,7 +2973,52 @@ void StatusPanel::update_model_info() void StatusPanel::update_subtask(MachineObject *obj) { if (!obj) return; + if (m_current_print_mode != PRINGINT) { + if (calib_bitmap == nullptr) { + m_calib_mode = get_obj_calibration_mode(obj, m_calib_method, cali_stage); + if (m_calib_mode == CalibMode::Calib_None) + m_current_print_mode = PRINGINT; + // the printing task is calibrattion, not normal printing. + else if (m_calib_mode != CalibMode::Calib_None) { + m_current_print_mode = CALIBRATION; + auto get_bitmap = [](wxString& png_path, int width, int height) { + wxImage image(width, height); + image.LoadFile(png_path, wxBITMAP_TYPE_PNG); + image = image.Scale(width, height, wxIMAGE_QUALITY_NORMAL); + return wxBitmap(image); + }; + wxString png_path = ""; + int width = m_project_task_panel->get_bitmap_thumbnail()->GetSize().x; + int height = m_project_task_panel->get_bitmap_thumbnail()->GetSize().y; + if (m_calib_method == CALI_METHOD_AUTO) { + if (m_calib_mode == CalibMode::Calib_PA_Line) { + png_path = (boost::format("%1%/images/fd_calibration_auto.png") % resources_dir()).str(); + } + else if (m_calib_mode == CalibMode::Calib_Flow_Rate) { + png_path = (boost::format("%1%/images/flow_rate_calibration_auto.png") % resources_dir()).str(); + } + } + else if (m_calib_method == CALI_METHOD_MANUAL) { + if (m_calib_mode== CalibMode::Calib_PA_Line) { + if (cali_stage == 0) { // Line mode + png_path = (boost::format("%1%/images/fd_calibration_manual.png") % resources_dir()).str(); + } + else if (cali_stage == 1) { // Pattern mode + png_path = (boost::format("%1%/images/fd_pattern_manual_device.png") % resources_dir()).str(); + } + } + } + if (png_path != "") { + calib_bitmap = new wxBitmap; + *calib_bitmap = get_bitmap(png_path, width, height); + } + } + } + if (calib_bitmap != nullptr) + m_project_task_panel->set_thumbnail_img(*calib_bitmap); + } + if (obj->is_support_layer_num) { m_project_task_panel->update_layers_num(true); } @@ -3039,15 +3176,18 @@ void StatusPanel::update_cloud_subtask(MachineObject *obj) } if (m_start_loading_thumbnail) { + update_calib_bitmap(); if (obj->slice_info) { m_request_url = wxString(obj->slice_info->thumbnail_url); if (!m_request_url.IsEmpty()) { wxImage img; std::map::iterator it = img_list.find(m_request_url); if (it != img_list.end()) { - img = it->second; - wxImage resize_img = img.Scale(m_project_task_panel->get_bitmap_thumbnail()->GetSize().x, m_project_task_panel->get_bitmap_thumbnail()->GetSize().y); - m_project_task_panel->set_thumbnail_img(resize_img); + if (m_current_print_mode != PrintingTaskType::CALIBRATION ||(m_calib_mode == CalibMode::Calib_Flow_Rate && m_calib_method == CalibrationMethod::CALI_METHOD_MANUAL)) { + img = it->second; + wxImage resize_img = img.Scale(m_project_task_panel->get_bitmap_thumbnail()->GetSize().x, m_project_task_panel->get_bitmap_thumbnail()->GetSize().y); + m_project_task_panel->set_thumbnail_img(resize_img); + } if (this->obj) { m_project_task_panel->set_plate_index(obj->m_plate_index); } else { @@ -3071,7 +3211,10 @@ void StatusPanel::update_sdcard_subtask(MachineObject *obj) if (!obj) return; if (!m_load_sdcard_thumbnail) { - m_project_task_panel->get_bitmap_thumbnail()->SetBitmap(m_thumbnail_sdcard.bmp()); + update_calib_bitmap(); + if (m_current_print_mode != PrintingTaskType::CALIBRATION) { + m_project_task_panel->get_bitmap_thumbnail()->SetBitmap(m_thumbnail_sdcard.bmp()); + } task_thumbnail_state = ThumbnailState::SDCARD_THUMBNAIL; m_load_sdcard_thumbnail = true; } @@ -3092,7 +3235,7 @@ void StatusPanel::reset_printing_values() update_basic_print_data(false); m_project_task_panel->update_left_time(NA_STR); m_project_task_panel->update_layers_num(true, wxString::Format(_L("Layer: %s"), NA_STR)); - + update_calib_bitmap(); task_thumbnail_state = ThumbnailState::PLACE_HOLDER; m_start_loading_thumbnail = false; @@ -3245,6 +3388,7 @@ void StatusPanel::on_set_bed_temp() BOOST_LOG_TRIVIAL(info) << "can not set over limit = " << limit << ", set temp = " << bed_temp; bed_temp = limit; m_tempCtrl_bed->SetTagTemp(wxString::Format("%d", bed_temp)); + m_tempCtrl_bed->Warning(false); } obj->command_set_bed(bed_temp); } @@ -3260,6 +3404,11 @@ void StatusPanel::on_set_nozzle_temp() long nozzle_temp; if (str.ToLong(&nozzle_temp) && obj) { set_hold_count(m_temp_nozzle_timeout); + if (nozzle_temp > m_tempCtrl_nozzle->get_max_temp()) { + nozzle_temp = m_tempCtrl_nozzle->get_max_temp(); + m_tempCtrl_nozzle->SetTagTemp(wxString::Format("%d", nozzle_temp)); + m_tempCtrl_nozzle->Warning(false); + } obj->command_set_nozzle(nozzle_temp); } } catch (...) { @@ -3274,6 +3423,11 @@ void StatusPanel::on_set_chamber_temp() long chamber_temp; if (str.ToLong(&chamber_temp) && obj) { set_hold_count(m_temp_chamber_timeout); + if (chamber_temp > m_tempCtrl_chamber->get_max_temp()) { + chamber_temp = m_tempCtrl_chamber->get_max_temp(); + m_tempCtrl_chamber->SetTagTemp(wxString::Format("%d", chamber_temp)); + m_tempCtrl_chamber->Warning(false); + } obj->command_set_chamber(chamber_temp); } } @@ -3379,7 +3533,7 @@ void StatusPanel::on_ams_setting_click(SimpleEvent &event) { if (!m_ams_setting_dlg) m_ams_setting_dlg = new AMSSetting((wxWindow *) this, wxID_ANY); if (obj) { - m_ams_setting_dlg->update_insert_material_read_mode(obj->ams_insert_flag); + update_ams_insert_material(obj); m_ams_setting_dlg->update_starting_read_mode(obj->ams_power_on_flag); m_ams_setting_dlg->update_ams_img(DeviceManager::get_printer_ams_img(obj->printer_type)); std::string ams_id = m_ams_control->GetCurentShowAms(); @@ -4016,7 +4170,8 @@ void StatusPanel::on_xyz_abs(wxCommandEvent &event) if (obj) obj->command_xyz_abs(); } -void StatusPanel::on_show_print_options(wxCommandEvent &event) + +void StatusPanel::on_show_print_options(wxCommandEvent& event) { if (obj) { if (print_options_dlg == nullptr) { @@ -4031,6 +4186,22 @@ void StatusPanel::on_show_print_options(wxCommandEvent &event) } } + +void StatusPanel::on_show_parts_options(wxCommandEvent &event) +{ + if (obj) { + if (print_parts_dlg == nullptr) { + print_parts_dlg = new PrinterPartsDialog(this); + print_parts_dlg->update_machine_obj(obj); + print_parts_dlg->ShowModal(); + } + else { + print_parts_dlg->update_machine_obj(obj); + print_parts_dlg->ShowModal(); + } + } +} + void StatusPanel::on_start_calibration(wxCommandEvent &event) { if (obj) { @@ -4084,12 +4255,14 @@ void StatusPanel::set_default() m_setting_button->Show(); m_tempCtrl_chamber->Show(); m_options_btn->Show(); + m_parts_btn->Show(); reset_temp_misc_control(); m_ams_control->Hide(); m_ams_control_box->Hide(); m_ams_control->Reset(); error_info_reset(); + SetFocus(); } void StatusPanel::show_status(int status) @@ -4105,14 +4278,14 @@ void StatusPanel::show_status(int status) show_printing_status(false, false); m_calibration_btn->Disable(); m_options_btn->Disable(); + m_parts_btn->Disable(); m_panel_monitoring_title->Disable(); - m_media_play_ctrl->Disable(); } else if ((status & (int) MonitorStatus::MONITOR_NORMAL) != 0) { show_printing_status(true, true); m_calibration_btn->Disable(); m_options_btn->Enable(); + m_parts_btn->Enable(); m_panel_monitoring_title->Enable(); - m_media_play_ctrl->Enable(); } } @@ -4236,7 +4409,10 @@ void StatusPanel::msw_rescale() m_calibration_btn->Rescale(); m_options_btn->SetMinSize(wxSize(-1, FromDIP(26))); - m_options_btn->Rescale(); + m_options_btn->Rescale(); + + m_parts_btn->SetMinSize(wxSize(-1, FromDIP(26))); + m_parts_btn->Rescale(); rescale_camera_icons(); diff --git a/src/slic3r/GUI/StatusPanel.hpp b/src/slic3r/GUI/StatusPanel.hpp index 399566373b..d82c6371b6 100644 --- a/src/slic3r/GUI/StatusPanel.hpp +++ b/src/slic3r/GUI/StatusPanel.hpp @@ -17,6 +17,7 @@ #include "MediaPlayCtrl.h" #include "AMSSetting.hpp" #include "Calibration.hpp" +#include "CalibrationWizardPage.hpp" #include "PrintOptionsDialog.hpp" #include "AMSMaterialsSetting.hpp" #include "ExtrusionCalibration.hpp" @@ -58,6 +59,7 @@ enum CameraTimelapseStatus { enum PrintingTaskType { PRINGINT, CALIBRATION, + NOT_CLEAR }; struct ScoreData @@ -212,7 +214,7 @@ public: void show_error_msg(wxString msg); void reset_printing_value(); void msw_rescale(); - + public: void enable_pause_resume_button(bool enable, std::string type); void enable_abort_button(bool enable); @@ -390,6 +392,7 @@ protected: wxStaticText* m_staticText_calibration_caption; wxStaticText* m_staticText_calibration_caption_top; wxStaticText* m_calibration_text; + Button* m_parts_btn; Button* m_options_btn; Button* m_calibration_btn; StepIndicator* m_calibration_flow; @@ -463,6 +466,7 @@ protected: std::shared_ptr m_camera_popup; std::set rated_model_id; AMSSetting *m_ams_setting_dlg{nullptr}; + PrinterPartsDialog* print_parts_dlg { nullptr }; PrintOptionsDialog* print_options_dlg { nullptr }; CalibrationDialog* calibration_dlg {nullptr}; AMSMaterialsSetting *m_filament_setting_dlg{nullptr}; @@ -504,6 +508,11 @@ protected: std::vector