FEM: do not allow to add multiple soler with gui

This commit is contained in:
Bernd Hahnebach 2015-11-27 17:56:04 +01:00 committed by Yorik van Havre
parent ce3284624f
commit ea2a0d12c2
2 changed files with 14 additions and 1 deletions

View File

@ -58,6 +58,8 @@ class FemCommands(object):
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()
elif self.is_active == 'with_analysis_without_solver':
active = FemGui.getActiveAnalysis() is not None and self.active_analysis_in_active_doc() and not self.analysis_has_solver()
return active
def results_present(self):
@ -84,3 +86,14 @@ class FemCommands(object):
return True
else:
return False
def analysis_has_solver(self):
solver = False
analysis_members = FemGui.getActiveAnalysis().Member
for o in analysis_members:
if o.isDerivedFrom("Fem::FemSolverObjectPython"):
solver = True
if solver is True:
return True
else:
return False

View File

@ -41,7 +41,7 @@ class _CommandFemSolverCalculix(FemCommands):
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_SolverCalculix", "Create FEM Solver CalculiX ..."),
'Accel': "S, C",
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_SolverCalculix", "Creates FEM Solver CalculiX")}
self.is_active = 'with_analysis'
self.is_active = 'with_analysis_without_solver'
def Activated(self):
FreeCAD.ActiveDocument.openTransaction("Create SolverCalculix")