|
import streamlit as st |
|
|
|
|
|
st.title("π Room Brick Masonry Estimator") |
|
st.write(""" |
|
This app estimates the number of bricks and the amount of mortar required for constructing a room. |
|
Input the dimensions of the room, gate, window, and bricks, and the app will calculate the required quantities. |
|
""") |
|
|
|
|
|
st.sidebar.title("Instructions") |
|
st.sidebar.write(""" |
|
1. Enter the dimensions of the room (height, length, and width in meters, wall width in inches). |
|
2. Enter the dimensions of the gate and window (in meters). |
|
3. Enter the dimensions of a single brick (in inches). |
|
4. Click the **Estimate Requirements** button to calculate the number of bricks and mortar volume. |
|
5. Reset inputs using the **Clear Inputs** button. |
|
""") |
|
|
|
|
|
st.subheader("Room Dimensions") |
|
room_height = st.number_input("Room Height (meters):", min_value=0.1, step=0.1, format="%.2f") |
|
room_length = st.number_input("Room Length (meters):", min_value=0.1, step=0.1, format="%.2f") |
|
room_width = st.number_input("Room Width (meters):", min_value=0.1, step=0.1, format="%.2f") |
|
wall_thickness_in = st.number_input("Wall Thickness (inches):", min_value=1.0, step=0.1, format="%.1f") |
|
|
|
|
|
st.subheader("Gate Dimensions") |
|
gate_height = st.number_input("Gate Height (meters):", min_value=0.1, step=0.1, format="%.2f") |
|
gate_width = st.number_input("Gate Width (meters):", min_value=0.1, step=0.1, format="%.2f") |
|
|
|
|
|
st.subheader("Window Dimensions") |
|
window_height = st.number_input("Window Height (meters):", min_value=0.1, step=0.1, format="%.2f") |
|
window_width = st.number_input("Window Width (meters):", min_value=0.1, step=0.1, format="%.2f") |
|
|
|
|
|
st.subheader("Brick Dimensions") |
|
brick_height_in = st.number_input("Brick Height (inches):", min_value=1.0, step=0.1, format="%.1f") |
|
brick_length_in = st.number_input("Brick Length (inches):", min_value=1.0, step=0.1, format="%.1f") |
|
brick_width_in = st.number_input("Brick Width (inches):", min_value=1.0, step=0.1, format="%.1f") |
|
|
|
|
|
if st.button("Estimate Requirements"): |
|
if room_height <= 0 or room_length <= 0 or room_width <= 0: |
|
st.error("Room dimensions must be greater than zero!") |
|
elif gate_height <= 0 or gate_width <= 0: |
|
st.error("Gate dimensions must be greater than zero!") |
|
elif window_height <= 0 or window_width <= 0: |
|
st.error("Window dimensions must be greater than zero!") |
|
elif brick_height_in <= 0 or brick_length_in <= 0 or brick_width_in <= 0: |
|
st.error("Brick dimensions must be greater than zero!") |
|
else: |
|
|
|
wall_thickness_m = wall_thickness_in * 0.0254 |
|
brick_height_m = brick_height_in * 0.0254 |
|
brick_length_m = brick_length_in * 0.0254 |
|
brick_width_m = brick_width_in * 0.0254 |
|
|
|
|
|
room_wall_volume = 2 * (room_height * room_length * wall_thickness_m) + 2 * (room_height * room_width * wall_thickness_m) |
|
gate_volume = gate_height * gate_width * wall_thickness_m |
|
window_volume = window_height * window_width * wall_thickness_m |
|
net_wall_volume = room_wall_volume - (gate_volume + window_volume) |
|
brick_volume = brick_height_m * brick_length_m * brick_width_m |
|
|
|
|
|
if brick_volume > 0: |
|
num_bricks = net_wall_volume / brick_volume |
|
mortar_volume = net_wall_volume * 0.2 |
|
|
|
|
|
st.subheader("Results") |
|
st.write(f"**Net Wall Volume:** {net_wall_volume:.2f} cubic meters") |
|
st.write(f"**Number of Bricks Required:** {int(num_bricks)} bricks") |
|
st.write(f"**Mortar Volume Required:** {mortar_volume:.2f} cubic meters") |
|
else: |
|
st.error("Brick dimensions must form a valid volume!") |
|
|
|
|
|
if st.button("Clear Inputs"): |
|
st.experimental_rerun() |
|
|
|
|
|
st.write("---") |
|
st.markdown("π‘ **Developed by Abdullah**") |
|
|