Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEM: Move _CommandFrequencyAnalysis class to separate file
Signed-off-by: Przemo Firszt <przemo@firszt.eu>
- Loading branch information
Showing
5 changed files
with
42 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()) |