Spaces:
Running
Running
preview rotated model
Browse files
app.py
CHANGED
|
@@ -478,8 +478,14 @@ def process_image_and_generate_stl(image_input, depth_near, depth_far, thickness
|
|
| 478 |
prepare_for_3d_printing=True,
|
| 479 |
lift_height=-lift
|
| 480 |
)
|
| 481 |
-
|
| 482 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 483 |
|
| 484 |
|
| 485 |
# Gradio Interface definition
|
|
|
|
| 478 |
prepare_for_3d_printing=True,
|
| 479 |
lift_height=-lift
|
| 480 |
)
|
| 481 |
+
preview_path = stl_path.replace(".stl", "_preview.stl")
|
| 482 |
+
mesh = trimesh.load(stl_path)
|
| 483 |
+
rot = trimesh.transformations.rotation_matrix(np.radians(180), [0, 0, 1])
|
| 484 |
+
rot2 = trimesh.transformations.rotation_matrix(np.radians(-90),[0, 1, 0])
|
| 485 |
+
mesh.apply_transform(rot)
|
| 486 |
+
mesh.apply_transform(rot2)
|
| 487 |
+
mesh.export(preview_path)
|
| 488 |
+
return stl_path, preview_path # Return the path to the generated STL file
|
| 489 |
|
| 490 |
|
| 491 |
# Gradio Interface definition
|