File size: 647 Bytes
15e56d9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import trimesh
from cadquery.occ_impl.exporters import exportShape

def generate_3d_stl(height, radius, thickness):
    """
    Create and export the 3D STL file for the ear-like bird shell.
    """
    bird_shell_model = create_bird_ear_shell(height, radius, thickness)
    stl_path = "ear_bird_shell.stl"
    with open(stl_path, "wb") as f:
        exportShape(bird_shell_model.val(), "STL", f)
    return stl_path

def visualize_3d_stl(stl_path):
    """
    Visualize the 3D model from the STL file.
    """
    # Load the STL file into a Trimesh object
    shell_mesh = trimesh.load(stl_path)
    # Display the 3D model
    shell_mesh.show()