From 477f0c913c4a96df1b76e8d472d51e5d3b9d7e9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20=C3=85gren?= Date: Mon, 20 Apr 2020 20:35:00 +0200 Subject: [PATCH 1/2] Toggle active state of all path operations in selection Changes "Toggle the Active State of the Operation" from only being able to toggle one operation. To toggle all operations in a selection. The toggle command will only be enabled if all selected objects can be toggled. --- src/Mod/Path/PathCommands.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Mod/Path/PathCommands.py b/src/Mod/Path/PathCommands.py index 64b37604ef..b4c17880d8 100644 --- a/src/Mod/Path/PathCommands.py +++ b/src/Mod/Path/PathCommands.py @@ -141,14 +141,16 @@ class _ToggleOperation: if bool(FreeCADGui.Selection.getSelection()) is False: return False try: - obj = FreeCADGui.Selection.getSelectionEx()[0].Object - return isinstance(PathScripts.PathDressup.baseOp(obj).Proxy, PathScripts.PathOp.ObjectOp) + for sel in FreeCADGui.Selection.getSelectionEx(): + if not isinstance(PathScripts.PathDressup.baseOp(sel.Object).Proxy, PathScripts.PathOp.ObjectOp): + return False + return True except(IndexError, AttributeError): return False def Activated(self): - obj = FreeCADGui.Selection.getSelectionEx()[0].Object - PathScripts.PathDressup.baseOp(obj).Active = not(PathScripts.PathDressup.baseOp(obj).Active) + for sel in FreeCADGui.Selection.getSelectionEx(): + PathScripts.PathDressup.baseOp(sel.Object).Active = not(PathScripts.PathDressup.baseOp(sel.Object).Active) FreeCAD.ActiveDocument.recompute() From bd669a603f0975d3c18edb7c2283501334daf2a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20=C3=85gren?= Date: Mon, 20 Apr 2020 20:44:58 +0200 Subject: [PATCH 2/2] Copy all path operations in selection Changes "Copy operation in the job" from only being able to copy one operation. To copy all operations in a selection. The copy command will only be enabled if all selected objects are copyable. --- src/Mod/Path/PathCommands.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Mod/Path/PathCommands.py b/src/Mod/Path/PathCommands.py index b4c17880d8..3afbd053f7 100644 --- a/src/Mod/Path/PathCommands.py +++ b/src/Mod/Path/PathCommands.py @@ -170,15 +170,17 @@ class _CopyOperation: if bool(FreeCADGui.Selection.getSelection()) is False: return False try: - obj = FreeCADGui.Selection.getSelectionEx()[0].Object - return isinstance(obj.Proxy, PathScripts.PathOp.ObjectOp) + for sel in FreeCADGui.Selection.getSelectionEx(): + if not isinstance(sel.Object.Proxy, PathScripts.PathOp.ObjectOp): + return False + return True except(IndexError, AttributeError): return False def Activated(self): - obj = FreeCADGui.Selection.getSelectionEx()[0].Object - jobname = findParentJob(obj).Name - addToJob(FreeCAD.ActiveDocument.copyObject(obj, False), jobname) + for sel in FreeCADGui.Selection.getSelectionEx(): + jobname = findParentJob(sel.Object).Name + addToJob(FreeCAD.ActiveDocument.copyObject(sel.Object, False), jobname) if FreeCAD.GuiUp: