FEM and Blender
From wikiluntti
Introduction
- Blender
- 3D print add-on (Check all)
- BFEX - Blender FEA Exporter https://github.com/MiguelDLM/BFEX
- Blendmsh https://github.com/senthurayyappan/blendmsh
- quad remesher https://www.youtube.com/watch?v=kfQfU_cDRWE
- Fix meshes https://github.com/evaherbst/Blender_remeshing_guide
- Elmer https://www.elmerfem.org/blog/
- FreeCAD
- Gmsh https://gmsh.info/
- Netgen https://ngsolve.org/
- OpenFOAM https://www.openfoam.com/
- Paraview https://www.paraview.org/
- Salome
- TetGen
Blender and CAD
- TinyCAD https://docs.blender.org/manual/en/4.1//addons/mesh/tinycad.html
- CadSketcher https://www.cadsketcher.com/
- Parts list
- Using a script: Selected parts only, and don't apply rotations! https://github.com/kittengue-dot/Blender-Script-Export-Part-list https://www.youtube.com/watch?v=C1RZszKlojQ
import bpy
import csv
def export_selected_mesh_dimensions_to_csv(filepath):
"""Export Parts
Args:
filepath (str): Le chemin du fichier CSV de sortie.
"""
with open(filepath, 'w', newline='', encoding='utf-8') as csvfile:
fieldnames = ['Part', 'Section X (mm)', 'Section Y (mm)', 'Length Z (mm)']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
for obj in bpy.context.selected_objects:
if obj.type == 'MESH':
dimensions = obj.dimensions
x = [0,0,0]
x[0] = round(dimensions.x * 1000, 3)
x[1] = round(dimensions.y * 1000, 3)
x[2] = round(dimensions.z * 1000, 3)
x.sort()
writer.writerow({'Part': obj.name, 'X (mm)': x[0], 'Y (mm)': x[1], 'Z (mm)': x[2]})
filepath = "/home/user/Downloads/part_list.csv" # Replace destination path
export_selected_mesh_dimensions_to_csv(filepath)
FreeCAD import
Steps:
- Export in Blender
- Use Boolean
- Eliminate the bolts and some holes
- Part -> Create shape from mesh
- Part -> MakeSolid
Some problems (see a Part check Geometry)
- Geometry is a shell -- not a solid: a shell mesh on meshing
- Check this by right clicking on the mesh and printing mesh informations (Tasks: Node count vs Triangle count vs Tetrahedron count)
- Self intersections
- Use Boolean in Blender for all parts (both, if two are overlapping)
- Self intersecting meshes are considered dirty
- Use Part -> View -> Transparency to see the intersection points, if they persist.
- eg Netfabb cleans
Workflow and test examples
- Make the Blender mesh and export as .obj file
- Make the mesh using GMSH or FreeCAD, and use FreeCAD to FEM calculations
Simple Cube
Works OK with the FreeCAD, not with the Gmsh
-
The imported cube has double nodes, and the color is strange.
-
It works flawless in the FreeCAD.
-
The FreeCAD FEM solver gives some results.
-
However, when importing to GMSH, it will produce an error.
-
If the cube is exported as STL, then GMSH will work better.
-
The mesh generation does not work: "PLC Error: A segment and a facet intersect at point" and "Invalid boundary mesh (segment-facet intersection) on surface 1, intersection (0.333327,0.333327,1)".
Two Cubes
-
The two cubes made in Blender. The mesh looks fine, and there are none self intersecting nodes.
Theory
Frame formulas: https://structx.com/frames.html