FEM: Move _CommandFrequencyAnalysis class to separate file
Signed-off-by: Przemo Firszt <przemo@firszt.eu>
This commit is contained in:
parent
dec1563c95
commit
ad68cad1bf
|
@ -87,6 +87,7 @@ SET(FemScripts_SRCS
|
||||||
_ViewProviderFemAnalysis.py
|
_ViewProviderFemAnalysis.py
|
||||||
_FemAnalysis.py
|
_FemAnalysis.py
|
||||||
_CommandMechanicalShowResult.py
|
_CommandMechanicalShowResult.py
|
||||||
|
_CommandFrequencyAnalysis.py
|
||||||
)
|
)
|
||||||
#SOURCE_GROUP("Scripts" FILES ${FemScripts_SRCS})
|
#SOURCE_GROUP("Scripts" FILES ${FemScripts_SRCS})
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ INSTALL(
|
||||||
_ViewProviderFemAnalysis.py
|
_ViewProviderFemAnalysis.py
|
||||||
_FemAnalysis.py
|
_FemAnalysis.py
|
||||||
_CommandMechanicalShowResult.py
|
_CommandMechanicalShowResult.py
|
||||||
|
_CommandFrequencyAnalysis.py
|
||||||
DESTINATION
|
DESTINATION
|
||||||
Mod/Fem
|
Mod/Fem
|
||||||
)
|
)
|
||||||
|
|
|
@ -103,6 +103,7 @@ void FemGuiExport initFemGui()
|
||||||
FemGui::ViewProviderResultPython ::init();
|
FemGui::ViewProviderResultPython ::init();
|
||||||
|
|
||||||
Base::Interpreter().loadModule("_CommandMechanicalShowResult");
|
Base::Interpreter().loadModule("_CommandMechanicalShowResult");
|
||||||
|
Base::Interpreter().loadModule("_CommandFrequencyAnalysis");
|
||||||
Base::Interpreter().loadModule("MechanicalAnalysis");
|
Base::Interpreter().loadModule("MechanicalAnalysis");
|
||||||
Base::Interpreter().loadModule("MechanicalMaterial");
|
Base::Interpreter().loadModule("MechanicalMaterial");
|
||||||
Base::Interpreter().loadModule("FemBeamSection");
|
Base::Interpreter().loadModule("FemBeamSection");
|
||||||
|
|
|
@ -174,34 +174,6 @@ class _CommandQuickAnalysis:
|
||||||
return FreeCADGui.ActiveDocument is not None and FemGui.getActiveAnalysis() is not None
|
return FreeCADGui.ActiveDocument is not None and FemGui.getActiveAnalysis() is not None
|
||||||
|
|
||||||
|
|
||||||
class _CommandFrequencyAnalysis:
|
|
||||||
def GetResources(self):
|
|
||||||
return {'Pixmap': 'fem-frequency-analysis',
|
|
||||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_Frequency_Analysis", "Run frequency analysis with CalculiX ccx"),
|
|
||||||
'Accel': "R, F",
|
|
||||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_Frequency_Analysis", "Write .inp file and run frequency analysis with CalculiX ccx")}
|
|
||||||
|
|
||||||
def Activated(self):
|
|
||||||
def load_results(ret_code):
|
|
||||||
if ret_code == 0:
|
|
||||||
self.fea.load_results()
|
|
||||||
else:
|
|
||||||
print "CalculiX failed ccx finished with error {}".format(ret_code)
|
|
||||||
|
|
||||||
self.fea = FemTools()
|
|
||||||
self.fea.reset_all()
|
|
||||||
self.fea.set_analysis_type('frequency')
|
|
||||||
message = self.fea.check_prerequisites()
|
|
||||||
if message:
|
|
||||||
QtGui.QMessageBox.critical(None, "Missing prerequisite", message)
|
|
||||||
return
|
|
||||||
self.fea.finished.connect(load_results)
|
|
||||||
QtCore.QThreadPool.globalInstance().start(self.fea)
|
|
||||||
|
|
||||||
def IsActive(self):
|
|
||||||
return FreeCADGui.ActiveDocument is not None and FemGui.getActiveAnalysis() is not None
|
|
||||||
|
|
||||||
|
|
||||||
# Helpers
|
# Helpers
|
||||||
|
|
||||||
|
|
||||||
|
@ -229,5 +201,4 @@ if FreeCAD.GuiUp:
|
||||||
FreeCADGui.addCommand('Fem_CreateFromShape', _CommandFemFromShape())
|
FreeCADGui.addCommand('Fem_CreateFromShape', _CommandFemFromShape())
|
||||||
FreeCADGui.addCommand('Fem_MechanicalJobControl', _CommandMechanicalJobControl())
|
FreeCADGui.addCommand('Fem_MechanicalJobControl', _CommandMechanicalJobControl())
|
||||||
FreeCADGui.addCommand('Fem_Quick_Analysis', _CommandQuickAnalysis())
|
FreeCADGui.addCommand('Fem_Quick_Analysis', _CommandQuickAnalysis())
|
||||||
FreeCADGui.addCommand('Fem_Frequency_Analysis', _CommandFrequencyAnalysis())
|
|
||||||
FreeCADGui.addCommand('Fem_PurgeResults', _CommandPurgeFemResults())
|
FreeCADGui.addCommand('Fem_PurgeResults', _CommandPurgeFemResults())
|
||||||
|
|
39
src/Mod/Fem/_CommandFrequencyAnalysis.py
Normal file
39
src/Mod/Fem/_CommandFrequencyAnalysis.py
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
import FreeCAD
|
||||||
|
from FemTools import FemTools
|
||||||
|
|
||||||
|
if FreeCAD.GuiUp:
|
||||||
|
import FreeCADGui
|
||||||
|
import FemGui
|
||||||
|
from PySide import QtCore, QtGui
|
||||||
|
|
||||||
|
|
||||||
|
class _CommandFrequencyAnalysis:
|
||||||
|
def GetResources(self):
|
||||||
|
return {'Pixmap': 'fem-frequency-analysis',
|
||||||
|
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_Frequency_Analysis", "Run frequency analysis with CalculiX ccx"),
|
||||||
|
'Accel': "R, F",
|
||||||
|
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_Frequency_Analysis", "Write .inp file and run frequency analysis with CalculiX ccx")}
|
||||||
|
|
||||||
|
def Activated(self):
|
||||||
|
def load_results(ret_code):
|
||||||
|
if ret_code == 0:
|
||||||
|
self.fea.load_results()
|
||||||
|
else:
|
||||||
|
print "CalculiX failed ccx finished with error {}".format(ret_code)
|
||||||
|
|
||||||
|
self.fea = FemTools()
|
||||||
|
self.fea.reset_all()
|
||||||
|
self.fea.set_analysis_type('frequency')
|
||||||
|
message = self.fea.check_prerequisites()
|
||||||
|
if message:
|
||||||
|
QtGui.QMessageBox.critical(None, "Missing prerequisite", message)
|
||||||
|
return
|
||||||
|
self.fea.finished.connect(load_results)
|
||||||
|
QtCore.QThreadPool.globalInstance().start(self.fea)
|
||||||
|
|
||||||
|
def IsActive(self):
|
||||||
|
return FreeCADGui.ActiveDocument is not None and FemGui.getActiveAnalysis() is not None
|
||||||
|
|
||||||
|
|
||||||
|
if FreeCAD.GuiUp:
|
||||||
|
FreeCADGui.addCommand('Fem_Frequency_Analysis', _CommandFrequencyAnalysis())
|
Loading…
Reference in New Issue
Block a user