FEM: mesh region, initialize new obj with length 0.0, do not use the obj for mesh creation if references are empty or lenght is 0.0
This commit is contained in:
parent
a245bf2abc
commit
3842f9c80b
|
@ -236,6 +236,8 @@ class FemGmshTools():
|
||||||
# print(mr_obj.Name)
|
# print(mr_obj.Name)
|
||||||
# print(mr_obj.CharacteristicLength)
|
# print(mr_obj.CharacteristicLength)
|
||||||
# print(Units.Quantity(mr_obj.CharacteristicLength).Value)
|
# print(Units.Quantity(mr_obj.CharacteristicLength).Value)
|
||||||
|
if mr_obj.CharacteristicLength:
|
||||||
|
if mr_obj.References:
|
||||||
for sub in mr_obj.References:
|
for sub in mr_obj.References:
|
||||||
# print(sub[0]) # Part the elements belongs to
|
# print(sub[0]) # Part the elements belongs to
|
||||||
# check if the shape of the mesh region is an element of the Part to mesh, if not try to find the element in the shape to mesh
|
# check if the shape of the mesh region is an element of the Part to mesh, if not try to find the element in the shape to mesh
|
||||||
|
@ -259,6 +261,10 @@ class FemGmshTools():
|
||||||
self.ele_length_map[eles] = Units.Quantity(mr_obj.CharacteristicLength).Value
|
self.ele_length_map[eles] = Units.Quantity(mr_obj.CharacteristicLength).Value
|
||||||
else:
|
else:
|
||||||
FreeCAD.Console.PrintError("The element " + eles + " of the meshregion " + mr_obj.Name + " has been added to another mesh region.\n")
|
FreeCAD.Console.PrintError("The element " + eles + " of the meshregion " + mr_obj.Name + " has been added to another mesh region.\n")
|
||||||
|
else:
|
||||||
|
FreeCAD.Console.PrintError("The meshregion: " + mr_obj.Name + " is not used to create the mesh because the reference list is empty.\n")
|
||||||
|
else:
|
||||||
|
FreeCAD.Console.PrintError("The meshregion: " + mr_obj.Name + " is not used to create the mesh because the CharacteristicLength is 0.0 mm.\n")
|
||||||
for elel in self.ele_length_map:
|
for elel in self.ele_length_map:
|
||||||
ele_shape = FemMeshTools.get_element(self.part_obj, elel) # the method getElement(element) does not return Solid elements
|
ele_shape = FemMeshTools.get_element(self.part_obj, elel) # the method getElement(element) does not return Solid elements
|
||||||
ele_vertexes = FemMeshTools.get_vertexes_by_element(self.part_obj.Shape, ele_shape)
|
ele_vertexes = FemMeshTools.get_vertexes_by_element(self.part_obj.Shape, ele_shape)
|
||||||
|
|
|
@ -31,7 +31,7 @@ import FreeCAD
|
||||||
import _FemMeshRegion
|
import _FemMeshRegion
|
||||||
|
|
||||||
|
|
||||||
def makeFemMeshRegion(base_mesh, element_length=2.0, name="FEMMeshRegion"):
|
def makeFemMeshRegion(base_mesh, element_length=0.0, name="FEMMeshRegion"):
|
||||||
'''makeFemMeshRegion([length], [name]): creates a FEM mesh region object to define properties for a regon of a FEM mesh'''
|
'''makeFemMeshRegion([length], [name]): creates a FEM mesh region object to define properties for a regon of a FEM mesh'''
|
||||||
obj = FreeCAD.ActiveDocument.addObject("Fem::FeaturePython", name)
|
obj = FreeCAD.ActiveDocument.addObject("Fem::FeaturePython", name)
|
||||||
_FemMeshRegion._FemMeshRegion(obj)
|
_FemMeshRegion._FemMeshRegion(obj)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user