jithenderchoudary commited on
Commit
49cc17c
·
verified ·
1 Parent(s): 325c1b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py CHANGED
@@ -2,6 +2,26 @@ import pyvista as pv
2
  import streamlit as st
3
  from streamlit_pyvista import st_pyvista
4
  import numpy as np
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  # Material properties (dummy data)
7
  materials = {
 
2
  import streamlit as st
3
  from streamlit_pyvista import st_pyvista
4
  import numpy as np
5
+ import pyvista as pv
6
+
7
+ # Generate the punch and die
8
+ punch, die = create_geometry(length, width, height, inner_width, inner_height, die_thickness)
9
+
10
+ # Create and save plot
11
+ plotter = pv.Plotter(off_screen=True)
12
+ plotter.add_mesh(punch, color="blue", opacity=0.5, label="Punch")
13
+ plotter.add_mesh(die, color="red", opacity=0.5, label="Die")
14
+ plotter.add_axes()
15
+ plotter.show_bounds()
16
+ plotter.view_xy()
17
+
18
+ # Save the plot as an image
19
+ plot_path = "visualization.png"
20
+ plotter.screenshot(plot_path)
21
+
22
+ # Display in Streamlit
23
+ st.image(plot_path, caption="Punch and Die Visualization")
24
+
25
 
26
  # Material properties (dummy data)
27
  materials = {