FEM: improve output on solver run
This commit is contained in:
@@ -219,10 +219,10 @@ class _TaskPanelFemSolverCalculix:
|
||||
|
||||
if out.isEmpty():
|
||||
self.femConsoleMessage("CalculiX stdout is empty", "#FF0000")
|
||||
return False
|
||||
return False
|
||||
|
||||
if sys.version_info.major >= 3:
|
||||
# https://forum.freecadweb.org/viewtopic.php?f=18&t=39195
|
||||
# https://forum.freecadweb.org/viewtopic.php?f=18&t=39195
|
||||
# convert QByteArray to a binary string an decode it to "utf-8"
|
||||
out = out.data().decode() # "utf-8" can be omitted
|
||||
# print(type(out))
|
||||
@@ -271,8 +271,8 @@ class _TaskPanelFemSolverCalculix:
|
||||
self.femConsoleMessage("CalculiX done without error!", "#00AA00")
|
||||
|
||||
def calculixStarted(self):
|
||||
print("calculixStarted()")
|
||||
print(self.Calculix.state())
|
||||
# print("calculixStarted()")
|
||||
FreeCAD.Console.PrintLog("{}".format(self.Calculix.state()))
|
||||
self.form.pb_run_ccx.setText("Break CalculiX")
|
||||
|
||||
def calculixStateChanged(self, newState):
|
||||
@@ -284,8 +284,8 @@ class _TaskPanelFemSolverCalculix:
|
||||
self.femConsoleMessage("CalculiX stopped.")
|
||||
|
||||
def calculixFinished(self, exitCode):
|
||||
print("calculixFinished() {}".format(exitCode))
|
||||
print(self.Calculix.state())
|
||||
# print("calculixFinished(), exit code: {}".format(exitCode))
|
||||
FreeCAD.Console.PrintLog("{}".format(self.Calculix.state()))
|
||||
|
||||
# Restore previous cwd
|
||||
QtCore.QDir.setCurrent(self.cwd)
|
||||
@@ -383,16 +383,16 @@ class _TaskPanelFemSolverCalculix:
|
||||
FemGui.open(self.fea.inp_file_name)
|
||||
|
||||
def runCalculix(self):
|
||||
print("runCalculix")
|
||||
# print("runCalculix")
|
||||
self.Start = time.time()
|
||||
|
||||
self.femConsoleMessage("CalculiX binary: {}".format(self.fea.ccx_binary))
|
||||
self.femConsoleMessage("CalculiX input file: {}".format(self.fea.inp_file_name))
|
||||
self.femConsoleMessage("Run CalculiX...")
|
||||
|
||||
# run Calculix
|
||||
print(
|
||||
FreeCAD.Console.PrintMessage(
|
||||
"run CalculiX at: {} with: {}"
|
||||
.format(self.fea.ccx_binary, os.path.splitext(self.fea.inp_file_name)[0])
|
||||
.format(self.fea.ccx_binary, self.fea.inp_file_name)
|
||||
)
|
||||
# change cwd because ccx may crash if directory has no write permission
|
||||
# there is also a limit of the length of file names so jump to the document directory
|
||||
|
||||
@@ -95,6 +95,10 @@ class FemInputWriterCcx(writerbase.FemInputWriter):
|
||||
self.dir_name,
|
||||
"{}_inout_nodes.txt".format(self.mesh_object.Name)
|
||||
)
|
||||
|
||||
def write_calculix_input_file(self):
|
||||
timestart = time.clock()
|
||||
FreeCAD.Console.PrintMessage("Start writing CalculiX input file\n")
|
||||
FreeCAD.Console.PrintLog(
|
||||
"writerbaseCcx --> self.dir_name --> " + self.dir_name + "\n"
|
||||
)
|
||||
@@ -104,15 +108,12 @@ class FemInputWriterCcx(writerbase.FemInputWriter):
|
||||
FreeCAD.Console.PrintMessage(
|
||||
"writerbaseCcx --> self.file_name --> " + self.file_name + "\n"
|
||||
)
|
||||
|
||||
def write_calculix_input_file(self):
|
||||
timestart = time.clock()
|
||||
if self.solver_obj.SplitInputWriter is True:
|
||||
self.write_calculix_splitted_input_file()
|
||||
else:
|
||||
self.write_calculix_one_input_file()
|
||||
writing_time_string = (
|
||||
"Writing time input file: {} seconds"
|
||||
"Writing time CalculiX input file: {} seconds"
|
||||
.format(round((time.clock() - timestart), 2))
|
||||
)
|
||||
if self.femelement_count_test is True:
|
||||
|
||||
@@ -279,6 +279,7 @@ class FemToolsCcx(QtCore.QRunnable, QtCore.QObject):
|
||||
self.transform_constraints = self._get_several_member("Fem::ConstraintTransform")
|
||||
|
||||
def check_prerequisites(self):
|
||||
FreeCAD.Console.PrintMessage("Check prerequisites.\n")
|
||||
from FreeCAD import Units
|
||||
message = ""
|
||||
# analysis
|
||||
@@ -666,10 +667,17 @@ class FemToolsCcx(QtCore.QRunnable, QtCore.QObject):
|
||||
elif fem_general_prefs.GetBool("OverwriteSolverWorkingDirectory", True) is False:
|
||||
self.working_dir = self.solver.WorkingDir
|
||||
if femutils.check_working_dir(self.working_dir) is not True:
|
||||
FreeCAD.Console.PrintError(
|
||||
"Dir from solver object \'{}\' doesn't exist.\n"
|
||||
.format(self.working_dir)
|
||||
)
|
||||
if self.working_dir == '':
|
||||
FreeCAD.Console.PrintError(
|
||||
"Working Dir is set to be used from solver object "
|
||||
"but Dir from solver object \'{}\' is empty.\n"
|
||||
.format(self.working_dir)
|
||||
)
|
||||
else:
|
||||
FreeCAD.Console.PrintError(
|
||||
"Dir from solver object \'{}\' doesn't exist.\n"
|
||||
.format(self.working_dir)
|
||||
)
|
||||
self.working_dir = femutils.get_pref_working_dir(self.solver)
|
||||
FreeCAD.Console.PrintMessage(
|
||||
"Dir \'{}\' will be used instead.\n"
|
||||
|
||||
Reference in New Issue
Block a user