From c9f843a359b6623b8c78592df90c51baf5449523 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Thu, 16 Feb 2017 08:06:51 +0100 Subject: [PATCH] FEM: result task panel, fix option hide constaints and parts and make a small change inside --- src/Mod/Fem/FemCommands.py | 17 ----------------- src/Mod/Fem/_CommandControlSolver.py | 3 --- src/Mod/Fem/_CommandShowResult.py | 3 --- src/Mod/Fem/_TaskPanelShowResult.py | 18 +++++++++++++++++- 4 files changed, 17 insertions(+), 24 deletions(-) diff --git a/src/Mod/Fem/FemCommands.py b/src/Mod/Fem/FemCommands.py index f0fc2c3e1..8f86a9c5c 100644 --- a/src/Mod/Fem/FemCommands.py +++ b/src/Mod/Fem/FemCommands.py @@ -164,23 +164,6 @@ class FemCommands(object): else: return False - def hide_parts_constraints_show_meshes(self): - if FreeCAD.GuiUp: - for acnstrmesh in FemGui.getActiveAnalysis().Member: - # if "Constraint" in acnstrmesh.TypeId: - # acnstrmesh.ViewObject.Visibility = False - fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/General") - hide_constraints = fem_prefs.GetBool("HideConstraint", False) - if hide_constraints: - if "Constraint" in acnstrmesh.TypeId: - acnstrmesh.ViewObject.Visibility = False - if "Mesh" in acnstrmesh.TypeId: - aparttoshow = acnstrmesh.Name.replace("_Mesh", "") - for apart in FreeCAD.activeDocument().Objects: - if aparttoshow == apart.Name: - apart.ViewObject.Visibility = False - acnstrmesh.ViewObject.Visibility = True # OvG: Hide constraints and parts and show meshes - def hide_meshes_show_parts_constraints(self): if FreeCAD.GuiUp: for acnstrmesh in FemGui.getActiveAnalysis().Member: diff --git a/src/Mod/Fem/_CommandControlSolver.py b/src/Mod/Fem/_CommandControlSolver.py index 9184c966a..8a6cb2899 100644 --- a/src/Mod/Fem/_CommandControlSolver.py +++ b/src/Mod/Fem/_CommandControlSolver.py @@ -43,9 +43,6 @@ class _CommandControlSolver(FemCommands): self.is_active = 'with_solver' def Activated(self): - - self.hide_parts_constraints_show_meshes() - solver_obj = FreeCADGui.Selection.getSelection()[0] FreeCADGui.ActiveDocument.setEdit(solver_obj, 0) diff --git a/src/Mod/Fem/_CommandShowResult.py b/src/Mod/Fem/_CommandShowResult.py index 4f60d4fb0..a77ebb673 100644 --- a/src/Mod/Fem/_CommandShowResult.py +++ b/src/Mod/Fem/_CommandShowResult.py @@ -48,9 +48,6 @@ class _CommandShowResult(FemCommands): if (len(sel) == 1): if sel[0].isDerivedFrom("Fem::FemResultObject"): self.result_object = sel[0] - - self.hide_parts_constraints_show_meshes() - import _TaskPanelShowResult taskd = _TaskPanelShowResult._TaskPanelShowResult(self.result_object) FreeCADGui.Control.showDialog(taskd) diff --git a/src/Mod/Fem/_TaskPanelShowResult.py b/src/Mod/Fem/_TaskPanelShowResult.py index be0f417b3..665bef7dc 100644 --- a/src/Mod/Fem/_TaskPanelShowResult.py +++ b/src/Mod/Fem/_TaskPanelShowResult.py @@ -320,9 +320,10 @@ class _TaskPanelShowResult: if hasattr(self.result_object, "Mesh") and self.result_object.Mesh: self.MeshObject = self.result_object.Mesh - self.MeshObject.ViewObject.Visibility = True if (self.MeshObject.FemMesh.NodeCount == len(self.result_object.NodeNumbers)): self.suitable_results = True + self.MeshObject.ViewObject.Visibility = True + hide_parts_constraints() else: if not self.MeshObject.FemMesh.VolumeCount: error_message = 'FEM: Graphical bending stress output for beam or shell FEM Meshes not yet supported.\n' @@ -344,3 +345,18 @@ class _TaskPanelShowResult: def reject(self): FreeCADGui.Control.closeDialog() # if the taks panell is called from Command obj is not in edit mode thus reset edit does not cleses the dialog, may be do not call but set in edit instead FreeCADGui.ActiveDocument.resetEdit() + + +# helper +def hide_parts_constraints(): + fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/General") + hide_constraints = fem_prefs.GetBool("HideConstraint", False) + if hide_constraints: + for acnstrmesh in FemGui.getActiveAnalysis().Member: + if "Constraint" in acnstrmesh.TypeId: + acnstrmesh.ViewObject.Visibility = False + if "Mesh" in acnstrmesh.TypeId: + aparttoshow = acnstrmesh.Name.replace("_Mesh", "") + for apart in FreeCAD.activeDocument().Objects: + if aparttoshow == apart.Name: + apart.ViewObject.Visibility = False