FEM and Blender: Difference between revisions
Line 110: | Line 110: | ||
! Min !! Max !! Min !! Max !! Min !! Max !! Min !! Max !! Min !! Max !! Min !! Max !! Min !! Max !! Min !! Max | ! Min !! Max !! Min !! Max !! Min !! Max !! Min !! Max !! Min !! Max !! Min !! Max !! Min !! Max !! Min !! Max | ||
|- | |- | ||
| No Rafters || | | No Rafters || 0.00 || 2.01 mm || -0.11 mm || 0.32 mm || -0.24 mm || 0.10 mm || -2.01 mm || 800.04 nm || 0.00 Pa || 5847.87 kPa || -191.14 kPa || 6037.13 kPa || -5486.84 kPa || 285.32 kPa || 0.00 Pa || 2969.41 kPa | ||
|- | |- | ||
| 22.5° rafter || 0.00 || 0.22 mm || -17.67 µm || 92.32 µm || -46.55 µm || 14.54 µm || -0.23 mm || 164.74 nm || 0.00 Pa || 2020.39 kPa || -118.97 kPa || 2101.76 kPa || -1742,35 kPa || 119.10 kPa || 0.00 Pa || 1014.03 kPa | | 22.5° rafter || 0.00 || 0.22 mm || -17.67 µm || 92.32 µm || -46.55 µm || 14.54 µm || -0.23 mm || 164.74 nm || 0.00 Pa || 2020.39 kPa || -118.97 kPa || 2101.76 kPa || -1742,35 kPa || 119.10 kPa || 0.00 Pa || 1014.03 kPa |
Revision as of 15:38, 2 July 2025
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 from Blender. If exporting STL, scale on export 1000x. Problems with non-manifold geometry.
- Use Boolean to make on mesh
- Non-manifold: Select -> Select All by Trait -> Non Manifold, also the others from there. Remove the faces and then dissolve the edges (Limited Dissolve or X > Dissolve Edges).
- (Select Similar). This is often useful to select vertices with only one connecting edge
- (Select Linked)
- W > Specials > Remove doubles Doubles,
- Check the normals outward: Edit mode, Select All, Mesh -> Normals -> Outward (Shift + N)
- Eliminate the bolts and some holes
- FreeCAD
- 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
FEM Calculations of the Door Canopy
Images of the displacement.
Results
Material: Wood-Generic
- Density 700 kg/m3
- Young's Modulus 12.00 GPa
- Poisson Ratio 0.05
Design | Displacement magnitude | Displacement X | Displacement Y | Displacement Z | von Mises Stress | Max Principal Stress | Min Principal Stress | Max Shear Stress | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Min | Max | Min | Max | Min | Max | Min | Max | Min | Max | Min | Max | Min | Max | Min | Max | |
No Rafters | 0.00 | 2.01 mm | -0.11 mm | 0.32 mm | -0.24 mm | 0.10 mm | -2.01 mm | 800.04 nm | 0.00 Pa | 5847.87 kPa | -191.14 kPa | 6037.13 kPa | -5486.84 kPa | 285.32 kPa | 0.00 Pa | 2969.41 kPa |
22.5° rafter | 0.00 | 0.22 mm | -17.67 µm | 92.32 µm | -46.55 µm | 14.54 µm | -0.23 mm | 164.74 nm | 0.00 Pa | 2020.39 kPa | -118.97 kPa | 2101.76 kPa | -1742,35 kPa | 119.10 kPa | 0.00 Pa | 1014.03 kPa |
22.5° × 2 rafters | 0.00 | 0.16 mm | -13.67 µm | 63.63 µm | -35.62 µm | 9.99 µm | -0.15 mm | 148.73 nm | 0.00 Pa | 1324.45 kPa | -108.65 kPa | 1142.64 kPa | -1356.50 kPa | 60.92 kPa | 0 Pa | 672.31 kPa |
45° rafter | 10 | 11 | 12 | |||||||||||||
Roof + No Rafters | 1 | 2 | 3 | |||||||||||||
Roof + 22.5° rafter | 4 | 5 | 6 | |||||||||||||
Roof + 22.5° × 2 rafters | 7 | 8 | 9 | |||||||||||||
Roof + 45° rafter | 10 | 11 | 12 |
The Cases
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
OBJ
-
The imported cube has double nodes, and the color is strange.
-
(If normals are fixed (shift+N in edit mode) the box will look better. This is not used in the following parts).
-
It works flawless in the FreeCAD.
-
The FreeCAD FEM solver gives some results.
-
However, when importing to GMSH, it will produce an error.
STL
-
Meshing works, if the normals are done.
-
If the cube is exported as STL, then GMSH will work better (if not normals done).
-
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)". (if not normals done.)
Two Cubes
-
The two cubes made in Blender. The mesh looks fine, and there are none self intersecting nodes.
-
When importing the Obj file back to Blender, the seems to be missing some faces.
-
Seems that some of the normals are faced wrong way. In edit mode use (Ctrl+A) shift+N to fix this.
-
Tetrahedron count is more than zero! It seems to work.
-
The FEM results seems to be working. The force is 10 N.
The Door Canopy
Couldn't do the model using Blender and Freecad/ Gmsh.
Make it step by step.
-
First part works, though the dimensions are totally wrong. In the inset is the Blender Edit mode image of the same part.
-
Set the scale from Blender export (1000x). Now the stress is visible, and dimensions are correct. Nice to work with familiar units.
-
Already second part (or third) gives problems. The mesh cannot be generated. This is with STL export.
-
If tested using OBJ format, there will be some places without faces, and no tetrahedron in the mesh.
Gmsh
-
Gmsh makes the FEM mesh for the first part, and by refining the mesh, it will be clearer.
-
Gmsh can use the second part, also. Need to check if FreeCAD can read that file.
-
FreeCAD has also Gmsh mesh generator. That will generate the mesh, but while solving gives an error: "Nodes, but no results found in frd file. It means there only is a mesh but no results in frd file. Usually this happens if CalculiX returned no results (happens on nonpositive jacobian determinant in at least one element)"
-
By trying again, it works! Force is 10 N.
-
Changed the Force to 100 N, and the maximum size of mesh to 10. The later increased the computation time a lot, the time being about 9 s.
FreeCAD Tutorials
Good tutorials for noobies
Theory
Frame formulas: https://structx.com/frames.html