Dev.to WebDev 🛠 Dev 👁 0 📖 5 min read

Modeling Sectional Overhead Doors and ANSI Z765 Shop/Living Partitioning in a TypeScript Browser CAD Engine

When you expand a residential CAD engine beyond standard ranch and craftsman floor plans into barndominiums, detached mechanic shops, and shop-houses, two deceptively simple drafting bugs show up immediately: Hinged-d

When you expand a residential CAD engine beyond standard ranch and craftsman floor plans into barndominiums, detached mechanic shops, and shop-houses, two deceptively simple drafting bugs show up immediately:

  1. Hinged-door assumptions break on wide garage bays. Treat a 12'-0" or 16'-0" overhead door like a normal OpeningKind = 'door' and your 2D SVG, vector PDF, and AutoCAD .DXF exporter happily draw a massive 16-foot quarter-circle swing arc straight through a pickup truck, workbench, or hydraulic lift.
  2. Gross Living Area (GLA) math collapses when conditioned living quarters share a roofline with an unheated shop. Under ANSI Z765 (the square-footage standard adopted across US real estate and appraisal workflows), a 40' × 80' barndominium does not have 3,200 sq ft of living space — it has roughly 2,011 sq ft of heated living area plus 1,200 sq ft of non-GLA shop space, separated by a continuous partition wall.

While building five new post-frame, farmhouse, and cabin templates for PlanCaliber (our browser-based 2D/3D floor plan and AutoCAD R12 .DXF studio), we promoted overhead to a first-class opening primitive across every export target and tightened our ANSI Z765 room-classification tests. Here is how the geometry and area math fit together in pure TypeScript.

1. Making overhead a First-Class OpeningKind

Relying solely on a heuristic like widthIn >= 72 works until someone places a 72-inch double French door on a rear patio or a narrow 60-inch ATV roll-up door on a side shed. Separating the semantic opening type eliminates ambiguity across 2D, 3D, PDF, DXF, and CSV schedules:

export type OpeningKind =
  | 'door'
  | 'double_door'
  | 'sliding_door'
  | 'pocket_door'
  | 'bifold_door'
  | 'overhead'
  | 'cased_opening'
  | 'window'
  | 'egress_window';

Every downstream renderer then handles op.kind === 'overhead' deterministically:

2D Vector PDF (pdf-lib) & AutoCAD R12 (AC1009) .DXF

Instead of projecting a door leaf and 90-degree ARC entity, the exporter computes the two jamb endpoints j1 and j2 along the wall tangent and offsets twin parallel sectional panel lines along the wall normal sw.normX, sw.normY on the AIA A-DOOR layer (ACI color 30):

// Overhead / garage / wide bay door ('overhead', >= 72" or swing='none'):
// draw parallel dashed bay lines instead of a hinged swing arc
if (
  op.kind === 'overhead' ||
  (op.kind === 'door' && (op.widthIn >= 72 || op.swing === 'none'))
) {
  const offIn = Math.max(1.2, halfWallThicknessIn * 0.45);
  addLine(
    'A-DOOR',
    j1.x + sw.normX * offIn,
    j1.y + sw.normY * offIn,
    j2.x + sw.normX * offIn,
    j2.y + sw.normY * offIn
  );
  addLine(
    'A-DOOR',
    j1.x - sw.normX * offIn,
    j1.y - sw.normY * offIn,
    j2.x - sw.normX * offIn,
    j2.y - sw.normY * offIn
  );
}

In our live SVG blueprint preview and 2D interactive canvas, those two parallel lines render with crisp dashed strokes (stroke-dasharray) inset inside the 2×6 exterior wall cavity so the plan reads like a real shop drawing at 1/4" = 1'-0".

3D Cutaway Rendering & Framing Schedules

