How grebtsew/floorplantoblender3d works
Project type and purpose
• This is a specialized full-stack Python application and library whose core purpose is to take 2D floorplan images and automatically generate corresponding 3D models in Blender.
• It ships with:
• FTBL (FloorplanToBlenderLib) – the core image-processing, detection, geometry-generation and Blender-export library.
• Example scripts and notebooks (Docs, Blender/) that invoke FTBL directly.
• A Flask-based server (Server/) exposing a Swagger documented REST API that accepts images and returns Blender files.
• Docker and Docker-Compose configurations for script, server and Jupyter modes.
File structure
• Top-level: Docker files, README, main.py, requirements, license.
• Server/ – Flask application with subfolders for API handlers (api/), file handling, processing pipeline (process/), configuration (config/), Swagger UI assets, test clients.
• Docs/ – tutorials and Jupyter notebooks.
• Blender/ and Development Center/ – example scripts for exporting to Blender.
• Stacking/ – batch/world-building language and examples.
• Testing/ – pytest suites for both library and server.
README for additional insights
• FTBL library and standalone scripts share the same processing pipeline.
• The server organizes its functionality into REST controllers → business logic in process/ → core FTBL library.
• Docker-Compose brings up three modes: script, server with Swagger, and Jupyter tutorials.
Main components and their interactions
a. Client Layers
• Example CLI scripts or Jupyter notebook (Docs/)
• HTTP clients (curl, browser via Swagger UI)
b. Server Layer
• Flask web server (Server/flask + Server/api)
• REST controllers (GET/POST/PUT) → delegate to Server/process modules
• FileHandler (Server/file) for temporary storage of inputs/outputs
• ConfigHandler (Server/config) for runtime settings
• Swagger UI (Server/swagger) for interactive docs
c. Processing Layer
• Server/process/*.py: orchestrate “load image → detect walls/rooms/doors → generate geometry → export .blend”
d. Core Library (FloorplanToBlenderLib/)
• Detection submodules (edge/feature matching)
• Geometric calculations (calculate.py, transform.py, stacking.py)
e. External Services & Tools
• Blender3D (called via scripts or headless mode)
• Docker container for packaging and deployment
• Weave Scope (optional monitoring)
f. Data & Config
• Input images (Images/Examples)
• Config files (Configs folder created at runtime)
• Stacking scripts (Stacking/) for batch builds
Architectural patterns and design principles
• Layered architecture: Presentation (CLI/HTTP) → Controller (Flask API) → Service/Process layer → Core library → External tool (Blender).
• Separation of concerns: FTBL library is reusable outside the server.
• Plug-in style modules: detection, transform, generate are decoupled.
• RESTful API with auto-generated Swagger documentation.
• Containerized deployment via Docker + Compose for reproducibility.