FEM: result task panel, fix option hide constaints and parts and make a small change inside

This commit is contained in:
Bernd Hahnebach 2017-02-16 08:06:51 +01:00
parent 28d0d737e5
commit c9f843a359
4 changed files with 17 additions and 24 deletions

View File

@ -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:

View File

@ -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)

View File

@ -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)

View File

@ -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