Ask a frontier LLM to estimate framing lumber, 4x8 drywall sheets, flooring, and baseboard for a 20'x20' garage conversion ADU, and you will usually get confident arithmetic that is quietly off by 20% to 45%.

The errors aren't random. They come from three structural traps in residential construction geometry that plain text reasoning consistently drops:

  1. Exterior walls have one interior finish face; interior partitions have two. Treating every linear foot of wall as two-sided inflates drywall and paint on compact ADUs and detached garages by 30%+.
  2. Doors interrupt baseboard trim; windows do not. Both doors and windows deduct from drywall and paint surface area—multiplied by the host wall's face count (1 for exterior, 2 for interior)—but only doors and cased openings break baseboard runs.
  3. 16" on-center framing is never just perimeter / 1.33. Every wall termination/corner needs backing studs, every door and window needs king/jack studs, top plates are doubled while bottom plates are single (3x linear feet), and cut waste is real.

At PlumbDraft, we compute US imperial framing and finish takeoffs deterministically from the exact wall/opening/room graph—both client-side in the 2D/3D CAD Studio and server-side on Cloudflare Workers via our REST API and hosted MCP server (https://www.plumbdraft.com/mcp).

Here is the exact TypeScript architecture we ship in production, along with the edge cases that bit us along the way.

1. Start From a Compiled Wall Graph, Not Room Rectangles

If you try to compute wall surface area from room.width * room.height, shared interior partitions get double-counted, wall thicknesses (6" exterior vs. 4.5" interior) drift, and L-shaped rooms break.

Instead, every floor plan compiles into canonical segments (walls), anchored openings (wallId, offsetIn, widthIn, heightIn, type), and closed rooms (areaSqFt, perimeterFt, flooring).

From that single source of truth, gross wall surface area and opening deductions become straightforward and auditable:

const defaultHeightFt = (plan.ceilingHeightIn || 96) / 12; let grossWallSurfaceSqFt = 0; for (const w of plan.walls) { const lenFt = wallLengthIn(w) / 12; const hFt = (w.heightIn ?? plan.ceilingHeightIn ?? 96) / 12 || defaultHeightFt; const faces = w.isExterior ? 1 : 2; grossWallSurfaceSqFt += lenFt * hFt * faces; } let openingAreaDeductionSqFt = 0; let baseboardOpeningDeductionFt = 0; for (const op of plan.openings) { const wall = wallMap.get(op.wallId); if (!wall) continue; const faces = wall.isExterior ? 1 : 2; const areaSqFt = (op.widthIn * op.heightIn) / 144; openingAreaDeductionSqFt += areaSqFt * faces; // Doors and cased openings break baseboard; windows do not if (op.type !== 'window') { baseboardOpeningDeductionFt += (op.widthIn / 12) * faces; } } const netWallSurfaceSqFt = round2( Math.max(0, grossWallSurfaceSqFt - openingAreaDeductionSqFt) ); 

Notice one subtle detail: an interior door (30" x 80") sits in a two-sided interior partition (faces = 2), so it deducts 33.33 sq ft of drywall (2 * 16.67) and 5.0 LF of baseboard (2 * 2.5', one side in each adjoining room). An exterior entry door (36" x 80") sits in an exterior wall (faces = 1), so it deducts 20.0 sq ft of interior drywall and 3.0 LF of interior baseboard.

2. Waste Factors, Sheet Sizes & 12-Foot Trim Sticks

Homeowners and contractors never buy exact net square footage. Each finish material carries its own standard ordering unit and cut-waste factor:

  • Flooring (grouped per room material — LVP, tile, hardwood, carpet, concrete): +10% waste (Math.ceil(netSqFt * 1.1)). Grouping per finish type first prevents rounding error from leaking across rooms with different materials (e.g., tile in the bath vs. LVP in the living room).
  • 4x8 Drywall Sheets (32 sq ft per sheet): Walls + ceiling (paintableSqFt = netWallSurfaceSqFt + ceilingAreaSqFt), multiplied by +12% cut waste:
 const drywallSheets4x8 = paintableSqFt > 0 ? Math.ceil((paintableSqFt * 1.12) / 32) : 0; 
  • Primer & Finish Paint (350 sq ft / gal): 1 coat of primer (Math.ceil(paintableSqFt / 350)) plus 2 finish coats (Math.ceil((paintableSqFt * 2) / 350)).
  • Baseboard Molding (12 ft sticks): Net room perimeter minus door/cased-opening widths, plus +10% miter waste:
 const baseboardSticks12Ft = baseboardLinearFt > 0 ? Math.ceil((baseboardLinearFt * 1.1) / 12) : 0; 

3. Conceptual 16" On-Center Wall Framing Takeoff

For conceptual lumber budgeting (always clearly disclaimed as conceptual and non-structural—never a substitute for an engineer's framing plan or local building code), we compute 16" OC studs and top/bottom wall plates directly from the compiled wall graph:

export function estimateFramingTakeoff( compiled: CompiledGeometry, plan: FloorPlan ): FramingTakeoffSummary { const totalWallLinearFt = Math.round(compiled.totalWallLinearFt * 10) / 10; // 16" OC = 0.75 studs/LF + 2 corner/end studs per wall segment // + 2 king/jack studs per door/window opening, +10% waste const baseStuds = totalWallLinearFt * 0.75 + plan.walls.length * 2 + plan.openings.length * 2; const studs16Oc = Math.ceil(baseStuds * 1.1); // Double top plate + single bottom plate = 3x total wall LF, +10% waste const wallPlatesLinearFt = Math.ceil(totalWallLinearFt * 3 * 1.1); return { studs16Oc, wallPlatesLinearFt, exteriorWallLinearFt: Math.round(compiled.exteriorWallLinearFt * 10) / 10, interiorWallLinearFt: Math.round(compiled.interiorWallLinearFt * 10) / 10, totalWallLinearFt }; } 

Why does walls.length * 2 matter so much? A 5'x8' hall bathroom has only 26.0 LF of walls (26 * 0.75 = 19.5 field studs), yet once you include 4 wall corners (+8), 1 door and 1 window (+4), and 10% waste, you actually need 35 studs—nearly double the naive 26 * 0.75 estimate.

Here is what the deterministic engine outputs across four real US templates on PlumbDraft today:

Template Footprint Net Area 16" OC Studs 4x8 Drywall Sheets Flooring Order Qty
5x8 Bathroom Remodel 8'-0" x 5'-0" 40 sq ft 35 studs 13 sheets 44 sq ft tile
10x10 Kitchen Layout 10'-0" x 10'-0" 100 sq ft 47 studs 19 sheets 110 sq ft
20x20 Garage Conversion ADU 20'-0" x 20'-0" 400 sq ft 102 studs 41 sheets 441 sq ft
24x32 Detached Garage 24'-0" x 32'-0" 768 sq ft 141 studs 68 sheets 845 sq ft

4. Generating RFC-4180 Takeoff CSVs Without Dependencies

Every export pack includes a contractor-ready .csv with grouped flooring, drywall, primer, finish paint, baseboard sticks, door schedule (tag, type, width x height, swing), window schedule (tag, width x height, sill height), and US retail material-only ballpark ranges.

Because this runs inside a Cloudflare Worker with zero npm spreadsheet dependencies, we serialize RFC-4180 CSV directly with strict quoting (csvEscape wraps any value containing ,, ", \n, or \r and doubles embedded quotes) so room names like Living, Dining & Kitchen never break Excel or Google Sheets columns.

5. Letting AI Agents Call the Takeoff Engine via MCP

The cleanest pattern we found for AI-assisted CAD is strict separation of responsibilities:

  • The LLM handles human intent: "Convert my 20x20 two-car garage into a studio ADU with a 60" tub and at least 36" clearances."
  • The deterministic CAD engine handles geometry, clearances, and takeoffs: Every wall coordinate, IRC/NKBA clearance warning, stud count, drywall sheet count, and AutoCAD R12 DXF entity is computed in pure TypeScript with zero LLM arithmetic.

Any MCP client (Claude Desktop, Cursor, Windsurf, or custom agent loops) can connect directly to our hosted Streamable HTTP endpoint at https://www.plumbdraft.com/mcp, call validate_floor_plan or generate_floor_plan, and receive exact structured JSON material takeoffs + a live browser share link in a single tool round-trip.

You can test the standalone calculator live for free (no account required) at plumbdraft.com/tools/wall-framing-drywall-takeoff-calculator, edit any of our 64 US imperial starter floor plans in 2D & 3D at plumbdraft.com/templates, or inspect the REST API and MCP tool schemas at plumbdraft.com/developers.