karthikmn commited on
Commit
c97d9a6
·
verified ·
1 Parent(s): 38f21e9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -11,7 +11,7 @@ def generate_die(length, width, thickness):
11
  die = plate.cut(punch)
12
  filename = "progressive_die.step"
13
  cq.exporters.export(die, filename)
14
- return f"Progressive die design saved as {filename}"
15
  except Exception as e:
16
  return f"Error generating die: {str(e)}"
17
 
@@ -25,7 +25,9 @@ def stress_analysis(force, die_width, die_height, material_strength):
25
  ax.bar(["Stress", "Material Strength"], [stress, material_strength])
26
  ax.set_ylabel("Stress (MPa)")
27
  ax.set_title("Stress Analysis")
28
- plt.close(fig)
 
 
29
 
30
  return f"Safety Factor: {round(safety_factor, 2)}", fig
31
  except Exception as e:
 
11
  die = plate.cut(punch)
12
  filename = "progressive_die.step"
13
  cq.exporters.export(die, filename)
14
+ return f"Progressive die design saved as {filename}. You can download the file."
15
  except Exception as e:
16
  return f"Error generating die: {str(e)}"
17
 
 
25
  ax.bar(["Stress", "Material Strength"], [stress, material_strength])
26
  ax.set_ylabel("Stress (MPa)")
27
  ax.set_title("Stress Analysis")
28
+
29
+ plt.tight_layout() # Ensure the plot is displayed correctly
30
+ plt.close(fig) # Close the plot so it doesn't render twice
31
 
32
  return f"Safety Factor: {round(safety_factor, 2)}", fig
33
  except Exception as e: