From 2d1746d04f5d40c7dad40bac5c672ede531003ff Mon Sep 17 00:00:00 2001 From: Samuel Abels Date: Sun, 29 Jun 2025 21:39:04 +0200 Subject: [PATCH] CAM: gracefully handle tool numbers that are strings in the tool library JSON --- src/Mod/CAM/Path/Tool/library/serializers/fctl.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Mod/CAM/Path/Tool/library/serializers/fctl.py b/src/Mod/CAM/Path/Tool/library/serializers/fctl.py index c4de58afc8..8b6737bddb 100644 --- a/src/Mod/CAM/Path/Tool/library/serializers/fctl.py +++ b/src/Mod/CAM/Path/Tool/library/serializers/fctl.py @@ -81,7 +81,11 @@ class FCTLSerializer(AssetSerializer): tools_list = data_dict.get("tools", []) for tool_data in tools_list: - tool_no = tool_data["nr"] + try: + tool_no = int(tool_data["nr"]) + except ValueError: + Path.Log.warning(f"Invalid tool ID in tool data: {tool_data}. Skipping.") + continue tool_id = pathlib.Path(tool_data["path"]).stem # Extract tool ID tool_uri = AssetUri(f"toolbit://{tool_id}") tool = dependencies.get(tool_uri)