From 7158294d3430e67ebc8e5d3a2dfd849ddadff94b Mon Sep 17 00:00:00 2001 From: Ian Abreu Date: Sun, 6 Jul 2025 11:07:15 -0400 Subject: [PATCH 1/3] Adding simple check --- src/Mod/CAM/Path/Main/Gui/Inspect.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Mod/CAM/Path/Main/Gui/Inspect.py b/src/Mod/CAM/Path/Main/Gui/Inspect.py index 055f18de84..569f3ca387 100644 --- a/src/Mod/CAM/Path/Main/Gui/Inspect.py +++ b/src/Mod/CAM/Path/Main/Gui/Inspect.py @@ -260,7 +260,10 @@ class CommandPathInspect: } def IsActive(self): - obj = FreeCADGui.Selection.getSelection()[0] + selection = FreeCADGui.Selection.getSelection() + if len(selection) == 0: + return False + obj = selection[0].Object return hasattr(obj, "Path") and len(obj.Path.Commands) > 0 def Activated(self): From 83dd97608f1b230af5f9365b827efedcebc149d7 Mon Sep 17 00:00:00 2001 From: Ian Abreu Date: Sun, 6 Jul 2025 16:26:50 -0400 Subject: [PATCH 2/3] adding sanity fix --- src/Mod/CAM/Path/Main/Gui/SanityCmd.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Mod/CAM/Path/Main/Gui/SanityCmd.py b/src/Mod/CAM/Path/Main/Gui/SanityCmd.py index b02defb403..86d3d04e8f 100644 --- a/src/Mod/CAM/Path/Main/Gui/SanityCmd.py +++ b/src/Mod/CAM/Path/Main/Gui/SanityCmd.py @@ -56,7 +56,10 @@ class CommandCAMSanity: } def IsActive(self): - obj = FreeCADGui.Selection.getSelectionEx()[0].Object + selection = FreeCADGui.Selection.getSelection() + if len(selection) == 0: + return False + obj = selection[0].Object return isinstance(obj.Proxy, Path.Main.Job.ObjectJob) def Activated(self): From 1724e9b62f2065a13d68f50845cb41d47a798db7 Mon Sep 17 00:00:00 2001 From: Ian Abreu Date: Sun, 6 Jul 2025 16:30:53 -0400 Subject: [PATCH 3/3] fixing typos --- src/Mod/CAM/Path/Main/Gui/Inspect.py | 2 +- src/Mod/CAM/Path/Main/Gui/SanityCmd.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mod/CAM/Path/Main/Gui/Inspect.py b/src/Mod/CAM/Path/Main/Gui/Inspect.py index 569f3ca387..097a81e221 100644 --- a/src/Mod/CAM/Path/Main/Gui/Inspect.py +++ b/src/Mod/CAM/Path/Main/Gui/Inspect.py @@ -263,7 +263,7 @@ class CommandPathInspect: selection = FreeCADGui.Selection.getSelection() if len(selection) == 0: return False - obj = selection[0].Object + obj = selection[0] return hasattr(obj, "Path") and len(obj.Path.Commands) > 0 def Activated(self): diff --git a/src/Mod/CAM/Path/Main/Gui/SanityCmd.py b/src/Mod/CAM/Path/Main/Gui/SanityCmd.py index 86d3d04e8f..32b8f298fe 100644 --- a/src/Mod/CAM/Path/Main/Gui/SanityCmd.py +++ b/src/Mod/CAM/Path/Main/Gui/SanityCmd.py @@ -56,7 +56,7 @@ class CommandCAMSanity: } def IsActive(self): - selection = FreeCADGui.Selection.getSelection() + selection = FreeCADGui.Selection.getSelectionEx() if len(selection) == 0: return False obj = selection[0].Object