engrmuhammadrizwan01 commited on
Commit
59a4607
·
verified ·
1 Parent(s): 8284bcb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -5
app.py CHANGED
@@ -9,11 +9,19 @@ def convert_to_sqm(length, width, unit):
9
  elif unit == "Millimeters (mm)":
10
  return (length / 1000) * (width / 1000)
11
 
 
 
 
 
 
 
 
 
12
  # Streamlit UI Configuration
13
- st.set_page_config(page_title="Area & Gypsum Board Calculator", layout="wide")
14
 
15
- st.title("📐 Area & Gypsum Board Calculator")
16
- st.markdown("Calculate the total area with unit conversion and estimate gypsum board requirements.")
17
 
18
  # Section 1: Area Calculation
19
  st.subheader("🔹 Main Area Input")
@@ -35,11 +43,11 @@ final_area = total_area - excluded_area
35
 
36
  st.markdown(f"### ✅ Total Area: `{final_area:.2f} m²`")
37
 
38
- # Section 2: Gypsum Board Calculation (Based on Calculated Area)
39
  st.subheader("🛠 Gypsum Board Calculation")
40
  gypsum_board_area = st.number_input("Enter Area of a Single Gypsum Board (m²):", min_value=0.1, format="%.2f")
41
 
42
- if st.button("Calculate Required Gypsum Boards (Based on Calculated Area)"):
43
  if gypsum_board_area > 0:
44
  num_boards = final_area / gypsum_board_area
45
  st.success(f"📌 You will need approximately `{num_boards:.2f}` gypsum boards.")
@@ -57,6 +65,21 @@ if st.button("Calculate Required Gypsum Boards (Based on Custom Area)"):
57
  else:
58
  st.error("Please enter a valid gypsum board area.")
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  # Footer
61
  st.markdown("---")
62
  st.markdown("Developed with ❤️ using Streamlit.")
 
9
  elif unit == "Millimeters (mm)":
10
  return (length / 1000) * (width / 1000)
11
 
12
+ # Function to calculate required C Channels/Rods
13
+ def calculate_c_channels(area, rod_length, box_length, box_width):
14
+ if rod_length <= 0 or box_length <= 0 or box_width <= 0:
15
+ return None
16
+ box_perimeter = 2 * (box_length + box_width)
17
+ rods_needed = (area / box_perimeter) / rod_length
18
+ return rods_needed
19
+
20
  # Streamlit UI Configuration
21
+ st.set_page_config(page_title="Area, Gypsum Board & C Channel Calculator", layout="wide")
22
 
23
+ st.title("📐 Multi-Purpose Calculator")
24
+ st.markdown("Calculate area, gypsum board requirements, and C Channel/Rod usage.")
25
 
26
  # Section 1: Area Calculation
27
  st.subheader("🔹 Main Area Input")
 
43
 
44
  st.markdown(f"### ✅ Total Area: `{final_area:.2f} m²`")
45
 
46
+ # Section 2: Gypsum Board Calculation
47
  st.subheader("🛠 Gypsum Board Calculation")
48
  gypsum_board_area = st.number_input("Enter Area of a Single Gypsum Board (m²):", min_value=0.1, format="%.2f")
49
 
50
+ if st.button("Calculate Required Gypsum Boards"):
51
  if gypsum_board_area > 0:
52
  num_boards = final_area / gypsum_board_area
53
  st.success(f"📌 You will need approximately `{num_boards:.2f}` gypsum boards.")
 
65
  else:
66
  st.error("Please enter a valid gypsum board area.")
67
 
68
+ # Section 4: C Channel/Rod Calculation
69
+ st.subheader("🛠 C Channel/Rod Calculation")
70
+
71
+ c_area = st.number_input("Enter Total Area to Cover (m²):", min_value=0.0, format="%.2f", key="c_area")
72
+ rod_length = st.number_input("Enter Length of One C Channel/Rod (meters):", min_value=0.1, format="%.2f", key="rod_length")
73
+ box_length = st.number_input("Enter Length of Box Made by C Channel/Rod (meters):", min_value=0.1, format="%.2f", key="box_length")
74
+ box_width = st.number_input("Enter Width of Box Made by C Channel/Rod (meters):", min_value=0.1, format="%.2f", key="box_width")
75
+
76
+ if st.button("Calculate Required C Channels/Rods"):
77
+ rods_required = calculate_c_channels(c_area, rod_length, box_length, box_width)
78
+ if rods_required is not None:
79
+ st.success(f"📌 You will need approximately `{rods_required:.2f}` C Channels/Rods.")
80
+ else:
81
+ st.error("Please enter valid values for the C Channel/Rod calculation.")
82
+
83
  # Footer
84
  st.markdown("---")
85
  st.markdown("Developed with ❤️ using Streamlit.")