FEM and Blender: Difference between revisions

From wikiluntti
 
Line 138: Line 138:
*    Young's Modulus 12.00 GPa
*    Young's Modulus 12.00 GPa
*    Poisson Ratio 0.05
*    Poisson Ratio 0.05
Force: 1000 N, downwards (about).


{| class="wikitable"
{| class="wikitable"
Line 148: Line 150:
| 22.5° rafter || 20407 || 6684 || 9775 || Example
| 22.5° rafter || 20407 || 6684 || 9775 || Example
|-
|-
| 22.5° × 2 rafters || Example || Example || Example || Example
| 22.5° × 2 rafters || 20185 || 6650 || 9627 || Example
|-
|-
| 45° rafter || Example || Example || Example || Example
| 45° rafter || Example || Example || Example || Example

Latest revision as of 19:06, 2 July 2025

Introduction

Blender and CAD

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

Roof is done with fine mesh, no roofed with even finer mesh.


Caption
Design Displacement magnitude Displacement X Displacement Y Displacement Z von Mises Stress Max Principal Stress Min Principal Stress Max Shear Stress
Min Max [mm] Min [µm] Max [µm] Min [µm] Max [µm] Min [mm] Max [nm] Min Max [kPa] Min [kPa] Max [kPa] Min [kPa] Max [kPa] Min Max [kPa]
No Rafters 0.00 2.01 -110 320 240 100 -2.01 800.04 0.00 5847.87 -191.14 6037.13 -5486.84 285.32 0.00 2969.41
22.5° rafter 0.00 0.22 -17.67 92.32 -46.55 14.54 -0.23 164.74 0.00 2020.39 -118.97 2101.76 -1742,35 119.10 0.00 1014.03
22.5° × 2 rafters 0.00 0.16 -13.67 63.63 -35.62 9.99 -0.15 148.73 0.00 1324.45 -108.65 1142.64 -1356.50 60.92 0 672.31
45° rafter 10 11 12
No Rafters + Roof 0.00 76.54 -15.85 8.37 -4.87 8.94 -0.076 121.03 0 2643.85 -391.25 618.96 -2727.37 33.93 0.0 1395.93
Roof + 22.5° rafter 4 5 6
Roof + 22.5° × 2 rafters 7 8 9
Roof + 45° rafter 10 11 12


Simulation parameters

  • Roof Sheet: 1150 x 900 x 22 and

Material: Wood-Generic

  • Density 700 kg/m3
  • Young's Modulus 12.00 GPa
  • Poisson Ratio 0.05

Force: 1000 N, downwards (about).

Caption text
Header text Nodes Triangles Tetrahedron Header text
No Rafters 16413 5424 7786 Example
22.5° rafter 20407 6684 9775 Example
22.5° × 2 rafters 20185 6650 9627 Example
45° rafter Example Example Example Example
No Rafters + roof Example Example Example Example
22.5° rafter + roof Example Example Example Example
22.5° × 2 rafters + roof Example Example Example Example
45° rafter + roof Example Example Example Example

Workflow and test examples

  1. Make the Blender mesh and export as .obj file
  2. 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

STL

Two Cubes

The Door Canopy

Couldn't do the model using Blender and Freecad/ Gmsh.

Make it step by step.

Gmsh

FreeCAD Tutorials

Good tutorials for noobies

Theory

Frame formulas: https://structx.com/frames.html

References