import streamlit as st # Constants BRICK_VOLUME_CFT = (9/12) * (4.5/12) * (3/12) # in cubic feet CEMENT_SAND_RATIO = 1 / 6 # Cement in 1:6 mortar SAND_RATIO = 5 / 6 # Sand in 1:6 mortar CEMENT_DENSITY_KG_PER_CFT = 1440 / 35.3147 # kg/cft approx CEMENT_BAG_WEIGHT_KG = 50 st.set_page_config(page_title="Brick, Cement & Sand Estimator", page_icon="🏗️") st.title("🏗️ Brick, Cement & Sand Estimation App") st.header("📏 Room Dimensions (in feet)") length = st.number_input("Room Length", min_value=1.0) width = st.number_input("Room Width", min_value=1.0) height = st.number_input("Room Height", min_value=1.0) wall_thickness = st.number_input("Wall Thickness", value=0.75, help="Typically 0.75 feet for 9-inch walls") st.header("🚪 Openings (Doors, Windows, Others)") num_openings = st.number_input("Total Number of Openings", min_value=0, step=1) openings = [] for i in range(num_openings): st.subheader(f"Opening #{i+1}") o_length = st.number_input(f"Length of Opening #{i+1} (ft)", min_value=0.0, key=f"length_{i}") o_height = st.number_input(f"Height of Opening #{i+1} (ft)", min_value=0.0, key=f"height_{i}") has_beam = st.checkbox(f"Add Beam Over Opening #{i+1}?", value=True, key=f"beam_{i}") openings.append({ "length": o_length, "height": o_height, "has_beam": has_beam }) st.header("🧱 Estimation Result") if st.button("Estimate Quantities"): # Total wall volume wall_area = 2 * (length + width) * height wall_volume = wall_area * wall_thickness total_opening_volume = 0 total_beam_volume = 0 for op in openings: vol = op["length"] * op["height"] * wall_thickness total_opening_volume += vol if op["has_beam"]: beam_length = op["length"] + 1 # 1 ft extra beam_volume = beam_length * 0.75 * 0.75 # 9"x9" beam in ft total_beam_volume += beam_volume net_volume = wall_volume - total_opening_volume - total_beam_volume # Brick calculation number_of_bricks = net_volume / BRICK_VOLUME_CFT number_of_bricks = round(number_of_bricks * 1.05) # 5% waste # Mortar volume (25% of brickwork volume) mortar_volume = net_volume * 0.25 # Cement and sand volumes cement_volume = mortar_volume * CEMENT_SAND_RATIO sand_volume = mortar_volume * SAND_RATIO # Cement in bags cement_bag_volume_cft = CEMENT_BAG_WEIGHT_KG / CEMENT_DENSITY_KG_PER_CFT cement_bags = cement_volume / cement_bag_volume_cft cement_bags = round(cement_bags) st.subheader("📊 Estimated Quantities:") st.write(f"🧱 **Bricks Needed:** {number_of_bricks:,} bricks") st.write(f"🏖️ **Sand Needed:** {sand_volume:.2f} cft") st.write(f"🪣 **Cement Needed:** {cement_bags} bags (50kg each)")