本文整理汇总了Python中FemMeshTools.get_femelement_table方法的典型用法代码示例。如果您正苦于以下问题:Python FemMeshTools.get_femelement_table方法的具体用法?Python FemMeshTools.get_femelement_table怎么用?Python FemMeshTools.get_femelement_table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FemMeshTools
的用法示例。
在下文中一共展示了FemMeshTools.get_femelement_table方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_z88_element_type
# 需要导入模块: import FemMeshTools [as 别名]
# 或者: from FemMeshTools import get_femelement_table [as 别名]
def get_z88_element_type(femmesh, femelement_table=None):
import FemMeshTools
if not femmesh:
print("Error: No femmesh!")
if not femelement_table:
print("We need to get the femelement_table first!")
femelement_table = FemMeshTools.get_femelement_table(femmesh)
# in some cases lowest key in femelement_table is not [1]
for elem in sorted(femelement_table):
elem_length = len(femelement_table[elem])
print(elem_length)
break # break after the first elem
if FemMeshTools.is_solid_femmesh(femmesh):
if femmesh.TetraCount == femmesh.VolumeCount:
if elem_length == 4:
return 17
elif elem_length == 10:
return 16
else:
print('Tetra with neiter 4 nor 10 nodes')
elif femmesh.HexaCount == femmesh.VolumeCount:
if elem_length == 8:
return 1
elif elem_length == 20:
return 10
else:
print('Hexa with neither 8 nor 20 nodes')
return 0
else:
print('no tetra, no hexa or Mixed Volume Elements')
elif FemMeshTools.is_face_femmesh(femmesh):
if femmesh.TriangleCount == femmesh.FaceCount:
if elem_length == 3:
print('tria3mesh, not supported by z88')
return 0
elif elem_length == 6:
return 24
else:
print('Tria with neither 3 nor 6 nodes')
return 0
elif femmesh.QuadrangleCount == femmesh.FaceCount:
if elem_length == 4:
print('quad4mesh, not supported by z88')
return 0
elif elem_length == 8:
return 23
else:
print('Quad with neiter 4 nor 8 nodes')
return 0
else:
print('no tria, no quad')
return 0
elif FemMeshTools.is_edge_femmesh(femmesh):
print('Edge femmesh will be exported as 3D truss element nr 4')
return 4
else:
print('Neither, edge, face or solid femmesh')
return 0
return 0
示例2: get_ccx_elsets_multiple_mat_solid
# 需要导入模块: import FemMeshTools [as 别名]
# 或者: from FemMeshTools import get_femelement_table [as 别名]
def get_ccx_elsets_multiple_mat_solid(self):
if not self.femelement_table:
self.femelement_table = FemMeshTools.get_femelement_table(self.femmesh)
FemMeshTools.get_femelement_sets(self.femmesh, self.femelement_table, self.material_objects)
for mat_data in self.material_objects:
mat_obj = mat_data['Object']
ccx_elset = {}
ccx_elset['ccx_elset'] = mat_data['FEMElements']
ccx_elset['ccx_elset_name'] = get_ccx_elset_solid_name(mat_obj.Name, None, mat_data['ShortName'])
ccx_elset['mat_obj_name'] = mat_obj.Name
ccx_elset['ccx_mat_name'] = mat_obj.Material['Name']
self.ccx_elsets.append(ccx_elset)
示例3: get_ccx_elsets_multiple_mat_single_shell
# 需要导入模块: import FemMeshTools [as 别名]
# 或者: from FemMeshTools import get_femelement_table [as 别名]
def get_ccx_elsets_multiple_mat_single_shell(self):
if not self.femelement_table:
self.femelement_table = FemMeshTools.get_femelement_table(self.femmesh)
shellth_obj = self.shellthickness_objects[0]['Object']
FemMeshTools.get_femelement_sets(self.femmesh, self.femelement_table, self.material_objects)
for mat_data in self.material_objects:
mat_obj = mat_data['Object']
ccx_elset = {}
ccx_elset['shellthickness_obj'] = shellth_obj
ccx_elset['ccx_elset'] = mat_data['FEMElements']
ccx_elset['ccx_elset_name'] = get_ccx_elset_shell_name(mat_obj.Name, shellth_obj.Name, mat_data['ShortName'])
ccx_elset['mat_obj_name'] = mat_obj.Name
ccx_elset['ccx_mat_name'] = mat_obj.Material['Name']
self.ccx_elsets.append(ccx_elset)
示例4: get_ccx_elsets_multiple_mat_single_beam
# 需要导入模块: import FemMeshTools [as 别名]
# 或者: from FemMeshTools import get_femelement_table [as 别名]
def get_ccx_elsets_multiple_mat_single_beam(self):
if not self.femelement_table:
self.femelement_table = FemMeshTools.get_femelement_table(self.femmesh)
beamsec_obj = self.beamsection_objects[0]['Object']
FemMeshTools.get_femelement_sets(self.femmesh, self.femelement_table, self.material_objects)
for mat_data in self.material_objects:
mat_obj = mat_data['Object']
ccx_elset = {}
ccx_elset['beamsection_obj'] = beamsec_obj
ccx_elset['ccx_elset'] = mat_data['FEMElements']
ccx_elset['ccx_elset_name'] = get_ccx_elset_beam_name(mat_obj.Name, beamsec_obj.Name, mat_data['ShortName'])
ccx_elset['mat_obj_name'] = mat_obj.Name
ccx_elset['ccx_mat_name'] = mat_obj.Material['Name']
self.ccx_elsets.append(ccx_elset)
示例5: export
# 需要导入模块: import FemMeshTools [as 别名]
# 或者: from FemMeshTools import get_femelement_table [as 别名]
def export(objectslist, filename):
"called when freecad exports a file"
if len(objectslist) != 1:
FreeCAD.Console.PrintError("This exporter can only export one object.\n")
return
obj = objectslist[0]
if not obj.isDerivedFrom("Fem::FemMeshObject"):
FreeCAD.Console.PrintError("No FEM mesh object selected.\n")
return
femnodes_mesh = obj.FemMesh.Nodes
femelement_table = FemMeshTools.get_femelement_table(obj.FemMesh)
z88_element_type = get_z88_element_type(obj.FemMesh, femelement_table)
f = pyopen(filename, "wb")
write_z88_mesh_to_file(femnodes_mesh, femelement_table, z88_element_type, f)
f.close()
示例6: get_ccx_elsets_multiple_mat_solid
# 需要导入模块: import FemMeshTools [as 别名]
# 或者: from FemMeshTools import get_femelement_table [as 别名]
def get_ccx_elsets_multiple_mat_solid(self):
all_found = False
if self.femmesh.GroupCount:
all_found = FemMeshTools.get_femelement_sets_from_group_data(self.femmesh, self.material_objects)
print(all_found)
if all_found is False:
if not self.femelement_table:
self.femelement_table = FemMeshTools.get_femelement_table(self.femmesh)
FemMeshTools.get_femelement_sets(self.femmesh, self.femelement_table, self.material_objects)
for mat_data in self.material_objects:
mat_obj = mat_data['Object']
ccx_elset = {}
ccx_elset['ccx_elset'] = mat_data['FEMElements']
ccx_elset['ccx_elset_name'] = get_ccx_elset_solid_name(mat_obj.Name, None, mat_data['ShortName'])
ccx_elset['mat_obj_name'] = mat_obj.Name
ccx_elset['ccx_mat_name'] = mat_obj.Material['Name']
self.ccx_elsets.append(ccx_elset)
示例7: get_ccx_elsets_multiple_mat_multiple_beam
# 需要导入模块: import FemMeshTools [as 别名]
# 或者: from FemMeshTools import get_femelement_table [as 别名]
def get_ccx_elsets_multiple_mat_multiple_beam(self):
if not self.femelement_table:
self.femelement_table = FemMeshTools.get_femelement_table(self.femmesh)
FemMeshTools.get_femelement_sets(self.femmesh, self.femelement_table, self.beamsection_objects)
FemMeshTools.get_femelement_sets(self.femmesh, self.femelement_table, self.material_objects)
for beamsec_data in self.beamsection_objects:
beamsec_obj = beamsec_data['Object']
for mat_data in self.material_objects:
mat_obj = mat_data['Object']
ccx_elset = {}
ccx_elset['beamsection_obj'] = beamsec_obj
elemids = []
for elemid in beamsec_data['FEMElements']:
if elemid in mat_data['FEMElements']:
elemids.append(elemid)
ccx_elset['ccx_elset'] = elemids
ccx_elset['ccx_elset_name'] = get_ccx_elset_beam_name(mat_obj.Name, beamsec_obj.Name, mat_data['ShortName'], beamsec_data['ShortName'])
ccx_elset['mat_obj_name'] = mat_obj.Name
ccx_elset['ccx_mat_name'] = mat_obj.Material['Name']
self.ccx_elsets.append(ccx_elset)
示例8: get_constraints_pressure_faces
# 需要导入模块: import FemMeshTools [as 别名]
# 或者: from FemMeshTools import get_femelement_table [as 别名]
def get_constraints_pressure_faces(self):
# TODO see comments in get_constraints_force_nodeloads(), it applies here too. Mhh it applies to all constraints ...
'''
# depreciated version
# get the faces and face numbers
for femobj in self.pressure_objects: # femobj --> dict, FreeCAD document object is femobj['Object']
femobj['PressureFaces'] = FemMeshTools.get_pressure_obj_faces_depreciated(self.femmesh, femobj)
# print(femobj['PressureFaces'])
'''
if not self.femnodes_mesh:
self.femnodes_mesh = self.femmesh.Nodes
if not self.femelement_table:
self.femelement_table = FemMeshTools.get_femelement_table(self.femmesh)
if not self.femnodes_ele_table:
self.femnodes_ele_table = FemMeshTools.get_femnodes_ele_table(self.femnodes_mesh, self.femelement_table)
for femobj in self.pressure_objects: # femobj --> dict, FreeCAD document object is femobj['Object']
pressure_faces = FemMeshTools.get_pressure_obj_faces(self.femmesh, self.femelement_table, self.femnodes_ele_table, femobj)
# print(len(pressure_faces))
femobj['PressureFaces'] = [(femobj['Object'].Name + ': face load', pressure_faces)]
示例9: get_constraints_force_nodeloads
# 需要导入模块: import FemMeshTools [as 别名]
# 或者: from FemMeshTools import get_femelement_table [as 别名]
def get_constraints_force_nodeloads(self):
# check shape type of reference shape
for femobj in self.force_objects: # femobj --> dict, FreeCAD document object is femobj['Object']
frc_obj = femobj['Object']
# in GUI defined frc_obj all ref_shape have the same shape type
# TODO in FemTools: check if all RefShapes really have the same type an write type to dictionary
femobj['RefShapeType'] = ''
if frc_obj.References:
first_ref_obj = frc_obj.References[0]
first_ref_shape = first_ref_obj[0].Shape.getElement(first_ref_obj[1][0])
femobj['RefShapeType'] = first_ref_shape.ShapeType
else:
# frc_obj.References could be empty ! # TODO in FemTools: check
FreeCAD.Console.PrintError('At least one Force Object has empty References!\n')
if femobj['RefShapeType'] == 'Vertex':
# print("load on vertices --> we do not need the femelement_table and femnodes_mesh for node load calculation")
pass
elif femobj['RefShapeType'] == 'Face' and FemMeshTools.is_solid_femmesh(self.femmesh) and not FemMeshTools.has_no_face_data(self.femmesh):
# print("solid_mesh with face data --> we do not need the femelement_table but we need the femnodes_mesh for node load calculation")
if not self.femnodes_mesh:
self.femnodes_mesh = self.femmesh.Nodes
else:
# print("mesh without needed data --> we need the femelement_table and femnodes_mesh for node load calculation")
if not self.femnodes_mesh:
self.femnodes_mesh = self.femmesh.Nodes
if not self.femelement_table:
self.femelement_table = FemMeshTools.get_femelement_table(self.femmesh)
# get node loads
for femobj in self.force_objects: # femobj --> dict, FreeCAD document object is femobj['Object']
frc_obj = femobj['Object']
if frc_obj.Force == 0:
print(' Warning --> Force = 0')
if femobj['RefShapeType'] == 'Vertex': # point load on vertieces
femobj['NodeLoadTable'] = FemMeshTools.get_force_obj_vertex_nodeload_table(self.femmesh, frc_obj)
elif femobj['RefShapeType'] == 'Edge': # line load on edges
femobj['NodeLoadTable'] = FemMeshTools.get_force_obj_edge_nodeload_table(self.femmesh, self.femelement_table, self.femnodes_mesh, frc_obj)
elif femobj['RefShapeType'] == 'Face': # area load on faces
femobj['NodeLoadTable'] = FemMeshTools.get_force_obj_face_nodeload_table(self.femmesh, self.femelement_table, self.femnodes_mesh, frc_obj)