FEM: activate CommandMechanicalJobControl with_Solver selected

This commit is contained in:
Bernd Hahnebach 2015-11-25 06:36:47 +01:00 committed by Yorik van Havre
parent 181262b39d
commit 882db04b3c
2 changed files with 10 additions and 1 deletions

View File

@ -56,6 +56,8 @@ class FemCommands(object):
active = FemGui.getActiveAnalysis() is not None and self.active_analysis_in_active_doc() and self.results_present()
elif self.is_active == 'with_part_feature':
active = FreeCADGui.ActiveDocument is not None and self.part_feature_selected()
elif self.is_active == 'with_solver':
active = FemGui.getActiveAnalysis() is not None and self.active_analysis_in_active_doc() and self.solver_selected()
return active
def results_present(self):
@ -75,3 +77,10 @@ class FemCommands(object):
def active_analysis_in_active_doc(self):
return FemGui.getActiveAnalysis().Document is FreeCAD.ActiveDocument
def solver_selected(self):
sel = FreeCADGui.Selection.getSelection()
if len(sel) == 1 and sel[0].isDerivedFrom("Fem::FemSolverObjectPython"):
return True
else:
return False

View File

@ -41,7 +41,7 @@ class _CommandMechanicalJobControl(FemCommands):
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_JobControl", "Start calculation"),
'Accel': "S, C",
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_JobControl", "Dialog to start the calculation of the mechanical anlysis")}
self.is_active = 'with_analysis'
self.is_active = 'with_solver'
def Activated(self):
import _TaskPanelFemSolverCalculix