Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| # Function to calculate the number of bricks including mortar, wall thickness, and wastage margin (in feet) | |
| def calculate_bricks(wall_length, wall_height, wall_thickness, brick_length, brick_height, brick_thickness, mortar_thickness): | |
| # Convert all input dimensions from feet to meters | |
| meters_per_foot = 0.3048 | |
| wall_length_m = wall_length * meters_per_foot | |
| wall_height_m = wall_height * meters_per_foot | |
| wall_thickness_m = wall_thickness * meters_per_foot | |
| brick_length_m = brick_length * meters_per_foot | |
| brick_height_m = brick_height * meters_per_foot | |
| brick_thickness_m = brick_thickness * meters_per_foot | |
| mortar_thickness_m = mortar_thickness * meters_per_foot | |
| # Adjust the brick dimensions by adding the mortar thickness to the brick size | |
| total_brick_length = brick_length_m + mortar_thickness_m | |
| total_brick_height = brick_height_m + mortar_thickness_m | |
| total_brick_thickness = brick_thickness_m + mortar_thickness_m | |
| # Volume of the wall in cubic meters | |
| wall_volume = wall_length_m * wall_height_m * wall_thickness_m | |
| # Volume of one brick with mortar in cubic meters | |
| brick_volume_with_mortar = total_brick_length * total_brick_height * total_brick_thickness | |
| # Calculate the number of bricks (including mortar) | |
| number_of_bricks = wall_volume / brick_volume_with_mortar | |
| # Add 5% wastage margin | |
| number_of_bricks_with_wastage = number_of_bricks * 1.05 | |
| return number_of_bricks_with_wastage | |
| # Streamlit app layout | |
| st.title('Brick Calculation with Mortar, Wall Thickness, and Wastage Margin (Feet)') | |
| st.sidebar.header('Enter Wall, Brick, and Mortar Dimensions in Feet') | |
| # Input fields | |
| wall_length = st.sidebar.number_input('Wall Length (in feet)', min_value=0.1, value=15.0) | |
| wall_height = st.sidebar.number_input('Wall Height (in feet)', min_value=0.1, value=10.0) | |
| wall_thickness = st.sidebar.number_input('Wall Thickness (in feet)', min_value=0.1, value=1.0) # New input for wall thickness | |
| brick_length = st.sidebar.number_input('Brick Length (in feet)', min_value=0.1, value=0.67) | |
| brick_height = st.sidebar.number_input('Brick Height (in feet)', min_value=0.1, value=0.33) | |
| brick_thickness = st.sidebar.number_input('Brick Thickness (in feet)', min_value=0.1, value=0.25) | |
| mortar_thickness = st.sidebar.number_input('Mortar Thickness (in feet)', min_value=0.01, value=0.05) | |
| # Button to calculate | |
| if st.sidebar.button('Calculate Number of Bricks'): | |
| result = calculate_bricks(wall_length, wall_height, wall_thickness, brick_length, brick_height, brick_thickness, mortar_thickness) | |
| st.write(f'The total number of bricks needed for the wall (including mortar, wall thickness, and 5% wastage) is: {result:.0f}') | |