Skip to content

Commit

Permalink
FEM: make python modules again flake8 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
berndhahnebach authored and wwmayer committed Mar 2, 2016
1 parent bc3cc03 commit 57c783e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
10 changes: 5 additions & 5 deletions src/Mod/Fem/FemCommands.py
Expand Up @@ -97,27 +97,27 @@ def analysis_has_solver(self):
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:
for acnstrmesh in FreeCAD.activeDocument().Objects:
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
6 changes: 3 additions & 3 deletions src/Mod/Fem/FemTools.py
Expand Up @@ -214,7 +214,7 @@ def update_objects(self):
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)
Expand Down Expand Up @@ -248,7 +248,7 @@ def check_prerequisites(self):
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):
Expand Down Expand Up @@ -277,7 +277,7 @@ def write_inp_file(self):
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)
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/_TaskPanelMechanicalMaterial.py
Expand Up @@ -142,7 +142,7 @@ def pr_changed(self, value):
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)
Expand Down
42 changes: 21 additions & 21 deletions src/Mod/Fem/ccxInpWriter.py
Expand Up @@ -148,13 +148,13 @@ def write_node_sets_constraints_fixed(self, f):
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 = []
Expand Down Expand Up @@ -286,39 +286,39 @@ def write_constraints_fixed(self, f):
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):
Expand Down

0 comments on commit 57c783e

Please sign in to comment.