Skip to content

Commit

Permalink
FEM: view provider calculix, get rid of a bare except
Browse files Browse the repository at this point in the history
  • Loading branch information
berndhahnebach committed Jul 2, 2019
1 parent f0df2aa commit 4883bd5
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions src/Mod/Fem/femguiobjects/_ViewProviderFemSolverCalculix.py
Expand Up @@ -286,20 +286,28 @@ def calculixFinished(self, exitCode):
self.form.l_time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))
self.fea.reset_mesh_purge_results_checked()
self.fea.inp_file_name = self.fea.inp_file_name
QApplication.setOverrideCursor(Qt.WaitCursor)
try:
self.fea.load_results()
except:
QApplication.restoreOverrideCursor()
majorVersion, minorVersion = self.fea.get_ccx_version()
if majorVersion == 2 and minorVersion <= 10:
message = "The used CalculiX version {}.{} creates broken output files.\n" \
"Please upgrade to a newer version.".format(majorVersion, minorVersion)
QtGui.QMessageBox.warning(None, "Upgrade CalculiX", message)

# check if ccx is greater than 2.10, if not do not read results
# https://forum.freecadweb.org/viewtopic.php?f=18&t=23548#p183829 Point 3
# https://forum.freecadweb.org/viewtopic.php?f=18&t=23548&start=20#p183909
# https://forum.freecadweb.org/viewtopic.php?f=18&t=23548&start=30#p185027
# https://github.com/FreeCAD/FreeCAD/commit/3dd1c9f
majorVersion, minorVersion = self.fea.get_ccx_version()
if majorVersion == 2 and minorVersion <= 10:
message = (
"The used CalculiX version {}.{} creates broken output files. "
"The result file will not be read by FreeCAD FEM. "
"You still can try to read it stand alone with FreeCAD, but it is "
"strongly recommended to upgrade CalculiX to a newer version.\n"
.format(majorVersion, minorVersion)
)
QtGui.QMessageBox.warning(None, "Upgrade CalculiX", message)
raise
else:
QApplication.restoreOverrideCursor()
self.form.l_time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))

QApplication.setOverrideCursor(Qt.WaitCursor)
self.fea.load_results()
QApplication.restoreOverrideCursor()
self.form.l_time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))

def choose_working_dir(self):
wd = QtGui.QFileDialog.getExistingDirectory(None, 'Choose CalculiX working directory',
Expand Down

0 comments on commit 4883bd5

Please sign in to comment.