|
|
import streamlit as st |
|
|
|
|
|
|
|
|
def convert_to_sqm(length, width, unit): |
|
|
if unit == "Meters (m)": |
|
|
return length * width |
|
|
elif unit == "Centimeters (cm)": |
|
|
return (length / 100) * (width / 100) |
|
|
elif unit == "Millimeters (mm)": |
|
|
return (length / 1000) * (width / 1000) |
|
|
|
|
|
|
|
|
def calculate_c_channels(area, rod_length, horizontal_spacing, vertical_spacing): |
|
|
if rod_length <= 0 or horizontal_spacing <= 0 or vertical_spacing <= 0: |
|
|
return None |
|
|
|
|
|
|
|
|
horizontal_rods = area / horizontal_spacing |
|
|
vertical_rods = area / vertical_spacing |
|
|
|
|
|
|
|
|
total_rods = (horizontal_rods + vertical_rods) / rod_length |
|
|
return total_rods |
|
|
|
|
|
|
|
|
st.set_page_config(page_title="Area, Gypsum Board & C Channel Calculator", layout="wide") |
|
|
|
|
|
st.title("π Multi-Purpose Calculator") |
|
|
st.markdown("Calculate area, gypsum board requirements, and C Channel/Rod usage.") |
|
|
|
|
|
|
|
|
st.subheader("πΉ Main Area Input") |
|
|
unit = st.selectbox("Select the unit of measurement:", ["Meters (m)", "Centimeters (cm)", "Millimeters (mm)"]) |
|
|
|
|
|
length = st.number_input("Enter Length:", min_value=0.0, format="%.2f") |
|
|
width = st.number_input("Enter Width:", min_value=0.0, format="%.2f") |
|
|
|
|
|
|
|
|
total_area = convert_to_sqm(length, width, unit) |
|
|
|
|
|
|
|
|
st.subheader("πΉ Excluded Area (Optional)") |
|
|
exclude_length = st.number_input("Enter Length of Excluded Area:", min_value=0.0, format="%.2f", key="ex_len") |
|
|
exclude_width = st.number_input("Enter Width of Excluded Area:", min_value=0.0, format="%.2f", key="ex_wid") |
|
|
|
|
|
excluded_area = convert_to_sqm(exclude_length, exclude_width, unit) |
|
|
final_area = total_area - excluded_area |
|
|
|
|
|
st.markdown(f"### β
Total Area: `{final_area:.2f} mΒ²`") |
|
|
|
|
|
|
|
|
st.subheader("π Gypsum Board Calculation") |
|
|
gypsum_board_area = st.number_input("Enter Area of a Single Gypsum Board (mΒ²):", min_value=0.1, format="%.2f") |
|
|
|
|
|
if st.button("Calculate Required Gypsum Boards"): |
|
|
if gypsum_board_area > 0: |
|
|
num_boards = final_area / gypsum_board_area |
|
|
st.success(f"π You will need approximately `{num_boards:.2f}` gypsum boards.") |
|
|
else: |
|
|
st.error("Please enter a valid gypsum board area.") |
|
|
|
|
|
|
|
|
st.subheader("π Enter a Custom Area for Gypsum Board Calculation") |
|
|
custom_area = st.number_input("Enter Total Area in mΒ²:", min_value=0.0, format="%.2f", key="custom_area") |
|
|
|
|
|
if st.button("Calculate Required Gypsum Boards (Based on Custom Area)"): |
|
|
if gypsum_board_area > 0: |
|
|
num_boards_custom = custom_area / gypsum_board_area |
|
|
st.success(f"π You will need approximately `{num_boards_custom:.2f}` gypsum boards.") |
|
|
else: |
|
|
st.error("Please enter a valid gypsum board area.") |
|
|
|
|
|
|
|
|
st.subheader("π C Channel/Rod Calculation") |
|
|
|
|
|
c_area = st.number_input("Enter Total Area to Cover (mΒ²):", min_value=0.0, format="%.2f", key="c_area") |
|
|
rod_length = st.number_input("Enter Length of One C Channel/Rod (meters):", min_value=0.1, format="%.2f", key="rod_length") |
|
|
horizontal_spacing = st.number_input("Enter Horizontal Distance Between Rods (meters):", min_value=0.1, format="%.2f", key="h_spacing") |
|
|
vertical_spacing = st.number_input("Enter Vertical Distance Between Rods (meters):", min_value=0.1, format="%.2f", key="v_spacing") |
|
|
|
|
|
if st.button("Calculate Required C Channels/Rods"): |
|
|
rods_required = calculate_c_channels(c_area, rod_length, horizontal_spacing, vertical_spacing) |
|
|
if rods_required is not None: |
|
|
st.success(f"π You will need approximately `{rods_required:.2f}` C Channels/Rods.") |
|
|
else: |
|
|
st.error("Please enter valid values for the C Channel/Rod calculation.") |
|
|
|
|
|
|
|
|
st.markdown("---") |
|
|
st.markdown("Developed with β€οΈ using Streamlit.") |
|
|
|