FEM: pep8
This commit is contained in:
@@ -112,7 +112,6 @@ def setup(doc=None, solvertype="elmer"):
|
||||
# setup box static, add a fixed, force and a pressure constraint
|
||||
|
||||
doc = setup_base(doc, solvertype)
|
||||
geom_obj = doc.Box
|
||||
analysis = doc.Analysis
|
||||
|
||||
# solver
|
||||
@@ -129,7 +128,7 @@ def setup(doc=None, solvertype="elmer"):
|
||||
solver_object = analysis.addObject(
|
||||
ObjectsFem.makeSolverElmer(doc, "SolverElmer")
|
||||
)[0]
|
||||
eq_electrostatic = ObjectsFem.makeEquationElasticity(doc, solver_object)
|
||||
ObjectsFem.makeEquationElasticity(doc, solver_object)
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(
|
||||
"Not known or not supported solver type: {}. "
|
||||
|
||||
@@ -708,17 +708,18 @@ class GmshTools():
|
||||
geo.write("Mesh.CharacteristicLengthMin = " + str(0) + ";\n")
|
||||
else:
|
||||
geo.write("Mesh.CharacteristicLengthMin = " + str(self.clmin) + ";\n")
|
||||
if hasattr(self.mesh_obj, "MeshSizeFromCurvature"):
|
||||
if hasattr(self.mesh_obj, "MeshSizeFromCurvature"):
|
||||
geo.write(
|
||||
"Mesh.MeshSizeFromCurvature = " + str(self.mesh_obj.MeshSizeFromCurvature) +
|
||||
"Mesh.MeshSizeFromCurvature = {}"
|
||||
"; // number of elements per 2*pi radians, 0 to deactivate\n"
|
||||
.format(self.mesh_obj.MeshSizeFromCurvature)
|
||||
)
|
||||
geo.write("\n")
|
||||
if hasattr(self.mesh_obj, "RecombineAll") and self.mesh_obj.RecombineAll is True:
|
||||
geo.write("// other mesh options\n")
|
||||
geo.write("Mesh.RecombineAll = 1;\n")
|
||||
geo.write("\n")
|
||||
|
||||
|
||||
geo.write("// optimize the mesh\n")
|
||||
# Gmsh tetra optimizer
|
||||
if hasattr(self.mesh_obj, "OptimizeStd") and self.mesh_obj.OptimizeStd is True:
|
||||
@@ -742,7 +743,7 @@ class GmshTools():
|
||||
"parameter check http://gmsh.info/doc/texinfo/gmsh.html\n"
|
||||
)
|
||||
geo.write("\n")
|
||||
|
||||
|
||||
geo.write("// mesh order\n")
|
||||
geo.write("Mesh.ElementOrder = " + self.order + ";\n")
|
||||
if self.order == "2":
|
||||
|
||||
@@ -220,7 +220,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
|
||||
"number of elements per 2*pi radians, 0 to deactivate"
|
||||
)
|
||||
obj.MeshSizeFromCurvature = (12, 0, 10000, 1)
|
||||
|
||||
|
||||
if not hasattr(obj, "Algorithm2D"):
|
||||
obj.addProperty(
|
||||
"App::PropertyEnumeration",
|
||||
|
||||
@@ -636,7 +636,6 @@ class Writer(object):
|
||||
return None
|
||||
|
||||
def _handleElasticityMaterial(self, bodies):
|
||||
gravObj = self._getSingleMember("Fem::ConstraintSelfWeight")
|
||||
tempObj = self._getSingleMember("Fem::ConstraintInitialTemperature")
|
||||
if tempObj is not None:
|
||||
refTemp = self._getFromUi(tempObj.initialTemperature, "K", "O")
|
||||
|
||||
@@ -274,24 +274,26 @@ def getBoundBoxOfAllDocumentShapes(doc):
|
||||
# https://forum.freecadweb.org/viewtopic.php?f=18&t=52920
|
||||
for o in doc.Objects:
|
||||
|
||||
FreeCAD.Console.PrintMessage(":\n") # debug only
|
||||
FreeCAD.Console.PrintMessage(":\n") # debug only
|
||||
bb = None
|
||||
|
||||
try:
|
||||
FreeCAD.Console.PrintMessage("trying: " + str(o.Label) + ": getPropertyOfGeometry()\n") # debug only
|
||||
FreeCAD.Console.PrintMessage(
|
||||
"trying: {}: getPropertyOfGeometry()\n".format(o.Label)
|
||||
) # debug only
|
||||
bb = o.getPropertyOfGeometry().BoundBox
|
||||
FreeCAD.Console.PrintMessage(str(bb) + "\n") # debug only
|
||||
FreeCAD.Console.PrintMessage("{}\n".format(bb)) # debug only
|
||||
except Exception:
|
||||
FreeCAD.Console.PrintMessage("exception \n") # debug only
|
||||
FreeCAD.Console.PrintMessage("exception \n") # debug only
|
||||
pass
|
||||
|
||||
if bb == None:
|
||||
if bb is None:
|
||||
try:
|
||||
FreeCAD.Console.PrintMessage("trying: " + str(o.Label) + ": FemMesh\n") # debug only
|
||||
FreeCAD.Console.PrintMessage("trying: {}: FemMesh\n".format(o.Label)) # debug only
|
||||
bb = o.FemMesh.BoundBox
|
||||
FreeCAD.Console.PrintMessage(str(bb) + "\n") # debug only
|
||||
FreeCAD.Console.PrintMessage("{}\n".format(bb)) # debug only
|
||||
except Exception:
|
||||
FreeCAD.Console.PrintMessage("exception \n") # debug only
|
||||
FreeCAD.Console.PrintMessage("exception \n") # debug only
|
||||
pass
|
||||
|
||||
if bb:
|
||||
|
||||
Reference in New Issue
Block a user