From e69ddeb036845a78cce009e9831be3070c44e94e Mon Sep 17 00:00:00 2001 From: Uwe Date: Fri, 24 Mar 2023 02:40:49 +0100 Subject: [PATCH] [FEM] don't add CCX solver by default for new analyses - if there are other solvers found, we should handle all solvers equally - also reduce amount of console output on every analysis run --- src/Mod/Fem/femcommands/commands.py | 17 +++++++++++------ src/Mod/Fem/femsolver/settings.py | 2 -- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Mod/Fem/femcommands/commands.py b/src/Mod/Fem/femcommands/commands.py index f3a943605d..f128de524d 100644 --- a/src/Mod/Fem/femcommands/commands.py +++ b/src/Mod/Fem/femcommands/commands.py @@ -34,6 +34,7 @@ import FreeCADGui from FreeCAD import Qt from .manager import CommandManager +from femsolver import settings from femtools.femutils import is_of_type @@ -67,12 +68,16 @@ class _Analysis(CommandManager): FreeCADGui.addModule("ObjectsFem") FreeCADGui.doCommand("ObjectsFem.makeAnalysis(FreeCAD.ActiveDocument, 'Analysis')") FreeCADGui.doCommand("FemGui.setActiveAnalysis(FreeCAD.ActiveDocument.ActiveObject)") - # create a CalculiX ccx tools solver for any new analysis - # to be on the safe side for new users - FreeCADGui.doCommand("ObjectsFem.makeSolverCalculixCcxTools(FreeCAD.ActiveDocument)") - FreeCADGui.doCommand( - "FemGui.getActiveAnalysis().addObject(FreeCAD.ActiveDocument.ActiveObject)" - ) + # if there is no Elmer or Z88 binary create a CalculiX ccx tools solver for + # new analysis to be on the safe side for new users + binary = settings.get_binary("ElmerSolver") + if binary is None: + binary = settings.get_binary("Z88") + if binary is None: + FreeCADGui.doCommand("ObjectsFem.makeSolverCalculixCcxTools(FreeCAD.ActiveDocument)") + FreeCADGui.doCommand( + "FemGui.getActiveAnalysis().addObject(FreeCAD.ActiveDocument.ActiveObject)" + ) FreeCAD.ActiveDocument.recompute() diff --git a/src/Mod/Fem/femsolver/settings.py b/src/Mod/Fem/femsolver/settings.py index 533ee485e5..317e80455d 100644 --- a/src/Mod/Fem/femsolver/settings.py +++ b/src/Mod/Fem/femsolver/settings.py @@ -95,8 +95,6 @@ def get_binary(name): """ if name in _SOLVER_PARAM: binary = _SOLVER_PARAM[name].get_binary() - if binary is not None: - FreeCAD.Console.PrintMessage('Solver binary path: {} \n'.format(binary)) return binary else: FreeCAD.Console.PrintError(