diff --git a/src/Mod/Fem/FemCommands.py b/src/Mod/Fem/FemCommands.py index 91ab4a96dc33..5eb9d60f4b43 100644 --- a/src/Mod/Fem/FemCommands.py +++ b/src/Mod/Fem/FemCommands.py @@ -97,18 +97,18 @@ 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: @@ -116,8 +116,8 @@ def hide_meshes_show_parts_constraints(self): 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 diff --git a/src/Mod/Fem/FemTools.py b/src/Mod/Fem/FemTools.py index 46782bced488..7a8d985cad7e 100644 --- a/src/Mod/Fem/FemTools.py +++ b/src/Mod/Fem/FemTools.py @@ -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) @@ -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): @@ -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) diff --git a/src/Mod/Fem/_TaskPanelMechanicalMaterial.py b/src/Mod/Fem/_TaskPanelMechanicalMaterial.py index 9cc9fadff1bd..d68831ba8cd6 100644 --- a/src/Mod/Fem/_TaskPanelMechanicalMaterial.py +++ b/src/Mod/Fem/_TaskPanelMechanicalMaterial.py @@ -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) diff --git a/src/Mod/Fem/ccxInpWriter.py b/src/Mod/Fem/ccxInpWriter.py index f841a0831e31..5cf3fc1b81f8 100644 --- a/src/Mod/Fem/ccxInpWriter.py +++ b/src/Mod/Fem/ccxInpWriter.py @@ -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 = [] @@ -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):