FEM: improvements for meshes without geometry link

This commit is contained in:
Bernd Hahnebach
2021-07-31 20:09:15 +02:00
parent e4b15dd336
commit 458bd00613
2 changed files with 22 additions and 13 deletions

View File

@@ -60,6 +60,7 @@ class MeshSetsGetter():
self.ccx_efaces = "Efaces"
self.ccx_eedges = "Eedges"
self.mat_geo_sets = []
self.theshape = None
if self.mesh_object:
if hasattr(self.mesh_object, "Shape"):
self.theshape = self.mesh_object.Shape
@@ -72,7 +73,21 @@ class MeshSetsGetter():
"Not all methods do work without this link.\n"
)
# ATM only used in meshtools.get_femelement_direction1D_set
# TODO somehow this is not smart, rare meshes might be used often
# TODO somehow this is not smart, pur mesh objects might be used often
if (
self.member.geos_beamsection
and (
type_of_obj(self.solver_obj) == "Fem::SolverCcxTools"
or type_of_obj(self.solver_obj) == "Fem::SolverCalculix"
)
):
FreeCAD.Console.PrintError(
"The mesh does not know the geometry it is made from. "
"Beam rotations can not retrieved but they are needed "
"for writing CalculiX solver input. "
"There might be problems in retrieving mesh data.\n"
)
# Z88 will run but CalculiX not
self.femmesh = self.mesh_object.FemMesh
else:
FreeCAD.Console.PrintWarning(
@@ -573,6 +588,12 @@ class MeshSetsGetter():
def get_element_rotation1D_elements(self):
# get for each geometry edge direction the element ids and rotation norma
FreeCAD.Console.PrintMessage("Beam rotations\n")
if self.theshape is None:
FreeCAD.Console.PrintError(
"Beam rotations set can not be retrieved, "
"because the mesh does not know the Geometry it is made from\n"
)
return
if not self.femelement_edges_table:
self.femelement_edges_table = meshtools.get_femelement_edges_table(
self.femmesh

View File

@@ -78,18 +78,6 @@ class FemInputWriter():
self.ccx_eedges = "Eedges"
self.mat_geo_sets = mat_geo_sets
if self.mesh_object:
if hasattr(self.mesh_object, "Shape"):
self.theshape = self.mesh_object.Shape
elif hasattr(self.mesh_object, "Part"):
self.theshape = self.mesh_object.Part
else:
FreeCAD.Console.PrintWarning(
"A finite mesh without a link to a Shape was given. "
"Happen on pure mesh objects. "
"Not all methods do work without this link.\n"
)
# ATM only used in meshtools.get_femelement_direction1D_set
# TODO somehow this is not smart, rare meshes might be used often
self.femmesh = self.mesh_object.FemMesh
else:
FreeCAD.Console.PrintWarning(