FEM: only define analysis types for calculix solver once

This commit is contained in:
Bernd Hahnebach
2020-03-01 14:16:00 +01:00
parent 9415e7b6da
commit 7be9a9083e
3 changed files with 6 additions and 6 deletions

View File

@@ -28,7 +28,7 @@ __url__ = "http://www.freecadweb.org"
# \brief FreeCAD FEM _FemSolverCalculix
import FreeCAD
from femtools import ccxtools
from femsolver.calculix.solver import ANALYSIS_TYPES
class _FemSolverCalculix():
@@ -58,9 +58,9 @@ class _FemSolverCalculix():
"Fem",
"Type of the analysis"
)
obj.AnalysisType = ccxtools.FemToolsCcx.known_analysis_types
obj.AnalysisType = ANALYSIS_TYPES
analysis_type = ccx_prefs.GetInt("AnalysisType", 0)
obj.AnalysisType = ccxtools.FemToolsCcx.known_analysis_types[analysis_type]
obj.AnalysisType = ANALYSIS_TYPES[analysis_type]
choices_geom_nonlinear = ["linear", "nonlinear"]
obj.addProperty(

View File

@@ -39,7 +39,7 @@ from femtools import femutils
if FreeCAD.GuiUp:
import FemGui
ANALYSIS_TYPES = ["static", "frequency", "thermomech"]
ANALYSIS_TYPES = ["static", "frequency", "thermomech", "check"]
def create(doc, name="SolverCalculiX"):

View File

@@ -34,6 +34,7 @@ import subprocess
import FreeCAD
from femsolver.calculix.solver import ANALYSIS_TYPES
from femtools import femutils
from femtools import membertools
@@ -66,7 +67,6 @@ class FemToolsCcx(QtCore.QRunnable, QtCore.QObject):
Updated with update_objects
"""
known_analysis_types = ["static", "frequency", "thermomech", "check"]
finished = QtCore.Signal(int)
def __init__(self, analysis=None, solver=None, test_mode=False):
@@ -248,7 +248,7 @@ class FemToolsCcx(QtCore.QRunnable, QtCore.QObject):
if not self.solver:
message += "No solver object defined in the analysis\n"
else:
if self.solver.AnalysisType not in self.known_analysis_types:
if self.solver.AnalysisType not in ANALYSIS_TYPES:
message += (
"Unknown analysis type: {}\n"
.format(self.solver.AnalysisType)