FEM: do not allow to add multiple soler with gui
This commit is contained in:
parent
ce3284624f
commit
ea2a0d12c2
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue
Block a user