FEM: activate CommandMechanicalJobControl with_Solver selected
This commit is contained in:
parent
181262b39d
commit
882db04b3c
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user