本文整理汇总了Python中FemTools.FemTools类的典型用法代码示例。如果您正苦于以下问题:Python FemTools类的具体用法?Python FemTools怎么用?Python FemTools使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FemTools类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: calculixFinished
def calculixFinished(self, exitCode):
print "calculixFinished()", exitCode
print self.Calculix.state()
# Restore previous cwd
QtCore.QDir.setCurrent(self.cwd)
self.printCalculiXstdout()
self.Timer.stop()
self.femConsoleMessage("Calculix done!", "#00AA00")
self.form.pushButton_generate.setText("Re-run Calculix")
print "Loading results...."
self.femConsoleMessage("Loading result sets...")
self.form.label_Time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))
fea = FemTools()
fea.reset_all()
frd_result_file = os.path.splitext(self.inp_file_name)[0] + '.frd'
if os.path.isfile(frd_result_file):
QApplication.setOverrideCursor(Qt.WaitCursor)
ccxFrdReader.importFrd(frd_result_file, FemGui.getActiveAnalysis())
QApplication.restoreOverrideCursor()
self.femConsoleMessage("Loading results done!", "#00AA00")
else:
self.femConsoleMessage("Loading results failed! Results file doesn\'t exist", "#FF0000")
self.form.label_Time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))
示例2: GetResources
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
示例3: _CommandQuickAnalysis
class _CommandQuickAnalysis(FemCommands):
def __init__(self):
super(_CommandQuickAnalysis, self).__init__()
self.resources = {'Pixmap': 'fem-quick-analysis',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_Quick_Analysis", "Run CalculiX ccx"),
'Accel': "R, C",
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_Quick_Analysis", "Write .inp file and run CalculiX ccx")}
self.is_active = 'with_solver'
def Activated(self):
def load_results(ret_code):
if ret_code == 0:
self.fea.load_results()
self.show_results_on_mesh()
self.hide_parts_constraints_show_meshes()
else:
print ("CalculiX failed ccx finished with error {}".format(ret_code))
self.fea = FemTools()
self.fea.reset_all()
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 show_results_on_mesh(self):
#FIXME proprer mesh refreshing as per FreeCAD.FEM_dialog settings required
# or confirmation that it's safe to call restore_result_dialog
import _TaskPanelResultControl
tp = _TaskPanelResultControl._TaskPanelResultControl()
tp.restore_result_dialog()
示例4: GetResources
class _CommandQuickAnalysis:
def GetResources(self):
return {'Pixmap': 'fem-quick-analysis',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_Quick_Analysis", "Run CalculiX ccx"),
'Accel': "R, C",
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_Quick_Analysis", "Write .inp file and run CalculiX ccx")}
def Activated(self):
def load_results(ret_code):
if ret_code == 0:
self.fea.load_results()
self.show_results_on_mesh()
else:
print "CalculiX failed ccx finished with error {}".format(ret_code)
self.fea = FemTools()
self.fea.reset_all()
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 show_results_on_mesh(self):
#FIXME proprer mesh refreshing as per FreeCAD.FEM_dialog settings required
# or confirmation that it's safe to call restore_result_dialog
tp = _ResultControlTaskPanel()
tp.restore_result_dialog()
def IsActive(self):
return FreeCADGui.ActiveDocument is not None and FemGui.getActiveAnalysis() is not None
示例5: check_prerequisites_helper
def check_prerequisites_helper(self):
self.Start = time.time()
self.femConsoleMessage("Check dependencies...")
self.form.label_Time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))
fea = FemTools()
fea.update_objects()
message = fea.check_prerequisites()
if message != "":
QtGui.QMessageBox.critical(None, "Missing prerequisit(s)", message)
return False
return True
示例6: write_input_file_handler
def write_input_file_handler(self):
QApplication.restoreOverrideCursor()
if self.check_prerequisites_helper():
QApplication.setOverrideCursor(Qt.WaitCursor)
self.inp_file_name = ""
fea = FemTools()
fea.update_objects()
fea.write_inp_file()
if fea.inp_file_name != "":
self.inp_file_name = fea.inp_file_name
self.femConsoleMessage("Write completed.")
self.form.pushButton_edit.setEnabled(True)
self.form.pushButton_generate.setEnabled(True)
else:
self.femConsoleMessage("Write .inp file failed!", "#FF0000")
QApplication.restoreOverrideCursor()
示例7: Activated
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)
示例8: Activated
def Activated(self):
def load_results(ret_code):
if ret_code == 0:
self.fea.load_results()
self.show_results_on_mesh()
else:
print "CalculiX failed ccx finished with error {}".format(ret_code)
self.fea = FemTools()
self.fea.purge_results()
self.fea.reset_mesh_color()
self.fea.reset_mesh_deformation()
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)
示例9: write_input_file_handler
def write_input_file_handler(self):
QApplication.restoreOverrideCursor()
if self.check_prerequisites_helper():
QApplication.setOverrideCursor(Qt.WaitCursor)
self.inp_file_name = ""
fea = FemTools()
fea.set_analysis_type(self.analysis_object.AnalysisType)
fea.update_objects()
fea.write_inp_file()
if fea.inp_file_name != "":
self.inp_file_name = fea.inp_file_name
self.femConsoleMessage("Write completed.")
self.form.pb_edit_inp.setEnabled(True)
self.form.pb_run_ccx.setEnabled(True)
else:
self.femConsoleMessage("Write .inp file failed!", "#FF0000")
QApplication.restoreOverrideCursor()
示例10: calculixFinished
def calculixFinished(self, exitCode):
print ("calculixFinished() {}".format(exitCode))
print (self.Calculix.state())
# Restore previous cwd
QtCore.QDir.setCurrent(self.cwd)
self.printCalculiXstdout()
self.Timer.stop()
self.femConsoleMessage("CalculiX done!", "#00AA00")
self.form.pb_run_ccx.setText("Re-run CalculiX")
self.femConsoleMessage("Loading result sets...")
self.form.l_time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))
fea = FemTools()
fea.reset_all()
fea.inp_file_name = self.inp_file_name
QApplication.setOverrideCursor(Qt.WaitCursor)
fea.load_results()
QApplication.restoreOverrideCursor()
self.form.l_time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))
示例11: none_selected
def none_selected(self, state):
FreeCAD.FEM_dialog["results_type"] = "None"
self.set_result_stats("mm", 0.0, 0.0, 0.0)
fea = FemTools()
fea.reset_mesh_color()
示例12: Activated
def Activated(self):
fea = FemTools()
fea.reset_all()
示例13: restore_initial_result_dialog
def restore_initial_result_dialog(self):
FreeCAD.FEM_dialog = {"results_type": "None", "show_disp": False,
"disp_factor": 0, "disp_factor_max": 100}
fea = FemTools()
fea.reset_mesh_color()
fea.reset_mesh_deformation()
示例14: Activated
def Activated(self):
fea = FemTools()
fea.reset_all()
self.hide_meshes_show_parts_constraints()