Why LLMs Fail at Closed Floor Plan Geometry (And How We Built a Deterministic Imperial CAD + DXF + Hosted MCP Engine in TypeScript)
If you have ever asked an LLM to generate a 20x20 garage ADU floor plan in SVG or AutoCAD DXF, you already know what happens: walls miss their corners by 14 inches, doors float outside walls, room square footage contradi
If you have ever asked an LLM to generate a 20x20 garage ADU floor plan in SVG or AutoCAD DXF, you already know what happens: walls miss their corners by 14 inches, doors float outside walls, room square footage contradicts the labeled dimensions, and the resulting DXF refuses to open cleanly in AutoCAD or LibreCAD.
Recently, a lot of developers have been wiring Claude Code and Cursor to local Blender MCP setups just to get usable 3D floor plans. That works well for cinematic renders, but it takes local installs and still does not give a contractor or homeowner a scaled 1/4" = 1'-0" ANSI B blueprint PDF, a layered AutoCAD DXF, or an accurate framing and drywall material takeoff.
When building PlumbDraft, we decided to split the problem cleanly: let humans or AI agents describe walls and openings in US imperial inches, and let a deterministic TypeScript CAD kernel handle every geometric invariant, clearance rule, 3D extrusion, and vector export.
1. Treating a Floor Plan as a Planar Wall Graph (Not a Bag of Rectangles)
Consumer floor-plan apps often model rooms as independent rectangles. That breaks down the moment you draw an L-shaped kitchen, share a 4.5" interior partition between a bedroom and a closet, or cut a 36" entry door through a 6" exterior stud wall.
Instead, PlumbDraft stores walls as segments (x1, y1) -> (x2, y2) in integer/decimal inches with wall thickness (6" exterior, 4.5" interior) and host-relative openings (wallId, offsetIn, widthIn, swingDir).
When compileFloorPlan(plan) runs:
- Endpoints within snap tolerance merge cleanly into shared graph vertices, and T-junction intersections split crossing walls automatically.
-
detectRoomsFromWalls()extracts minimal closed interior cycles from the planar wall graph to compute exact net square footage and perimeter linear feet. - For non-convex polygons (like L-shaped living/dining zones or wrap-around hallways),
computeInteriorLabelPoint()searches strictly inside the polygon so room labels and area readouts never drift into an adjacent room or wall.
2. Automated Architectural Clearance Audits & Material Takeoffs
Because every wall, door swing arc, window opening, and fixture footprint lives in real imperial inches, engineering checks become plain deterministic math rather than LLM guesswork:
- Hallway width checks: flags passageways narrower than 36".
- Door swing conflict checks: detects overlapping door arcs or fixtures obstructing clearance zones.
- Kitchen work-aisle checks: flags counter-to-island clearances tighter than 42" (single-cook) or 48" (two-cook).
-
Material takeoff (
calculateMaterialTakeoff): derives net flooring square footage (plus waste allowance), 4x8 drywall sheet count from wall face area minus door/window rough openings, top/bottom plates and stud counts, linear baseboard trim, paint gallons, and structured door/window schedules.
3. Pure TypeScript Vector Exporters (Zero Native Binaries)
Running CAD exports on edge workers means no headless Chromium, no LibreOffice, and no native C++ bindings. Both deliverable formats are emitted directly from the compiled wall graph in pure TypeScript:
-
Layered AutoCAD R12 DXF (
exportFloorPlanDxf): writes standardHEADER,TABLES, andENTITIESsections with AIA architectural layers (A-WALL,A-DOOR,A-WIND,A-FURN,A-DIMS,A-ANNO) so files open cleanly in AutoCAD, AutoCAD LT, QCAD, LibreCAD, and SketchUp. You can inspect real sample R12 DXF output directly on plumbdraft.com/developers. -
2-Sheet 1/4" = 1'-0" Scaled Blueprint PDF (
exportBlueprintPdf): generates exact vector PDF drawing commands sized to ANSI B (11"x17") or US Letter (8.5"x11") at true architectural scale (18 PDF points per real-world foot at 1/4" = 1'-0"), complete with dimension strings, north arrow, title block, and Sheet A1.1 room/door/window schedules.
4. Zero-Install Hosted MCP Server for Claude, Cursor & AI Agents
Instead of forcing every developer to install local Python or Blender addons, PlumbDraft exposes the exact same CAD engine over a hosted Streamable HTTP MCP server (https://www.plumbdraft.com/mcp, registered as com.plumbdraft/cad).
Connect it in one command in Claude Code:
claude mcp add --transport http plumbdraft https://www.plumbdraft.com/mcp
Or with universal add-mcp:
npx add-mcp 'https://www.plumbdraft.com/mcp'
Or in Claude Desktop / Cursor JSON config:
{
"mcpServers": {
"plumbdraft": {
"url": "https://www.plumbdraft.com/mcp"
}
}
}
What works free with zero API key:
-
compile_floorplan_geometry: compiles imperial walls, openings, and rooms into closed polygons, validates geometry, and returns a live shareable 2D + 3D browser preview link (/p/<id>) that the user can open immediately. -
validate_clearance_ergonomics: runs hallway, door-swing, and kitchen aisle checks. -
calculate_material_takeoff: computes flooring, 4x8 drywall sheets, framing lumber, trim, paint, and schedules. -
export_blueprint_dxf/export_blueprint_pdf: even without an API key, stages the validated plan to a live/p/<id>studio preview with a one-click unlock link; with a Bearer API key ($39Builder 5-Pack includes 50 API/MCP credits), returns the raw.DXFor base64 scaled Blueprint.PDFbytes inline directly to the agent.
Try It Directly (No Sign-Up Required)
- Interactive 2D/3D CAD Studio: plumbdraft.com/studio
- 12 US Imperial Starter Templates (ADUs, kitchens, apartments, offices): plumbdraft.com/templates
- Claude & Cursor MCP Setup Guide: plumbdraft.com/tools/claude-mcp-floor-plan-cad
- REST API Playground & Live DXF Inspector: plumbdraft.com/developers
Drafting, 3D walkthroughs, cloud save, and free MCP geometry/clearance/takeoff calls cost $0. When you actually need clean unwatermarked Blueprint PDF, High-Res PNG, CSV takeoff, and AutoCAD DXF files for a project, unlocking a single project is $14 one-time (no recurring subscription, 30-day refund).
Happy to answer questions in the comments about planar wall-graph cycle detection, DXF R12 quirks across CAD viewers, or hosting Streamable HTTP MCP servers on Cloudflare Workers.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.