FEM: remove working dir and ccx binary check from InitGui

- they are duplicates of the methods in FemToolsCcx
- FEM could be used without solving too
- they only checked for ccx, but we have more solver already
This commit is contained in:
Bernd Hahnebach 2016-09-13 19:31:31 +01:00 committed by Yorik van Havre
parent 3dd586b5be
commit 0da41bb4cc

View File

@ -60,39 +60,6 @@ class FemWorkbench (Workbench):
import _CommandSolverZ88
import _CommandConstraintSelfWeight
import subprocess
from platform import system
ccx_path = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/Ccx").GetString("ccxBinaryPath")
if not ccx_path:
try:
if system() == 'Linux':
p1 = subprocess.Popen(['which', 'ccx'], stdout=subprocess.PIPE)
if p1.wait() == 0:
ccx_path = p1.stdout.read().split('\n')[0]
elif system() == 'Windows':
ccx_path = FreeCAD.getHomePath() + 'bin/ccx.exe'
if ccx_path:
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/Ccx").SetString("ccxBinaryPath", ccx_path)
else:
FreeCAD.Console.PrintError("CalculiX ccx binary not found! Please set it manually in FEM preferences.\n")
except Exception as e:
FreeCAD.Console.PrintError(e.message)
import os
working_dir = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/General").GetString("WorkingDir")
if not (os.path.isdir(working_dir)):
try:
os.makedirs(working_dir)
except:
print ("Dir \'{}\' from FEM preferences doesn't exist and cannot be created.".format(working_dir))
import tempfile
working_dir = tempfile.gettempdir()
print ("Dir \'{}\' will be used instead.".format(working_dir))
if working_dir:
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/General").SetString("WorkingDir", working_dir)
else:
FreeCAD.Console.PrintError("Setting working directory \'{}\' for ccx failed!\n")
def GetClassName(self):
return "FemGui::Workbench"