FEM and Blender: Difference between revisions

From wikiluntti
Line 55: Line 55:


== FreeCAD import ==
== FreeCAD import ==
Steps:
* Export in Blender
* 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
* Self intersections


== References ==
== References ==

Revision as of 10:57, 28 June 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 in Blender
  • 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
  • Self intersections

References