Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -32,11 +32,11 @@ def plot_convex_hull(points):
|
|
32 |
# Function to create and save 3D meshes
|
33 |
def create_3d_meshes():
|
34 |
box_a = pymesh.generate_box_mesh([0,0,0], [1,1,1])
|
35 |
-
pymesh.save_mesh("
|
36 |
|
37 |
box_b = pymesh.generate_box_mesh([0.4,0.4,0], [0.6,0.6,1])
|
38 |
box_c = pymesh.boolean(box_a, box_b, operation='difference', engine="igl")
|
39 |
-
pymesh.save_mesh("
|
40 |
|
41 |
# Function to create and save solid models
|
42 |
def create_solid_models():
|
@@ -47,7 +47,7 @@ def create_solid_models():
|
|
47 |
t = translate([2, 0, 0])(c)
|
48 |
e = linear_extrude(height=10, center=True, convexity=10, twist=-500, slices=500)(t)
|
49 |
col = color('lightgreen')(e)
|
50 |
-
scad_render_to_file(col, '
|
51 |
|
52 |
# Streamlit UI
|
53 |
st.title("3D Graphics and Geometry with Streamlit")
|
@@ -63,9 +63,9 @@ points = np.array([[0, 0], [-2, 0], [-2, 2], [0, 1.5], [2, 2], [2, 0]])
|
|
63 |
plot_convex_hull(points)
|
64 |
|
65 |
if st.button('Create and Save 3D Meshes'):
|
66 |
-
create_3d_meshes()
|
67 |
-
st.write("3D meshes saved to files.")
|
68 |
|
69 |
if st.button('Create and Save Solid Models'):
|
70 |
-
create_solid_models()
|
71 |
-
st.write("Solid models saved to files.")
|
|
|
32 |
# Function to create and save 3D meshes
|
33 |
def create_3d_meshes():
|
34 |
box_a = pymesh.generate_box_mesh([0,0,0], [1,1,1])
|
35 |
+
pymesh.save_mesh("pymesh_example_01.stl", box_a, ascii=False)
|
36 |
|
37 |
box_b = pymesh.generate_box_mesh([0.4,0.4,0], [0.6,0.6,1])
|
38 |
box_c = pymesh.boolean(box_a, box_b, operation='difference', engine="igl")
|
39 |
+
pymesh.save_mesh("pymesh_example_02.stl", box_c, ascii=False)
|
40 |
|
41 |
# Function to create and save solid models
|
42 |
def create_solid_models():
|
|
|
47 |
t = translate([2, 0, 0])(c)
|
48 |
e = linear_extrude(height=10, center=True, convexity=10, twist=-500, slices=500)(t)
|
49 |
col = color('lightgreen')(e)
|
50 |
+
scad_render_to_file(col, 'solidpython_example_02.scad')
|
51 |
|
52 |
# Streamlit UI
|
53 |
st.title("3D Graphics and Geometry with Streamlit")
|
|
|
63 |
plot_convex_hull(points)
|
64 |
|
65 |
if st.button('Create and Save 3D Meshes'):
|
66 |
+
create_3d_meshes()
|
67 |
+
st.write("3D meshes saved to files.")
|
68 |
|
69 |
if st.button('Create and Save Solid Models'):
|
70 |
+
create_solid_models()
|
71 |
+
st.write("Solid models saved to files.")
|