DEV Community

Rajesh
Rajesh

Posted on

How I Built an AI Pipeline That Converts Floor Plans to 3D Printable Models

The Problem

Turning a 2D floor plan into a 3D model is tedious. Architects spend hours tracing walls in SketchUp or Blender. Non-technical users have no viable path at all. I wanted to automate the entire pipeline — upload a floor plan image, get a 3D model back.

The Stack

  • Mobile: Flutter (iOS, Android coming soon)
  • API: Flask monolith on a single GCE VM
  • 3D Pipeline: Blender (headless, via bpy)
  • Database: PostgreSQL + SQLAlchemy
  • Auth: Firebase Admin SDK
  • Storage: Google Cloud Storage + Cloudflare CDN
  • Queue: Redis-backed worker pool

How the AI Detection Works

The floor plan image goes through a detection pipeline that identifies:

  • Wall segments (position, thickness, orientation)
  • Door openings (location, swing direction)
  • Window openings (location, sill height, header height)
  • Room boundaries (polygons + room type classification)

The output is a structured JSON that drives the Blender pipeline.

The Blender Pipeline

Blender runs headless on the server. The JSON layout drives a Python script that:

  1. Creates wall geometry (extruded polygons with proper thickness)
  2. Applies boolean operations for door and window openings
  3. Assigns PBR materials (plaster, wood, tile) based on room type
  4. Sets up lighting (ambient, hemisphere, directional)
  5. Exports to GLB for the interactive web viewer

The 3D Printing Challenge

GLB meshes optimized for rendering are terrible for 3D printing. Walls are thin textured planes — they look fine on screen but produce zero-thickness geometry that slicers skip entirely.

The STL export pipeline takes a different approach:

  1. Create solid box geometry for each wall from bounding boxes
  2. Auto-thicken walls below 1.2mm at print scale
  3. Use Blender's EXACT boolean solver to cut door/window openings
  4. Merge all geometry into a single watertight mesh
  5. Export as binary STL at the user's chosen scale

This produces clean, printable STLs from keychain-sized (1:500) to desk models (1:50).

What I Learned

  • Blender's boolean engine is fragile — EXACT solver works better than FAST for architectural geometry, but still fails on certain edge cases. Robust error handling is essential.
  • Wall thickness at scale is the #1 print quality factor — a 15cm real wall becomes 0.75mm at 1:200. Below 0.8mm, FDM printers skip it silently.
  • GCE with Blender headless works — no GPU needed for geometry-only operations. A single e2-standard-4 handles the load.

Try It

The first render is free. Would love to hear what the dev community thinks.

Top comments (0)