Spaces:
Build error
Build error
Create assets/ example.stl
Browse files- assets/ example.stl +21 -0
assets/ example.stl
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import trimesh
|
| 2 |
+
from cadquery.occ_impl.exporters import exportShape
|
| 3 |
+
|
| 4 |
+
def generate_3d_stl(height, radius, thickness):
|
| 5 |
+
"""
|
| 6 |
+
Create and export the 3D STL file for the ear-like bird shell.
|
| 7 |
+
"""
|
| 8 |
+
bird_shell_model = create_bird_ear_shell(height, radius, thickness)
|
| 9 |
+
stl_path = "ear_bird_shell.stl"
|
| 10 |
+
with open(stl_path, "wb") as f:
|
| 11 |
+
exportShape(bird_shell_model.val(), "STL", f)
|
| 12 |
+
return stl_path
|
| 13 |
+
|
| 14 |
+
def visualize_3d_stl(stl_path):
|
| 15 |
+
"""
|
| 16 |
+
Visualize the 3D model from the STL file.
|
| 17 |
+
"""
|
| 18 |
+
# Load the STL file into a Trimesh object
|
| 19 |
+
shell_mesh = trimesh.load(stl_path)
|
| 20 |
+
# Display the 3D model
|
| 21 |
+
shell_mesh.show()
|