In the 3D WebGL cutaway viewer, an overhead opening cuts the exterior wall mesh from slab (0") to the door header (96" to 144" for tall RV bays) and drops a recessed sectional header lintel instead of an angled swing slab. Meanwhile, the Door & Window Schedule in Sheet A-102 and the Framing Takeoff .CSV automatically classify the opening as Overhead Garage / Shop Door so contractors don't confuse a 16-foot sectional door rough opening with a standard pre-hung swing unit.

2. Partitioning Heated GLA vs. Unheated Shop Area (ANSI Z765)

A subtle pitfall in planar-graph floor plan engines is computing total square footage strictly from the exterior wall loop. That works for a single-zone cabin or farmhouse, where 100% of the enclosed interior is heated living area — for instance:

Once you introduce a shared-roof shop-house or garage office, however, the exterior envelope mixes conditioned rooms with unconditioned vehicle bays. We solve this directly on the planar face graph after interior rooms are detected:

export interface AreaSummary {
  grossFootprintSqFt: number;
  heatedGlaSqFt: number;
  nonGlaSqFt: number;
}

const NON_GLA_KEYWORDS = /\b(garage|shop|bay|carport|porch|deck|patio|storage|mechanical)\b/i;

export function classifyRoomGla(roomName: string, explicitFlag?: boolean): boolean {
  if (typeof explicitFlag === 'boolean') return explicitFlag;
  return !NON_GLA_KEYWORDS.test(roomName);
}

export function partitionPlanArea(
  rooms: ReadonlyArray<{ name: string; netAreaSqFt: number; isHeatedGla?: boolean }>,
  exteriorPolygonSqFt: number
): AreaSummary {
  let netGla = 0;
  let netNonGla = 0;

  for (const room of rooms) {
    if (classifyRoomGla(room.name, room.isHeatedGla)) {
      netGla += room.netAreaSqFt;
    } else {
      netNonGla += room.netAreaSqFt;
    }
  }

  // Allocate exterior/interior wall displacement proportionally so
  // ANSI Z765 exterior-measured GLA + Non-GLA reconcile cleanly
  const totalNet = netGla + netNonGla;
  if (totalNet <= 0) {
    return { grossFootprintSqFt: Math.round(exteriorPolygonSqFt), heatedGlaSqFt: 0, nonGlaSqFt: 0 };
  }

  const heatedGlaSqFt = Math.round((netGla / totalNet) * exteriorPolygonSqFt);
  const nonGlaSqFt = Math.max(0, Math.round(exteriorPolygonSqFt) - heatedGlaSqFt);

  return {
    grossFootprintSqFt: Math.round(exteriorPolygonSqFt),
    heatedGlaSqFt,
    nonGlaSqFt
  };
}

Why proportional exterior reconciliation matters: under ANSI Z765, finished living area is measured to the exterior finished surface of outside walls (including the thickness of interior partition studs inside the living zone), whereas a naive sum of clear interior room polygons drops 6%–9% of the square footage into wall cavities. Reconciling room polygons against the solved exterior footprint polygon keeps the numbers honest on mixed-use envelopes:

Post-Frame / Shop Template Overall Envelope Heated GLA (ANSI Z765) Non-GLA Shop / Garage Overhead Doors
30×40 Barndominium & 1-Bay Shop 40'-0" × 30'-0" 728 sq ft 480 sq ft 1× 12'-0"
40×80 Barndominium w/ 3-Bed & RV Shop 80'-0" × 40'-0" 2,011 sq ft 1,200 sq ft 2× 12'-0"
30×40 Detached Garage & Mechanic Shop 40'-0" × 30'-0" 261 sq ft (Office + Half Bath) 948 sq ft (Lift Bay + Storage) 16'-0" + 10'-0"

You can also experiment with post-frame living-to-shop bay ratios, wall heights, and concrete slab cubic yards before opening a template using our free Barndominium Footprint & Shop Split Calculator.

3. Regression-Testing Every Template as a Watertight Graph

When shipping parametric CAD starter templates, a 1-inch wall coordinate typo can break a T-junction, leave an open face, drop room square footage to zero, or trigger an IRC/NKBA clearance warning (like a doorway encroaching on a toilet center clearance or an exterior bedroom losing its egress window).

In our Node TypeScript test suite (node --experimental-strip-types --test), every template in the catalog is compiled through the exact production planar room solver, IRC/NKBA geometry linter, and server SVG preview pipeline on every commit:

for (const tpl of PLAN_TEMPLATES) {
  const solved = solveFloorPlan(buildTemplate(tpl.id));
  assert.ok(solved.rooms.length >= 2, `${tpl.id} must solve closed rooms`);
  assert.ok(solved.summary.heatedGlaSqFt > 0, `${tpl.id} must have heated GLA`);

  const issues = runCodeClearanceLinter(solved);
  const blocking = issues.filter((i) => i.severity === 'error' || i.severity === 'warning');
  assert.equal(blocking.length, 0, `${tpl.id} has linter findings`);
}

That single loop guarantees all 25 starter sheets — from compact cabins to 12-room modern farmhouses and 80-foot RV shop-houses — load cleanly in 2D and 3D with accurate framing takeoffs and zero dangling endpoints.

Try the Live Templates in Your Browser

Every one of the 25 templates opens directly in the browser with no install and no account required to draft, customize walls to exact feet and inches, inspect 3D cutaways, or download a watermarked proof PNG:

Note: PlanCaliber produces preliminary space-planning drawings and framing estimates; always verify finished dimensions and local building-department requirements on site prior to construction.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.