From 2fa386cbdb66e59ca3eafe40bd0ec84c1044d24b Mon Sep 17 00:00:00 2001 From: Noisyfox Date: Sat, 11 Oct 2025 16:17:14 +0800 Subject: [PATCH] Treat `extruder_clearance_max_radius` as `extruder_clearance_radius`, and raise error if both options are present --- .../Anker/machine/Anker M5 0.2 nozzle.json | 1 - .../Anker/machine/Anker M5 0.25 nozzle.json | 1 - .../Anker/machine/Anker M5 0.4 nozzle.json | 1 - .../Anker/machine/Anker M5 0.6 nozzle.json | 1 - .../Anker M5 All-Metal 0.2 nozzle.json | 1 - .../Anker M5 All-Metal 0.25 nozzle.json | 1 - .../Anker M5 All-Metal 0.4 nozzle.json | 1 - .../Anker M5 All-Metal 0.6 nozzle.json | 1 - .../Anker/machine/Anker M5C 0.2 nozzle.json | 1 - .../Anker/machine/Anker M5C 0.25 nozzle.json | 1 - .../Anker/machine/Anker M5C 0.4 nozzle.json | 1 - .../Anker/machine/Anker M5C 0.6 nozzle.json | 1 - .../BBL/machine/Bambu Lab H2D 0.4 nozzle.json | 1 - .../machine/Bambu Lab H2D Pro 0.4 nozzle.json | 1 - .../BBL/machine/Bambu Lab H2S 0.4 nozzle.json | 1 - .../BBL/machine/fdm_bbl_3dp_001_common.json | 1 - .../BBL/machine/fdm_bbl_3dp_002_common.json | 1 - .../BBL/machine/fdm_machine_common.json | 2 +- .../Creality Ender-3 V3 KE 0.2 nozzle.json | 1 - .../Creality Ender-3 V3 KE 0.4 nozzle.json | 1 - .../Creality Ender-3 V3 KE 0.6 nozzle.json | 1 - .../Creality Ender-3 V3 KE 0.8 nozzle.json | 1 - .../Creality Ender-3 V3 SE 0.2 nozzle.json | 1 - .../Creality Ender-3 V3 SE 0.4 nozzle.json | 1 - .../Creality Ender-3 V3 SE 0.6 nozzle.json | 1 - .../Creality Ender-3 V3 SE 0.8 nozzle.json | 1 - .../Elegoo/machine/ECC/fdm_machine_ecc.json | 1 - .../machine/fdm_elegoo_3dp_001_common.json | 1 - scripts/orca_extra_profile_check.py | 57 +++++++++++++++++++ scripts/orca_filament_lib.py | 16 ++++++ src/libslic3r/PrintConfig.cpp | 4 +- 31 files changed, 77 insertions(+), 29 deletions(-) diff --git a/resources/profiles/Anker/machine/Anker M5 0.2 nozzle.json b/resources/profiles/Anker/machine/Anker M5 0.2 nozzle.json index 5048600cee..6c0bd1e8bb 100644 --- a/resources/profiles/Anker/machine/Anker M5 0.2 nozzle.json +++ b/resources/profiles/Anker/machine/Anker M5 0.2 nozzle.json @@ -21,7 +21,6 @@ "default_print_profile": "0.10mm Standard 0.2mm nozzle @Anker", "extruder_clearance_height_to_lid": "250", "extruder_clearance_height_to_rod": "30", - "extruder_clearance_max_radius": "45", "extruder_clearance_radius": "45", "printer_structure": "i3", "nozzle_type": "brass", diff --git a/resources/profiles/Anker/machine/Anker M5 0.25 nozzle.json b/resources/profiles/Anker/machine/Anker M5 0.25 nozzle.json index 8a36ef13fd..15ffe0e36a 100644 --- a/resources/profiles/Anker/machine/Anker M5 0.25 nozzle.json +++ b/resources/profiles/Anker/machine/Anker M5 0.25 nozzle.json @@ -21,7 +21,6 @@ "default_print_profile": "0.10mm Standard 0.25mm nozzle @Anker", "extruder_clearance_height_to_lid": "250", "extruder_clearance_height_to_rod": "30", - "extruder_clearance_max_radius": "45", "extruder_clearance_radius": "45", "printer_structure": "i3", "nozzle_type": "brass", diff --git a/resources/profiles/Anker/machine/Anker M5 0.4 nozzle.json b/resources/profiles/Anker/machine/Anker M5 0.4 nozzle.json index e35cb21cda..53dc7dc56c 100644 --- a/resources/profiles/Anker/machine/Anker M5 0.4 nozzle.json +++ b/resources/profiles/Anker/machine/Anker M5 0.4 nozzle.json @@ -18,7 +18,6 @@ "default_print_profile": "0.20mm Standard @Anker", "extruder_clearance_height_to_lid": "250", "extruder_clearance_height_to_rod": "30", - "extruder_clearance_max_radius": "45", "extruder_clearance_radius": "45", "printer_structure": "i3", "nozzle_type": "brass", diff --git a/resources/profiles/Anker/machine/Anker M5 0.6 nozzle.json b/resources/profiles/Anker/machine/Anker M5 0.6 nozzle.json index 0831de77b2..597000d3ce 100644 --- a/resources/profiles/Anker/machine/Anker M5 0.6 nozzle.json +++ b/resources/profiles/Anker/machine/Anker M5 0.6 nozzle.json @@ -24,7 +24,6 @@ "default_print_profile": "0.30mm Standard 0.6 nozzle @Anker", "extruder_clearance_height_to_lid": "250", "extruder_clearance_height_to_rod": "30", - "extruder_clearance_max_radius": "45", "extruder_clearance_radius": "45", "printer_structure": "i3", "nozzle_type": "brass", diff --git a/resources/profiles/Anker/machine/Anker M5 All-Metal 0.2 nozzle.json b/resources/profiles/Anker/machine/Anker M5 All-Metal 0.2 nozzle.json index e1fe117e0f..6cca64040a 100644 --- a/resources/profiles/Anker/machine/Anker M5 All-Metal 0.2 nozzle.json +++ b/resources/profiles/Anker/machine/Anker M5 All-Metal 0.2 nozzle.json @@ -21,7 +21,6 @@ "default_print_profile": "0.10mm Standard 0.2mm nozzle @Anker", "extruder_clearance_height_to_lid": "250", "extruder_clearance_height_to_rod": "30", - "extruder_clearance_max_radius": "45", "extruder_clearance_radius": "45", "printer_structure": "i3", "nozzle_type": "brass", diff --git a/resources/profiles/Anker/machine/Anker M5 All-Metal 0.25 nozzle.json b/resources/profiles/Anker/machine/Anker M5 All-Metal 0.25 nozzle.json index a3b45dde16..54b191c5a9 100644 --- a/resources/profiles/Anker/machine/Anker M5 All-Metal 0.25 nozzle.json +++ b/resources/profiles/Anker/machine/Anker M5 All-Metal 0.25 nozzle.json @@ -21,7 +21,6 @@ "default_print_profile": "0.10mm Standard 0.25mm nozzle @Anker", "extruder_clearance_height_to_lid": "250", "extruder_clearance_height_to_rod": "30", - "extruder_clearance_max_radius": "45", "extruder_clearance_radius": "45", "printer_structure": "i3", "nozzle_type": "brass", diff --git a/resources/profiles/Anker/machine/Anker M5 All-Metal 0.4 nozzle.json b/resources/profiles/Anker/machine/Anker M5 All-Metal 0.4 nozzle.json index 777e6e247c..a3414aa4a5 100644 --- a/resources/profiles/Anker/machine/Anker M5 All-Metal 0.4 nozzle.json +++ b/resources/profiles/Anker/machine/Anker M5 All-Metal 0.4 nozzle.json @@ -18,7 +18,6 @@ "default_print_profile": "0.20mm Standard @Anker", "extruder_clearance_height_to_lid": "250", "extruder_clearance_height_to_rod": "30", - "extruder_clearance_max_radius": "45", "extruder_clearance_radius": "45", "printer_structure": "i3", "nozzle_type": "brass", diff --git a/resources/profiles/Anker/machine/Anker M5 All-Metal 0.6 nozzle.json b/resources/profiles/Anker/machine/Anker M5 All-Metal 0.6 nozzle.json index 48b66ca4cd..af095f7d28 100644 --- a/resources/profiles/Anker/machine/Anker M5 All-Metal 0.6 nozzle.json +++ b/resources/profiles/Anker/machine/Anker M5 All-Metal 0.6 nozzle.json @@ -24,7 +24,6 @@ "default_print_profile": "0.30mm Standard 0.6 nozzle @Anker", "extruder_clearance_height_to_lid": "250", "extruder_clearance_height_to_rod": "30", - "extruder_clearance_max_radius": "45", "extruder_clearance_radius": "45", "printer_structure": "i3", "nozzle_type": "brass", diff --git a/resources/profiles/Anker/machine/Anker M5C 0.2 nozzle.json b/resources/profiles/Anker/machine/Anker M5C 0.2 nozzle.json index ee4f2e3b72..7e1e537f34 100644 --- a/resources/profiles/Anker/machine/Anker M5C 0.2 nozzle.json +++ b/resources/profiles/Anker/machine/Anker M5C 0.2 nozzle.json @@ -21,7 +21,6 @@ "default_print_profile": "0.10mm Standard 0.2mm nozzle @Anker", "extruder_clearance_height_to_lid": "250", "extruder_clearance_height_to_rod": "30", - "extruder_clearance_max_radius": "45", "extruder_clearance_radius": "45", "printer_structure": "i3", "nozzle_type": "brass", diff --git a/resources/profiles/Anker/machine/Anker M5C 0.25 nozzle.json b/resources/profiles/Anker/machine/Anker M5C 0.25 nozzle.json index 4bede71429..2d8ca24466 100644 --- a/resources/profiles/Anker/machine/Anker M5C 0.25 nozzle.json +++ b/resources/profiles/Anker/machine/Anker M5C 0.25 nozzle.json @@ -21,7 +21,6 @@ "default_print_profile": "0.10mm Standard 0.25mm nozzle @Anker", "extruder_clearance_height_to_lid": "250", "extruder_clearance_height_to_rod": "30", - "extruder_clearance_max_radius": "45", "extruder_clearance_radius": "45", "printer_structure": "i3", "nozzle_type": "brass", diff --git a/resources/profiles/Anker/machine/Anker M5C 0.4 nozzle.json b/resources/profiles/Anker/machine/Anker M5C 0.4 nozzle.json index a720b34bf9..f30e092edc 100644 --- a/resources/profiles/Anker/machine/Anker M5C 0.4 nozzle.json +++ b/resources/profiles/Anker/machine/Anker M5C 0.4 nozzle.json @@ -18,7 +18,6 @@ "default_print_profile": "0.20mm Standard @Anker", "extruder_clearance_height_to_lid": "250", "extruder_clearance_height_to_rod": "30", - "extruder_clearance_max_radius": "45", "extruder_clearance_radius": "45", "printer_structure": "i3", "nozzle_type": "brass", diff --git a/resources/profiles/Anker/machine/Anker M5C 0.6 nozzle.json b/resources/profiles/Anker/machine/Anker M5C 0.6 nozzle.json index 51ade1aa7b..c85c313c8f 100644 --- a/resources/profiles/Anker/machine/Anker M5C 0.6 nozzle.json +++ b/resources/profiles/Anker/machine/Anker M5C 0.6 nozzle.json @@ -24,7 +24,6 @@ "default_print_profile": "0.30mm Standard 0.6 nozzle @Anker", "extruder_clearance_height_to_lid": "250", "extruder_clearance_height_to_rod": "30", - "extruder_clearance_max_radius": "45", "extruder_clearance_radius": "45", "printer_structure": "i3", "nozzle_type": "brass", diff --git a/resources/profiles/BBL/machine/Bambu Lab H2D 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab H2D 0.4 nozzle.json index f42ba05cef..3fdeccb456 100644 --- a/resources/profiles/BBL/machine/Bambu Lab H2D 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab H2D 0.4 nozzle.json @@ -19,7 +19,6 @@ "extruder_clearance_height_to_lid": "201", "extruder_clearance_height_to_rod": "47.4", "extruder_clearance_max_radius": "96", - "extruder_clearance_radius": "49", "extruder_printable_area": [ "0x0,325x0,325x320,0x320", "25x0,350x0,350x320,25x320" diff --git a/resources/profiles/BBL/machine/Bambu Lab H2D Pro 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab H2D Pro 0.4 nozzle.json index 721f64df82..038d55afed 100644 --- a/resources/profiles/BBL/machine/Bambu Lab H2D Pro 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab H2D Pro 0.4 nozzle.json @@ -23,7 +23,6 @@ "extruder_clearance_height_to_lid": "201", "extruder_clearance_height_to_rod": "47.4", "extruder_clearance_max_radius": "96", - "extruder_clearance_radius": "49", "extruder_printable_area": [ "0x0,325x0,325x320,0x320", "25x0,350x0,350x320,25x320" diff --git a/resources/profiles/BBL/machine/Bambu Lab H2S 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab H2S 0.4 nozzle.json index 59a618a680..a54ab1ab85 100644 --- a/resources/profiles/BBL/machine/Bambu Lab H2S 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab H2S 0.4 nozzle.json @@ -27,7 +27,6 @@ "extruder_clearance_height_to_lid": "187", "extruder_clearance_height_to_rod": "33", "extruder_clearance_max_radius": "81", - "extruder_clearance_radius": "30", "fan_direction": "left", "hotend_cooling_rate": [ "2", diff --git a/resources/profiles/BBL/machine/fdm_bbl_3dp_001_common.json b/resources/profiles/BBL/machine/fdm_bbl_3dp_001_common.json index 9ccd5c9c6a..b96d22beb2 100644 --- a/resources/profiles/BBL/machine/fdm_bbl_3dp_001_common.json +++ b/resources/profiles/BBL/machine/fdm_bbl_3dp_001_common.json @@ -33,7 +33,6 @@ ], "extruder_clearance_height_to_lid": "90", "extruder_clearance_max_radius": "68", - "extruder_clearance_radius": "57", "extruder_colour": [ "#018001" ], diff --git a/resources/profiles/BBL/machine/fdm_bbl_3dp_002_common.json b/resources/profiles/BBL/machine/fdm_bbl_3dp_002_common.json index 9dc6b019d0..5624177baa 100644 --- a/resources/profiles/BBL/machine/fdm_bbl_3dp_002_common.json +++ b/resources/profiles/BBL/machine/fdm_bbl_3dp_002_common.json @@ -32,7 +32,6 @@ "extruder_clearance_height_to_lid": "90", "extruder_clearance_height_to_rod": "38.70", "extruder_clearance_max_radius": "92", - "extruder_clearance_radius": "13", "extruder_colour": [ "#018001", "#018001" diff --git a/resources/profiles/BBL/machine/fdm_machine_common.json b/resources/profiles/BBL/machine/fdm_machine_common.json index 5feab216a8..c04004abcf 100644 --- a/resources/profiles/BBL/machine/fdm_machine_common.json +++ b/resources/profiles/BBL/machine/fdm_machine_common.json @@ -17,7 +17,7 @@ ], "extruder_clearance_height_to_lid": "140", "extruder_clearance_height_to_rod": "34", - "extruder_clearance_radius": "65", + "extruder_clearance_max_radius": "65", "extruder_clearance_dist_to_rod": "33", "extruder_colour": [ "#FCE94F" diff --git a/resources/profiles/Creality/machine/Creality Ender-3 V3 KE 0.2 nozzle.json b/resources/profiles/Creality/machine/Creality Ender-3 V3 KE 0.2 nozzle.json index 6b876509ba..d495fb7b39 100644 --- a/resources/profiles/Creality/machine/Creality Ender-3 V3 KE 0.2 nozzle.json +++ b/resources/profiles/Creality/machine/Creality Ender-3 V3 KE 0.2 nozzle.json @@ -11,7 +11,6 @@ "printer_structure": "i3", "default_print_profile": "0.20mm Standard @Creality Ender3V3KE", "extruder_clearance_height_to_rod": "47", - "extruder_clearance_max_radius": "90", "extruder_clearance_radius": "90", "machine_load_filament_time": "11", "nozzle_diameter": [ diff --git a/resources/profiles/Creality/machine/Creality Ender-3 V3 KE 0.4 nozzle.json b/resources/profiles/Creality/machine/Creality Ender-3 V3 KE 0.4 nozzle.json index fb4d9f6f02..247e6b8327 100644 --- a/resources/profiles/Creality/machine/Creality Ender-3 V3 KE 0.4 nozzle.json +++ b/resources/profiles/Creality/machine/Creality Ender-3 V3 KE 0.4 nozzle.json @@ -11,7 +11,6 @@ "printer_structure": "i3", "default_print_profile": "0.20mm Standard @Creality Ender3V3KE", "extruder_clearance_height_to_rod": "47", - "extruder_clearance_max_radius": "90", "extruder_clearance_radius": "90", "machine_load_filament_time": "11", "nozzle_diameter": [ diff --git a/resources/profiles/Creality/machine/Creality Ender-3 V3 KE 0.6 nozzle.json b/resources/profiles/Creality/machine/Creality Ender-3 V3 KE 0.6 nozzle.json index eeff131c02..bcfa85e09f 100644 --- a/resources/profiles/Creality/machine/Creality Ender-3 V3 KE 0.6 nozzle.json +++ b/resources/profiles/Creality/machine/Creality Ender-3 V3 KE 0.6 nozzle.json @@ -11,7 +11,6 @@ "printer_structure": "i3", "default_print_profile": "0.20mm Standard @Creality Ender3V3KE", "extruder_clearance_height_to_rod": "47", - "extruder_clearance_max_radius": "90", "extruder_clearance_radius": "90", "machine_load_filament_time": "11", "nozzle_diameter": [ diff --git a/resources/profiles/Creality/machine/Creality Ender-3 V3 KE 0.8 nozzle.json b/resources/profiles/Creality/machine/Creality Ender-3 V3 KE 0.8 nozzle.json index 36cfcffb60..80d042b46f 100644 --- a/resources/profiles/Creality/machine/Creality Ender-3 V3 KE 0.8 nozzle.json +++ b/resources/profiles/Creality/machine/Creality Ender-3 V3 KE 0.8 nozzle.json @@ -11,7 +11,6 @@ "printer_structure": "i3", "default_print_profile": "0.20mm Standard @Creality Ender3V3KE", "extruder_clearance_height_to_rod": "47", - "extruder_clearance_max_radius": "90", "extruder_clearance_radius": "90", "machine_load_filament_time": "11", "nozzle_diameter": [ diff --git a/resources/profiles/Creality/machine/Creality Ender-3 V3 SE 0.2 nozzle.json b/resources/profiles/Creality/machine/Creality Ender-3 V3 SE 0.2 nozzle.json index c48674d7d4..d11c81c658 100644 --- a/resources/profiles/Creality/machine/Creality Ender-3 V3 SE 0.2 nozzle.json +++ b/resources/profiles/Creality/machine/Creality Ender-3 V3 SE 0.2 nozzle.json @@ -12,7 +12,6 @@ "printer_structure": "i3", "default_print_profile": "0.20mm Standard @Creality Ender3V3SE 0.2", "extruder_clearance_height_to_rod": "47", - "extruder_clearance_max_radius": "90", "extruder_clearance_radius": "90", "machine_load_filament_time": "11", "nozzle_diameter": [ diff --git a/resources/profiles/Creality/machine/Creality Ender-3 V3 SE 0.4 nozzle.json b/resources/profiles/Creality/machine/Creality Ender-3 V3 SE 0.4 nozzle.json index 2e279745ae..3264d668a0 100644 --- a/resources/profiles/Creality/machine/Creality Ender-3 V3 SE 0.4 nozzle.json +++ b/resources/profiles/Creality/machine/Creality Ender-3 V3 SE 0.4 nozzle.json @@ -12,7 +12,6 @@ "printer_structure": "i3", "default_print_profile": "0.20mm Standard @Creality Ender3V3SE 0.4", "extruder_clearance_height_to_rod": "47", - "extruder_clearance_max_radius": "90", "extruder_clearance_radius": "90", "machine_load_filament_time": "11", "nozzle_diameter": [ diff --git a/resources/profiles/Creality/machine/Creality Ender-3 V3 SE 0.6 nozzle.json b/resources/profiles/Creality/machine/Creality Ender-3 V3 SE 0.6 nozzle.json index aabc454d05..5b17184bb0 100644 --- a/resources/profiles/Creality/machine/Creality Ender-3 V3 SE 0.6 nozzle.json +++ b/resources/profiles/Creality/machine/Creality Ender-3 V3 SE 0.6 nozzle.json @@ -12,7 +12,6 @@ "printer_structure": "i3", "default_print_profile": "0.20mm Standard @Creality Ender3V3SE 0.6", "extruder_clearance_height_to_rod": "47", - "extruder_clearance_max_radius": "90", "extruder_clearance_radius": "90", "machine_load_filament_time": "11", "nozzle_diameter": [ diff --git a/resources/profiles/Creality/machine/Creality Ender-3 V3 SE 0.8 nozzle.json b/resources/profiles/Creality/machine/Creality Ender-3 V3 SE 0.8 nozzle.json index d24392c4af..06a93521fc 100644 --- a/resources/profiles/Creality/machine/Creality Ender-3 V3 SE 0.8 nozzle.json +++ b/resources/profiles/Creality/machine/Creality Ender-3 V3 SE 0.8 nozzle.json @@ -12,7 +12,6 @@ "printer_structure": "i3", "default_print_profile": "0.20mm Standard @Creality Ender3V3SE 0.8", "extruder_clearance_height_to_rod": "47", - "extruder_clearance_max_radius": "90", "extruder_clearance_radius": "90", "machine_load_filament_time": "11", "nozzle_diameter": [ diff --git a/resources/profiles/Elegoo/machine/ECC/fdm_machine_ecc.json b/resources/profiles/Elegoo/machine/ECC/fdm_machine_ecc.json index 0b598e982c..8468e640cb 100644 --- a/resources/profiles/Elegoo/machine/ECC/fdm_machine_ecc.json +++ b/resources/profiles/Elegoo/machine/ECC/fdm_machine_ecc.json @@ -96,7 +96,6 @@ "retract_lift_below": [ "249" ], - "extruder_clearance_radius": "57", "extruder_clearance_max_radius": "68", "extruder_clearance_height_to_lid": "90", "nozzle_volume": "107", diff --git a/resources/profiles/Elegoo/machine/fdm_elegoo_3dp_001_common.json b/resources/profiles/Elegoo/machine/fdm_elegoo_3dp_001_common.json index 3d56bfba8c..cb9d5cf250 100644 --- a/resources/profiles/Elegoo/machine/fdm_elegoo_3dp_001_common.json +++ b/resources/profiles/Elegoo/machine/fdm_elegoo_3dp_001_common.json @@ -95,7 +95,6 @@ "retract_lift_below": [ "249" ], - "extruder_clearance_radius": "57", "extruder_clearance_max_radius": "68", "extruder_clearance_height_to_lid": "90", "nozzle_volume": "107", diff --git a/scripts/orca_extra_profile_check.py b/scripts/orca_extra_profile_check.py index cb5075a764..a91866020d 100644 --- a/scripts/orca_extra_profile_check.py +++ b/scripts/orca_extra_profile_check.py @@ -355,6 +355,57 @@ def check_obsolete_keys(profiles_dir, vendor_name): return error_count + +CONFLICT_KEYS = [ + ['extruder_clearance_radius', 'extruder_clearance_max_radius'], +] + +def check_conflict_keys(profiles_dir, vendor_name): + """ + Check for keys that could not be specified at the same time, + due to option renaming & backward compatibility reasons. + + For example, `extruder_clearance_max_radius` and `extruder_clearance_radius` cannot co-exist + otherwise slicer won't know which one to use. + + Parameters: + profiles_dir (Path): Base profiles directory + vendor_name (str): Vendor name + + Returns: + int: Number of errors found + int: Number of warnings found + """ + error_count = 0 + warn_count = 0 + vendor_path = profiles_dir / vendor_name + + if not vendor_path.exists(): + print_warning(f"No machine profiles found for vendor: {vendor_name}") + return 0, 1 + + for file_path in vendor_path.rglob("*.json"): + try: + with open(file_path, 'r', encoding='UTF-8') as fp: + # Use custom hook to detect duplicates. + data = json.load(fp, object_pairs_hook=no_duplicates_object_pairs_hook) + except ValueError as ve: + print_error(f"Duplicate key error in {file_path.relative_to(profiles_dir)}: {ve}") + error_count += 1 + continue + except Exception as e: + print_error(f"Error processing {file_path.relative_to(profiles_dir)}: {e}") + error_count += 1 + continue + + for key_sets in CONFLICT_KEYS: + if sum([1 if k in data else 0 for k in key_sets]) > 1: + print_error(f"Conflict keys {key_sets} co-exist in {file_path.relative_to(profiles_dir)}") + error_count += 1 + + return error_count, warn_count + + def main(): parser = argparse.ArgumentParser( description="Check 3D printer profiles for common issues", @@ -393,6 +444,10 @@ def main(): errors_found += new_errors warnings_found += new_warnings + new_errors, new_warnings = check_conflict_keys(profiles_dir, vendor_name) + errors_found += new_errors + warnings_found += new_warnings + errors_found += check_filament_id(vendor_name, vendor_path / "filament") checked_vendor_count += 1 @@ -416,6 +471,8 @@ def main(): else: print_success("Files with warnings : 0") print("=================================================") + if errors_found > 0 or warnings_found > 0 : + print_warning('Issue(s) found, try `orca_filament_lib.py --fix` to fix common issues automatically') exit(-1 if errors_found > 0 else 0) diff --git a/scripts/orca_filament_lib.py b/scripts/orca_filament_lib.py index f8f6909e14..c85855acf0 100644 --- a/scripts/orca_filament_lib.py +++ b/scripts/orca_filament_lib.py @@ -160,6 +160,9 @@ def clean_up_profile(vendor="", profile_type="", force=False): for root, dirs, files in os.walk(profile_dir): for file in files: if file.lower().endswith('.json'): + if file == 'filaments_color_codes.json': # Ignore non-profile file + continue + full_path = os.path.join(root, file) # Get relative path from base directory @@ -190,6 +193,19 @@ def clean_up_profile(vendor="", profile_type="", force=False): print(f"Removed {field} field from {file}") need_update = True + # Handle `extruder_clearance_radius`. + if 'extruder_clearance_radius' in _profile and 'extruder_clearance_max_radius' in _profile: + # BBS renamed `extruder_clearance_radius` to `extruder_clearance_max_radius` + # however some of their profiles have both options exists with different value, which + # could cause very bad consequence such as toolhead collision. + # Here we make sure only one of these options exist, and if both present, we keep + # the one with greater value. + need_update = True + if float(_profile['extruder_clearance_max_radius']) > float(_profile['extruder_clearance_radius']): + del _profile['extruder_clearance_radius'] + else: + del _profile['extruder_clearance_max_radius'] + if need_update or force: # write back to file f.seek(0) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index e70f84ba9e..d4ed750b83 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -7373,6 +7373,8 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va opt_key = "wipe_tower_rib_width"; } else if (opt_key == "prime_tower_fillet_wall") { opt_key = "wipe_tower_fillet_wall"; + } else if (opt_key == "extruder_clearance_max_radius") { + opt_key = "extruder_clearance_radius"; } // Ignore the following obsolete configuration keys: @@ -7389,7 +7391,7 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va "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","long_retraction_when_cut", "retraction_distance_when_cut", - "internal_bridge_support_thickness","extruder_clearance_max_radius", "top_area_threshold", "reduce_wall_solid_infill","filament_load_time","filament_unload_time", + "internal_bridge_support_thickness", "top_area_threshold", "reduce_wall_solid_infill","filament_load_time","filament_unload_time", "smooth_coefficient", "overhang_totally_speed", "silent_mode", "overhang_speed_classic", "filament_prime_volume", };