Skip to content

Commit

Permalink
FEM: do not allow to add multiple soler with gui
Browse files Browse the repository at this point in the history
  • Loading branch information
berndhahnebach authored and yorikvanhavre committed Nov 28, 2015
1 parent ce32846 commit ea2a0d1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/Mod/Fem/FemCommands.py
Expand Up @@ -58,6 +58,8 @@ def IsActive(self):
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):
Expand All @@ -84,3 +86,14 @@ def solver_selected(self):
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
2 changes: 1 addition & 1 deletion src/Mod/Fem/_CommandFemSolverCalculix.py
Expand Up @@ -41,7 +41,7 @@ def __init__(self):
'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")
Expand Down

0 comments on commit ea2a0d1

Please sign in to comment.