diff --git a/resources/profiles/OrcaFilamentLibrary/filament/AliZ/AliZ PETG-CF @base.json b/resources/profiles/OrcaFilamentLibrary/filament/AliZ/AliZ PETG-CF @base.json index 83da3ae163..9097bd1407 100644 --- a/resources/profiles/OrcaFilamentLibrary/filament/AliZ/AliZ PETG-CF @base.json +++ b/resources/profiles/OrcaFilamentLibrary/filament/AliZ/AliZ PETG-CF @base.json @@ -2,7 +2,7 @@ "type": "filament", "name": "AliZ PETG-CF @base", "inherits": "AliZ PETG @base", - "filament_id": "AliZ001-1", + "filament_id": "AZ01-1", "from": "system", "instantiation": "false", "fan_cooling_layer_time": [ diff --git a/resources/profiles/OrcaFilamentLibrary/filament/AliZ/AliZ PETG-Metal @base.json b/resources/profiles/OrcaFilamentLibrary/filament/AliZ/AliZ PETG-Metal @base.json index 978b4495b3..564552fc5f 100644 --- a/resources/profiles/OrcaFilamentLibrary/filament/AliZ/AliZ PETG-Metal @base.json +++ b/resources/profiles/OrcaFilamentLibrary/filament/AliZ/AliZ PETG-Metal @base.json @@ -2,7 +2,7 @@ "type": "filament", "name": "AliZ PETG-Metal @base", "inherits": "AliZ PETG @base", - "filament_id": "AliZ001-2", + "filament_id": "AZ01-2", "from": "system", "instantiation": "false", "fan_cooling_layer_time": [ diff --git a/resources/profiles/OrcaFilamentLibrary/filament/base/fdm_filament_sbs.json b/resources/profiles/OrcaFilamentLibrary/filament/base/fdm_filament_sbs.json index 02634084a0..d7e74a8a37 100644 --- a/resources/profiles/OrcaFilamentLibrary/filament/base/fdm_filament_sbs.json +++ b/resources/profiles/OrcaFilamentLibrary/filament/base/fdm_filament_sbs.json @@ -4,7 +4,7 @@ "inherits": "fdm_filament_common", "from": "system", "instantiation": "false", - "filament_id": "OGFLSBS99", + "filament_id": "OFLSBS99", "fan_cooling_layer_time": [ "100" ], diff --git a/scripts/orca_extra_profile_check.py b/scripts/orca_extra_profile_check.py index 7ebba70592..893ebeb9c2 100644 --- a/scripts/orca_extra_profile_check.py +++ b/scripts/orca_extra_profile_check.py @@ -232,6 +232,44 @@ def check_filament_name_consistency(profiles_dir, vendor_name): return error_count +def check_filament_id(vendor, vendor_folder): + """ + Make sure filament_id is not longer than 8 characters, otherwise AMS won't work properly + """ + if vendor not in ('BBL', 'OrcaFilamentLibrary'): + return 0 + + error = 0 + vendor_path = Path(vendor_folder) + if not vendor_path.exists(): + return 0 + + # Use rglob to recursively find .json files. + 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(f"Duplicate key error in {file_path}: {ve}") + error += 1 + continue + except Exception as e: + print(f"Error processing {file_path}: {e}") + error += 1 + continue + + if 'filament_id' not in data: + continue + + filament_id = data['filament_id'] + + if len(filament_id) > 8: + error += 1 + print(f"Filament id too long \"{filament_id}\": {file_path}") + + return error + def main(): print("Checking profiles ...") parser = argparse.ArgumentParser(description="Check profiles for issues") @@ -251,12 +289,14 @@ def main(): if args.check_materials: errors_found += check_machine_default_materials(profiles_dir, args.vendor) errors_found += check_filament_name_consistency(profiles_dir, args.vendor) + errors_found += check_filament_id(args.vendor, profiles_dir / args.vendor / "filament") checked_vendor_count += 1 else: for vendor_dir in profiles_dir.iterdir(): if not vendor_dir.is_dir(): continue errors_found += check_filament_name_consistency(profiles_dir, vendor_dir.name) + errors_found += check_filament_id(vendor_dir.name, vendor_dir / "filament") # skip "OrcaFilamentLibrary" folder if vendor_dir.name == "OrcaFilamentLibrary": continue