FEM: make python modules again flake8 compatible
This commit is contained in:
parent
bc3cc033e1
commit
57c783e5b0
|
@ -97,18 +97,18 @@ class FemCommands(object):
|
|||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def hide_parts_constraints_show_meshes(self):
|
||||
if FreeCAD.GuiUp:
|
||||
for acnstrmesh in FreeCAD.activeDocument().Objects:
|
||||
#if "Constraint" in acnstrmesh.TypeId:
|
||||
# acnstrmesh.ViewObject.Visibility = False
|
||||
if "Mesh" in acnstrmesh.TypeId:
|
||||
aparttoshow = acnstrmesh.Name.replace("_Mesh","")
|
||||
aparttoshow = acnstrmesh.Name.replace("_Mesh", "")
|
||||
for apart in FreeCAD.activeDocument().Objects:
|
||||
if aparttoshow == apart.Name:
|
||||
apart.ViewObject.Visibility = False
|
||||
acnstrmesh.ViewObject.Visibility = True #OvG: Hide constraints and parts and show meshes
|
||||
acnstrmesh.ViewObject.Visibility = True # OvG: Hide constraints and parts and show meshes
|
||||
|
||||
def hide_meshes_show_parts_constraints(self):
|
||||
if FreeCAD.GuiUp:
|
||||
|
@ -116,8 +116,8 @@ class FemCommands(object):
|
|||
if "Constraint" in acnstrmesh.TypeId:
|
||||
acnstrmesh.ViewObject.Visibility = True
|
||||
if "Mesh" in acnstrmesh.TypeId:
|
||||
aparttoshow = acnstrmesh.Name.replace("_Mesh","")
|
||||
aparttoshow = acnstrmesh.Name.replace("_Mesh", "")
|
||||
for apart in FreeCAD.activeDocument().Objects:
|
||||
if aparttoshow == apart.Name:
|
||||
apart.ViewObject.Visibility = True
|
||||
acnstrmesh.ViewObject.Visibility = False #OvG: Hide meshes and show constraints and meshed part e.g. on purging results
|
||||
acnstrmesh.ViewObject.Visibility = False # OvG: Hide meshes and show constraints and meshed part e.g. on purging results
|
||||
|
|
|
@ -214,7 +214,7 @@ class FemTools(QtCore.QRunnable, QtCore.QObject):
|
|||
PressureObjectDict = {}
|
||||
PressureObjectDict['Object'] = m
|
||||
self.pressure_constraints.append(PressureObjectDict)
|
||||
elif m.isDerivedFrom("Fem::ConstraintDisplacement"): #OvG: Replacement reference to C++ implementation of Displacement Constraint
|
||||
elif m.isDerivedFrom("Fem::ConstraintDisplacement"): # OvG: Replacement reference to C++ implementation of Displacement Constraint
|
||||
displacement_constraint_dict = {}
|
||||
displacement_constraint_dict['Object'] = m
|
||||
self.displacement_constraints.append(displacement_constraint_dict)
|
||||
|
@ -248,7 +248,7 @@ class FemTools(QtCore.QRunnable, QtCore.QObject):
|
|||
if has_no_references is True:
|
||||
message += "More than one Material has empty References list (Only one empty References list is allowed!).\n"
|
||||
has_no_references = True
|
||||
if not (self.fixed_constraints):
|
||||
if not (self.fixed_constraints):
|
||||
message += "No fixed-constraint nodes defined in the Analysis\n"
|
||||
if self.analysis_type == "static":
|
||||
if not (self.force_constraints or self.pressure_constraints):
|
||||
|
@ -277,7 +277,7 @@ class FemTools(QtCore.QRunnable, QtCore.QObject):
|
|||
inp_writer = iw.inp_writer(self.analysis, self.mesh, self.materials,
|
||||
self.fixed_constraints,
|
||||
self.force_constraints, self.pressure_constraints,
|
||||
self.displacement_constraints, #OvG: Stick to naming convention
|
||||
self.displacement_constraints, # OvG: Stick to naming convention
|
||||
self.beam_sections, self.shell_thicknesses,
|
||||
self.analysis_type, self.eigenmode_parameters,
|
||||
self.working_dir)
|
||||
|
|
|
@ -142,7 +142,7 @@ class _TaskPanelMechanicalMaterial:
|
|||
old_pr = Units.Quantity(self.material['PoissonRatio'])
|
||||
variation = 0.001
|
||||
if value:
|
||||
if not (1 - variation < float(old_pr) / value < 1 + variation):
|
||||
if not (1 - variation < float(old_pr) / value < 1 + variation):
|
||||
# PoissonRatio has changed
|
||||
material = self.material
|
||||
material['PoissonRatio'] = unicode(value)
|
||||
|
|
|
@ -148,13 +148,13 @@ class inp_writer:
|
|||
for i in n:
|
||||
f.write(str(i) + ',\n')
|
||||
|
||||
def write_node_sets_constraints_displacement(self,f):
|
||||
def write_node_sets_constraints_displacement(self, f):
|
||||
f.write('\n***********************************************************\n')
|
||||
f.write('** Node sets for prescribed displacement constraint\n')
|
||||
f.write('** written by {} function\n'.format(sys._getframe().f_code.co_name))
|
||||
for fobj in self.displacement_objects:
|
||||
disp_obj = fobj['Object']
|
||||
f.write('*NSET,NSET='+disp_obj.Name + '\n')
|
||||
f.write('*NSET,NSET=' + disp_obj.Name + '\n')
|
||||
for o, elem in disp_obj.References:
|
||||
fo = o.Shape.getElement(elem)
|
||||
n = []
|
||||
|
@ -286,39 +286,39 @@ class inp_writer:
|
|||
f.write(fix_obj_name + ',6\n')
|
||||
f.write('\n')
|
||||
|
||||
def write_constraints_displacement(self,f):
|
||||
def write_constraints_displacement(self, f):
|
||||
f.write('\n***********************************************************\n')
|
||||
f.write('** Displacement constraint applied\n')
|
||||
f.write('** written by {} function\n'.format(sys._getframe().f_code.co_name))
|
||||
for disp_obj in self.displacement_objects:
|
||||
disp_obj_name = disp_obj['Object'].Name
|
||||
f.write('*BOUNDARY\n')
|
||||
if disp_obj['Object'].xFix == True:
|
||||
if disp_obj['Object'].xFix:
|
||||
f.write(disp_obj_name + ',1\n')
|
||||
elif disp_obj['Object'].xFree == False:
|
||||
f.write(disp_obj_name + ',1,1,'+str(disp_obj['Object'].xDisplacement)+'\n')
|
||||
if disp_obj['Object'].yFix == True:
|
||||
elif not disp_obj['Object'].xFree:
|
||||
f.write(disp_obj_name + ',1,1,' + str(disp_obj['Object'].xDisplacement) + '\n')
|
||||
if disp_obj['Object'].yFix:
|
||||
f.write(disp_obj_name + ',2\n')
|
||||
elif disp_obj['Object'].yFree == False:
|
||||
f.write(disp_obj_name + ',2,2,'+str(disp_obj['Object'].yDisplacement)+'\n')
|
||||
if disp_obj['Object'].zFix == True:
|
||||
elif not disp_obj['Object'].yFree:
|
||||
f.write(disp_obj_name + ',2,2,' + str(disp_obj['Object'].yDisplacement) + '\n')
|
||||
if disp_obj['Object'].zFix:
|
||||
f.write(disp_obj_name + ',3\n')
|
||||
elif disp_obj['Object'].zFree == False:
|
||||
f.write(disp_obj_name + ',3,3,'+str(disp_obj['Object'].zDisplacement)+'\n')
|
||||
elif not disp_obj['Object'].zFree:
|
||||
f.write(disp_obj_name + ',3,3,' + str(disp_obj['Object'].zDisplacement) + '\n')
|
||||
|
||||
if self.beamsection_objects or self.shellthickness_objects:
|
||||
if disp_obj['Object'].rotxFix == True:
|
||||
if disp_obj['Object'].rotxFix:
|
||||
f.write(disp_obj_name + ',4\n')
|
||||
elif disp_obj['Object'].rotxFree == False:
|
||||
f.write(disp_obj_name + ',4,4,'+str(disp_obj['Object'].xRotation)+'\n')
|
||||
if disp_obj['Object'].rotyFix == True:
|
||||
elif not disp_obj['Object'].rotxFree:
|
||||
f.write(disp_obj_name + ',4,4,' + str(disp_obj['Object'].xRotation) + '\n')
|
||||
if disp_obj['Object'].rotyFix:
|
||||
f.write(disp_obj_name + ',5\n')
|
||||
elif disp_obj['Object'].rotyFree == False:
|
||||
f.write(disp_obj_name + ',5,5,'+str(disp_obj['Object'].yRotation)+'\n')
|
||||
if disp_obj['Object'].rotzFix == True:
|
||||
elif not disp_obj['Object'].rotyFree:
|
||||
f.write(disp_obj_name + ',5,5,' + str(disp_obj['Object'].yRotation) + '\n')
|
||||
if disp_obj['Object'].rotzFix:
|
||||
f.write(disp_obj_name + ',6\n')
|
||||
elif disp_obj['Object'].rotzFree == False:
|
||||
f.write(disp_obj_name + ',6,6,'+str(disp_obj['Object'].zRotation)+'\n')
|
||||
elif not disp_obj['Object'].rotzFree:
|
||||
f.write(disp_obj_name + ',6,6,' + str(disp_obj['Object'].zRotation) + '\n')
|
||||
f.write('\n')
|
||||
|
||||
def write_constraints_force(self, f):
|
||||
|
|
Loading…
Reference in New Issue
Block a user