FEM: pyhton code formating: comment should start with '# '
This commit is contained in:
parent
30baceeb61
commit
5c2ffb784a
|
@ -34,5 +34,5 @@ def makeFemAnalysis(name):
|
||||||
_FemAnalysis._FemAnalysis(obj)
|
_FemAnalysis._FemAnalysis(obj)
|
||||||
import _ViewProviderFemAnalysis
|
import _ViewProviderFemAnalysis
|
||||||
_ViewProviderFemAnalysis._ViewProviderFemAnalysis()
|
_ViewProviderFemAnalysis._ViewProviderFemAnalysis()
|
||||||
#FreeCAD.ActiveDocument.recompute()
|
# FreeCAD.ActiveDocument.recompute()
|
||||||
return obj
|
return obj
|
||||||
|
|
|
@ -39,7 +39,7 @@ class FemCommands(object):
|
||||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_Command", "Default Fem Command MenuText"),
|
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_Command", "Default Fem Command MenuText"),
|
||||||
'Accel': "",
|
'Accel': "",
|
||||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_Command", "Default Fem Command ToolTip")}
|
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_Command", "Default Fem Command ToolTip")}
|
||||||
#FIXME add option description
|
# FIXME add option description
|
||||||
self.is_active = None
|
self.is_active = None
|
||||||
|
|
||||||
def GetResources(self):
|
def GetResources(self):
|
||||||
|
@ -101,8 +101,8 @@ class FemCommands(object):
|
||||||
def hide_parts_constraints_show_meshes(self):
|
def hide_parts_constraints_show_meshes(self):
|
||||||
if FreeCAD.GuiUp:
|
if FreeCAD.GuiUp:
|
||||||
for acnstrmesh in FemGui.getActiveAnalysis().Member:
|
for acnstrmesh in FemGui.getActiveAnalysis().Member:
|
||||||
#if "Constraint" in acnstrmesh.TypeId:
|
# if "Constraint" in acnstrmesh.TypeId:
|
||||||
# acnstrmesh.ViewObject.Visibility = False
|
# acnstrmesh.ViewObject.Visibility = False
|
||||||
if "Mesh" in acnstrmesh.TypeId:
|
if "Mesh" in acnstrmesh.TypeId:
|
||||||
aparttoshow = acnstrmesh.Name.replace("_Mesh", "")
|
aparttoshow = acnstrmesh.Name.replace("_Mesh", "")
|
||||||
for apart in FreeCAD.activeDocument().Objects:
|
for apart in FreeCAD.activeDocument().Objects:
|
||||||
|
|
|
@ -103,14 +103,14 @@ class FemInputWriter():
|
||||||
# frc_obj.References could be empty ! # TODO in FemTools: check
|
# frc_obj.References could be empty ! # TODO in FemTools: check
|
||||||
FreeCAD.Console.PrintError('At least one Force Object has empty References!\n')
|
FreeCAD.Console.PrintError('At least one Force Object has empty References!\n')
|
||||||
if femobj['RefShapeType'] == 'Vertex':
|
if femobj['RefShapeType'] == 'Vertex':
|
||||||
#print("load on vertices --> we do not need the femelement_table and femnodes_mesh for node load calculation")
|
# print("load on vertices --> we do not need the femelement_table and femnodes_mesh for node load calculation")
|
||||||
pass
|
pass
|
||||||
elif femobj['RefShapeType'] == 'Face' and FemMeshTools.is_solid_femmesh(self.femmesh) and not FemMeshTools.has_no_face_data(self.femmesh):
|
elif femobj['RefShapeType'] == 'Face' and FemMeshTools.is_solid_femmesh(self.femmesh) and not FemMeshTools.has_no_face_data(self.femmesh):
|
||||||
#print("solid_mesh with face data --> we do not need the femelement_table but we need the femnodes_mesh for node load calculation")
|
# print("solid_mesh with face data --> we do not need the femelement_table but we need the femnodes_mesh for node load calculation")
|
||||||
if not self.femnodes_mesh:
|
if not self.femnodes_mesh:
|
||||||
self.femnodes_mesh = self.femmesh.Nodes
|
self.femnodes_mesh = self.femmesh.Nodes
|
||||||
else:
|
else:
|
||||||
#print("mesh without needed data --> we need the femelement_table and femnodes_mesh for node load calculation")
|
# print("mesh without needed data --> we need the femelement_table and femnodes_mesh for node load calculation")
|
||||||
if not self.femnodes_mesh:
|
if not self.femnodes_mesh:
|
||||||
self.femnodes_mesh = self.femmesh.Nodes
|
self.femnodes_mesh = self.femmesh.Nodes
|
||||||
if not self.femelement_table:
|
if not self.femelement_table:
|
||||||
|
|
|
@ -73,15 +73,15 @@ class _CommandRunSolver(FemCommands):
|
||||||
QtGui.QMessageBox.critical(None, "Missing prerequisite", message)
|
QtGui.QMessageBox.critical(None, "Missing prerequisite", message)
|
||||||
return
|
return
|
||||||
self.fea.run() # test z88
|
self.fea.run() # test z88
|
||||||
#self.fea.finished.connect(load_results)
|
# self.fea.finished.connect(load_results)
|
||||||
#QtCore.QThreadPool.globalInstance().start(self.fea)
|
# QtCore.QThreadPool.globalInstance().start(self.fea)
|
||||||
else:
|
else:
|
||||||
QtGui.QMessageBox.critical(None, "Not known solver type", message)
|
QtGui.QMessageBox.critical(None, "Not known solver type", message)
|
||||||
|
|
||||||
def show_results_on_mesh(self):
|
def show_results_on_mesh(self):
|
||||||
#FIXME proprer mesh refreshing as per FreeCAD.FEM_dialog settings required
|
# FIXME proprer mesh refreshing as per FreeCAD.FEM_dialog settings required
|
||||||
# or confirmation that it's safe to call restore_result_dialog
|
# or confirmation that it's safe to call restore_result_dialog
|
||||||
#FIXME if an analysis has multiple results (frequence) the first result object found is restored
|
# FIXME if an analysis has multiple results (frequence) the first result object found is restored
|
||||||
import _TaskPanelShowResult
|
import _TaskPanelShowResult
|
||||||
tp = _TaskPanelShowResult._TaskPanelShowResult()
|
tp = _TaskPanelShowResult._TaskPanelShowResult()
|
||||||
tp.restore_result_dialog()
|
tp.restore_result_dialog()
|
||||||
|
|
|
@ -56,7 +56,7 @@ class _CommandShowResult(FemCommands):
|
||||||
FreeCADGui.Control.showDialog(taskd)
|
FreeCADGui.Control.showDialog(taskd)
|
||||||
|
|
||||||
|
|
||||||
#Code duplidation - to be removed after migration to FemTools
|
# Code duplidation - to be removed after migration to FemTools
|
||||||
def get_results_object(sel):
|
def get_results_object(sel):
|
||||||
import FemGui
|
import FemGui
|
||||||
if (len(sel) == 1):
|
if (len(sel) == 1):
|
||||||
|
|
|
@ -55,7 +55,7 @@ class _FemSolverCalculix():
|
||||||
obj.NumberOfEigenmodes = (noe, 1, 100, 1)
|
obj.NumberOfEigenmodes = (noe, 1, 100, 1)
|
||||||
|
|
||||||
obj.addProperty("App::PropertyFloatConstraint", "EigenmodeLowLimit", "Fem", "Low frequency limit for eigenmode calculations")
|
obj.addProperty("App::PropertyFloatConstraint", "EigenmodeLowLimit", "Fem", "Low frequency limit for eigenmode calculations")
|
||||||
#Not yet in prefs, so it will always default to 0.0
|
# Not yet in prefs, so it will always default to 0.0
|
||||||
ell = fem_prefs.GetFloat("EigenmodeLowLimit", 0.0)
|
ell = fem_prefs.GetFloat("EigenmodeLowLimit", 0.0)
|
||||||
obj.EigenmodeLowLimit = (ell, 0.0, 1000000.0, 10000.0)
|
obj.EigenmodeLowLimit = (ell, 0.0, 1000000.0, 10000.0)
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ class _TaskPanelFemSolverCalculix:
|
||||||
|
|
||||||
self.fem_console_message = ''
|
self.fem_console_message = ''
|
||||||
|
|
||||||
#Connect Signals and Slots
|
# Connect Signals and Slots
|
||||||
QtCore.QObject.connect(self.form.tb_choose_working_dir, QtCore.SIGNAL("clicked()"), self.choose_working_dir)
|
QtCore.QObject.connect(self.form.tb_choose_working_dir, QtCore.SIGNAL("clicked()"), self.choose_working_dir)
|
||||||
QtCore.QObject.connect(self.form.pb_write_inp, QtCore.SIGNAL("clicked()"), self.write_input_file_handler)
|
QtCore.QObject.connect(self.form.pb_write_inp, QtCore.SIGNAL("clicked()"), self.write_input_file_handler)
|
||||||
QtCore.QObject.connect(self.form.pb_edit_inp, QtCore.SIGNAL("clicked()"), self.editCalculixInputFile)
|
QtCore.QObject.connect(self.form.pb_edit_inp, QtCore.SIGNAL("clicked()"), self.editCalculixInputFile)
|
||||||
|
|
|
@ -43,7 +43,7 @@ class _TaskPanelShowResult:
|
||||||
self.fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem")
|
self.fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem")
|
||||||
self.restore_result_settings_in_dialog = self.fem_prefs.GetBool("RestoreResultDialog", True)
|
self.restore_result_settings_in_dialog = self.fem_prefs.GetBool("RestoreResultDialog", True)
|
||||||
|
|
||||||
#Connect Signals and Slots
|
# Connect Signals and Slots
|
||||||
QtCore.QObject.connect(self.form.rb_none, QtCore.SIGNAL("toggled(bool)"), self.none_selected)
|
QtCore.QObject.connect(self.form.rb_none, QtCore.SIGNAL("toggled(bool)"), self.none_selected)
|
||||||
QtCore.QObject.connect(self.form.rb_x_displacement, QtCore.SIGNAL("toggled(bool)"), self.x_displacement_selected)
|
QtCore.QObject.connect(self.form.rb_x_displacement, QtCore.SIGNAL("toggled(bool)"), self.x_displacement_selected)
|
||||||
QtCore.QObject.connect(self.form.rb_y_displacement, QtCore.SIGNAL("toggled(bool)"), self.y_displacement_selected)
|
QtCore.QObject.connect(self.form.rb_y_displacement, QtCore.SIGNAL("toggled(bool)"), self.y_displacement_selected)
|
||||||
|
@ -231,7 +231,7 @@ class _TaskPanelShowResult:
|
||||||
FreeCADGui.Control.closeDialog()
|
FreeCADGui.Control.closeDialog()
|
||||||
|
|
||||||
|
|
||||||
#It's code duplication that should be removes wher we migrate to FemTools.py
|
# It's code duplication that should be removes wher we migrate to FemTools.py
|
||||||
def get_results_object(sel):
|
def get_results_object(sel):
|
||||||
if (len(sel) == 1):
|
if (len(sel) == 1):
|
||||||
if sel[0].isDerivedFrom("Fem::FemResultObject"):
|
if sel[0].isDerivedFrom("Fem::FemResultObject"):
|
||||||
|
|
|
@ -9,7 +9,7 @@ class _ViewProviderFemAnalysis:
|
||||||
"A View Provider for the FemAnalysis container object"
|
"A View Provider for the FemAnalysis container object"
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
#vobj.addProperty("App::PropertyLength", "BubbleSize", "Base", "The size of the axis bubbles")
|
# vobj.addProperty("App::PropertyLength", "BubbleSize", "Base", "The size of the axis bubbles")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def getIcon(self):
|
def getIcon(self):
|
||||||
|
|
|
@ -68,7 +68,7 @@ def readResult(dat_input):
|
||||||
|
|
||||||
def import_dat(filename, Analysis=None):
|
def import_dat(filename, Analysis=None):
|
||||||
r = readResult(filename)
|
r = readResult(filename)
|
||||||
#print ("Results {}".format(r))
|
# print ("Results {}".format(r))
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -64,24 +64,24 @@ def readResult(frd_input):
|
||||||
elemType = 0
|
elemType = 0
|
||||||
|
|
||||||
for line in frd_file:
|
for line in frd_file:
|
||||||
#Check if we found nodes section
|
# Check if we found nodes section
|
||||||
if line[4:6] == "2C":
|
if line[4:6] == "2C":
|
||||||
nodes_found = True
|
nodes_found = True
|
||||||
#first lets extract the node and coordinate information from the results file
|
# first lets extract the node and coordinate information from the results file
|
||||||
if nodes_found and (line[1:3] == "-1"):
|
if nodes_found and (line[1:3] == "-1"):
|
||||||
elem = int(line[4:13])
|
elem = int(line[4:13])
|
||||||
nodes_x = float(line[13:25])
|
nodes_x = float(line[13:25])
|
||||||
nodes_y = float(line[25:37])
|
nodes_y = float(line[25:37])
|
||||||
nodes_z = float(line[37:49])
|
nodes_z = float(line[37:49])
|
||||||
nodes[elem] = FreeCAD.Vector(nodes_x, nodes_y, nodes_z)
|
nodes[elem] = FreeCAD.Vector(nodes_x, nodes_y, nodes_z)
|
||||||
#Check if we found nodes section
|
# Check if we found nodes section
|
||||||
if line[4:6] == "3C":
|
if line[4:6] == "3C":
|
||||||
elements_found = True
|
elements_found = True
|
||||||
#first lets extract element number
|
# first lets extract element number
|
||||||
if elements_found and (line[1:3] == "-1"):
|
if elements_found and (line[1:3] == "-1"):
|
||||||
elem = int(line[4:13])
|
elem = int(line[4:13])
|
||||||
elemType = int(line[14:18])
|
elemType = int(line[14:18])
|
||||||
#then import elements
|
# then import elements
|
||||||
if elements_found and (line[1:3] == "-2"):
|
if elements_found and (line[1:3] == "-2"):
|
||||||
# node order fits with node order in writeAbaqus() in FemMesh.cpp
|
# node order fits with node order in writeAbaqus() in FemMesh.cpp
|
||||||
if elemType == 1:
|
if elemType == 1:
|
||||||
|
@ -236,13 +236,13 @@ def readResult(frd_input):
|
||||||
nd2 = int(line[13:23])
|
nd2 = int(line[13:23])
|
||||||
elements_seg2[elem] = (nd1, nd2)
|
elements_seg2[elem] = (nd1, nd2)
|
||||||
|
|
||||||
#Check if we found new eigenmode
|
# Check if we found new eigenmode
|
||||||
if line[5:10] == "PMODE":
|
if line[5:10] == "PMODE":
|
||||||
eigenmode = int(line[30:36])
|
eigenmode = int(line[30:36])
|
||||||
#Check if we found displacement section
|
# Check if we found displacement section
|
||||||
if line[5:9] == "DISP":
|
if line[5:9] == "DISP":
|
||||||
mode_disp_found = True
|
mode_disp_found = True
|
||||||
#we found a displacement line in the frd file
|
# we found a displacement line in the frd file
|
||||||
if mode_disp_found and (line[1:3] == "-1"):
|
if mode_disp_found and (line[1:3] == "-1"):
|
||||||
elem = int(line[4:13])
|
elem = int(line[4:13])
|
||||||
mode_disp_x = float(line[13:25])
|
mode_disp_x = float(line[13:25])
|
||||||
|
@ -251,7 +251,7 @@ def readResult(frd_input):
|
||||||
mode_disp[elem] = FreeCAD.Vector(mode_disp_x, mode_disp_y, mode_disp_z)
|
mode_disp[elem] = FreeCAD.Vector(mode_disp_x, mode_disp_y, mode_disp_z)
|
||||||
if line[5:11] == "STRESS":
|
if line[5:11] == "STRESS":
|
||||||
mode_stress_found = True
|
mode_stress_found = True
|
||||||
#we found a displacement line in the frd file
|
# we found a displacement line in the frd file
|
||||||
if mode_stress_found and (line[1:3] == "-1"):
|
if mode_stress_found and (line[1:3] == "-1"):
|
||||||
elem = int(line[4:13])
|
elem = int(line[4:13])
|
||||||
stress_1 = float(line[13:25])
|
stress_1 = float(line[13:25])
|
||||||
|
@ -261,7 +261,7 @@ def readResult(frd_input):
|
||||||
stress_5 = float(line[61:73])
|
stress_5 = float(line[61:73])
|
||||||
stress_6 = float(line[73:85])
|
stress_6 = float(line[73:85])
|
||||||
mode_stress[elem] = (stress_1, stress_2, stress_3, stress_4, stress_5, stress_6)
|
mode_stress[elem] = (stress_1, stress_2, stress_3, stress_4, stress_5, stress_6)
|
||||||
#Check for the end of a section
|
# Check for the end of a section
|
||||||
if line[1:3] == "-3":
|
if line[1:3] == "-3":
|
||||||
if mode_disp_found:
|
if mode_disp_found:
|
||||||
mode_disp_found = False
|
mode_disp_found = False
|
||||||
|
|
Loading…
Reference in New Issue
Block a user