awacke1 commited on
Commit
a50d8e2
·
verified ·
1 Parent(s): e76f8e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -8,6 +8,7 @@ import pymesh
8
  from solid import *
9
  from solid.utils import *
10
  import os
 
11
 
12
  def plot_vertices_and_mesh(vertices, faces):
13
  fig = plt.figure()
@@ -28,11 +29,15 @@ def plot_convex_hull(points):
28
  st.pyplot(plt)
29
 
30
  def create_3d_meshes():
31
- box_a = pymesh.generate_box_mesh([0, 0, 0], [1, 1, 1])
32
- box_b = pymesh.generate_box_mesh([0.4, 0.4, 0], [0.6, 0.6, 1])
33
- box_c = pymesh.boolean(box_a, box_b, operation='difference', engine="igl")
34
- pymesh.save_mesh("pymesh_example_01.stl", box_a, ascii=False)
35
- pymesh.save_mesh("pymesh_example_02.stl", box_c, ascii=False)
 
 
 
 
36
  st.write("3D meshes saved to files.")
37
 
38
  def create_solid_models():
 
8
  from solid import *
9
  from solid.utils import *
10
  import os
11
+ import trimesh
12
 
13
  def plot_vertices_and_mesh(vertices, faces):
14
  fig = plt.figure()
 
29
  st.pyplot(plt)
30
 
31
  def create_3d_meshes():
32
+ # Create a box mesh
33
+ box_a = trimesh.creation.box(extents=[1, 1, 1])
34
+ box_a.export('pymesh_example_01.stl')
35
+
36
+ # Create another box mesh and perform a boolean operation
37
+ box_b = trimesh.creation.box(extents=[0.2, 0.2, 1], translate=[0.4, 0.4, 0])
38
+ box_c = box_a.difference(box_b)
39
+ box_c.export('pymesh_example_02.stl')
40
+
41
  st.write("3D meshes saved to files.")
42
 
43
  def create_solid_models():