|
|
|
|
|
import streamlit as st |
|
|
|
|
|
def calculate_tiles(area_length, area_width, area_height, tile_length, tile_width, door_area=0, exhaust_area=0): |
|
|
|
|
|
floor_area = area_length * area_width |
|
|
|
|
|
|
|
|
wall_area = 2 * (area_length * area_height) + 2 * (area_width * area_height) - (door_area + exhaust_area) |
|
|
|
|
|
|
|
|
total_area = floor_area + wall_area |
|
|
|
|
|
|
|
|
tile_area = tile_length * tile_width |
|
|
|
|
|
|
|
|
num_tiles = total_area / tile_area |
|
|
|
|
|
return floor_area, wall_area, total_area, num_tiles |
|
|
|
|
|
def calculate_bond_bags(num_tiles, tiles_per_bag): |
|
|
|
|
|
num_bags = num_tiles / tiles_per_bag |
|
|
return num_bags |
|
|
|
|
|
def main(): |
|
|
st.set_page_config(page_title="Tile Calculator", page_icon="π", layout="centered") |
|
|
|
|
|
|
|
|
st.title("π Tile Calculator App") |
|
|
st.markdown( |
|
|
""" |
|
|
Welcome to the Tile Calculator! π¨ Use this app to calculate the number of tiles required for walls and floors, adjust for doors and exhaust spaces, and estimate the bond bags required. |
|
|
""" |
|
|
) |
|
|
|
|
|
|
|
|
st.header("Room Dimensions") |
|
|
area_length = st.number_input("Room Length (in feet):", min_value=0.0, step=0.1, format="%.2f") |
|
|
area_width = st.number_input("Room Width (in feet):", min_value=0.0, step=0.1, format="%.2f") |
|
|
area_height = st.number_input("Room Height (in feet):", min_value=0.0, step=0.1, format="%.2f") |
|
|
|
|
|
|
|
|
st.header("Tile Dimensions") |
|
|
tile_length = st.number_input("Tile Length (in feet):", min_value=0.0, step=0.1, format="%.2f") |
|
|
tile_width = st.number_input("Tile Width (in feet):", min_value=0.0, step=0.1, format="%.2f") |
|
|
|
|
|
|
|
|
st.header("Adjustments for Doors and Exhaust") |
|
|
door_area = st.number_input("Total Door Area (in square feet):", min_value=0.0, step=0.1, format="%.2f") |
|
|
exhaust_area = st.number_input("Total Exhaust Area (in square feet):", min_value=0.0, step=0.1, format="%.2f") |
|
|
|
|
|
|
|
|
if st.button("Calculate Tiles"): |
|
|
if area_length > 0 and area_width > 0 and area_height > 0 and tile_length > 0 and tile_width > 0: |
|
|
floor_area, wall_area, total_area, num_tiles = calculate_tiles( |
|
|
area_length, area_width, area_height, tile_length, tile_width, door_area, exhaust_area |
|
|
) |
|
|
|
|
|
st.success("Calculation Complete!") |
|
|
st.subheader("Results") |
|
|
st.write(f"**Floor Area:** {floor_area:.2f} sq. feet") |
|
|
st.write(f"**Wall Area (adjusted for doors and exhaust):** {wall_area:.2f} sq. feet") |
|
|
st.write(f"**Total Area to be Tiled:** {total_area:.2f} sq. feet") |
|
|
st.write(f"**Number of Tiles Required:** {num_tiles:.0f}") |
|
|
|
|
|
|
|
|
st.header("Bond Bag Estimation") |
|
|
tiles_per_bag = st.number_input("Number of tiles covered per bond bag:", min_value=0.0, step=0.1, format="%.2f") |
|
|
if tiles_per_bag > 0: |
|
|
num_bags = calculate_bond_bags(num_tiles, tiles_per_bag) |
|
|
st.write(f"**Estimated Number of Bond Bags Required:** {num_bags:.0f}") |
|
|
else: |
|
|
st.warning("Please enter a valid number of tiles covered per bond bag.") |
|
|
else: |
|
|
st.error("Please enter all dimensions greater than zero.") |
|
|
|
|
|
|
|
|
st.markdown( |
|
|
""" |
|
|
--- |
|
|
Created with π by [Your Name](https://huggingface.co/). |
|
|
""" |
|
|
) |
|
|
|
|
|
if __name__ == "__main__": |
|
|
main() |
|
|
|