mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-14 00:52:04 +00:00
Treat extruder_clearance_max_radius as extruder_clearance_radius, and raise error if both options are present
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user