FEM: Add new analysis properity AnalysisType

To run frequency analysis user have 2 options:
1. Run normal aalysis, set "frequency" and start ccx
2. Set Analysis Type in Analysis object properties to "frequency" and
use Quick Analysis

With that workflow we no longer need a separate button for frequency
analysis. Also it's much easier to prepare & run a dediacted analysis
for frequency calculiations and separate analysis objects for
different load cases.
This commit is contained in:
Przemo Firszt 2015-10-19 13:11:26 +01:00 committed by wmayer
parent 2c21325353
commit 35632147ad
2 changed files with 16 additions and 15 deletions

View File

@ -24,12 +24,20 @@ __title__ = "Fem Analysis"
__author__ = "Juergen Riegel"
__url__ = "http://www.freecadweb.org"
import FreeCAD
from FemTools import FemTools
class _FemAnalysis:
"The FemAnalysis container object"
def __init__(self, obj):
self.Type = "FemAnalysis"
obj.Proxy = self
fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem")
obj.addProperty("App::PropertyEnumeration", "AnalysisType", "Fem", "Type of the analysis")
obj.AnalysisType = FemTools.known_analysis_types
analysis_type = fem_prefs.GetInt("AnalysisType", 0)
obj.AnalysisType = FemTools.known_analysis_types[analysis_type]
def execute(self, obj):
return

View File

@ -58,12 +58,6 @@ class _JobControlTaskPanel:
self.working_dir = self.fem_prefs.GetString("WorkingDir", '/tmp')
self.analysis_object = analysis_object
try:
self.analysis_type = FreeCAD.FEM_analysis["type"]
except:
analysis_type = self.fem_prefs.GetInt("AnalysisType", 0)
self.analysis_type = FemTools.known_analysis_types[analysis_type]
FreeCAD.FEM_analysis = {"type": self.analysis_type}
self.Calculix = QtCore.QProcess()
self.Timer = QtCore.QTimer()
@ -167,9 +161,9 @@ class _JobControlTaskPanel:
def update(self):
'fills the widgets'
self.form.le_working_dir.setText(self.working_dir)
if self.analysis_type == 'static':
if self.analysis_object.AnalysisType == 'static':
self.form.rb_static_analysis.setChecked(True)
elif self.analysis_type == 'frequency':
elif self.analysis_object.AnalysisType == 'frequency':
self.form.rb_frequency_analysis.setChecked(True)
return
@ -195,7 +189,7 @@ class _JobControlTaskPanel:
QApplication.setOverrideCursor(Qt.WaitCursor)
self.inp_file_name = ""
fea = FemTools()
fea.set_analysis_type(self.analysis_type)
fea.set_analysis_type(self.analysis_object.AnalysisType)
fea.update_objects()
fea.write_inp_file()
if fea.inp_file_name != "":
@ -256,18 +250,17 @@ class _JobControlTaskPanel:
QApplication.restoreOverrideCursor()
def store_analysis_type(self, analysis_type):
if self.analysis_type != analysis_type:
self.analysis_type = analysis_type
FreeCAD.FEM_analysis["type"] = analysis_type
def select_analysis_type(self, analysis_type):
if self.analysis_object.AnalysisType != analysis_type:
self.analysis_object.AnalysisType = analysis_type
self.form.pb_edit_inp.setEnabled(False)
self.form.pb_run_ccx.setEnabled(False)
def select_static_analysis(self):
self.store_analysis_type('static')
self.select_analysis_type('static')
def select_frequency_analysis(self):
self.change_analysis_type('frequency')
self.select_analysis_type('frequency')
#Code duplication!!!!