Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,6 +37,13 @@ def generate_3d_view(file):
|
|
| 37 |
return three_d_image
|
| 38 |
except Exception as e:
|
| 39 |
return f"Error generating 3D view: {str(e)}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
# Wrapper function to generate views
|
| 42 |
def generate_views(file):
|
|
|
|
| 37 |
return three_d_image
|
| 38 |
except Exception as e:
|
| 39 |
return f"Error generating 3D view: {str(e)}"
|
| 40 |
+
def generate_3d_view(step_file):
|
| 41 |
+
model = cq.importers.importStep(step_file.name)
|
| 42 |
+
solids = model.val().Solids()
|
| 43 |
+
meshes = [trimesh.Trimesh(vertices=solid.vertices(), faces=solid.faces()) for solid in solids]
|
| 44 |
+
combined_mesh = trimesh.util.concatenate(meshes)
|
| 45 |
+
combined_mesh.show()
|
| 46 |
+
|
| 47 |
|
| 48 |
# Wrapper function to generate views
|
| 49 |
def generate_views(file):
|