Skip to content

Commit

Permalink
FEM: activate CommandMechanicalJobControl with_Solver selected
Browse files Browse the repository at this point in the history
  • Loading branch information
berndhahnebach authored and yorikvanhavre committed Nov 28, 2015
1 parent 181262b commit 882db04
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/Mod/Fem/FemCommands.py
Expand Up @@ -56,6 +56,8 @@ def IsActive(self):
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):
Expand All @@ -75,3 +77,10 @@ def part_feature_selected(self):

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
2 changes: 1 addition & 1 deletion src/Mod/Fem/_CommandMechanicalJobControl.py
Expand Up @@ -41,7 +41,7 @@ def __init__(self):
'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
Expand Down

0 comments on commit 882db04

Please sign in to comment.