From fcea8faf22d8583bef77ba7239161eb4b4518b96 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Sun, 3 Mar 2019 21:06:07 +0100 Subject: [PATCH] FEM: purge results gui tool, make it active if only result meshes are left in an analysis --- src/Mod/Fem/femcommands/manager.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Mod/Fem/femcommands/manager.py b/src/Mod/Fem/femcommands/manager.py index 20be399534..c3d00a3cf0 100644 --- a/src/Mod/Fem/femcommands/manager.py +++ b/src/Mod/Fem/femcommands/manager.py @@ -29,6 +29,7 @@ __url__ = "http://www.freecadweb.org" # @{ import FreeCAD +import femtools.femutils as femutils if FreeCAD.GuiUp: import FreeCADGui import FemGui @@ -60,7 +61,7 @@ class CommandManager(object): elif self.is_active == 'with_analysis': active = FemGui.getActiveAnalysis() is not None and self.active_analysis_in_active_doc() elif self.is_active == 'with_results': - active = FemGui.getActiveAnalysis() is not None and self.active_analysis_in_active_doc() and self.results_present() + active = FemGui.getActiveAnalysis() is not None and self.active_analysis_in_active_doc() and (self.results_present() or self.result_mesh_present()) elif self.is_active == 'with_selresult': active = FemGui.getActiveAnalysis() is not None and self.active_analysis_in_active_doc() and self.result_selected() elif self.is_active == 'with_part_feature': @@ -91,6 +92,14 @@ class CommandManager(object): results = True return results + def result_mesh_present(self): + result_mesh = False + analysis_members = FemGui.getActiveAnalysis().Group + for o in analysis_members: + if femutils.is_of_type(o, 'Fem::FemMeshResult'): + result_mesh = True + return result_mesh + def result_selected(self): sel = FreeCADGui.Selection.getSelection() if len(sel) == 1 and sel[0].isDerivedFrom("Fem::FemResultObject"):