Ask any general-purpose image diffusion model for a "3-bedroom, 1,500 sq ft ranch floor plan with a 12×10 kitchen island" and you will get something that looks architectural from six feet away—and falls apart the second you zoom in.
The dimension strings are melted gibberish. A bedroom labeled "14' x 12'" sits next to a bathroom that is visually wider than the bedroom. Doors open directly into kitchen islands. And worst of all, the output is a flat raster PNG. If a homeowner wants to move one partition wall 18 inches to widen a pantry, or hand the drawing to a draftsman in AutoCAD, the image is useless. You have to redraw the entire house from scratch.
When we built PlanCaliber—a browser-based 2D/3D CAD drafting studio—we made a strict architectural rule from day one: never generate pixels where the user needs geometry.
Here is how our compilation pipeline turns either a plain-English building program or a hand-drawn phone photo / PDF into an editable, closed-polygon CAD wall graph in TypeScript, ready for true 1/4"=1'-0" vector PDFs and 8-layer AutoCAD R12 .DXF export.
The Core Problem: Floor Plans Are Graphs, Not Pictures
A real architectural floor plan is a planar straight-line graph (PSLG) with semantic constraints attached to edges, vertices, and faces:
- Vertices must close cleanly (
degree >= 2) so rooms form watertight polygons whose areas can be computed deterministically via the shoelace formula—and classified into ANSI Z765 heated Gross Living Area (GLA) vs. unheated garage, shop, or porch bays. - Walls carry physical thickness (typically
6"exterior framing,4.5"interior partitions), double-line mitered corners, and collinearity relationships across T-junctions. - Openings (doors, windows, overhead garage doors, cased openings) are parametric children of a host wall—stored as
(wallId, offsetIn, widthIn, swingDir)rather than disconnected ink lines—so moving a wall moves every door and window mounted on it. - Clearances are geometric invariants, not visual guesses: an NKBA kitchen work aisle must measure at least
42"for a single cook (48"for two cooks), and an IRC R310 bedroom egress window needs5.7 sq ftof net clear opening (20"min width,24"min height).
Diffusion models operate in latent pixel space. They have no concept of an invariant graph, no unit coordinate system ($INSUNITS=1 US inches), and no way to guarantee that Room A + Room B + Wall Thickness = Exterior Footprint.
Treating AI as a Structured Front-End Compiler, Not a Renderer
Instead of asking a model to paint an image, our AI Floor Plan Generator treats both Text-to-CAD and Sketch/PDF-to-CAD as front-end parsing stages into a strict intermediate representation (PlanDocument):
export interface PlanDocument { walls: WallSegment[]; // endpoints in inches, thicknessIn, isExterior openings: WallOpening[]; // host wallId, offsetIn, widthIn, kind, swing fixtures: PlanFixture[]; // cabinets, islands, plumbing, electrical roomHints: RoomHint[]; // semantic labels + heated/unheated flags } Every coordinate in PlanDocument lives in real-world US inches, quantized on a 0.25" (1/4") drafting grid via snapInches(value, 0.25).
Even with strict JSON schemas, raw coordinates extracted from a napkin sketch or synthesized from a natural-language prompt always contain small topological flaws:
- Two walls that meet visually at a corner may have endpoints
2.5"apart (degree 1dangling edges that prevent room polygon closure). - Hand-traced walls frequently drift
2°to5°off true horizontal or vertical. - Interior partitions often terminate near an exterior wall instead of splitting that wall cleanly into a topological T-junction.
- Extracted doors or windows sometimes land past a corner miter or overlap an adjacent opening.
If you hand that raw graph straight to a CAD renderer or .DXF exporter, room areas collapse to 0 sq ft and dimension chains break.
The 4-Pass Planar Graph Healer (healPlanDocument)
Before a generated or scanned floor plan ever reaches the interactive canvas, it runs synchronously through our TypeScript geometry healer (healPlanDocument):
- Pass 1 — Vertex Welding (
weldVerticesInPlace): Clusters near-touching wall endpoints within a weld radius (default6"for rough sketches, tighter on interactive edits), snaps each cluster to its0.25"-quantized centroid, and closes micro-gaps that would otherwise break face traversal. - Pass 2 — Orthogonal Angle Snapping (
snapWallAnglesInPlace): Any wall within±6°of0°or90°rotates cleanly onto the orthogonal axis around its midpoint, followed by a tight4"re-weld pass. Intentional 45° bay windows or angled walls outside±6°stay untouched. - Pass 3 — T-Junction & Crossing Splits (
splitCrossingsAndTJunctionsInPlace): Whenever a wall endpoint lands near the interior of another wall segment—or two walls cross—the host wall splits cleanly at the exact projected intersection point, followed by collinear deduplication and degenerate-stub culling. - Pass 4 — Opening Clamping (
clampOpeningsInPlace): Every door, window, and cased opening is re-projected onto its healed host wall and clamped at least3"clear of corner miters so jambs never collide with perpendicular drywall.
Once healed, our planar half-edge face solver extracts every minimal enclosed cycle, removes the unbounded outer perimeter face, matches room hint points inside polygons, and computes exact wall-to-wall square footage and ANSI Z765 heated GLA in milliseconds—entirely client-side in the browser.
Locking Real-World Scale from Any Sketch (rescalePlanToWall)
When someone snaps a phone photo of a hand sketch or uploads a multi-page PDF into PlanCaliber's Sketch & PDF-to-CAD studio, pixel dimensions don't automatically equal feet and inches.
Our two-point calibration engine (rescalePlanToWall) lets the user click any single known wall—or even a standard 36" entry door—and type its real measurement (for example 24'-6"). From that single reference ratio:
- Every wall endpoint scales proportionally in real US inches.
- Door and window widths snap cleanly to standard
2"framing increments (18"to120"), while cabinetry and fixtures snap to3"modular widths (18"minimum). - Openings re-clamp cleanly to their scaled host walls, and the entire 2D plan, 3D dollhouse extrusion, room schedule, and lumber takeoff recompute immediately.
And when a user later edits a wall length directly (setWallLength), the engine walks collinear split wall chains across healed T-junctions so stretching a bedroom wall shifts the entire aligned facade cleanly without ripping the perimeter apart.
Compiling One Graph Into Five Real Engineering Artifacts
Because the source of truth is a true-scale planar CAD graph instead of a flat image, every downstream export compiles deterministically from the exact same math:
- Live 3D Dollhouse & Interior Walkthrough: Wall centerlines extrude automatically with mitered corners, cut out for doors and windows, and support front-wall auto-cutaway as you orbit.
- True-Scale Vector Blueprint PDFs: Compiled server-side into real PDF vector drawing commands at exact
1/4"=1'-0"or1/8"=1'-0"scale (A-101Dimensioned Floor Plan,A-102Furniture & Fixture Plan,E-101Electrical & Lighting Plan,A-201Exterior Elevations, andM-101Clean White MLS Presentation Plan). - AutoCAD R12 (
AC1009) ASCII.DXF: Written at1:1Model Space scale ($INSUNITS=1inches, North-up+Y) across 8 standard AIA layers (A-WALL,A-DOOR,A-GLAZ,A-CABN,A-FURN,E-POWR,A-ROOM, andA-DIMS), opening directly in AutoCAD, Revit, SketchUp Pro, Rhino, LibreCAD, and QCAD. - Wavefront 3D
.OBJ/.MTL& Framing Takeoff.CSV: Exact wall linear footage, 16" OC stud estimates, and drywall sheet counts derived straight from the wall graph.
You can inspect unlocked real compiler output directly before opening the studio:
Try the Compiler Free in Your Browser
AI shines in drafting when it eliminates the tedious blank-page step—converting a messy paper sketch, a real-estate PDF, or a plain-English room list into a clean starting geometry—while deterministic CAD engineering takes over for scale, clearances, editing, and plotting.
You can open PlanCaliber's AI Floor Plan Generator right in your browser with no account required, run up to 2 free AI scans or text-to-CAD generations per day, edit every wall to 1/4" precision in 2D and 3D, and only pay a simple one-time pass ($9 for clean scaled PDF/PNG/SVG + share link, or $19 for the full 5-sheet CAD + AutoCAD .DXF pack, no subscription, 14-day instant refund) when you are ready for clean exports.
Note: PlanCaliber produces preliminary space-planning and architectural drafting documents—not licensed architectural or structural engineering stamps. Always verify dimensions and local building codes on site before construction or permit submission.


