File size: 1,806 Bytes
b3a4477
 
df48628
 
b3a4477
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
547f204
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import streamlit as st
from streamlit.components.v1 import html
import streamlit as st


# Embed custom HTML and JS for 3D rendering (Three.js example)
html_code = """
<html>
<head>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
</head>
<body>
  <div id="threejs-container" style="width: 100%; height: 500px;"></div>
  <script>
    // Three.js rendering code here
    var scene = new THREE.Scene();
    var camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
    var renderer = new THREE.WebGLRenderer();
    renderer.setSize(window.innerWidth, window.innerHeight);
    document.getElementById('threejs-container').appendChild(renderer.domElement);
    // Your 3D model or scene setup goes here
    var geometry = new THREE.BoxGeometry();
    var material = new THREE.MeshBasicMaterial({ color: 0x00ff00 });
    var cube = new THREE.Mesh(geometry, material);
    scene.add(cube);
    camera.position.z = 5;
    function animate() {
      requestAnimationFrame(animate);
      cube.rotation.x += 0.01;
      cube.rotation.y += 0.01;
      renderer.render(scene, camera);
    }
    animate();
  </script>
</body>
</html>
"""

# Display the HTML/JS in the Streamlit app
html(html_code)
# User Inputs
wall_height = st.slider("Wall Height (meters)", min_value=2, max_value=5, value=3)
room_length = st.number_input("Room Length (meters)", value=5)
room_width = st.number_input("Room Width (meters)", value=4)

# Action Button for Floor Plan Update
if st.button("Generate Floor Plan"):
    st.write(f"Generating floor plan for {room_length}m x {room_width}m with walls {wall_height}m high")
    # Call a function here that updates the floor plan based on user input
    update_floor_plan(room_length, room_width, wall_height)