forked from gbowne1/learn_python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sheetmetalcalc.py
32 lines (21 loc) · 1.37 KB
/
sheetmetalcalc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# This is a sheet metal usage calculator
# to determine how many parts of a certain size (l x w) be made from
# a certain size (l x w) sheet of metallic material.
# allow for 90deg arrangement of parts
import math
length = float(input("Input the length of your sheet in inches: "))
width = float(input("Input the width of your sheet in inches: "))
margin = float(input("Input the margin width of your sheet in inches: "))
part_len = float(input("Input the length of your part in inches: "))
part_wid = float(input("Input the width of your part in inches: "))
area_big = length * width
area_little = part_len * part_wid
print(f"The area of your sheet is {area_big:.2f} square inches.")
print(f"The area your parts cover across your sheet is {area_little:.2f} square inches.")
area_big = (length - 2 * margin / 2) * (width - 2 * margin / 2)
area_little = (part_len + margin / 2) * (part_wid + margin / 2)
parts = math.floor(area_big / area_little)
print(f"{parts} pieces can be cut from the sheet. ")
print(f"The area your parts cover across your sheet is {parts * (part_len * part_wid)} square inches.")
print(f"The number of parts that fit on this sheet length in this configuration is {math.floor((length - margin) / (part_len + margin / 2))}. ")
print(f"The number of parts that fit on this sheet width in this configuration is {math.floor((width - margin) / (part_wid + margin / 2))}. ")