diff --git a/src/Mod/Arch/ArchAxis.py b/src/Mod/Arch/ArchAxis.py index c99c91bd8..6ec20568a 100644 --- a/src/Mod/Arch/ArchAxis.py +++ b/src/Mod/Arch/ArchAxis.py @@ -72,6 +72,9 @@ class _CommandAxis: else: FreeCADGui.doCommand("Arch.makeAxis()") FreeCAD.ActiveDocument.commitTransaction() + + def IsActive(self): + return not FreeCAD.ActiveDocument is None class _Axis: "The Axis object" diff --git a/src/Mod/Arch/ArchBuilding.py b/src/Mod/Arch/ArchBuilding.py index c0af9545f..64f34438f 100644 --- a/src/Mod/Arch/ArchBuilding.py +++ b/src/Mod/Arch/ArchBuilding.py @@ -51,6 +51,9 @@ class _CommandBuilding: 'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Building","Building"), 'Accel': "B, U", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Building","Creates a building object including selected objects.")} + + def IsActive(self): + return not FreeCAD.ActiveDocument is None def Activated(self): sel = FreeCADGui.Selection.getSelection() diff --git a/src/Mod/Arch/ArchCommands.py b/src/Mod/Arch/ArchCommands.py index 59257663a..33eaac099 100644 --- a/src/Mod/Arch/ArchCommands.py +++ b/src/Mod/Arch/ArchCommands.py @@ -997,6 +997,9 @@ class _CommandSelectNonSolidMeshes: return {'Pixmap': 'Arch_SelectNonManifold.svg', 'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_SelectNonSolidMeshes","Select non-manifold meshes"), 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_SelectNonSolidMeshes","Selects all non-manifold meshes from the document or from the selected groups")} + + def IsActive(self): + return not FreeCAD.ActiveDocument is None def Activated(self): msel = [] @@ -1087,6 +1090,9 @@ class _CommandSurvey: return {'Pixmap' : 'Arch_Survey', 'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Survey","Survey"), 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Survey","Starts survey")} + + def IsActive(self): + return not FreeCAD.ActiveDocument is None def Activated(self): FreeCADGui.doCommand("import Arch") diff --git a/src/Mod/Arch/ArchFloor.py b/src/Mod/Arch/ArchFloor.py index 0f4a482c5..d39dc124b 100644 --- a/src/Mod/Arch/ArchFloor.py +++ b/src/Mod/Arch/ArchFloor.py @@ -53,6 +53,9 @@ class _CommandFloor: 'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Floor","Floor"), 'Accel': "F, L", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Floor","Creates a floor object including selected objects")} + + def IsActive(self): + return not FreeCAD.ActiveDocument is None def Activated(self): sel = FreeCADGui.Selection.getSelection() diff --git a/src/Mod/Arch/ArchFrame.py b/src/Mod/Arch/ArchFrame.py index ea0d24150..3fb074249 100644 --- a/src/Mod/Arch/ArchFrame.py +++ b/src/Mod/Arch/ArchFrame.py @@ -58,6 +58,9 @@ class _CommandFrame: 'Accel': "F, R", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Frame","Creates a frame object from a planar 2D object and a profile")} + def IsActive(self): + return not FreeCAD.ActiveDocument is None + def Activated(self): s = FreeCADGui.Selection.getSelection() if len(s) == 2: diff --git a/src/Mod/Arch/ArchRebar.py b/src/Mod/Arch/ArchRebar.py index 3eef47ce9..90c88bfc5 100644 --- a/src/Mod/Arch/ArchRebar.py +++ b/src/Mod/Arch/ArchRebar.py @@ -79,6 +79,9 @@ class _CommandRebar: 'Accel': "R, B", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Rebar","Creates a Reinforcement bar from the selected face of a structural object")} + def IsActive(self): + return not FreeCAD.ActiveDocument is None + def Activated(self): sel = FreeCADGui.Selection.getSelectionEx() if sel: diff --git a/src/Mod/Arch/ArchRoof.py b/src/Mod/Arch/ArchRoof.py index 71184a3dd..568c9bed7 100644 --- a/src/Mod/Arch/ArchRoof.py +++ b/src/Mod/Arch/ArchRoof.py @@ -57,6 +57,9 @@ class _CommandRoof: 'Accel': "R, F", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Roof","Creates a roof object from the selected face of an object")} + def IsActive(self): + return not FreeCAD.ActiveDocument is None + def Activated(self): sel = FreeCADGui.Selection.getSelectionEx() if sel: diff --git a/src/Mod/Arch/ArchSectionPlane.py b/src/Mod/Arch/ArchSectionPlane.py index f4c936635..812f14272 100644 --- a/src/Mod/Arch/ArchSectionPlane.py +++ b/src/Mod/Arch/ArchSectionPlane.py @@ -75,6 +75,9 @@ class _CommandSectionPlane: 'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_SectionPlane","Section Plane"), 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_SectionPlane","Creates a section plane object, including the selected objects")} + def IsActive(self): + return not FreeCAD.ActiveDocument is None + def Activated(self): sel = FreeCADGui.Selection.getSelection() ss = "[" diff --git a/src/Mod/Arch/ArchSite.py b/src/Mod/Arch/ArchSite.py index 6ed49f922..1eb244b13 100644 --- a/src/Mod/Arch/ArchSite.py +++ b/src/Mod/Arch/ArchSite.py @@ -51,6 +51,9 @@ class _CommandSite: 'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Site","Site"), 'Accel': "S, I", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Site","Creates a site object including selected objects.")} + + def IsActive(self): + return not FreeCAD.ActiveDocument is None def Activated(self): sel = FreeCADGui.Selection.getSelection() diff --git a/src/Mod/Arch/ArchSpace.py b/src/Mod/Arch/ArchSpace.py index 0151a89ab..a29d72f9c 100644 --- a/src/Mod/Arch/ArchSpace.py +++ b/src/Mod/Arch/ArchSpace.py @@ -77,6 +77,9 @@ class _CommandSpace: 'Accel': "S, P", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Space","Creates a space object from selected boundary objects")} + def IsActive(self): + return not FreeCAD.ActiveDocument is None + def Activated(self): FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Space")) FreeCADGui.doCommand("import Arch") diff --git a/src/Mod/Arch/ArchStairs.py b/src/Mod/Arch/ArchStairs.py index 72905bb37..6482a8c9b 100644 --- a/src/Mod/Arch/ArchStairs.py +++ b/src/Mod/Arch/ArchStairs.py @@ -59,6 +59,9 @@ class _CommandStairs: 'Accel': "S, R", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Space","Creates a stairs object")} + def IsActive(self): + return not FreeCAD.ActiveDocument is None + def Activated(self): FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Stairs")) FreeCADGui.doCommand("import Arch") diff --git a/src/Mod/Arch/ArchStructure.py b/src/Mod/Arch/ArchStructure.py index 316a6ccb6..e02b26a89 100644 --- a/src/Mod/Arch/ArchStructure.py +++ b/src/Mod/Arch/ArchStructure.py @@ -363,6 +363,9 @@ class _CommandStructure: 'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Structure","Structure"), 'Accel': "S, T", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Structure","Creates a structure object from scratch or from a selected object (sketch, wire, face or solid)")} + + def IsActive(self): + return not FreeCAD.ActiveDocument is None def Activated(self): p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch") diff --git a/src/Mod/Arch/ArchWall.py b/src/Mod/Arch/ArchWall.py index 0303751ba..40a2d99e9 100644 --- a/src/Mod/Arch/ArchWall.py +++ b/src/Mod/Arch/ArchWall.py @@ -149,6 +149,9 @@ class _CommandWall: 'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Wall","Wall"), 'Accel': "W, A", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Wall","Creates a wall object from scratch or from a selected object (wire, face or solid)")} + + def IsActive(self): + return not FreeCAD.ActiveDocument is None def Activated(self): self.Align = "Center" diff --git a/src/Mod/Arch/ArchWindow.py b/src/Mod/Arch/ArchWindow.py index 2d6817646..3ce06c040 100644 --- a/src/Mod/Arch/ArchWindow.py +++ b/src/Mod/Arch/ArchWindow.py @@ -373,6 +373,9 @@ class _CommandWindow: 'Accel': "W, N", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Window","Creates a window object from a selected object (wire, rectangle or sketch)")} + def IsActive(self): + return not FreeCAD.ActiveDocument is None + def Activated(self): sel = FreeCADGui.Selection.getSelection() p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")