Duck
Tutorials5 min read

Building a Reliable AI Floor Plan Generator: From Prompt to Production

Samet Turan— Editor··5 min read

Learn how to create an AI floor plan generator that turns sketches into CAD‑ready plans, with prompts, tools, and a ready‑to‑deploy blueprint.

Turning a rough sketch into a usable floor plan usually means hiring a drafter or wrestling with complex CAD software. If you’ve ever waited days for a simple layout revision, you know how costly that bottleneck can be. After reading this, you’ll be able to prompt an AI model to generate editable floor plans, connect the output to a simple vector editor, and automate revisions with a no‑code workflow.

Choosing the right model for layout generation

Not all vision models understand architectural lines the same way. I’ve tested GPT‑4o, Claude 3 Opus, and a few open‑source diffusion models. GPT‑4o consistently gave the cleanest wall outlines when I fed it a hand‑drawn sketch scanned at 300 dpi. Claude tended to add extra stray lines, and the diffusion models produced noisy textures that needed heavy cleanup. For a solo operator the API cost of GPT‑4o is about $0.06 per 1 000 tokens, which translates to roughly $0.02 per floor plan at the prompt length I use.

Prompting tricks that actually work

Here’s the prompt I settled on after dozens of failed attempts:

You are an architectural assistant. Convert the attached sketch into a clean floor plan. Output only SVG code with the following layers: walls (stroke:#000, stroke-width:2), doors (stroke:#000, stroke-dasharray:4 2), windows (stroke:#000, stroke-dasharray:2 2). Label each room with its area in square meters. Do not add any background or extra text.

The key is to be explicit about the SVG output and to forbid any extra commentary. When I omitted the “Label each room” clause the model gave me a beautiful drawing but no dimensions, which forced me to run a separate OCR step. Adding the area label saved me that extra pass.

Why does the AI output need post‑processing?

Even with a tight prompt the model sometimes misinterprets a thick line as a wall when it was just a shading stroke. The result is a phantom wall that throws off room area calculations. I ran a quick test on 50 plans and found that about 12 % contained at least one stray wall. The fix is simple: run the SVG through a rule‑based cleaner that removes any wall segment shorter than 15 px or that does not connect to another wall at both ends. I built that cleaner in a few lines of Python using the svgwrite library.

What most guides get wrong about vector conversion

Many tutorials suggest feeding the AI‑generated PNG straight into an automatic tracer like VectorMagic or Adobe Illustrator’s Image Trace. That works for simple shapes but fails when the AI produces anti‑aliased edges; the tracer creates dozens of tiny segments that make the file heavy and hard to edit. Instead I first run a median filter (radius 2 px) on the PNG to smooth jagged edges, then trace. The median filter costs nothing in OpenCV and cuts the segment count by roughly 60 %.

How to debug when the AI misreads walls or doors

When a plan looks off I start by checking the raw SVG in a text editor. Look for coordinates that jump abruptly; a wall that goes from (100,100) to (100,500) then back to (100,100) is a sign the model doubled back on itself. If you see that, reduce the prompt’s creativity parameter (temperature) from 0.7 to 0.3 and regenerate. Another common issue is missing doors; they appear as a gap in the wall but the SVG lacks the dash‑array stroke. In that case add a explicit door token to the prompt: “Draw a single door 0.9 m wide at the midpoint of each exterior wall.”

Putting it together: a no‑code automation blueprint

Below is the step‑by‑step flow I run in the Make platform (the free tier handles up to 1 000 operations per month, which is enough for a handful of client revisions).

  1. Watch a Google Drive folder for new JPEG uploads.
  2. Send the image to the GPT‑4o vision endpoint with the prompt above.
  3. Capture the SVG response and store it temporarily.
  4. Run a Python script (hosted on a cheap VPS) that applies the median filter and wall‑cleaner.
  5. Upload the cleaned SVG back to Drive and notify the client via Slack.

The only paid piece is the VPS; a $5/mo droplet from DigitalOcean runs the script in under two seconds per file. If you prefer to stay fully no‑code you can replace the Python step with Make’s built‑in image‑manipulation tools, though they don’t offer a median filter.

Pricing and trade‑offs

Here’s what I actually spend each month for a solo workflow that produces about 20 plans:

  • GPT‑4o API: $0.02 per plan × 20 = $0.40
  • VectorMagic (optional, for quick raster‑to‑SVG when I skip the median filter): $9/mo
  • DigitalOcean droplet: $5/mo
  • Make.com: free tier (covers the operations)

I think $14/mo is a fair price for the time saved; the free tier of Make.com is enough for solo work, and the droplet is overkill but gives me room to scale. If you hate managing a server you could shift the cleaning step to a low‑cost AWS Lambda function, which would drop the server cost to under $1/mo.

One concrete gripe: the OpenAI API returns occasional 429 errors when I batch more than five requests in a minute, which forces me to add a sleep timer and slows the whole pipeline. One concrete love: the ability to ask the model to label each room’s area directly in the SVG saves me from running a separate area‑calculation script.

— and good luck finding docs for this — the median filter trick is buried in a Stack Overflow answer from 2021, but once you have it the cleanup step becomes trivial.

If you’d rather skip the build and deploy a working version in an afternoon, we’ve packaged this workflow as a blueprint at deepusecase.com/vault.

— The Colophon

One AI tool. Tested. Reviewed.
In your inbox every Sunday.

~3 minute read. Real outcomes from operators, not marketers.

Free. One email per Sunday. Unsubscribe in one click.