<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[PlanCaliber Engineering]]></title><description><![CDATA[PlanCaliber Engineering]]></description><link>https://plancaliber.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 28 Nov 2026 20:55:23 GMT</lastBuildDate><atom:link href="https://plancaliber.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Modeling US Home Office Desk Ergonomics, Swivel-Chair Clearances, and Door-Swing Conflicts in TypeScript]]></title><description><![CDATA[Converting a spare 9' x 8' bedroom nook or a 14' x 11' bonus room into a full-time home office sounds effortless until a 60" x 30" sit-stand desk blocks…]]></description><link>https://plancaliber.hashnode.dev/modeling-us-home-office-desk-ergonomics-swivel-chair-clearances-and-door-swing-conflicts-in-typescript</link><guid isPermaLink="true">https://plancaliber.hashnode.dev/modeling-us-home-office-desk-ergonomics-swivel-chair-clearances-and-door-swing-conflicts-in-typescript</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[webdev]]></category><category><![CDATA[cad]]></category><category><![CDATA[engineering]]></category><dc:creator><![CDATA[Clara Sutton]]></dc:creator><pubDate>Sat, 28 Nov 2026 17:28:46 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b07d6b9e447de416c07f0c8/63008b20-1970-4aca-bc78-871bf92a830a.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Converting a spare <code>9' x 8'</code> bedroom nook or a <code>14' x 11'</code> bonus room into a full-time home office sounds effortless until a <code>60" x 30"</code> sit-stand desk blocks the entry door swing or a task chair slams into the rear bookcase every time you stand up.</p>
<p>When building <a href="https://www.plancaliber.com/calculators/home-office-desk-ergonomics-calculator">PlanCaliber's home office desk ergonomics calculator</a>, we modeled <strong>IRC R304</strong> habitable room minimums, single and dual-workstation wall runs, <strong><code>36"</code> to <code>48"</code></strong> swivel-chair pull-back depth, entry door swing conflicts, and video-call backdrop focal depth in deterministic TypeScript (<code>calculateHomeOfficeLayout</code>).</p>
<h2>1. Workstation Wall Run and Dual-Desk Spacing Math</h2>
<p>A <code>60"</code> standing desk does not occupy <code>60"</code> of wall space once you account for monitor arms, PC towers, surge strips, and side elbow margin. Our solver enforces:</p>
<ul>
<li><strong>Single workstation</strong>: <code>deskWidthIn + 24"</code> minimum wall run (<code>84"</code> for a <code>60"</code> desk).</li>
<li><strong>Dual side-by-side workstations</strong>: <code>deskWidthIn * 2 + 30"</code> minimum wall run (<code>150"</code> for two <code>60"</code> desks, leaving <code>10"</code> side/center acoustic and cable margins).</li>
</ul>
<pre><code class="language-ts">export type ChairClearanceGrade = "generous" | "pass" | "tight";

export interface HomeOfficeLayoutInput {
  roomLengthFt: number;
  roomWidthFt: number;
  workstations: 1 | 2;
  deskWidthIn: number;
  deskDepthIn: number;
  storageDepthIn: number; // rear credenza or bookcase depth (0" to 24")
  doorWidthIn: number; // 28" to 36" entry door leaf
  includeReadingCorner: boolean;
}
</code></pre>
<h2>2. Swivel-Chair Pull-Back Clearance (<code>36"</code> and <code>48"</code> Bands) and Door-Swing Conflict Detection</h2>
<p>The chair zone sits between the front edge of the desk and the front edge of any rear bookcase or wall (<code>roomWidthIn - deskDepthIn - storageDepthIn</code>). We grade that depth into three bands:</p>
<ul>
<li><strong><code>&gt;= 48"</code> (<code>generous</code>)</strong>: Full swivel-chair roll-back plus walk-behind aisle for a second person or rear cabinet doors.</li>
<li><strong><code>36"</code> to <code>47"</code> (<code>pass</code>)</strong>: Meets ergonomic roll-back minimum for a solo user, though tight for walking behind a seated person.</li>
<li><strong><code>&lt; 36"</code> (<code>tight</code> / <code>FAIL</code>)</strong>: Task chair casters collide with the rear wall or credenza.</li>
</ul>
<p>For entry door swing conflict detection, an in-swinging door of width <code>doorWidthIn</code> clears the desk footprint if either the remaining wall length past the workstation run is <code>&gt;= doorWidthIn</code>, OR the perpendicular room depth past the desk is <code>&gt;= doorWidthIn + 12"</code> (allowing the door to swing open behind the workstation without hitting a monitor overhang):</p>
<pre><code class="language-ts">export function evaluateHomeOfficeErgonomics(input: HomeOfficeLayoutInput) {
  const areaSqFt = Math.round(input.roomLengthFt * input.roomWidthFt);
  const ircHabitableRoomPass =
    areaSqFt &gt;= 70 &amp;&amp; Math.min(input.roomLengthFt, input.roomWidthFt) &gt;= 7;

  const roomLengthIn = input.roomLengthFt * 12;
  const roomWidthIn = input.roomWidthFt * 12;

  const requiredDeskRunIn =
    input.workstations === 1 ? input.deskWidthIn + 24 : input.deskWidthIn * 2 + 30;
  const deskRunFits = roomLengthIn &gt;= requiredDeskRunIn;

  const chairClearanceDepthIn = Math.round(
    roomWidthIn - input.deskDepthIn - input.storageDepthIn
  );
  const chairClearanceGrade: ChairClearanceGrade =
    chairClearanceDepthIn &gt;= 48 ? "generous" : chairClearanceDepthIn &gt;= 36 ? "pass" : "tight";

  const doorSwingClearPass =
    roomLengthIn - requiredDeskRunIn &gt;= input.doorWidthIn ||
    roomWidthIn - input.deskDepthIn &gt;= input.doorWidthIn + 12;

  const cameraBackdropDepthFt = Number(((roomWidthIn - input.deskDepthIn) / 12).toFixed(1));
  const readingCornerMinSqFt = input.workstations === 2 ? 150 : 110;
  const readingCornerFits = input.includeReadingCorner ? areaSqFt &gt;= readingCornerMinSqFt : true;

  return {
    areaSqFt,
    ircHabitableRoomPass,
    requiredDeskRunIn,
    deskRunFits,
    chairClearanceDepthIn,
    chairClearanceGrade,
    doorSwingClearPass,
    cameraBackdropDepthFt,
    readingCornerFits,
    overallPass:
      ircHabitableRoomPass &amp;&amp;
      deskRunFits &amp;&amp;
      chairClearanceGrade !== "tight" &amp;&amp;
      doorSwingClearPass &amp;&amp;
      readingCornerFits,
  };
}
</code></pre>
<p>Test two real layouts:</p>
<ul>
<li><strong><code>14' x 11'</code> (<code>154 sq ft</code>) Dual-Desk Office (<code>2x 60" x 30"</code> desks, <code>16"</code> rear bookcase, <code>32"</code> door, reading corner)</strong>:<ul>
<li><code>requiredDeskRunIn = 150"</code> against a <code>168"</code> wall (<code>PASS</code>).</li>
<li><code>chairClearanceDepthIn = 132 - 30 - 16 = 86"</code> (<code>generous</code>, ample walk-behind).</li>
<li><code>doorSwingClearPass = true</code> (<code>102" &gt;= 44"</code>).</li>
<li><code>readingCornerFits = true</code> (<code>154 &gt;= 150 sq ft</code>).</li>
</ul>
</li>
<li><strong><code>9' x 8'</code> (<code>72 sq ft</code>) Compact Cloffice (<code>1x 48" x 24"</code> desk, <code>14"</code> rear bookcase, <code>30"</code> door)</strong>:<ul>
<li><code>ircHabitableRoomPass = true</code> (<code>72 &gt;= 70 sq ft</code>, min dimension <code>8' &gt;= 7'</code>).</li>
<li><code>chairClearanceDepthIn = 96 - 24 - 14 = 58"</code> (<code>generous</code>).</li>
<li><code>doorSwingClearPass = true</code> (<code>72" &gt;= 42"</code>).</li>
</ul>
</li>
</ul>
<h2>3. Electrical Receptacles and Rough Door Openings</h2>
<p>Home offices concentrate heavy desk loads (dual monitors, workstations, dock chargers, desk lamps). Plan wall outlets along the desk wall under NEC 210.52 (no point along a wall line more than <code>6'-0"</code> from a receptacle) using our <a href="https://www.plancaliber.com/calculators/electrical-outlet-placement-calculator">electrical outlet placement calculator</a>, and if an in-swing door collides with your desk zone, verify pocket-door or out-swing framing widths in our <a href="https://www.plancaliber.com/calculators/door-window-rough-opening-calculator">door and window rough opening calculator</a>.</p>
<h2>Draft Your Home Office or Backyard Studio in 2D and 3D</h2>
<p>Start directly from our <a href="https://www.plancaliber.com/templates/home_office_studio">Home Office Studio Template</a> or detached <a href="https://www.plancaliber.com/templates/backyard_studio_12x16">12x16 Backyard Studio Template</a> inside PlanCaliber's <code>$0</code> Free Studio. Browser 2D/3D drafting, 2 free AI Sketch/PDF-to-CAD scans per day, 40 US templates, 50 US code calculators, live 3D cutaways, and <code>1400x1050</code> watermarked proof PNGs are free. Optional one-time passes unlock clean 2-sheet <code>1/4"=1'-0"</code> vector PDFs (<code>$9</code> Clean Print Pass) or full 5-sheet <code>1/4"=1'-0"</code> CAD PDFs + 8-layer AutoCAD R12 <code>.DXF</code> (<code>$INSUNITS=1</code> US inches) + 3D <code>.OBJ/.MTL</code> + Framing &amp; Drywall CSV takeoffs (<code>$19</code> one-time, <code>$49</code> 5-Pack, or optional <code>$29/mo</code> / <code>$99/yr</code> unlimited), with permanent edits and 14-day instant refunds.</p>
<p>All home office ergonomic calculations and floor plans are for preliminary space planning and estimating; always field-verify framing dimensions, electrical circuit loads, and IRC R304 habitable room rules with your local building official (AHJ).</p>
]]></content:encoded></item><item><title><![CDATA[Dining Room Table Sizing and Chair Pull-Back Geometry in TypeScript: 24-Inch Seat Pitch and 36-to-42-Inch Walk-Behind Envelopes]]></title><description><![CDATA[Dining rooms are notorious for looking fine on paper and feeling cramped the first time eight people sit down for dinner. The math failure almost always…]]></description><link>https://plancaliber.hashnode.dev/dining-room-table-sizing-and-chair-pull-back-geometry-in-typescript-24-inch-seat-pitch-and-36-to-42-inch-walk-behind-envelopes</link><guid isPermaLink="true">https://plancaliber.hashnode.dev/dining-room-table-sizing-and-chair-pull-back-geometry-in-typescript-24-inch-seat-pitch-and-36-to-42-inch-walk-behind-envelopes</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[webdev]]></category><category><![CDATA[cad]]></category><category><![CDATA[engineering]]></category><dc:creator><![CDATA[Clara Sutton]]></dc:creator><pubDate>Sat, 28 Nov 2026 17:20:43 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b07d6b9e447de416c07f0c8/abc0055c-a2d1-4e6c-b77b-78291973c460.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Dining rooms are notorious for looking fine on paper and feeling cramped the first time eight people sit down for dinner. The math failure almost always happens in the perimeter ring around the table: people measure the tabletop against the walls and forget to subtract <strong><code>18"</code> to <code>20"</code></strong> for a sideboard or buffet plus <strong><code>36"</code> minimum</strong> (or <strong><code>42"</code></strong> comfortable walk-behind, <strong><code>48"</code></strong> server aisle) on every side for chair push-back.</p>
<p>When building <a href="https://www.plancaliber.com/calculators/dining-room-table-size-calculator">PlanCaliber's dining room table size calculator</a>, we encoded <code>24"</code> per-diner seat pitch, round and rectangular capacity curves, sideboard deductions, <code>+24"</code> area rug envelopes, and chandelier scale heuristics into a deterministic TypeScript solver (<code>calculateDiningTableClearance</code>).</p>
<h2>1. Computing Seat Capacity for Rectangular and Round Tables</h2>
<p>Standard US residential ergonomics allocate <strong><code>24"</code> of linear tabletop width per seated guest</strong> along the long edges of a rectangular table, plus <strong><code>12"</code> per head/foot seat</strong> (<code>+24"</code> total end allowance) and a <strong><code>38"</code> to <code>42"</code></strong> table width so opposite place settings and serving dishes do not collide. For round tables, diameter steps up in standard woodworking increments (<code>42"</code>, <code>54"</code>, <code>60"</code>, <code>72"</code>, <code>84"</code>):</p>
<pre><code class="language-ts">export type DiningTableShape = "rectangular" | "round";
export type DiningTargetClearanceIn = 36 | 42 | 48;

export function recommendedDiningTableDims(
  shape: DiningTableShape,
  guests: number
): { recLengthIn: number; recWidthIn: number } {
  if (shape === "round") {
    let diameter = 42;
    if (guests &lt;= 4) diameter = 42;
    else if (guests &lt;= 6) diameter = 54;
    else if (guests &lt;= 8) diameter = 60;
    else if (guests &lt;= 10) diameter = 72;
    else diameter = 84;
    return { recLengthIn: diameter, recWidthIn: diameter };
  }

  // Rectangular: 2 head seats + balanced side seats at 24" pitch
  const recWidthIn = guests &gt;= 10 ? 42 : 38;
  const sideSeats = Math.max(1, Math.ceil((guests - 2) / 2));
  const recLengthIn = Math.max(48, sideSeats * 24 + 24);
  return { recLengthIn, recWidthIn };
}
</code></pre>
<p>For an 8-seat rectangular table (<code>2</code> head seats + <code>3</code> seats per long edge), <code>recommendedDiningTableDims('rectangular', 8)</code> returns <strong><code>96" x 38"</code></strong> (<code>8'-0"</code> long). For a 6-seat breakfast nook round table, it returns a <strong><code>54"</code></strong> diameter circle.</p>
<h2>2. Solving Chair Pull-Back Clearances, Sideboard Deductions, and Max Comfortable Guests</h2>
<p>With the table envelope known, the solver deducts any wall sideboard (<code>buffetDepthIn</code>, typically <code>16"</code> to <code>20"</code>) from the room width before splitting remaining clearance equally across opposite sides. It also runs a descending search from <code>14</code> down to <code>4</code> guests to report <code>maxComfortableGuests</code> at the strict <code>36"</code> NKBA/dining pull-out floor:</p>
<pre><code class="language-ts">export interface DiningTableInput {
  roomLengthFt: number;
  roomWidthFt: number;
  tableShape: DiningTableShape;
  guests: number;
  targetClearanceIn: DiningTargetClearanceIn;
  buffetDepthIn: number;
}

export function evaluateDiningEnvelope(input: DiningTableInput) {
  const roomLengthIn = input.roomLengthFt * 12;
  const roomWidthIn = input.roomWidthFt * 12;

  const { recLengthIn, recWidthIn } = recommendedDiningTableDims(input.tableShape, input.guests);

  const actualEndClearanceIn = Math.round((roomLengthIn - recLengthIn) / 2);
  const actualSideClearanceIn = Math.round((roomWidthIn - input.buffetDepthIn - recWidthIn) / 2);

  const minActualClearanceIn = Math.min(actualSideClearanceIn, actualEndClearanceIn);
  const fitsMinimum36In = minActualClearanceIn &gt;= 36;
  const fitsTargetClearance = minActualClearanceIn &gt;= input.targetClearanceIn;

  let maxComfortableGuests = 0;
  for (let g = 14; g &gt;= 4; g--) {
    const dims = recommendedDiningTableDims(input.tableShape, g);
    const endClr = Math.round((roomLengthIn - dims.recLengthIn) / 2);
    const sideClr = Math.round((roomWidthIn - input.buffetDepthIn - dims.recWidthIn) / 2);
    if (Math.min(endClr, sideClr) &gt;= 36) {
      maxComfortableGuests = g;
      break;
    }
  }

  // Rug extends +24" past every table edge so rear chair legs stay on the rug
  const recommendedRugLengthIn = recLengthIn + 48;
  const recommendedRugWidthIn = recWidthIn + 48;

  // Classic interior lighting heuristic: room L(ft) + W(ft) in inches, capped at 2/3 table width
  const chandelierDiameterIn = Math.round(input.roomLengthFt + input.roomWidthFt);
  const chandelierMaxByTableIn = Math.round((recWidthIn * 2) / 3);

  return {
    recLengthIn,
    recWidthIn,
    actualEndClearanceIn,
    actualSideClearanceIn,
    fitsMinimum36In,
    fitsTargetClearance,
    maxComfortableGuests,
    recommendedRugLengthIn,
    recommendedRugWidthIn,
    chandelierDiameterIn,
    chandelierMaxByTableIn,
  };
}
</code></pre>
<p>Test a standard <strong><code>14' x 12'</code> (<code>168" x 144"</code>)</strong> US dining room hosting <code>8</code> guests on a rectangular <code>96" x 38"</code> table with an <code>18"</code> sideboard:</p>
<ul>
<li><code>actualEndClearanceIn = (168 - 96) / 2 = 36"</code> (hits the <code>36"</code> minimum, flagged <code>TIGHT</code> if your target is <code>42"</code>).</li>
<li><code>actualSideClearanceIn = (144 - 18 - 38) / 2 = 44"</code> (<code>PASS</code> for <code>42"</code> walk-behind).</li>
<li><code>recommendedRug = 144" x 86"</code> (closest standard stock rug: <code>8' x 12'</code> or <code>9' x 12'</code>).</li>
<li><code>chandelierDiameterIn = 14 + 12 = 26"</code>, right at the <code>25"</code> (<code>2/3 * 38"</code>) width cap, signaling that a linear chandelier or <code>24"</code> round fixture fits best.</li>
</ul>
<h2>3. Coordinating Adjacent Open-Concept Kitchen Aisles and Lighting</h2>
<p>In modern open-concept floor plans, dining chair pull-back often collides with kitchen island barstools. Always verify at least <code>42"</code> to <code>48"</code> between the island counter overhang and the dining chair push-back zone using our <a href="https://www.plancaliber.com/calculators/kitchen-island-clearance">kitchen island clearance calculator</a>, and balance ambient ceiling cans around the central chandelier with our <a href="https://www.plancaliber.com/calculators/recessed-lighting-spacing-layout-calculator">recessed lighting spacing calculator</a>.</p>
<h2>Test Your Dining Layout in 2D and 3D CAD</h2>
<p>Open our <a href="https://www.plancaliber.com/templates/open_concept_remodel">Open-Concept Remodel Template</a> or <a href="https://www.plancaliber.com/templates/modern_farmhouse_4bed">Modern Farmhouse 4-Bedroom Template</a> in PlanCaliber's <code>$0</code> Free Studio to test rectangular, oval, and round tables inside your real walls. Drafting, 2 free AI Sketch/PDF-to-CAD scans per day, 40 US templates, 50 US code calculators, live 3D cutaways, and <code>1400x1050</code> watermarked proof PNGs are free. Optional one-time passes unlock clean 2-sheet <code>1/4"=1'-0"</code> vector PDFs (<code>$9</code> Clean Print Pass) or full 5-sheet <code>1/4"=1'-0"</code> CAD PDFs + 8-layer AutoCAD R12 <code>.DXF</code> (<code>$INSUNITS=1</code> US inches) + 3D <code>.OBJ/.MTL</code> + Framing &amp; Drywall CSV takeoffs (<code>$19</code> one-time, <code>$49</code> 5-Pack, or optional <code>$29/mo</code> / <code>$99/yr</code> unlimited), with permanent edits and 14-day instant refunds.</p>
<p>All dining room sizing calculations and floor plans are for preliminary space planning and estimating; always field-verify room dimensions, door swings, and electrical junction-box locations with your contractor or local building official (AHJ).</p>
]]></content:encoded></item><item><title><![CDATA[Writing a Deterministic Bedroom Furniture Clearance and IRC R304 Solver in TypeScript]]></title><description><![CDATA[A bedroom that looks spacious on an empty rectangle often breaks down once you drop in an Eastern King mattress (76" x 80"), a 4" perimeter bed frame, twin…]]></description><link>https://plancaliber.hashnode.dev/writing-a-deterministic-bedroom-furniture-clearance-and-irc-r304-solver-in-typescript</link><guid isPermaLink="true">https://plancaliber.hashnode.dev/writing-a-deterministic-bedroom-furniture-clearance-and-irc-r304-solver-in-typescript</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[webdev]]></category><category><![CDATA[cad]]></category><category><![CDATA[engineering]]></category><dc:creator><![CDATA[Clara Sutton]]></dc:creator><pubDate>Sat, 28 Nov 2026 17:18:26 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b07d6b9e447de416c07f0c8/122d92d3-1b9c-4a13-b7bd-c0ff54fa88b3.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>A bedroom that looks spacious on an empty rectangle often breaks down once you drop in an Eastern King mattress (<code>76" x 80"</code>), a <code>4"</code> perimeter bed frame, twin <code>24"</code> nightstands, and a <code>20"</code> deep opposite dresser. Suddenly the bedside walkway narrows below <code>24"</code>, drawers collide with the footboard, or an in-swinging closet door clips the nightstand corner.</p>
<p>When building <a href="https://www.plancaliber.com/calculators/bedroom-size-furniture-clearance-calculator">PlanCaliber's bedroom size and furniture clearance calculator</a>, we modeled mattress-plus-frame envelopes, <strong>IRC Section R304.1</strong> minimum habitable sleeping-room rules, bedside aisle buffers, foot-of-bed drawer clearance, and area rug sizing in pure TypeScript so remodelers and homebuilders can validate room dimensions before framing a single partition wall.</p>
<h2>1. Modeling Mattress and Bed Frame Envelopes Under IRC R304.1</h2>
<p>A common geometry bug in DIY room planners is using bare mattress dimensions. Standard upholstered or wood bed frames add roughly <strong><code>+4"</code> to width</strong> (<code>2"</code> per rail) and <strong><code>+5"</code> to length</strong> (headboard + footboard thickness). On top of that, <strong>IRC R304.1 / R304.2</strong> requires every habitable sleeping room to provide at least <strong><code>70 sq ft</code></strong> of floor area and a minimum horizontal dimension of <strong><code>7'-0"</code></strong> (<code>84"</code>).</p>
<pre><code class="language-ts">export type BedSizeKey = "twin" | "twin_xl" | "full" | "queen" | "king" | "cal_king";

export const BED_MATTRESS_SPECS: Record&lt;BedSizeKey, { mattressW: number; mattressL: number }&gt; = {
  twin: { mattressW: 38, mattressL: 75 },
  twin_xl: { mattressW: 38, mattressL: 80 },
  full: { mattressW: 54, mattressL: 75 },
  queen: { mattressW: 60, mattressL: 80 },
  king: { mattressW: 76, mattressL: 80 },
  cal_king: { mattressW: 72, mattressL: 84 },
};

export interface BedroomCalcInput {
  lengthFt: number;
  widthFt: number;
  bedSize: BedSizeKey;
  nightstands: 0 | 1 | 2;
  nightstandWidthIn: number;
  hasOppositeDresser: boolean;
}
</code></pre>
<h2>2. Bedside Walkway, Nightstand Overflow, and Foot-of-Bed Drawer Clearances</h2>
<p>Our solver splits clearance analysis along two orthogonal axes:</p>
<ul>
<li><strong>Headboard-wall axis (<code>widthFt * 12</code>)</strong>: Checks both raw bedside aisle clearance (<code>(roomWidthIn - bedFrameWidthIn) / 2</code>) and the remaining buffer outside the nightstands (<code>sideWallBufferIn</code>). Ideal primary-suite circulation targets <strong><code>&gt;= 30"</code></strong> per side (or <code>&gt;= 24"</code> with at least a <code>6"</code> buffer past the nightstand so drapery, baseboards, and closet door swings do not bind). Anything below <code>20"</code> per side or any nightstand overflow (<code>sideWallBufferIn &lt; 0</code>) triggers a <code>FAIL</code>.</li>
<li><strong>Foot-of-bed axis (<code>lengthFt * 12</code>)</strong>: Deducts the bed frame length plus a <strong><code>20"</code></strong> opposite dresser when present. An unobstructed wall passage targets <strong><code>&gt;= 36"</code></strong>, while an opposite dresser bumps the target to <strong><code>&gt;= 42"</code></strong> so <code>18"</code> to <code>20"</code> open drawers leave standing room in front of the casework.</li>
</ul>
<pre><code class="language-ts">export type CalcCheckStatus = "PASS" | "TIGHT" | "FAIL";

export function evaluateBedroomClearances(input: BedroomCalcInput) {
  const spec = BED_MATTRESS_SPECS[input.bedSize];
  const bedFrameWidthIn = spec.mattressW + 4;
  const bedFrameLengthIn = spec.mattressL + 5;

  const areaSqFt = Math.round(input.lengthFt * input.widthFt);
  const ircR304Pass = areaSqFt &gt;= 70 &amp;&amp; Math.min(input.lengthFt, input.widthFt) &gt;= 7;

  const roomWidthIn = input.widthFt * 12;
  const roomLengthIn = input.lengthFt * 12;

  const sideMattressClearanceIn = Math.round((roomWidthIn - bedFrameWidthIn) / 2);
  const sideWallBufferIn = Math.round(
    (roomWidthIn - bedFrameWidthIn - input.nightstands * input.nightstandWidthIn) / 2
  );
  const nightstandsFit = sideWallBufferIn &gt;= 0;

  let sideStatus: CalcCheckStatus = "TIGHT";
  if (!nightstandsFit || sideMattressClearanceIn &lt; 20) {
    sideStatus = "FAIL";
  } else if (
    sideMattressClearanceIn &gt;= 30 ||
    (input.nightstands &gt; 0 &amp;&amp; sideMattressClearanceIn &gt;= 24 &amp;&amp; sideWallBufferIn &gt;= 6)
  ) {
    sideStatus = "PASS";
  }

  const dresserDepthIn = input.hasOppositeDresser ? 20 : 0;
  const footWalkwayIn = Math.round(roomLengthIn - bedFrameLengthIn - dresserDepthIn);
  const footTargetIn = input.hasOppositeDresser ? 42 : 36;
  const footStatus: CalcCheckStatus =
    footWalkwayIn &gt;= footTargetIn ? "PASS" : footWalkwayIn &gt;= 24 ? "TIGHT" : "FAIL";

  return {
    areaSqFt,
    ircR304Pass,
    sideMattressClearanceIn,
    sideWallBufferIn,
    sideStatus,
    footWalkwayIn,
    footTargetIn,
    footStatus,
  };
}
</code></pre>
<p>Run a real US primary-bedroom test case through this function:</p>
<ul>
<li><strong><code>14' x 12'</code> (<code>168 sq ft</code>) with Eastern King (<code>80" x 85"</code> frame), twin <code>24"</code> nightstands, opposite <code>20"</code> dresser</strong>:<ul>
<li><code>sideMattressClearanceIn = (144 - 80) / 2 = 32"</code> (<code>PASS</code>, <code>8"</code> buffer past each nightstand).</li>
<li><code>footWalkwayIn = 168 - 85 - 20 = 63"</code> (<code>PASS</code>, well above the <code>42"</code> open-drawer target).</li>
</ul>
</li>
<li><strong><code>10' x 12'</code> (<code>120 sq ft</code>) with Queen (<code>64" x 85"</code> frame), twin <code>20"</code> nightstands, opposite <code>20"</code> dresser</strong>:<ul>
<li><code>sideMattressClearanceIn = (120 - 64) / 2 = 28"</code> with <code>8"</code> past each stand (<code>PASS</code>).</li>
<li><code>footWalkwayIn = 144 - 85 - 20 = 39"</code> (<code>TIGHT</code>: below <code>42"</code>, telling the designer to slide the dresser onto an adjacent wall or switch to a recessed reach-in closet).</li>
</ul>
</li>
</ul>
<h2>3. Don't Forget Adjacent Code Constraints: Egress Windows and Closets</h2>
<p>A sleeping room's floor envelope is only one piece of IRC compliance. Every bedroom also requires an <strong>IRC R310</strong> emergency escape and rescue opening (<code>&gt;= 5.7 sq ft</code> net clear opening above grade, <code>24"</code> min height, <code>20"</code> min width, <code>&lt;= 44"</code> sill height) and sensible closet swing clearance. Pair your room layout check with our <a href="https://www.plancaliber.com/calculators/irc-egress-window">IRC R310 egress window calculator</a> and <a href="https://www.plancaliber.com/calculators/walk-in-closet-dimensions">walk-in closet dimensions calculator</a> so door swing arcs never clip the foot of the bed.</p>
<h2>Lay Out Your Bedroom Suite in 2D and 3D CAD</h2>
<p>Drop your validated room dimensions into a full floor plan starting from our <a href="https://www.plancaliber.com/templates/ranch_4bed_2000">4-Bedroom Ranch Template</a> or <a href="https://www.plancaliber.com/templates/craftsman_2bed_1200">2-Bedroom Craftsman Template</a> in PlanCaliber's <code>$0</code> Free Studio. Browser 2D/3D drafting, 2 free AI Sketch/PDF-to-CAD scans per day, 40 US templates, 50 US code calculators, live 3D cutaways, and <code>1400x1050</code> watermarked proof PNGs are free. Optional one-time passes unlock clean 2-sheet <code>1/4"=1'-0"</code> vector PDFs (<code>$9</code> Clean Print Pass) or full 5-sheet <code>1/4"=1'-0"</code> CAD PDFs + 8-layer AutoCAD R12 <code>.DXF</code> (<code>$INSUNITS=1</code> US inches) + 3D <code>.OBJ/.MTL</code> + Framing &amp; Drywall CSV takeoffs (<code>$19</code> one-time, <code>$49</code> 5-Pack, or optional <code>$29/mo</code> / <code>$99/yr</code> unlimited), with permanent edits and 14-day instant refunds.</p>
<p>All bedroom clearance calculations and floor plans are for preliminary space planning and estimating; always field-verify framing dimensions, closet door swings, and local IRC R304/R310 requirements with your local building official (AHJ).</p>
]]></content:encoded></item><item><title><![CDATA[Building a Deterministic Post-Frame Barndominium Footprint Solver in TypeScript: Column Bays, IRC R302.6 Splits, and Slab Yardage]]></title><description><![CDATA[Designing a post-frame barndominium (or "shouse") starts with structural bay math long before you place a kitchen island or bathroom vanity. Because…]]></description><link>https://plancaliber.hashnode.dev/building-a-deterministic-post-frame-barndominium-footprint-solver-in-typescript-column-bays-irc-r302-6-splits-and-slab-yardage</link><guid isPermaLink="true">https://plancaliber.hashnode.dev/building-a-deterministic-post-frame-barndominium-footprint-solver-in-typescript-column-bays-irc-r302-6-splits-and-slab-yardage</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[webdev]]></category><category><![CDATA[cad]]></category><category><![CDATA[engineering]]></category><dc:creator><![CDATA[Clara Sutton]]></dc:creator><pubDate>Sat, 28 Nov 2026 17:15:03 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b07d6b9e447de416c07f0c8/9ccf03ea-b4fd-4df8-bee5-c6c34970cc63.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Designing a post-frame barndominium (or "shouse") starts with structural bay math long before you place a kitchen island or bathroom vanity. Because pole-barn and steel-frame shells carry roof loads down perimeter columns spaced at <strong><code>8'-0"</code></strong>, <strong><code>10'-0"</code></strong>, or <strong><code>12'-0"</code></strong> on center (OC), an arbitrary building length or an unaligned shop-to-living firewall creates awkward header spans, clipped overhead door tracks, and unnecessary framing waste.</p>
<p>When building <a href="https://www.plancaliber.com/calculators/barndominium-footprint-calculator">PlanCaliber's barndominium footprint calculator</a>, we wrote a deterministic TypeScript solver (<code>evaluateBarndominium</code>) that snaps perimeter post grids, enforces <strong>IRC R302.6</strong> shop-to-living fire-separation geometry, checks overhead door headroom and gable end-wall pier fit, and computes concrete slab yardage with a 10% waste allowance.</p>
<h2>1. Snapping the Post-Frame Structural Bay Grid (<code>8'</code>, <code>10'</code>, or <code>12'</code> OC)</h2>
<p>Instead of letting a user draw floating walls and hoping the columns line up later, our solver derives exact perimeter post coordinates along the building's <code>lengthFt</code> (X-axis) and <code>widthFt</code> (Y-axis) from the chosen post spacing (<code>8 | 10 | 12</code> feet). That perimeter point array feeds both the live 2D SVG blueprint preview and the structural bay check:</p>
<pre><code class="language-ts">export type PostSpacingFt = 8 | 10 | 12;
export type EaveHeightFt = 10 | 12 | 14 | 16;
export type BarndoSlabThicknessIn = 4 | 5 | 6;

export interface BarndoPostPoint {
  xFt: number;
  yFt: number;
}

export function buildPerimeterPostGrid(
  lengthFt: number,
  widthFt: number,
  postSpacingFt: PostSpacingFt
): {
  lengthBays: number;
  widthBays: number;
  perimeterPostCount: number;
  posts: BarndoPostPoint[];
} {
  const lengthBays = Math.max(1, Math.ceil(lengthFt / postSpacingFt));
  const widthBays = Math.max(1, Math.ceil(widthFt / postSpacingFt));
  const perimeterPostCount = 2 * (lengthBays + widthBays);

  const posts: BarndoPostPoint[] = [];
  for (let i = 0; i &lt;= lengthBays; i++) {
    const xFt = (i / lengthBays) * lengthFt;
    posts.push({ xFt, yFt: 0 });
    posts.push({ xFt, yFt: widthFt });
  }
  for (let j = 1; j &lt; widthBays; j++) {
    const yFt = (j / widthBays) * widthFt;
    posts.push({ xFt: 0, yFt });
    posts.push({ xFt: lengthFt, yFt });
  }

  return { lengthBays, widthBays, perimeterPostCount, posts };
}
</code></pre>
<p>On a classic <code>40' x 60'</code> shell at <code>10'-0"</code> OC, this yields <code>6</code> length bays (<code>10.0'</code> avg OC), <code>4</code> width bays (<code>10.0'</code> avg OC), and exactly <code>20</code> perimeter posts (<code>2 * (6 + 4)</code>). Keeping the IRC R302.6 fire-separation partition aligned on or near a bay line simplifies truss bracing and continuous drywall fire-taping between the attached shop and living quarters.</p>
<h2>2. Overhead Door Headroom, End-Wall Pier Fit, and Shop Bay Depth</h2>
<p>The most common barndominium design mistake is specifying a <code>12'-0"</code> or <code>14'-0"</code> tall RV overhead door under an eave that is too low for standard-lift tracks and a structural header beam, or cramming too many doors onto a narrow gable end wall without leaving structural shear piers (<code>&gt;= 2'-0"</code> per jamb/pier).</p>
<pre><code class="language-ts">export type BarndoDoorId = "10x10" | "12x12" | "12x14_rv" | "16x10";
export type BarndoCheckStatus = "PASS" | "TIGHT" | "FAIL";

export interface BarndoDoorProfile {
  id: BarndoDoorId;
  widthFt: number;
  heightFt: number;
  recommendedBayDepthFt: number;
}

export const BARNDO_DOORS: Record&lt;BarndoDoorId, BarndoDoorProfile&gt; = {
  "10x10": { id: "10x10", widthFt: 10, heightFt: 10, recommendedBayDepthFt: 22 },
  "12x12": { id: "12x12", widthFt: 12, heightFt: 12, recommendedBayDepthFt: 24 },
  "12x14_rv": { id: "12x14_rv", widthFt: 12, heightFt: 14, recommendedBayDepthFt: 40 },
  "16x10": { id: "16x10", widthFt: 16, heightFt: 10, recommendedBayDepthFt: 24 },
};

export function evaluateShopClearances(params: {
  widthFt: number;
  eaveHeightFt: EaveHeightFt;
  actualShopLengthFt: number;
  doorId: BarndoDoorId;
  doorCount: 1 | 2 | 3;
}) {
  const door = BARNDO_DOORS[params.doorId];
  const headroomMarginIn = params.eaveHeightFt * 12 - door.heightFt * 12;
  const headroomStatus: BarndoCheckStatus =
    headroomMarginIn &lt; 12 ? "FAIL" : headroomMarginIn &lt; 24 ? "TIGHT" : "PASS";

  // Reserve &gt;= 2'-0" structural jamb/pier on both sides of every opening
  const requiredDoorWallFt = params.doorCount * door.widthFt + (params.doorCount + 1) * 2;
  const doorsFitWidth = requiredDoorWallFt &lt;= params.widthFt + 0.001;

  let bayDepthStatus: BarndoCheckStatus = "PASS";
  if (params.actualShopLengthFt &gt; 0) {
    if (params.actualShopLengthFt &lt; door.recommendedBayDepthFt - 4) {
      bayDepthStatus = "FAIL";
    } else if (params.actualShopLengthFt &lt; door.recommendedBayDepthFt) {
      bayDepthStatus = "TIGHT";
    }
  }

  return { headroomMarginIn, headroomStatus, requiredDoorWallFt, doorsFitWidth, bayDepthStatus };
}
</code></pre>
<p>Notice how <code>12x14_rv</code> enforces a <code>16'-0"</code> minimum eave (<code>+24"</code> headroom margin for torsion springs and header depth) and a <code>40'-0"</code> clear shop bay depth so a Class A motorhome clears the <strong>IRC R302.6</strong> separation wall (typically <code>1/2"</code> gypsum board on the garage/shop side, or <code>5/8"</code> Type X beneath habitable lofts, with a <code>1-3/8"</code> solid-wood/steel or <code>20-minute</code> fire-rated self-closing man door). You can also cross-check individual vehicle stalls in our <a href="https://www.plancaliber.com/calculators/garage-size-clearance-calculator">garage size and vehicle clearance calculator</a>.</p>
<h2>3. Living-to-Shop Area Split, Loft Cap, and Concrete Slab Yardage</h2>
<p>Once the living split (<code>percent</code> or exact <code>feet</code>) is resolved, the solver caps any optional mezzanine/loft area to <code>mainLivingSqFt</code> and computes monolithic slab concrete volume (<code>cubic yards = (footprintSqFt * slabThicknessIn / 12) / 27</code>) plus a standard <code>10%</code> pour waste factor:</p>
<pre><code class="language-ts">export function computeSlabAndProgram(params: {
  widthFt: number;
  lengthFt: number;
  livingLengthFt: number;
  loftSqFt: number;
  slabThicknessIn: BarndoSlabThicknessIn;
}) {
  const footprintSqFt = Math.round(params.widthFt * params.lengthFt);
  const mainLivingSqFt = Math.round(params.widthFt * params.livingLengthFt);
  const effectiveLoftSqFt = Math.round(Math.max(0, Math.min(params.loftSqFt, mainLivingSqFt)));
  const totalHeatedLivingSqFt = mainLivingSqFt + effectiveLoftSqFt;
  const shopBaySqFt = Math.round(params.widthFt * Math.max(0, params.lengthFt - params.livingLengthFt));

  const exactConcreteCuYd = Number(((footprintSqFt * (params.slabThicknessIn / 12)) / 27).toFixed(2));
  const concreteWith10PctWasteCuYd = Number((exactConcreteCuYd * 1.1).toFixed(2));

  return {
    footprintSqFt,
    totalHeatedLivingSqFt,
    shopBaySqFt,
    exactConcreteCuYd,
    concreteWith10PctWasteCuYd,
  };
}
</code></pre>
<p>For a <code>40' x 60'</code> (<code>2,400 sq ft</code>) barndominium on a <code>5"</code> reinforced shop slab, exact concrete volume is <code>37.04 cu yd</code>, and <code>40.74 cu yd</code> with 10% waste (<code>4</code> to <code>5</code> ready-mix truckloads before thickened perimeter edges). For thickened-edge monolithic footing beams and rebar spacing, pair this with our <a href="https://www.plancaliber.com/calculators/concrete-slab-footing-calculator">concrete slab and footing calculator</a>.</p>
<h2>Drafting Your Barndominium Floor Plan in 2D and 3D</h2>
<p>Once your post-frame shell, door heights, and living/shop split pass every check in the <a href="https://www.plancaliber.com/barndominium-floor-plans">barndominium floor plans hub</a>, open our pre-built <a href="https://www.plancaliber.com/templates/barndominium_40x60">40x60 Barndominium Floor Plan Template</a> in PlanCaliber's <code>$0</code> Free Studio. Drafting, 2 free AI Sketch/PDF-to-CAD scans per day, 40 US templates, 50 US code calculators, live 3D cutaways, and <code>1400x1050</code> watermarked proof PNGs are free. Optional one-time passes unlock clean unwatermarked 2-sheet <code>1/4"=1'-0"</code> vector PDFs (<code>$9</code> Clean Print Pass) or full 5-sheet <code>1/4"=1'-0"</code> CAD PDFs (<code>A-101</code>/<code>A-102</code>/<code>E-101</code>/<code>A-201</code>/<code>M-101</code>) + 8-layer AutoCAD R12 <code>.DXF</code> (<code>$INSUNITS=1</code> US inches) + 3D <code>.OBJ/.MTL</code> + Framing &amp; Drywall CSV takeoffs (<code>$19</code> one-time, <code>$49</code> 5-Pack, or optional <code>$29/mo</code> / <code>$99/yr</code> unlimited), with permanent edits on one-time passes and 14-day instant refunds.</p>
<p>All PlanCaliber calculations, templates, and CAD exports are for preliminary space planning and estimating; always field-verify structural post sizing, snow/wind loads, slab rebar, and IRC R302.6 fire-separation assemblies with a licensed structural engineer and your local building official (AHJ).</p>
]]></content:encoded></item><item><title><![CDATA[Tiny House CAD Envelopes in TypeScript: DOT 8'-6" Road Limits, IRC Appendix Q Loft Headroom, and Alternating-Tread Stair Math]]></title><description><![CDATA[Drafting a tiny house on wheels (8x24) or compact foundation (16x32) leaves zero wasted inches. On a trailer build, crossing 8'-6" (102") exterior width or…]]></description><link>https://plancaliber.hashnode.dev/tiny-house-cad-envelopes-in-typescript-dot-8-6-road-limits-irc-appendix-q-loft-headroom-and-alternating-tread-stair-math</link><guid isPermaLink="true">https://plancaliber.hashnode.dev/tiny-house-cad-envelopes-in-typescript-dot-8-6-road-limits-irc-appendix-q-loft-headroom-and-alternating-tread-stair-math</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Clara Sutton]]></dc:creator><pubDate>Sat, 28 Nov 2026 16:37:12 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b07d6b9e447de416c07f0c8/23442d81-de25-417e-93be-eef5b5d7edfc.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Drafting a tiny house on wheels (<code>8x24</code>) or compact foundation (<code>16x32</code>) leaves zero wasted inches. On a trailer build, crossing <strong><code>8'-6"</code> (<code>102"</code>)</strong> exterior width or <strong><code>13'-6"</code> (<code>162"</code>)</strong> road height turns a highway-legal tiny house into a permitted oversize load across US states. Meanwhile, inside the shell, standard <code>7-3/4"</code> rise / <code>10"</code> run stairs consume nearly <code>11 feet</code> of linear floor length unless you model <strong>IRC Appendix Q (Tiny Houses)</strong> compact loft stairs and ladders cleanly.</p>
<p>When building <a href="https://www.plancaliber.com/tiny-house-floor-plans">PlanCaliber's tiny house floor plan studio</a>, we encoded DOT highway bounding-box checks, wall-thickness interior net-width losses, and IRC Appendix Q loft headroom and steep-stair formulas directly in TypeScript.</p>
<h2>1. US DOT Highway Envelope &amp; Net Interior Width Solver</h2>
<p>A standard <code>8'-6"</code> (<code>102"</code>) road-legal trailer shell loses wall depth fast: two <code>2x4</code> framed walls (<code>3.5"</code> studs + <code>0.5"</code> exterior sheathing + <code>0.75"</code> siding + <code>0.5"</code> interior shiplap = <code>5.25"</code> per side -&gt; <code>10.5"</code> total) trim interior wall-to-wall width to <strong><code>91.5"</code> (<code>7'-7.5"</code>)</strong>. Overlooking exterior siding overhang or wheel-well fender boxes breaks cabinet and shower fits immediately:</p>
<pre><code class="language-ts">export interface TinyHouseShellInput {
  exteriorLengthFt: number;
  exteriorWidthIn: number;        // max 102" (8'-6") DOT without wide-load permit
  trailerDeckHeightIn: number;    // typically 22"-26" above road surface
  totalStructureHeightIn: number; // floor framing + main wall + loft + roof peak
  wallAssemblyThickIn: number;    // e.g. 5.25" per side (2x4 + sheathing + siding + finish)
  roofAssemblyThickIn: number;    // e.g. 8.5" rafters + insulation + roofing
  mainFloorClearHeightIn: number; // e.g. 80" (6'-8" IRC App Q min)
  loftFloorAssemblyIn: number;    // e.g. 6.25" (2x6 joists + 3/4" ply)
}

export interface TinyHouseEnvelopeReport {
  netInteriorWidthIn: number;
  netInteriorSqFt: number;
  totalRoadHeightIn: number;
  remainingLoftPeakHeightIn: number;
  passesDotWidth: boolean;
  passesDotHeight: boolean;
  passesAppQMainCeiling: boolean;
  warnings: string[];
}

export function validateTinyHouseEnvelope(input: TinyHouseShellInput): TinyHouseEnvelopeReport {
  const warnings: string[] = [];
  const netInteriorWidthIn = input.exteriorWidthIn - input.wallAssemblyThickIn * 2;
  const netInteriorLengthIn = input.exteriorLengthFt * 12 - input.wallAssemblyThickIn * 2;
  const netInteriorSqFt = (netInteriorWidthIn * netInteriorLengthIn) / 144;

  const totalRoadHeightIn = input.trailerDeckHeightIn + input.totalStructureHeightIn;
  const remainingLoftPeakHeightIn =
    input.totalStructureHeightIn -
    input.mainFloorClearHeightIn -
    input.loftFloorAssemblyIn -
    input.roofAssemblyThickIn;

  const passesDotWidth = input.exteriorWidthIn &lt;= 102;
  const passesDotHeight = totalRoadHeightIn &lt;= 162;
  const passesAppQMainCeiling = input.mainFloorClearHeightIn &gt;= 80; // IRC AQ103.1: 6'-8" habitable min

  if (!passesDotWidth) {
    warnings.push(`Exterior width ${input.exteriorWidthIn}" exceeds 102" (8'-6") US DOT highway limit.`);
  }
  if (!passesDotHeight) {
    warnings.push(`Total road height ${totalRoadHeightIn}" exceeds 162" (13'-6") US DOT bridge clearance limit.`);
  }
  if (!passesAppQMainCeiling) {
    warnings.push(`Main floor height ${input.mainFloorClearHeightIn}" is below 80" (6'-8") IRC Appendix Q minimum.`);
  }
  if (remainingLoftPeakHeightIn &lt; 36) {
    warnings.push(`Loft peak headroom ${remainingLoftPeakHeightIn.toFixed(1)}" is tight for sitting up on an 8" mattress.`);
  }

  return {
    netInteriorWidthIn: Number(netInteriorWidthIn.toFixed(1)),
    netInteriorSqFt: Number(netInteriorSqFt.toFixed(1)),
    totalRoadHeightIn: Number(totalRoadHeightIn.toFixed(1)),
    remainingLoftPeakHeightIn: Number(remainingLoftPeakHeightIn.toFixed(1)),
    passesDotWidth,
    passesDotHeight,
    passesAppQMainCeiling,
    warnings,
  };
}
</code></pre>
<p>Run the numbers on a <code>24-foot</code> trailer with <code>24"</code> deck height and <code>136"</code> structure height (<code>160"</code> road height, <code>PASS</code> under <code>162"</code>): after <code>80"</code> main-floor height (<code>6'-8"</code> IRC AQ103.1), <code>6.25"</code> loft floor joists, and <code>8.5"</code> insulated roof assembly, your sleeping loft peaks at <strong><code>41.25"</code></strong> clear, enough to sit up comfortably over a low-profile <code>6"</code> mattress while staying road-legal nationwide!</p>
<h2>2. IRC Appendix Q Loft Stairway Slope &amp; Footprint Solver</h2>
<p>Under <strong>IRC Appendix Q (Section AQ104.2)</strong> for dwellings <code>&lt;= 400 sq ft</code>, sleeping loft stairs allow steeper risers (<code>7"</code> to <code>12"</code>) governed by the exact relationship <strong><code>R = 20 - T</code></strong> (where riser <code>R</code> plus tread <code>T</code> equals <code>20"</code>):</p>
<pre><code class="language-ts">export interface AppQLoftStairResult {
  riserCount: number;
  riserHeightIn: number;
  treadDepthIn: number;
  totalHorizontalRunIn: number;
  minStairWidthIn: number;
  passesAppQ: boolean;
}

export function solveAppendixQLoftStairs(
  floorToLoftTopIn: number,
  targetRiserHeightIn = 9.5
): AppQLoftStairResult {
  const riserCount = Math.ceil(floorToLoftTopIn / targetRiserHeightIn);
  const riserHeightIn = floorToLoftTopIn / riserCount;
  // IRC AQ104.2.1: Tread depth = 20 - (4/3)*R, minimum 6.25"
  const treadDepthIn = Math.max(6.25, 20 - (4 / 3) * riserHeightIn);
  const totalHorizontalRunIn = (riserCount - 1) * treadDepthIn;
  const passesAppQ = riserHeightIn &gt;= 7 &amp;&amp; riserHeightIn &lt;= 12 &amp;&amp; treadDepthIn &gt;= 6.25;

  return {
    riserCount,
    riserHeightIn: Number(riserHeightIn.toFixed(2)),
    treadDepthIn: Number(treadDepthIn.toFixed(2)),
    totalHorizontalRunIn: Number(totalHorizontalRunIn.toFixed(1)),
    minStairWidthIn: 17, // IRC AQ104.2.2 min clear width at handrail
    passesAppQ,
  };
}
</code></pre>
<p>For an <code>86.25"</code> floor-to-loft vertical climb, standard IRC stairs demand <code>110"</code> (<code>9'-2"</code>) of horizontal floor run, whereas an Appendix Q storage staircase (<code>10</code> risers at <code>8.63"</code> rise, <code>8.5"</code> tread) climbs the same height in <strong><code>76.5"</code> (<code>6'-4.5"</code>)</strong> while creating <code>16+ cu ft</code> of built-in wardrobe storage beneath the treads! You can also check standard residential stair stringers in our <a href="https://www.plancaliber.com/calculators/stair-stringer-rise-run">staircase rise and run calculator</a> and framing takeoff in our <a href="https://www.plancaliber.com/calculators/wall-stud-drywall-takeoff">wall stud &amp; drywall calculator</a>.</p>
<h2>Drafting Your Tiny House or Foundation Cabin in 2D and 3D</h2>
<p>Start directly inside our pre-built <a href="https://www.plancaliber.com/templates/tiny_house_8x24">8x24 Tiny House on Wheels Template</a> or <a href="https://www.plancaliber.com/templates/tiny_house_16x32">16x32 Foundation Tiny House Template</a> in <a href="https://www.plancaliber.com/tiny-house-floor-plans">PlanCaliber</a>. Inspect furniture, kitchenette, and loft proportions in live 3D and save watermarked proof PNGs free. Optional one-time passes unlock clean unwatermarked 2-sheet <code>1/4"=1'-0"</code> vector PDFs (<code>$9</code>) or full 5-sheet CAD PDFs + 8-layer AutoCAD R12 <code>.DXF</code> files (<code>$INSUNITS=1</code> US inches) + 3D <code>.OBJ</code> models + framing/drywall CSVs (<code>$19</code>), with permanent edits and 14-day instant refunds.</p>
<p>All plans and calculators are for preliminary space planning and estimating; always verify trailer axle weight ratings, local IRC Appendix Q adoption, ANSI/RVIA standards, and egress requirements with your local building official (AHJ).</p>
]]></content:encoded></item><item><title><![CDATA[Detached Backyard Studio & Shed Geometry in TypeScript: IRC R105.2 200 sq ft Thresholds, Pier Footing Loads, and Common Rafter Cuts]]></title><description><![CDATA[A 12x16 (192 sq ft) detached backyard office or workshop is one of the smartest footprints in US residential building. Under IRC Section R105.2, many US…]]></description><link>https://plancaliber.hashnode.dev/detached-backyard-studio-shed-geometry-in-typescript-irc-r105-2-200-sq-ft-thresholds-pier-footing-loads-and-common-rafter-cuts</link><guid isPermaLink="true">https://plancaliber.hashnode.dev/detached-backyard-studio-shed-geometry-in-typescript-irc-r105-2-200-sq-ft-thresholds-pier-footing-loads-and-common-rafter-cuts</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Clara Sutton]]></dc:creator><pubDate>Sat, 28 Nov 2026 16:31:29 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b07d6b9e447de416c07f0c8/d497fcce-9936-4b60-aa3e-2455e90b498c.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>A <code>12x16</code> (<code>192 sq ft</code>) detached backyard office or workshop is one of the smartest footprints in US residential building. Under <strong>IRC Section R105.2</strong>, many US municipalities exempt detached one-story accessory structures whose floor area does not exceed <strong><code>200 sq ft</code></strong> (or <code>120 sq ft</code> under older IBC/local amendments) from full building permits when kept unplumbed and set back cleanly from lot lines.</p>
<p>When building <a href="https://www.plancaliber.com/shed-backyard-studio-plans">PlanCaliber's shed and backyard studio floor plan tool</a>, we implemented IRC area-threshold checks, concrete pier tributary load sizing, and gable/shed rafter geometry directly in TypeScript so DIY builders and contractors get exact dimensions and lumber counts before digging a single footing hole.</p>
<h2>1. Footprint Area &amp; IRC R105.2 Threshold Geometry</h2>
<p>Standard <code>4x8</code> plywood/OSB subfloor and wall sheathing sheets make footprints divisible by <code>4 feet</code> (<code>10x12</code>, <code>12x16</code>, <code>12x20</code>, <code>14x20</code>) dramatically cheaper in cut waste. A <code>12'-0" x 16'-0"</code> exterior footprint yields <code>192 sq ft</code> (<code>6</code> full <code>4x8</code> subfloor sheets with zero rip waste!) while staying <code>8 sq ft</code> below the <code>200 sq ft</code> IRC R105.2 threshold:</p>
<pre><code class="language-ts">export interface ShedFootprintInput {
  widthFt: number;
  lengthFt: number;
  wallThicknessIn?: number; // 4.0" for 2x4 + sheathing, 6.0" for 2x6 insulated studio
  localExemptLimitSqFt?: number; // 200 under IRC R105.2, 120 in stricter jurisdictions
}

export interface ShedGeometrySummary {
  grossFootprintSqFt: number;
  netInteriorSqFt: number;
  subfloorSheets4x8: number;
  withinLocalExemptSqFt: boolean;
  perimeterLinFt: number;
}

export function analyzeShedFootprint(input: ShedFootprintInput): ShedGeometrySummary {
  const wallFt = (input.wallThicknessIn ?? 4.5) / 12;
  const grossFootprintSqFt = input.widthFt * input.lengthFt;
  const netWidthFt = Math.max(0, input.widthFt - wallFt * 2);
  const netLengthFt = Math.max(0, input.lengthFt - wallFt * 2);
  const netInteriorSqFt = netWidthFt * netLengthFt;

  // 4x8 sheet = 32 sq ft; add 8% waste factor when dimensions are not multiples of 4'
  const cleanModular = input.widthFt % 4 === 0 &amp;&amp; input.lengthFt % 4 === 0;
  const wasteFactor = cleanModular ? 1.0 : 1.08;
  const subfloorSheets4x8 = Math.ceil((grossFootprintSqFt * wasteFactor) / 32);

  return {
    grossFootprintSqFt: Number(grossFootprintSqFt.toFixed(1)),
    netInteriorSqFt: Number(netInteriorSqFt.toFixed(1)),
    subfloorSheets4x8,
    withinLocalExemptSqFt: grossFootprintSqFt &lt;= (input.localExemptLimitSqFt ?? 200),
    perimeterLinFt: Number(((input.widthFt + input.lengthFt) * 2).toFixed(1)),
  };
}
</code></pre>
<p>Test multiple footprints, wall studs, and desk clearance interactively in our free <a href="https://www.plancaliber.com/calculators/shed-backyard-studio-size-calculator">shed &amp; backyard studio size calculator</a>.</p>
<h2>2. Common Gable &amp; Single-Slope Shed Rafter Length Math</h2>
<p>Whether framing a classic <code>6:12</code> gable roof or a modern <code>3:12</code> single-slope studio roof, calculating exact common rafter length (including ridge thickness deduction and eaves overhang) prevents short tails and misaligned fascia boards:</p>
<pre><code class="language-ts">export interface RafterSpec {
  buildingSpanFt: number;
  pitchRisePer12: number; // e.g. 6 for 6:12 gable, 3 for 3:12 mono-pitch
  roofType: "gable" | "shed_monopitch";
  overhangHorizIn: number; // e.g. 12" eaves overhang
  ridgeBoardThickIn?: number; // 1.5" for 2x ridge board
}

export interface RafterCutResult {
  horizontalRunIn: number;
  totalRiseIn: number;
  rafterSlopeLengthIn: number;
  recommendedStockLengthFt: number;
  plumbCutAngleDeg: number;
}

export function calculateCommonRafter(spec: RafterSpec): RafterCutResult {
  const spanIn = spec.buildingSpanFt * 12;
  const ridgeDeduction = spec.roofType === "gable" ? (spec.ridgeBoardThickIn ?? 1.5) / 2 : 0;
  const baseRunIn = spec.roofType === "gable" ? spanIn / 2 - ridgeDeduction : spanIn;

  // Mono-pitch shed roof overhangs both high and low walls; gable overhangs low eaves wall
  const totalOverhangIn =
    spec.roofType === "gable" ? spec.overhangHorizIn : spec.overhangHorizIn * 2;
  const horizontalRunIn = baseRunIn + totalOverhangIn;

  const slopeRatio = spec.pitchRisePer12 / 12;
  const totalRiseIn = horizontalRunIn * slopeRatio;
  const rafterSlopeLengthIn = Math.hypot(horizontalRunIn, totalRiseIn);

  // Standard US lumber lengths in 2-foot increments (8', 10', 12', 14', 16', 18', 20')
  const rawFeet = rafterSlopeLengthIn / 12;
  const recommendedStockLengthFt = Math.max(8, Math.ceil(rawFeet / 2) * 2);
  const plumbCutAngleDeg = (Math.atan(slopeRatio) * 180) / Math.PI;

  return {
    horizontalRunIn: Number(horizontalRunIn.toFixed(2)),
    totalRiseIn: Number(totalRiseIn.toFixed(2)),
    rafterSlopeLengthIn: Number(rafterSlopeLengthIn.toFixed(2)),
    recommendedStockLengthFt,
    plumbCutAngleDeg: Number(plumbCutAngleDeg.toFixed(1)),
  };
}
</code></pre>
<p>On a <code>12'-0"</code> span modern mono-pitch <code>3:12</code> backyard office with <code>12"</code> overhangs front and rear (<code>horizontalRunIn = 168"</code>), total sloped rafter length is <code>173.17"</code> (<code>14.43 ft</code>), immediately dictating <strong><code>16-foot</code> 2x8 rafters</strong> instead of discovering <code>14-foot</code> boards come up <code>5.2"</code> short at the lumberyard! Check gable, hip, and valley rafter geometry interactively in our free <a href="https://www.plancaliber.com/calculators/roof-pitch-rafter-length-calculator">roof pitch &amp; rafter length calculator</a>.</p>
<h2>3. Concrete Sonotube Pier Spacing &amp; Soil Bearing Sanity Check</h2>
<p>For a <code>12x16</code> insulated office carrying <code>40 psf</code> floor live load + <code>10 psf</code> floor dead load + <code>30 psf</code> snow/roof load (<code>80 psf</code> total combined tributary load -&gt; <code>15,360 lbs</code> total building load), placing <code>9</code> concrete piers (<code>3</code> beams × <code>3</code> piers on <code>6'-0"</code> × <code>8'-0"</code> centers) puts roughly <code>1,707 lbs</code> average load (<code>~3,840 lbs</code> peak on the center pier) onto the soil. At a conservative <code>1,500 psf</code> soil bearing capacity, a <code>12"</code> diameter Sonotube pier (<code>0.785 sq ft</code> area -&gt; <code>1,178 lbs</code> capacity) is undersized for the center beam; bumping center piers to <strong><code>18"</code> footings</strong> (<code>1.77 sq ft</code> -&gt; <code>2,650 lbs</code>) or adding a 4th pier per beam keeps soil bearing safely inside code.</p>
<h2>Drafting Your Backyard Studio or Workshop in 2D and 3D</h2>
<p>Start directly inside our pre-built <a href="https://www.plancaliber.com/templates/backyard_studio_12x16">12x16 Backyard Studio Floor Plan Template</a> on <a href="https://www.plancaliber.com/shed-backyard-studio-plans">PlanCaliber</a>. Place sliding glass doors, built-in desks, mini-split indoor heads, and outlets, orbit your live 3D studio cutaway, and download watermarked proof PNGs free. Optional one-time passes unlock clean unwatermarked 2-sheet <code>1/4"=1'-0"</code> vector PDFs (<code>$9</code>) or full 5-sheet CAD PDFs + 8-layer AutoCAD R12 <code>.DXF</code> files (<code>$INSUNITS=1</code> US inches) + framing/drywall takeoff CSVs (<code>$19</code>), with permanent edits and 14-day instant refunds.</p>
<p>All plans and code calculators are for preliminary space planning and estimating; always verify zoning setbacks, electrical/subpanel permits, frost-line footing depths, and local IRC R105.2 exemptions with your local building official (AHJ).</p>
]]></content:encoded></item><item><title><![CDATA[Walk-In Closet Double-Rod Clearances, 84-Inch Minimum Widths, and Laundry Dryer Vent Equivalent Length Math in TypeScript]]></title><description><![CDATA[Two of the smallest rooms in a US home generate a disproportionate share of framing regrets: walk-in closets drafted too narrow for hanging garments on…]]></description><link>https://plancaliber.hashnode.dev/walk-in-closet-double-rod-clearances-84-inch-minimum-widths-and-laundry-dryer-vent-equivalent-length-math-in-typescript</link><guid isPermaLink="true">https://plancaliber.hashnode.dev/walk-in-closet-double-rod-clearances-84-inch-minimum-widths-and-laundry-dryer-vent-equivalent-length-math-in-typescript</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Clara Sutton]]></dc:creator><pubDate>Sat, 28 Nov 2026 16:22:01 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b07d6b9e447de416c07f0c8/2a2207bc-7f84-4d86-817a-1ea66db1a99a.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Two of the smallest rooms in a US home generate a disproportionate share of framing regrets: walk-in closets drafted too narrow for hanging garments on both walls, and laundry/mudrooms whose front-load washer doors collide with the entry door or whose dryer exhaust duct exceeds the <strong>IRC M1502.4.5.1</strong> <code>35-foot</code> developed length limit.</p>
<p>When building <a href="https://www.plancaliber.com/closet-laundry-floor-plans">PlanCaliber's closet and laundry room floor plan studio</a>, we modeled double-sided hanging geometry, front-load door clearance arcs, and IRC M1502 dryer duct equivalent length penalties as pure TypeScript functions so remodelers catch tight pinch points before setting bottom plates.</p>
<h2>1. Why a 5-Foot Walk-In Closet Fails Double Hanging Rods (<code>84"</code> Rule)</h2>
<p>Standard adult coat hangers on a closet rod require <strong><code>24"</code></strong> of clear hanging depth from the wall to the outer edge of hanging garments. Place hanging rods on opposite walls (<code>24" + 24" = 48"</code>), and you still need a minimum <strong><code>36"</code></strong> center walking aisle so shoulders do not brush clothes on both sides (<code>24" + 36" + 24" = 84"</code>, or <strong><code>7'-0"</code></strong> clear interior width). Drop the room to <code>5'-0"</code> (<code>60"</code>) and double hanging leaves an unworkable <code>12"</code> slot between sleeves.</p>
<pre><code class="language-ts">export type ClosetLayoutMode = "single_wall" | "l_shape" | "double_wall_galley" | "u_shape_island";

export interface ClosetClearanceReport {
  mode: ClosetLayoutMode;
  clearAisleWidthIn: number;
  passesComfortableAisle: boolean;
  passesMinWalkway: boolean;
  recommendedRodHeightIn: { singleRod: number; doubleUpper: number; doubleLower: number };
  warnings: string[];
}

export function evaluateWalkInClosetWidth(
  interiorWidthIn: number,
  mode: ClosetLayoutMode,
  includeCenterIsland = false,
  islandWidthIn = 24
): ClosetClearanceReport {
  const HANGING_DEPTH_IN = 24;
  const warnings: string[] = [];

  let clearAisleWidthIn = interiorWidthIn - HANGING_DEPTH_IN;
  if (mode === "double_wall_galley" || mode === "u_shape_island") {
    clearAisleWidthIn = interiorWidthIn - HANGING_DEPTH_IN * 2;
  }
  if (includeCenterIsland) {
    // Clear passage required on BOTH sides of a center dresser island
    clearAisleWidthIn = (clearAisleWidthIn - islandWidthIn) / 2;
  }

  const passesMinWalkway = clearAisleWidthIn &gt;= 30;
  const passesComfortableAisle = clearAisleWidthIn &gt;= 36;

  if (!passesMinWalkway) {
    warnings.push(
      `Clear aisle is ${clearAisleWidthIn.toFixed(1)}" (&lt; 30" bare min). Switch one side to 14" folded-shelf towers or widen room to 84" (7'-0").`
    );
  } else if (!passesComfortableAisle) {
    warnings.push(
      `Clear aisle is ${clearAisleWidthIn.toFixed(1)}" (tight). 36" clear aisle (84" room width for double rods) is recommended.`
    );
  }

  return {
    mode,
    clearAisleWidthIn: Number(clearAisleWidthIn.toFixed(1)),
    passesComfortableAisle,
    passesMinWalkway,
    recommendedRodHeightIn: { singleRod: 66, doubleUpper: 82, doubleLower: 41 },
    warnings,
  };
}
</code></pre>
<p>Want a center dresser island (<code>24"</code> wide) between two hanging walls? Our formula immediately reveals the real width requirement: <code>24" hanging + 36" aisle + 24" island + 36" aisle + 24" hanging = 144"</code> (<code>12'-0"</code> clear width). Test any room size interactively in our free <a href="https://www.plancaliber.com/calculators/walk-in-closet-dimensions">walk-in closet dimensions calculator</a>.</p>
<h2>2. Laundry Room Door Clearance &amp; IRC M1502.4.5.1 Dryer Vent Equivalent Length</h2>
<p>Modern full-size US front-load washers and dryers are typically <code>27"</code> wide by <code>32"</code> to <code>34"</code> deep, plus <code>4"</code> to <code>6"</code> behind the machines for water valves, drain box, and rigid <code>4"</code> exhaust duct (<code>38"</code> to <code>40"</code> total installed depth). Add a <code>22"</code> front-load door swing and a <code>24"</code> standing zone, and a single-wall laundry room needs at least <strong><code>66"</code> to <code>72"</code></strong> (<code>5'-6"</code> to <code>6'-0"</code>) of clear depth.</p>
<p>Equally critical is <strong>IRC M1502.4.5.1</strong>: rigid metal dryer exhaust ducts are capped at <strong><code>35 feet</code></strong> of developed length, with every <code>90-degree</code> smooth elbow deducting <code>5 ft</code> and every <code>45-degree</code> elbow deducting <code>2.5 ft</code>:</p>
<pre><code class="language-ts">export interface DryerVentInput {
  straightRunFeet: number;
  elbows90Count: number;
  elbows45Count: number;
  elbowRadiusIn?: number; // 6"+ long-sweep radius reduces penalty vs tight 4" radius
}

export interface DryerVentCheck {
  equivalentLengthFt: number;
  maxAllowedFt: number;
  passesIrcM1502: boolean;
  marginFt: number;
}

export function checkDryerExhaustLength(input: DryerVentInput): DryerVentCheck {
  const maxAllowedFt = 35;
  const penalty90 = (input.elbowRadiusIn ?? 4) &gt;= 6 ? 2.5 : 5.0;
  const penalty45 = (input.elbowRadiusIn ?? 4) &gt;= 6 ? 1.25 : 2.5;

  const equivalentLengthFt =
    input.straightRunFeet + input.elbows90Count * penalty90 + input.elbows45Count * penalty45;
  const marginFt = maxAllowedFt - equivalentLengthFt;

  return {
    equivalentLengthFt: Number(equivalentLengthFt.toFixed(1)),
    maxAllowedFt,
    passesIrcM1502: equivalentLengthFt &lt;= maxAllowedFt,
    marginFt: Number(marginFt.toFixed(1)),
  };
}
</code></pre>
<p>A seemingly short <code>22 ft</code> straight duct with three standard <code>90-degree</code> elbows clocks in at <code>22 + 15 = 37 ft</code> (<code>FAIL</code> under IRC M1502.4.5.1). Moving the dryer onto an exterior mudroom wall eliminates two turns immediately and drops equivalent length to <code>9 ft</code>. Check bench depths, cubbies, and washer swings interactively in our <a href="https://www.plancaliber.com/calculators/laundry-mudroom-dimensions-calculator">laundry &amp; mudroom dimensions calculator</a>.</p>
<h2>Drafting Your Walk-In Closet or Mudroom in 2D and 3D</h2>
<p>Open our pre-built <a href="https://www.plancaliber.com/templates/laundry_mudroom_12x16">12x16 Laundry &amp; Mudroom Floor Plan Template</a> in <a href="https://www.plancaliber.com/closet-laundry-floor-plans">PlanCaliber</a>. Resize walls to <code>1/16"</code> precision, verify door swings and bench clearances in live 3D, and download watermarked proof PNGs free. Optional one-time passes unlock clean unwatermarked 2-sheet <code>1/4"=1'-0"</code> vector PDFs (<code>$9</code>) or full 5-sheet CAD PDFs + 8-layer AutoCAD R12 <code>.DXF</code> files (<code>$INSUNITS=1</code> US inches) + framing/drywall takeoff CSVs (<code>$19</code>), with permanent edits and 14-day instant refunds.</p>
<p>All plans and code calculators are for preliminary space planning and estimating; always field-verify clearances, plumbing/electrical rough-ins, and local IRC mechanical requirements with your local building official (AHJ).</p>
]]></content:encoded></item><item><title><![CDATA[Encoding Finished Basement Code Geometry in TypeScript: IRC R305.1 Beam Headroom, R310 Egress Wells, and Wet-Bar Clearances]]></title><description><![CDATA[Finishing a 28x36 basement into a guest suite, media room, and wet bar is one of the highest-ROI US home remodels, yet basements introduce three hidden 3D…]]></description><link>https://plancaliber.hashnode.dev/encoding-finished-basement-code-geometry-in-typescript-irc-r305-1-beam-headroom-r310-egress-wells-and-wet-bar-clearances</link><guid isPermaLink="true">https://plancaliber.hashnode.dev/encoding-finished-basement-code-geometry-in-typescript-irc-r305-1-beam-headroom-r310-egress-wells-and-wet-bar-clearances</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Clara Sutton]]></dc:creator><pubDate>Sat, 28 Nov 2026 16:18:22 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b07d6b9e447de416c07f0c8/239a2334-32f6-44d6-905d-2045d2fa30cf.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Finishing a <code>28x36</code> basement into a guest suite, media room, and wet bar is one of the highest-ROI US home remodels, yet basements introduce three hidden 3D geometric constraints that flat 2D drawing apps miss completely:</p>
<ol>
<li><strong>Structural drop beams and HVAC trunk soffits</strong> (<code>IRC R305.1.1</code>) that drop ceiling clearance below <code>6'-4"</code> right over a hallway or stair landing.</li>
<li><strong>Below-grade bedroom egress window wells</strong> (<code>IRC R310.2</code> &amp; <code>R310.4</code>) requiring <code>5.7 sq ft</code> net clear opening (<code>5.0 sq ft</code> at grade), <code>&lt;= 44"</code> sill height, and a <code>36"x36"</code> clear exterior well with a ladder if deeper than <code>44"</code>.</li>
<li><strong>Staircase headroom and mechanical clearances</strong> (<code>6'-8"</code> vertical nosing clearance under <code>IRC R311.7.2</code>, plus <code>30"x36"</code> NEC 110.26 electrical panel working space).</li>
</ol>
<p>When building <a href="https://www.plancaliber.com/basement-floor-plans">PlanCaliber's finished basement floor plan studio</a>, we modeled every basement code rule as deterministic TypeScript functions so homeowners and remodelers catch headroom and egress traps before framing partitions.</p>
<h2>1. IRC R305.1 &amp; R305.1.1 Basement Ceiling and Beam Headroom Validation</h2>
<p>Under IRC R305.1, habitable rooms and hallways require a <code>7'-0"</code> (<code>84"</code>) minimum ceiling height, while Exception R305.1.1 allows beams, girders, ducts, and pipes in basements to project down to <code>6'-4"</code> (<code>76"</code>) above the finished floor (never lower over required stair headroom, which stays <code>6'-8"</code> / <code>80"</code>!):</p>
<pre><code class="language-ts">export interface BasementCeilingInput {
  joistBottomHeightIn: number;      // raw slab-to-joist height, e.g. 90"
  subfloorAndFinishLossIn: number;  // e.g. 1.25" Dricore + LVP
  ceilingDrywallIn: number;         // e.g. 0.5" gypsum
  lowestBeamOrDuctDropIn: number;   // depth beam/duct drops below joist bottom
  isOverStairRun: boolean;
}

export interface HeadroomReport {
  finishedFieldHeightIn: number;
  finishedUnderBeamHeightIn: number;
  passesHabitableCeiling: boolean;
  passesBeamException: boolean;
  warnings: string[];
}

export function checkBasementHeadroom(input: BasementCeilingInput): HeadroomReport {
  const warnings: string[] = [];
  const finishedFieldHeightIn =
    input.joistBottomHeightIn - input.subfloorAndFinishLossIn - input.ceilingDrywallIn;
  const finishedUnderBeamHeightIn = finishedFieldHeightIn - input.lowestBeamOrDuctDropIn;

  const passesHabitableCeiling = finishedFieldHeightIn &gt;= 84;
  const minUnderProjection = input.isOverStairRun ? 80 : 76;
  const passesBeamException = finishedUnderBeamHeightIn &gt;= minUnderProjection;

  if (!passesHabitableCeiling) {
    warnings.push(
      `Finished field height is ${finishedFieldHeightIn.toFixed(1)}" (&lt; 84" IRC R305.1 habitable min); consider painted exposed joists or thin direct-glue flooring.`
    );
  }
  if (!passesBeamException) {
    warnings.push(
      `Clearance under beam/duct is ${finishedUnderBeamHeightIn.toFixed(1)}" (&lt; ${minUnderProjection}" min); relocate soffit over closets or non-habitable storage.`
    );
  }

  return {
    finishedFieldHeightIn: Number(finishedFieldHeightIn.toFixed(1)),
    finishedUnderBeamHeightIn: Number(finishedUnderBeamHeightIn.toFixed(1)),
    passesHabitableCeiling,
    passesBeamException,
    warnings,
  };
}
</code></pre>
<p>On an older home with <code>88"</code> slab-to-joist height, adding a <code>1.5"</code> insulated subfloor + <code>0.5"</code> drywall leaves <code>86"</code> clear (<code>PASS</code>), whereas a <code>12"</code> HVAC supply trunk drops to <code>74"</code> (<code>FAIL</code> under <code>76"</code>). Routing a closet wall or wet-bar soffit directly beneath that trunk turns a code violation into clean intentional framing! Test full room dimensions, drywall sheets, and egress interactively in our free <a href="https://www.plancaliber.com/calculators/basement-finishing-layout-calculator">basement finishing layout calculator</a>.</p>
<h2>2. Validating IRC R310 Bedroom Egress Windows and Window Wells</h2>
<p>Any basement room labeled or used as a sleeping room must include an emergency escape and rescue opening (EERO) meeting all four IRC R310 thresholds simultaneously:</p>
<pre><code class="language-ts">export interface EgressWindowInput {
  clearOpenWidthIn: number;
  clearOpenHeightIn: number;
  sillHeightAboveFloorIn: number;
  wellWidthIn: number;
  wellProjectionIn: number;
  wellDepthBelowGradeIn: number;
  isGradeFloorOpening: boolean;
}

export interface EgressCheckResult {
  pass: boolean;
  netClearAreaSqFt: number;
  requiresWellLadder: boolean;
  issues: string[];
}

export function validateBasementEgress(input: EgressWindowInput): EgressCheckResult {
  const issues: string[] = [];
  const netClearAreaSqFt = (input.clearOpenWidthIn * input.clearOpenHeightIn) / 144;
  const minAreaSqFt = input.isGradeFloorOpening ? 5.0 : 5.7;

  if (netClearAreaSqFt &lt; minAreaSqFt) {
    issues.push(`Net clear area ${netClearAreaSqFt.toFixed(2)} sq ft &lt; ${minAreaSqFt} sq ft IRC R310.2.1 min.`);
  }
  if (input.clearOpenWidthIn &lt; 20) {
    issues.push(`Clear opening width ${input.clearOpenWidthIn}" &lt; 20" min.`);
  }
  if (input.clearOpenHeightIn &lt; 24) {
    issues.push(`Clear opening height ${input.clearOpenHeightIn}" &lt; 24" min.`);
  }
  if (input.sillHeightAboveFloorIn &gt; 44) {
    issues.push(`Sill height ${input.sillHeightAboveFloorIn}" exceeds 44" max above finished floor.`);
  }

  const wellAreaSqFt = (input.wellWidthIn * input.wellProjectionIn) / 144;
  if (wellAreaSqFt &lt; 9.0 || input.wellWidthIn &lt; 36 || input.wellProjectionIn &lt; 36) {
    issues.push(`Window well (${input.wellWidthIn}" x ${input.wellProjectionIn}") must be &gt;= 36"x36" and &gt;= 9 sq ft.`);
  }

  const requiresWellLadder = input.wellDepthBelowGradeIn &gt; 44;

  return {
    pass: issues.length === 0,
    netClearAreaSqFt: Number(netClearAreaSqFt.toFixed(2)),
    requiresWellLadder,
    issues,
  };
}
</code></pre>
<p>Note the classic trap: a window with <code>20"</code> width and <code>24"</code> height satisfies both minimums individually (<code>20" &gt;= 20"</code>, <code>24" &gt;= 24"</code>), yet its area is only <code>3.33 sq ft</code> (<code>FAIL</code>: a <code>24"</code> wide casement needs at least <code>34.2"</code> clear height to reach <code>5.7 sq ft</code>).</p>
<h2>3. NEC 110.26 Electrical Panel &amp; Mechanical Access Buffers</h2>
<p>When boxing out basement utilities, never frame a wet bar or couch inside the NEC 110.26(A) dedicated working space in front of the main breaker panel: <code>30"</code> wide (or width of equipment), <code>36"</code> deep clear floor space, and <code>78"</code> (<code>6'-6"</code>) headroom with a <code>90</code>-degree door swing. Checking basement stair rise/run too? Verify your treads and <code>80"</code> stair headroom in our <a href="https://www.plancaliber.com/calculators/stair-stringer-rise-run">staircase rise and run calculator</a>.</p>
<h2>Drafting Your Finished Basement in 2D and 3D Without Monthly Lock-In</h2>
<p>Launch straight into our pre-built <a href="https://www.plancaliber.com/templates/basement_suite_28x36">28x36 Basement Suite Template</a> or <a href="https://www.plancaliber.com/templates/basement_rec_bar_24x40">24x40 Basement Rec Room &amp; Bar Template</a> inside PlanCaliber. Place foundation posts, wrap soffits cleanly, inspect live 3D sightlines, and save watermarked proof PNGs free. Optional one-time passes unlock clean unwatermarked 2-sheet vector PDFs (<code>$9</code>) or full 5-sheet <code>1/4"=1'-0"</code> vector PDFs, 8-layer AutoCAD R12 <code>.DXF</code> files (<code>$INSUNITS=1</code> US inches), 3D <code>.OBJ</code> models, and stud/drywall takeoff CSVs (<code>$19</code>), with permanent edits and 14-day instant refunds.</p>
<p>All plans and code calculators are for preliminary space planning and estimating; always field-verify structural beams, radon/vapor mitigation, egress wells, and local IRC amendments with your local building official (AHJ).</p>
]]></content:encoded></item><item><title><![CDATA[Modeling IBC Table 1004.5 Restaurant & Retail Occupancy Loads, ADA 60-Inch Turn Circles, and Exit Aisle Widths in TypeScript]]></title><description><![CDATA[When a restaurant, coffee shop, or retail tenant leases a 40x24 (960 sq ft) vanilla shell, early floor plan mistakes cost months of lease carry. Put 42…]]></description><link>https://plancaliber.hashnode.dev/modeling-ibc-table-1004-5-restaurant-retail-occupancy-loads-ada-60-inch-turn-circles-and-exit-aisle-widths-in-typescript</link><guid isPermaLink="true">https://plancaliber.hashnode.dev/modeling-ibc-table-1004-5-restaurant-retail-occupancy-loads-ada-60-inch-turn-circles-and-exit-aisle-widths-in-typescript</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Clara Sutton]]></dc:creator><pubDate>Sat, 28 Nov 2026 16:12:35 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b07d6b9e447de416c07f0c8/53d80e78-1300-4b43-9ebc-d940675e328a.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When a restaurant, coffee shop, or retail tenant leases a <code>40x24</code> (<code>960 sq ft</code>) vanilla shell, early floor plan mistakes cost months of lease carry. Put 42 dining seats into a space whose occupant load crosses 50 without a second exit door (<code>IBC Table 1006.2.1</code>), squeeze a checkout aisle below <code>36"</code> clear, or design a restroom lacking a <code>60"</code> ADA wheelchair turning circle (<code>ADA 304.3.1</code>), and the city plan reviewer bounces the layout immediately.</p>
<p>When building <a href="https://www.plancaliber.com/restaurant-retail-floor-plans">PlanCaliber's restaurant and retail floor plan studio</a>, we implemented IBC Table 1004.5 mixed-function occupant load math, egress door thresholds, service aisle clearance validators, and ADA 60-inch restroom clearance checks directly in TypeScript so founders and contractors catch bottlenecks on day one.</p>
<h2>1. Mixed-Function Occupancy Load Under IBC Table 1004.5</h2>
<p>Unlike single-use office suites, restaurants and cafes combine multiple IBC load factors under one roof:</p>
<ul>
<li><strong>Unconcentrated dining (tables &amp; chairs)</strong>: <code>15 net sq ft / occupant</code></li>
<li><strong>Standing / bar / queue area (concentrated)</strong>: <code>7 net sq ft / occupant</code></li>
<li><strong>Commercial kitchen</strong>: <code>200 gross sq ft / occupant</code></li>
<li><strong>Mercantile / retail sales floor</strong>: <code>60 gross sq ft / occupant</code></li>
<li><strong>Storage / stockroom</strong>: <code>300 gross sq ft / occupant</code></li>
</ul>
<p>Because IBC rounds fractional loads up (<code>Math.ceil</code>) per functional zone and triggers a <strong>second remote exit</strong> for Group A-2 assembly spaces at <strong>50 occupants</strong> (and Group M retail spaces at <strong>50 occupants</strong> as well under IBC Table 1006.2.1), exact zone-by-zone summation matters:</p>
<pre><code class="language-ts">export type CommercialZoneKind =
  | "dining_tables"
  | "standing_bar"
  | "commercial_kitchen"
  | "retail_sales"
  | "storage_stockroom";

export const IBC_1004_5_SQFT_PER_OCCUPANT: Record&lt;CommercialZoneKind, number&gt; = {
  dining_tables: 15,
  standing_bar: 7,
  commercial_kitchen: 200,
  retail_sales: 60,
  storage_stockroom: 300,
};

export interface CommercialZone {
  name: string;
  kind: CommercialZoneKind;
  areaSqFt: number;
}

export interface OccupancyLoadReport {
  zoneBreakdown: Array&lt;{ name: string; occupants: number }&gt;;
  totalOccupants: number;
  requiresTwoExits: boolean;
  requiresPanicHardware: boolean;
  minCombinedExitWidthIn: number;
}

export function computeRestaurantRetailOccupancy(
  zones: CommercialZone[],
  isSprinklered = false
): OccupancyLoadReport {
  const zoneBreakdown = zones.map((z) =&gt; ({
    name: z.name,
    occupants: Math.ceil(z.areaSqFt / IBC_1004_5_SQFT_PER_OCCUPANT[z.kind]),
  }));

  const totalOccupants = zoneBreakdown.reduce((sum, z) =&gt; sum + z.occupants, 0);

  // IBC Table 1006.2.1: Group A and M spaces with &gt;= 50 occupants require minimum 2 exits
  const requiresTwoExits = totalOccupants &gt;= 50;
  // IBC 1010.2.9: Group A occupancy &gt;= 50 requires panic hardware on egress doors
  const requiresPanicHardware = totalOccupants &gt;= 50;
  // IBC 1005.3.2: 0.2" per occupant for doors (0.15" if sprinklered with voice alarm)
  const factorInPerOcc = isSprinklered ? 0.15 : 0.2;
  const minCombinedExitWidthIn = Math.max(32, Math.ceil(totalOccupants * factorInPerOcc));

  return {
    zoneBreakdown,
    totalOccupants,
    requiresTwoExits,
    requiresPanicHardware,
    minCombinedExitWidthIn,
  };
}
</code></pre>
<p>In a <code>40x24</code> cafe (<code>520 sq ft</code> dining tables -&gt; <code>35</code>, <code>120 sq ft</code> espresso/kitchen -&gt; <code>1</code>, <code>160 sq ft</code> counter/retail -&gt; <code>3</code>, <code>80 sq ft</code> back storage -&gt; <code>1</code>), total occupant load lands at <code>40</code> occupants (staying safely under the <code>50</code>-occupant two-exit threshold). Increase the dining area to <code>720 sq ft</code> (<code>48</code> occupants) plus kitchen/retail (<code>4</code>), and the validator immediately flags <code>52</code> occupants -&gt; second exit door + panic hardware required. You can also test multi-zone loads interactively in our free <a href="https://www.plancaliber.com/calculators/commercial-office-occupancy-load-calculator">IBC occupancy load calculator</a>.</p>
<h2>2. Verifying ADA 60-Inch Wheelchair Turning Space and Toilet Clearances</h2>
<p>In single-user commercial restrooms (ADA 2010 Sections 304.3.1 &amp; 604.3.1), a <code>60"</code> diameter circular turning space (or T-shaped turning space) must remain clear of fixed walls and partition doors, and the water closet needs a <code>60"</code> wide by <code>56"</code> deep clear floor zone (measured perpendicular from the side wall and rear wall):</p>
<pre><code class="language-ts">export interface RectIn {
  x: number;
  y: number;
  w: number;
  h: number;
}

export interface AdaRestroomCheck {
  fits60InCircle: boolean;
  doorSwingClearsFixture: boolean;
  warnings: string[];
}

export function validateAdaSingleRestroom(
  interiorWidthIn: number,
  interiorDepthIn: number,
  doorSwingIntrusionIn: number,
  vanityDepthIn = 21,
  kneeClearanceUnderLavatory = true
): AdaRestroomCheck {
  const warnings: string[] = [];

  // Toe/knee clearance under wall-hung lavatory may overlap turning circle up to 12"-17"
  const effectiveTurnWidth = kneeClearanceUnderLavatory
    ? interiorWidthIn
    : interiorWidthIn - vanityDepthIn;

  const fits60InCircle = effectiveTurnWidth &gt;= 60 &amp;&amp; interiorDepthIn &gt;= 60;
  if (!fits60InCircle) {
    warnings.push(
      `Clear interior (${effectiveTurnWidth}" x ${interiorDepthIn}") cannot accommodate a 60" ADA turning circle.`
    );
  }

  // ADA 603.2.3: Door swing may not overlap clear floor space of fixtures unless room provides 30"x48" clear beyond swing
  const clearDepthBeyondDoor = interiorDepthIn - doorSwingIntrusionIn;
  const doorSwingClearsFixture = doorSwingIntrusionIn === 0 || clearDepthBeyondDoor &gt;= 48;
  if (!doorSwingClearsFixture) {
    warnings.push(
      `In-swinging door leaves only ${clearDepthBeyondDoor}" clear depth; reverse to out-swinging door or deepen room.`
    );
  }

  return {
    fits60InCircle,
    doorSwingClearsFixture,
    warnings,
  };
}
</code></pre>
<p>Checking interior entry slopes too? Pair restroom validation with our free <a href="https://www.plancaliber.com/calculators/ada-wheelchair-ramp-slope-calculator">ADA wheelchair ramp slope calculator</a> (<code>1:12</code> max slope, <code>60"</code> level landings).</p>
<h2>3. Dining Table Circulation &amp; Service Aisle Geometry</h2>
<p>Commercial dining layouts fail when chairs pull back <code>18"</code> to <code>20"</code> from tables and block waitstaff or wheelchair passage. Modeling occupied chair footprints directly around each table bounding box makes aisle validation trivial:</p>
<pre><code class="language-ts">export function computeTableToTablePitchIn(
  tableWidthIn: number,
  chairPulloutPerSideIn = 18,
  minServiceAisleIn = 36
): number {
  return tableWidthIn + chairPulloutPerSideIn * 2 + minServiceAisleIn;
}
</code></pre>
<p>For standard <code>30"x30"</code> cafe two-tops with <code>18"</code> chair pull-out on both sides and a <code>36"</code> ADA accessible service path between chair backs, center-to-center table spacing must be at least <code>102"</code> (<code>8'-6"</code>).</p>
<h2>Drafting Your Cafe, Restaurant, or Retail Space in 2D and 3D</h2>
<p>Start directly from our pre-built <a href="https://www.plancaliber.com/templates/cafe_retail_40x24">40x24 Cafe &amp; Retail Floor Plan Template</a> in <a href="https://www.plancaliber.com/restaurant-retail-floor-plans">PlanCaliber</a>. Resize walls to exact feet and inches, check 3D sightlines from entry to POS counter, and save watermarked proof PNGs free. Optional one-time passes unlock clean 2-sheet vector PDFs (<code>$9</code>) or full 5-sheet <code>1/4"=1'-0"</code> vector PDFs, layered AutoCAD R12 <code>.DXF</code> files (<code>$INSUNITS=1</code> US inches, 8 AIA layers), 3D <code>.OBJ</code> models, and framing/drywall takeoff CSVs (<code>$19</code>), with permanent edits, zero recurring subscriptions, and 14-day instant refunds.</p>
<p>All outputs are for preliminary space planning, lease negotiation, and estimating; always verify occupancy classifications, fire-life-safety egress, health department requirements, and ADA details on site with your local building official (AHJ) or licensed design professional.</p>
]]></content:encoded></item><item><title><![CDATA[Calculating Room Addition Header Spans, Foundation Step-Downs, and Roof Tie-In Framing in TypeScript]]></title><description><![CDATA[Adding a 12x16 primary bedroom bump-out or 14x20 family room addition to an existing US house introduces three framing calculations that standalone garage…]]></description><link>https://plancaliber.hashnode.dev/calculating-room-addition-header-spans-foundation-step-downs-and-roof-tie-in-framing-in-typescript</link><guid isPermaLink="true">https://plancaliber.hashnode.dev/calculating-room-addition-header-spans-foundation-step-downs-and-roof-tie-in-framing-in-typescript</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Clara Sutton]]></dc:creator><pubDate>Sat, 28 Nov 2026 16:03:31 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b07d6b9e447de416c07f0c8/d2ef5aae-15d4-4a1a-bcfe-d679a826b43b.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Adding a <code>12x16</code> primary bedroom bump-out or <code>14x20</code> family room addition to an existing US house introduces three framing calculations that standalone garage or ADU estimators consistently get wrong:</p>
<ol>
<li><strong>Over-ordering 25% of wall framing and drywall</strong> by counting all 4 perimeter walls instead of the 3 new exterior walls plus the demo/tie-in wall.</li>
<li><strong>Undersizing the cased-opening header</strong> cut through the existing load-bearing exterior wall (and forgetting the extra jack studs required under IRC Table R602.7(1)).</li>
<li><strong>Ignoring roof pitch tie-in geometry</strong> (calculating shed-roof minimum <code>3:12</code> shingle slope against existing eave height so the new ceiling does not drop below the IRC R305.1 <code>7'-0"</code> minimum habitable height).</li>
</ol>
<p>When building <a href="https://www.plancaliber.com/room-addition-floor-plans">PlanCaliber's US room addition floor plan studio</a>, we implemented these three calculators in pure TypeScript so contractors and homeowners get realistic preliminary framing and clearance checks right in the browser.</p>
<h2>1. Sizing the Load-Bearing Tie-In Header and Jack Studs</h2>
<p>Cutting a wide <code>8'-0"</code> or <code>12'-0"</code> opening into an existing exterior wall transfers roof (and sometimes second-floor) loads into two point-loaded jamb columns. Below is a simplified TypeScript selector modeled on IRC Table R602.7(1) for a single-story <code>28 ft</code> building width under a <code>30 psf</code> ground snow load using <code>#2</code> Douglas Fir / Southern Pine dimensional lumber:</p>
<pre><code class="language-ts">export interface HeaderRecommendation {
  memberSpec: string;
  jackStudsPerSide: number;
  requiresEngineeredBeam: boolean;
  note: string;
}

export function sizeLoadBearingHeader(
  roughOpeningFt: number,
  storiesSupported: 1 | 2,
  groundSnowPsf: 20 | 30 | 50 = 30
): HeaderRecommendation {
  // Penalize allowable dimensional span when supporting 2 stories or heavy snow
  const loadMultiplier = (storiesSupported === 2 ? 0.68 : 1.0) * (groundSnowPsf &gt;= 50 ? 0.85 : 1.0);
  const effectiveSpanFt = roughOpeningFt / loadMultiplier;

  if (effectiveSpanFt &lt;= 4.5) {
    return {
      memberSpec: "2-2x8 (#2 DF/SP)",
      jackStudsPerSide: 1,
      requiresEngineeredBeam: false,
      note: "Standard single jack stud + single king stud per jamb.",
    };
  }
  if (effectiveSpanFt &lt;= 6.2) {
    return {
      memberSpec: "2-2x10 (#2 DF/SP)",
      jackStudsPerSide: 1,
      requiresEngineeredBeam: false,
      note: "Verify continuous load path under jack studs to footing.",
    };
  }
  if (effectiveSpanFt &lt;= 7.8) {
    return {
      memberSpec: "2-2x12 (#2 DF/SP)",
      jackStudsPerSide: 2,
      requiresEngineeredBeam: false,
      note: "Requires 2 jack studs per side (3\" bearing) and full rim blocking below.",
    };
  }
  if (effectiveSpanFt &lt;= 9.2) {
    return {
      memberSpec: "3-2x12 (#2 DF/SP) or 2-ply 1-3/4\" x 11-7/8\" LVL",
      jackStudsPerSide: 2,
      requiresEngineeredBeam: false,
      note: "Consider flush LVL beam if ceiling joist height is tight.",
    };
  }

  return {
    memberSpec: "Engineered LVL / PSL / Steel Flush Beam (sized by structural engineer)",
    jackStudsPerSide: 3,
    requiresEngineeredBeam: true,
    note: `Rough opening (${roughOpeningFt} ft) exceeds prescriptive dimensional lumber tables; verify point loads and pad footings locally.`,
  };
}
</code></pre>
<p>For a <code>10'-0"</code> open kitchen bump-out under a two-story exterior wall, <code>effectiveSpanFt</code> reaches <code>14.7 ft</code>, immediately flagging the need for an engineered LVL/steel beam and pad footings instead of silently letting someone frame a <code>2-2x10</code>.</p>
<h2>2. Three-Wall Bump-Out Framing, Sheathing &amp; Drywall Takeoff</h2>
<p>A bump-out of width <code>W</code> (parallel to the existing house) and projection depth <code>D</code> adds only <code>W + 2 * D</code> linear feet of new exterior wall, NOT <code>2 * (W + D)</code>. Separating the 3 new exterior walls from the existing shared wall keeps framing stud counts, OSB sheathing sheets, and drywall quantities accurate:</p>
<pre><code class="language-ts">export interface BumpOutTakeoffInput {
  widthAlongHouseFt: number;   // e.g. 16 ft
  projectionDepthFt: number;   // e.g. 12 ft
  wallHeightFt: number;        // e.g. 8 or 9 ft
  studSpacingIn: 16 | 24;
  windowAndDoorCount: number;  // adds king/jack/cripple framing allowance
  wasteFactor?: number;        // default 1.10 (10%)
}

export interface BumpOutTakeoff {
  newExteriorWallLf: number;
  estimatedStuds: number;
  exteriorOsbSheets4x8: number;
  interiorDrywallSheets4x8: number;
  ceilingDrywallSheets4x8: number;
}

export function estimateBumpOutMaterials(input: BumpOutTakeoffInput): BumpOutTakeoff {
  const waste = input.wasteFactor ?? 1.1;
  const newExteriorWallLf = input.widthAlongHouseFt + 2 * input.projectionDepthFt;

  // Base studs + 2 exterior corners (3 studs each) + 2 house tie-in junctions + 4 studs/opening
  const studsPerFt = 12 / input.studSpacingIn;
  const rawStuds =
    Math.ceil(newExteriorWallLf * studsPerFt) +
    2 * 3 +
    2 * 2 +
    input.windowAndDoorCount * 4;

  const newWallAreaSqFt = newExteriorWallLf * input.wallHeightFt;
  const ceilingAreaSqFt = input.widthAlongHouseFt * input.projectionDepthFt;

  const exteriorOsbSheets4x8 = Math.ceil((newWallAreaSqFt / 32) * waste);
  const interiorDrywallSheets4x8 = Math.ceil((newWallAreaSqFt / 32) * waste);
  const ceilingDrywallSheets4x8 = Math.ceil((ceilingAreaSqFt / 32) * waste);

  return {
    newExteriorWallLf,
    estimatedStuds: Math.ceil(rawStuds * waste),
    exteriorOsbSheets4x8,
    interiorDrywallSheets4x8,
    ceilingDrywallSheets4x8,
  };
}
</code></pre>
<p>On a <code>16x12</code> addition (<code>40 LF</code> of new exterior walls at <code>8 ft</code> height, <code>16"</code> OC, 3 openings), the calculator outputs <code>58</code> studs, <code>11</code> OSB sheets, <code>11</code> wall drywall sheets, and <code>7</code> ceiling drywall sheets (saving <code>~18</code> excess studs and <code>5</code> drywall sheets compared to naive 4-wall estimates). Pair this with our interactive <a href="https://www.plancaliber.com/calculators/wall-stud-drywall-takeoff">stud framing and drywall takeoff calculator</a> and <a href="https://www.plancaliber.com/calculators/room-addition-framing-estimator">room addition framing estimator</a> for custom partition counts.</p>
<h2>3. Shed-Roof Tie-In Slope vs. IRC R305.1 Ceiling Clearance</h2>
<p>When tying a shed-roof bump-out below an existing second-story window sill or eaves ledger, ceiling height drops as projection depth <code>D</code> grows. Dimensional asphalt shingles typically require at least a <code>2:12</code> (low-slope underlayment) to <code>4:12</code> pitch; checking the outer wall plate height prevents designing an unusable <code>6'-4"</code> ceiling at the far edge:</p>
<pre><code class="language-ts">export interface ShedRoofClearance {
  dropInches: number;
  outerPlateHeightFt: number;
  passesIrc7FtMin: boolean;
  recommendedRoofType: string;
}

export function checkShedRoofTieIn(
  ledgerHeightFt: number,
  projectionDepthFt: number,
  pitchRisePer12: number,
  rafterAndFinishLossIn = 10.5 // 2x8 rafter (7.25") + drywall + birdsmouth allowance
): ShedRoofClearance {
  const dropInches = projectionDepthFt * pitchRisePer12;
  const outerInteriorIn = ledgerHeightFt * 12 - dropInches - rafterAndFinishLossIn;
  const outerPlateHeightFt = Number((outerInteriorIn / 12).toFixed(2));

  const recommendedRoofType =
    pitchRisePer12 &gt;= 4
      ? "Standard dimensional asphalt shingles (4:12+)"
      : pitchRisePer12 &gt;= 2
      ? "Low-slope double underlayment shingles or standing-seam metal (2:12 to &lt;4:12)"
      : "TPO / EPDM membrane roof (&lt;2:12)";

  return {
    dropInches: Number(dropInches.toFixed(1)),
    outerPlateHeightFt,
    passesIrc7FtMin: outerPlateHeightFt &gt;= 7.0,
    recommendedRoofType,
  };
}
</code></pre>
<p>A <code>12 ft</code> deep addition tied to a <code>10'-6"</code> ledger at a <code>3:12</code> pitch drops <code>36"</code> across the span, landing at an outer interior height of <code>~6'-7"</code> (failing IRC R305.1 <code>7'-0"</code> minimum) and prompting a switch to a <code>2:12</code> standing-seam metal roof or gable tie-in. You can also check roof pitch and rafter run interactively in our <a href="https://www.plancaliber.com/calculators/roof-pitch-rafter-length-calculator">roof pitch and rafter calculator</a>.</p>
<h2>Drafting Your Room Addition in 2D and 3D Without Subscriptions</h2>
<p>Inside <a href="https://www.plancaliber.com/templates/room_addition_24x18">PlanCaliber</a>, you can sketch an existing house wall, snap a bump-out addition to exact US feet and inches, verify bedroom egress and bathroom clearances, inspect the live Three.js 3D cutaway, and save a watermarked proof PNG free. When ready for clean deliverables, one-time passes unlock unwatermarked 2-sheet vector PDFs (<code>$9</code>) or full 5-sheet <code>1/4"=1'-0"</code> vector PDFs, 8-layer AutoCAD R12 <code>.DXF</code> files (<code>$INSUNITS=1</code> US inches), 3D <code>.OBJ</code> models, and framing/drywall takeoff CSVs (<code>$19</code>), with permanent edits and 14-day instant refunds.</p>
<p>All plans and calculators are for preliminary space planning and estimating; always verify structural headers, footings, lateral tie-ins, and local building codes on site with your local building official (AHJ) or licensed structural engineer.</p>
]]></content:encoded></item><item><title><![CDATA[Calculating IRC R507.6 Deck Joist Spans, Tributary Footing Loads, and Ledger Fastener Spacing in TypeScript]]></title><description><![CDATA[Residential wood decks look simple on paper until someone sizes a 12x16 frame by guesswork: over-spanning 2x8 joists at 16 inches on center creates bouncy…]]></description><link>https://plancaliber.hashnode.dev/calculating-irc-r507-6-deck-joist-spans-tributary-footing-loads-and-ledger-fastener-spacing-in-typescript</link><guid isPermaLink="true">https://plancaliber.hashnode.dev/calculating-irc-r507-6-deck-joist-spans-tributary-footing-loads-and-ledger-fastener-spacing-in-typescript</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Clara Sutton]]></dc:creator><pubDate>Sat, 28 Nov 2026 15:57:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b07d6b9e447de416c07f0c8/e0c6956d-62a0-448a-a9a9-a2c73c0dd188.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Residential wood decks look simple on paper until someone sizes a <code>12x16</code> frame by guesswork: over-spanning <code>2x8</code> joists at 16 inches on center creates bouncy decking, pouring 8-inch sonotubes under a multi-joist beam overloads soft clay soil, and spacing ledger bolts every 24 inches regardless of joist span violates IRC Table R507.9.1.3(1).</p>
<p>While building <a href="https://www.plancaliber.com/deck-patio-floor-plans">PlanCaliber's US deck and patio floor plan studio</a>, we implemented deterministic TypeScript framing validators based on IRC Section R507 tables so homeowners and contractors can check preliminary joist sizes, cantilever limits, concrete pier diameters, and ledger attachment spacing in real time before ordering lumber.</p>
<h2>1. Modeling IRC Table R507.6 Maximum Deck Joist Spans</h2>
<p>Under standard residential loads (<code>40 psf</code> live load + <code>10 psf</code> dead load = <code>50 psf</code> total), maximum joist clear span depends on lumber species/grade, nominal joist depth, and on-center spacing (<code>12"</code>, <code>16"</code>, or <code>24"</code> OC). Furthermore, IRC R507.6 caps joist overhangs (cantilevers) past the drop beam at <code>25%</code> of the actual back-span (and never exceeding the table's maximum overhang):</p>
<pre><code class="language-ts">export type LumberSpecies = "southern_pine_2" | "douglas_fir_2" | "hem_fir_2" | "redwood_cedar_2";
export type JoistSize = "2x6" | "2x8" | "2x10" | "2x12";
export type JoistSpacingIn = 12 | 16 | 24;

// Baseline IRC Table R507.6 allowable clear spans (in inches) for 40 psf live / 10 psf dead
const MAX_JOIST_SPAN_IN: Record&lt;LumberSpecies, Record&lt;JoistSize, Record&lt;JoistSpacingIn, number&gt;&gt;&gt; = {
  southern_pine_2: {
    "2x6":  { 12: 119, 16: 108, 24: 90 },
    "2x8":  { 12: 157, 16: 142, 24: 116 },
    "2x10": { 12: 194, 16: 168, 24: 137 },
    "2x12": { 12: 216, 16: 198, 24: 162 },
  },
  douglas_fir_2: {
    "2x6":  { 12: 114, 16: 100, 24: 81 },
    "2x8":  { 12: 150, 16: 132, 24: 107 },
    "2x10": { 12: 188, 16: 164, 24: 133 },
    "2x12": { 12: 216, 16: 190, 24: 155 },
  },
  hem_fir_2: {
    "2x6":  { 12: 108, 16: 96, 24: 78 },
    "2x8":  { 12: 142, 16: 126, 24: 103 },
    "2x10": { 12: 178, 16: 156, 24: 127 },
    "2x12": { 12: 204, 16: 180, 24: 147 },
  },
  redwood_cedar_2: {
    "2x6":  { 12: 96, 16: 87, 24: 72 },
    "2x8":  { 12: 127, 16: 115, 24: 94 },
    "2x10": { 12: 162, 16: 141, 24: 115 },
    "2x12": { 12: 192, 16: 164, 24: 134 },
  },
};

export interface JoistCheckResult {
  pass: boolean;
  maxAllowedSpanIn: number;
  maxAllowedCantileverIn: number;
  notes: string[];
}

export function validateDeckJoist(
  species: LumberSpecies,
  size: JoistSize,
  spacingIn: JoistSpacingIn,
  backSpanIn: number,
  cantileverIn: number
): JoistCheckResult {
  const maxAllowedSpanIn = MAX_JOIST_SPAN_IN[species][size][spacingIn];
  // IRC R507.6 caps overhang at 1/4 of actual back-span (and typical table ceiling ~24-36")
  const maxAllowedCantileverIn = Math.floor(Math.min(backSpanIn * 0.25, 36));
  const notes: string[] = [];

  if (backSpanIn &gt; maxAllowedSpanIn) {
    notes.push(
      `Back-span ${(backSpanIn / 12).toFixed(1)} ft exceeds ${size} @ ${spacingIn}" OC limit (${(maxAllowedSpanIn / 12).toFixed(1)} ft).`
    );
  }
  if (cantileverIn &gt; maxAllowedCantileverIn) {
    notes.push(
      `Cantilever ${cantileverIn}" exceeds 25% of back-span (${maxAllowedCantileverIn}" max).`
    );
  }

  return {
    pass: notes.length === 0,
    maxAllowedSpanIn,
    maxAllowedCantileverIn,
    notes,
  };
}
</code></pre>
<p>On a popular <code>12'-0"</code> deep deck using a <code>10'-0"</code> (<code>120"</code>) back-span and <code>2'-0"</code> (<code>24"</code>) cantilever past a drop beam, <code>#2 Southern Pine 2x8</code> joists at <code>16"</code> OC (<code>142"</code> max span, <code>30"</code> max cantilever) pass comfortably with a <code>22"</code> margin, whereas <code>24"</code> OC (<code>116"</code> max) fails and requires stepping up to <code>2x10</code>.</p>
<h2>2. Computing Tributary Load and Concrete Pier Diameter</h2>
<p>Every deck post carries half the joist back-span plus the full cantilever overhang, multiplied by half the sum of adjacent beam spans. Dividing total vertical load (in pounds) by the soil bearing capacity (<code>1,500 psf</code> default presumptive clay/sandy clay under IRC Table R401.4.1) gives the minimum footing area:</p>
<pre><code class="language-ts">export interface PierFootingInput {
  backSpanFt: number;
  cantileverFt: number;
  postSpacingFt: number;      // e.g. 8 ft along the beam
  isInteriorPost: boolean;    // interior posts carry ~2x edge post tributary width
  totalLoadPsf?: number;      // default 50 psf (40 live + 10 dead)
  soilBearingPsf?: number;    // default 1500 psf conservative presumptive soil
}

export interface PierFootingResult {
  tributaryAreaSqFt: number;
  designLoadLbs: number;
  minFootingAreaSqFt: number;
  recommendedRoundDiameterIn: number;
}

export function sizeConcreteDeckPier(input: PierFootingInput): PierFootingResult {
  const totalPsf = input.totalLoadPsf ?? 50;
  const soilPsf = input.soilBearingPsf ?? 1500;

  const joistTributaryDepthFt = input.backSpanFt / 2 + input.cantileverFt;
  const beamTributaryWidthFt = input.isInteriorPost
    ? input.postSpacingFt
    : input.postSpacingFt / 2 + 1; // +1 ft typical beam overhang at corner post

  const tributaryAreaSqFt = joistTributaryDepthFt * beamTributaryWidthFt;
  const designLoadLbs = tributaryAreaSqFt * totalPsf;
  const minFootingAreaSqFt = designLoadLbs / soilPsf;

  // Area of circle = pi * r^2 =&gt; d = sqrt(4 * A / pi)
  const rawDiamIn = Math.sqrt((4 * minFootingAreaSqFt) / Math.PI) * 12;
  // Snap up to standard US concrete form sizes (minimum 12" per IRC Table R507.3.1)
  const standardForms = [12, 14, 16, 18, 20, 22, 24];
  const recommendedRoundDiameterIn =
    standardForms.find((d) =&gt; d &gt;= rawDiamIn) ?? Math.ceil(rawDiamIn / 2) * 2;

  return {
    tributaryAreaSqFt: Number(tributaryAreaSqFt.toFixed(1)),
    designLoadLbs: Math.round(designLoadLbs),
    minFootingAreaSqFt: Number(minFootingAreaSqFt.toFixed(2)),
    recommendedRoundDiameterIn,
  };
}
</code></pre>
<p>For an interior post on our <code>12x16</code> deck (<code>10 ft</code> back-span, <code>2 ft</code> cantilever, <code>8 ft</code> post spacing), tributary area is <code>(5 + 2) * 8 = 56 sq ft</code>, generating <code>2,800 lbs</code> of vertical load (<code>1.87 sq ft</code> minimum footing area -&gt; <strong><code>18"</code> round pier</strong> in <code>1,500 psf</code> soil). You can explore custom post counts, frost-depth concrete volumes, and joist counts interactively in our free <a href="https://www.plancaliber.com/calculators/deck-size-joist-span-calculator">deck joist and footing calculator</a>.</p>
<h2>3. Ledger Board Lag-Screw / Through-Bolt Spacing</h2>
<p>When a deck attaches to a house band joist, ledger pull-out is the leading cause of residential deck failures. As joist span grows, ledger load per linear foot increases, so fastener horizontal spacing tightens (IRC Table R507.9.1.3(1) for <code>1/2"</code> through-bolts into a <code>2x</code> Douglas Fir/Southern Pine band joist with 1/2" wood structural sheathing):</p>
<pre><code class="language-ts">export function getLedgerThroughBoltSpacingIn(joistSpanFt: number): number {
  if (joistSpanFt &lt;= 6) return 36;
  if (joistSpanFt &lt;= 8) return 36;
  if (joistSpanFt &lt;= 10) return 34;
  if (joistSpanFt &lt;= 12) return 29;
  if (joistSpanFt &lt;= 14) return 24;
  if (joistSpanFt &lt;= 16) return 21;
  return 19; // up to 18 ft joist span
}
</code></pre>
<p>Staggering bolts along the upper and lower ledger rows (staying <code>&gt;= 2"</code> from top/bottom edges and <code>2"</code> to <code>5"</code> from board ends) prevents splitting the rim joist while maintaining continuous uplift and lateral resistance. Pair ledger flashing with two lateral-load tension ties (<code>1,500 lb</code> capacity each per IRC R507.9.2).</p>
<h2>4. Generating Complete Deck Framing &amp; Board Count Layouts</h2>
<p>Once the structural sizing passes, our browser studio lays out the <code>12x16</code>, <code>14x20</code>, or wraparound deck directly beside the exterior house wall so you can check door swings, outdoor grill clearance, stairs (<code>36"</code> minimum clear width), and guardrail lines in 2D and 3D simultaneously.</p>
<p>Try building or customizing a deck layout free in <a href="https://www.plancaliber.com/deck-patio-floor-plans">PlanCaliber's deck and patio studio</a> or browse our <a href="https://www.plancaliber.com/calculators">50 free US remodel code calculators</a> (draft, view in 3D, and save watermarked proof PNGs free; optional one-time <code>$9</code> clean 2-sheet vector PDF or <code>$19</code> full 5-sheet <code>1/4"=1'-0"</code> PDF + 8-layer AutoCAD R12 <code>.DXF</code> + 3D <code>.OBJ</code> + framing takeoff CSV, with no recurring subscription and 14-day instant refunds). Always verify snow loads, soil bearing capacity, frost line depth, and lateral-load hardware with your local building official (AHJ) before digging or building.</p>
]]></content:encoded></item><item><title><![CDATA[Compiling Natural-Language Floor Plan Prompts Into Watertight 2D/3D CAD Wall Graphs in TypeScript]]></title><description><![CDATA[Ask a general-purpose image model to draw a "1,200 sq ft 2-bedroom ADU floor plan with an L-shaped kitchen and 36-inch hallways," and you get an attractive…]]></description><link>https://plancaliber.hashnode.dev/compiling-natural-language-floor-plan-prompts-into-watertight-2d-3d-cad-wall-graphs-in-typescript</link><guid isPermaLink="true">https://plancaliber.hashnode.dev/compiling-natural-language-floor-plan-prompts-into-watertight-2d-3d-cad-wall-graphs-in-typescript</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Clara Sutton]]></dc:creator><pubDate>Sat, 28 Nov 2026 15:49:08 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b07d6b9e447de416c07f0c8/d246f654-65a7-4f22-8c94-671e90388d0e.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Ask a general-purpose image model to draw a "1,200 sq ft 2-bedroom ADU floor plan with an L-shaped kitchen and 36-inch hallways," and you get an attractive bitmap that falls apart the moment a contractor puts a scale ruler on it. Exterior walls drift out of square, closets overlap bathrooms, text labels garble dimensions, and nothing can be edited as a vector wall or exported to AutoCAD <code>.DXF</code>.</p>
<p>To ship an <a href="https://www.plancaliber.com/ai-floor-plan-generator">AI floor plan generator</a> that produces real editable CAD files in the browser, we split the pipeline cleanly in two: an LLM proposes structured room layout intent, and a deterministic TypeScript compiler snaps, validates, closes, and exports the 2D/3D wall graph.</p>
<h2>1. The Intermediate Representation (IR): Rooms First, Walls Second</h2>
<p>Asking a model to output raw <code>(x1, y1, x2, y2)</code> wall coordinates directly causes floating gaps (<code>0.4 ft</code> off-axis), double-drawn shared interior partitions, and doors floating outside wall segments. Instead, constrain the model to emit snapped room rectangles on a 6-inch (<code>0.5 ft</code>) structural grid, then compile shared edges into single canonical walls.</p>
<pre><code class="language-ts">export interface ProposedRoom {
  id: string;
  label: string;
  xFt: number;
  yFt: number;
  widthFt: number;
  depthFt: number;
  roomType: "living" | "kitchen" | "bedroom" | "bath" | "hall" | "garage" | "utility";
}

export interface WallSegment {
  id: string;
  x1In: number;
  y1In: number;
  x2In: number;
  y2In: number;
  thicknessIn: number;
  isExterior: boolean;
}

const GRID_IN = 6; // 6-inch snap grid keeps lumber &amp; drywall framing sane

export function snapInches(feet: number): number {
  return Math.round((feet * 12) / GRID_IN) * GRID_IN;
}
</code></pre>
<h2>2. Deduplicating Shared Edges and Detecting Exterior vs. Interior Walls</h2>
<p>When two rooms share a boundary (say a bedroom east wall and a hallway west wall), naive rectangle-to-wall conversion creates duplicate overlapping lines that corrupt both PDF lineweights and <code>.DXF</code> framing length totals.</p>
<p>By decomposing every horizontal and vertical room edge along collinear split points (every vertex coordinate projected onto that axis), we obtain atomic unit segments. A segment with <code>coverageCount === 1</code> is an exterior envelope wall (<code>6.0"</code> or <code>6.5"</code> framing); a segment with <code>coverageCount === 2</code> is a shared interior partition (<code>4.5"</code> 2x4 framing).</p>
<pre><code class="language-ts">interface AtomicEdge {
  axis: "H" | "V";
  coord: number; // y for H, x for V
  start: number;
  end: number;
  roomIds: string[];
}

export function compileWatertightWalls(rooms: ProposedRoom[]): WallSegment[] {
  const xCoords = new Set&lt;number&gt;();
  const yCoords = new Set&lt;number&gt;();

  const snapped = rooms.map((r) =&gt; {
    const x1 = snapInches(r.xFt);
    const y1 = snapInches(r.yFt);
    const x2 = x1 + Math.max(GRID_IN * 2, snapInches(r.widthFt));
    const y2 = y1 + Math.max(GRID_IN * 2, snapInches(r.depthFt));
    xCoords.add(x1);
    xCoords.add(x2);
    yCoords.add(y1);
    yCoords.add(y2);
    return { ...r, x1, y1, x2, y2 };
  });

  const xs = [...xCoords].sort((a, b) =&gt; a - b);
  const ys = [...yCoords].sort((a, b) =&gt; a - b);
  const edgeMap = new Map&lt;string, AtomicEdge&gt;();

  const addSegment = (axis: "H" | "V", coord: number, start: number, end: number, roomId: string) =&gt; {
    const key = `${axis}:${coord}:${start}:${end}`;
    const existing = edgeMap.get(key);
    if (existing) {
      if (!existing.roomIds.includes(roomId)) existing.roomIds.push(roomId);
    } else {
      edgeMap.set(key, { axis, coord, start, end, roomIds: [roomId] });
    }
  };

  for (const r of snapped) {
    for (let i = 0; i &lt; xs.length - 1; i++) {
      if (xs[i] &gt;= r.x1 &amp;&amp; xs[i + 1] &lt;= r.x2) {
        addSegment("H", r.y1, xs[i], xs[i + 1], r.id);
        addSegment("H", r.y2, xs[i], xs[i + 1], r.id);
      }
    }
    for (let j = 0; j &lt; ys.length - 1; j++) {
      if (ys[j] &gt;= r.y1 &amp;&amp; ys[j + 1] &lt;= r.y2) {
        addSegment("V", r.x1, ys[j], ys[j + 1], r.id);
        addSegment("V", r.x2, ys[j], ys[j + 1], r.id);
      }
    }
  }

  return [...edgeMap.values()].map((e, idx) =&gt; {
    const isExterior = e.roomIds.length === 1;
    return {
      id: `W-${idx + 1}`,
      x1In: e.axis === "H" ? e.start : e.coord,
      y1In: e.axis === "H" ? e.coord : e.start,
      x2In: e.axis === "H" ? e.end : e.coord,
      y2In: e.axis === "H" ? e.coord : e.end,
      thicknessIn: isExterior ? 6.0 : 4.5,
      isExterior,
    };
  });
}
</code></pre>
<p>Merging adjacent collinear atomic segments with matching <code>isExterior</code> flags then reduces the wall count while preserving exact T-junction nodes for corner snapping and 3D mesh extrusion.</p>
<h2>3. Enforcing Door and Window Opening Clearances Deterministically</h2>
<p>A prompt might generate a 36-inch bedroom door on a 38-inch shared wall segment, leaving only 1 inch of trimmer/king-stud jamb clearance on each side. Before accepting any opening onto a wall, our compiler enforces minimum jamb margins and automatically clamps or shifts the offset:</p>
<pre><code class="language-ts">export interface WallOpening {
  id: string;
  wallId: string;
  kind: "door" | "window" | "cased_opening";
  widthIn: number;
  offsetFromStartIn: number;
}

export function clampOpeningToWall(
  wall: WallSegment,
  opening: WallOpening,
  minJambMarginIn = 6
): WallOpening | null {
  const wallLengthIn = Math.hypot(wall.x2In - wall.x1In, wall.y2In - wall.y1In);
  const maxWidthIn = wallLengthIn - minJambMarginIn * 2;

  if (maxWidthIn &lt; 24) {
    // Wall segment too narrow for a standard 24-inch door or window
    return null;
  }

  const safeWidth = Math.min(opening.widthIn, maxWidthIn);
  const maxOffset = wallLengthIn - minJambMarginIn - safeWidth;
  const safeOffset = Math.max(
    minJambMarginIn,
    Math.min(opening.offsetFromStartIn, maxOffset)
  );

  return {
    ...opening,
    widthIn: Math.round(safeWidth),
    offsetFromStartIn: Math.round(safeOffset),
  };
}
</code></pre>
<h2>4. Validating Connectivity Before Rendering 2D/3D</h2>
<p>One subtle failure mode of AI-proposed room grids is a sealed room with no door connected to a hallway or living zone. Running a simple breadth-first search (BFS) over the room adjacency graph through valid door openings guarantees every habitable room is reachable from the entry node before the user ever sees the floor plan:</p>
<pre><code class="language-ts">export function findUnreachableRooms(
  roomIds: string[],
  entryRoomId: string,
  doorEdges: Array&lt;[string, string]&gt;
): string[] {
  const adj = new Map&lt;string, string[]&gt;();
  for (const id of roomIds) adj.set(id, []);
  for (const [a, b] of doorEdges) {
    adj.get(a)?.push(b);
    adj.get(b)?.push(a);
  }

  const visited = new Set&lt;string&gt;();
  const queue = [entryRoomId];
  visited.add(entryRoomId);

  while (queue.length &gt; 0) {
    const curr = queue.shift()!;
    for (const next of adj.get(curr) ?? []) {
      if (!visited.has(next)) {
        visited.add(next);
        queue.push(next);
      }
    }
  }

  return roomIds.filter((id) =&gt; !visited.has(id));
}
</code></pre>
<p>When <code>findUnreachableRooms()</code> returns a non-empty list, the compiler injects a standard 32-inch interior swing door on the longest shared interior wall connecting that isolated room to the visited component.</p>
<h2>5. From Watertight Wall Graph to Interactive 3D, Vector PDF, and R12 .DXF</h2>
<p>Once the wall graph is watertight and unit-tested, every downstream output reads from the exact same immutable model:</p>
<ul>
<li><strong>Live 2D CAD Canvas</strong>: Ortho snapping, dimension strings, furniture clearances, and drag-to-resize walls.</li>
<li><strong>Live Three.js 3D Cutaway</strong>: Extrudes exterior and interior wall polygons with accurate door/window cutouts directly in WebGL.</li>
<li><strong>Scaled Vector PDF &amp; AutoCAD R12 <code>.DXF</code></strong>: Outputs <code>1/4"=1'-0"</code> vector sheets (<code>A-101</code> through <code>M-101</code>) and 8-layer ASCII <code>.DXF</code> (<code>$INSUNITS=1</code> US inches) via our <a href="https://www.plancaliber.com/blueprint-dxf-maker">blueprint and DXF generator</a> and <a href="https://www.plancaliber.com/sketch-to-cad">sketch-to-CAD pipeline</a>.</li>
</ul>
<p>Try generating a floor plan from plain English free in the browser at <a href="https://www.plancaliber.com/ai-floor-plan-generator">PlanCaliber</a> (2 free AI generations/day, full 2D/3D editing, and instant watermarked proof PNGs; optional one-time <code>$9</code> 2-sheet clean vector PDF or <code>$19</code> full 5-sheet PDF + layered <code>.DXF</code> + 3D <code>.OBJ</code> + framing/drywall CSV, with no recurring subscription and 14-day instant refunds). Generated plans are for preliminary space planning and estimating; always field-verify dimensions and local code compliance before construction.</p>
]]></content:encoded></item><item><title><![CDATA[Modeling 2-Car and 3-Car Garage Clearances, Slab Concrete Takeoffs, and IRC R302.6 Fire Separation in TypeScript]]></title><description><![CDATA[A 20x20-foot garage looks spacious on an empty sketch until two modern US vehicles park inside it. A half-ton crew-cab pickup is roughly 19 feet 4 inches…]]></description><link>https://plancaliber.hashnode.dev/modeling-2-car-and-3-car-garage-clearances-slab-concrete-takeoffs-and-irc-r302-6-fire-separation-in-typescript</link><guid isPermaLink="true">https://plancaliber.hashnode.dev/modeling-2-car-and-3-car-garage-clearances-slab-concrete-takeoffs-and-irc-r302-6-fire-separation-in-typescript</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Clara Sutton]]></dc:creator><pubDate>Sat, 28 Nov 2026 15:42:06 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b07d6b9e447de416c07f0c8/7465308c-1a51-4489-ade6-045af803f378.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>A 20x20-foot garage looks spacious on an empty sketch until two modern US vehicles park inside it. A half-ton crew-cab pickup is roughly 19 feet 4 inches long and 6 feet 8 inches wide without mirrors. Add 2x6 exterior walls (reducing interior clear depth to ~18 feet 10 inches), an automatic opener clearance zone, and a 32-inch door swing on each side, and a nominal 20x20 shell fails before the concrete cures.</p>
<p>When building <a href="https://www.plancaliber.com/garage-floor-plans">PlanCaliber's US garage floor plan studio</a>, we modeled garage bay geometry, vehicle door-swing clearance envelopes, overhead door rough openings, thickened-edge slab concrete volume, and IRC R302.6 attached-garage fire separation checks directly in TypeScript so every layout updates deterministically in the browser.</p>
<h2>1. Nominal Exterior Dimensions vs. Interior Clear Envelope</h2>
<p>Residential builders dimension garage plans from outside of framing to outside of framing. Standard 2x6 exterior framing with 1/2-inch sheathing and 1/2-inch interior drywall subtracts approximately 6.5 inches per wall (13 inches total along each axis).</p>
<pre><code class="language-ts">export interface GarageShellInput {
  exteriorWidthFt: number;   // e.g. 24 for a 2-car, 36 for a 3-car
  exteriorDepthFt: number;   // e.g. 24 or 26
  wallThicknessIn: number;   // 6.5 for 2x6 stud wall + sheathing + drywall
  attachedToDwelling: boolean;
  hasHabitableRoomAbove: boolean;
}

export interface ClearEnvelope {
  interiorWidthIn: number;
  interiorDepthIn: number;
  exteriorAreaSqFt: number;
  interiorAreaSqFt: number;
}

export function computeClearEnvelope(input: GarageShellInput): ClearEnvelope {
  const extW = input.exteriorWidthFt * 12;
  const extD = input.exteriorDepthFt * 12;
  const interiorWidthIn = Math.max(0, extW - input.wallThicknessIn * 2);
  const interiorDepthIn = Math.max(0, extD - input.wallThicknessIn * 2);

  return {
    interiorWidthIn,
    interiorDepthIn,
    exteriorAreaSqFt: Number((input.exteriorWidthFt * input.exteriorDepthFt).toFixed(1)),
    interiorAreaSqFt: Number(((interiorWidthIn * interiorDepthIn) / 144).toFixed(1)),
  };
}
</code></pre>
<p>On a standard 24x24-foot two-car shell, interior clear width is <code>275"</code> (<code>22'-11"</code>), which comfortably fits two mid-size SUVs with side walk paths and workbench depth. On a 20x20 shell, interior clear depth drops to <code>227"</code> (<code>18'-11"</code>), leaving zero front-bumper clearance for a full-size truck.</p>
<h2>2. Deterministic Vehicle Door-Swing and Side-Aisle Validation</h2>
<p>Instead of checking raw vehicle widths, a reliable CAD validator checks the parked body footprint plus active door-swing arcs and perimeter walk clearances:</p>
<pre><code class="language-ts">export interface VehicleProfile {
  label: string;
  lengthIn: number;
  bodyWidthIn: number;
  mirrorWidthIn: number;
  doorSwingClearanceIn: number; // minimum side clearance to open doors cleanly
}

export const US_VEHICLE_PROFILES: Record&lt;string, VehicleProfile&gt; = {
  midsize_suv: {
    label: "Midsize SUV",
    lengthIn: 196,
    bodyWidthIn: 78,
    mirrorWidthIn: 86,
    doorSwingClearanceIn: 30,
  },
  fullsize_pickup: {
    label: "Full-Size Crew-Cab Pickup",
    lengthIn: 232,
    bodyWidthIn: 80,
    mirrorWidthIn: 96,
    doorSwingClearanceIn: 32,
  },
  compact_sedan: {
    label: "Compact Sedan",
    lengthIn: 184,
    bodyWidthIn: 72,
    mirrorWidthIn: 80,
    doorSwingClearanceIn: 28,
  },
};

export interface BayFitResult {
  fitsLength: boolean;
  fitsWidth: boolean;
  frontRearBufferIn: number;
  sharedCenterAisleIn: number;
  sideWallClearanceIn: number;
  warnings: string[];
}

export function evaluateMultiBayFit(
  envelope: ClearEnvelope,
  vehicles: VehicleProfile[],
  frontStorageDepthIn = 24
): BayFitResult {
  const warnings: string[] = [];
  const maxLen = Math.max(...vehicles.map((v) =&gt; v.lengthIn));
  const frontRearBufferIn = envelope.interiorDepthIn - maxLen - frontStorageDepthIn;
  const totalBodyWidth = vehicles.reduce((acc, v) =&gt; acc + v.bodyWidthIn, 0);
  const gapCount = vehicles.length + 1;
  const remainingWidth = envelope.interiorWidthIn - totalBodyWidth;
  const averageGap = remainingWidth / gapCount;

  const minSide = 24;
  const minCenter = Math.max(...vehicles.map((v) =&gt; v.doorSwingClearanceIn));

  const fitsLength = frontRearBufferIn &gt;= 24;
  const fitsWidth = averageGap &gt;= minSide &amp;&amp; (vehicles.length === 1 || averageGap &gt;= minCenter);

  if (!fitsLength) {
    warnings.push(
      `Clear depth leaves ${Math.round(frontRearBufferIn)}" after ${frontStorageDepthIn}" front storage; target at least 24" combined walk buffer.`
    );
  }
  if (!fitsWidth) {
    warnings.push(
      `Average lateral aisle is ${Math.round(averageGap)}"; full-door egress between bays needs ~${minCenter}".`
    );
  }

  return {
    fitsLength,
    fitsWidth,
    frontRearBufferIn: Math.round(frontRearBufferIn),
    sharedCenterAisleIn: Math.round(averageGap),
    sideWallClearanceIn: Math.round(averageGap),
    warnings,
  };
}
</code></pre>
<p>You can test these exact bay widths interactively in our free <a href="https://www.plancaliber.com/calculators/garage-size-clearance-calculator">US garage size and clearance calculator</a>, which links directly into pre-built 2-car (<code>24x24</code>) and 3-car (<code>24x36</code>) CAD templates.</p>
<h2>3. Overhead Door Rough Openings and Pier Spacing</h2>
<p>For sectional overhead doors, structural shear walls require adequate corner returns (typically <code>&gt;= 24"</code> to <code>36"</code> depending on braced wall panel method) and a center mullion pier (<code>&gt;= 18"</code> to <code>24"</code>) between twin single bays.</p>
<pre><code class="language-ts">export interface OverheadDoorSpec {
  widthFt: number;     // 9, 10, 16, or 18
  heightFt: number;    // 7 or 8
}

export function checkOverheadDoorWallFit(
  exteriorWidthFt: number,
  doors: OverheadDoorSpec[],
  minCornerReturnFt = 2.0,
  minCenterPierFt = 1.5
): { ok: boolean; remainingSideReturnFt: number; note: string } {
  const doorsTotalFt = doors.reduce((sum, d) =&gt; sum + d.widthFt, 0);
  const piersTotalFt = Math.max(0, doors.length - 1) * minCenterPierFt;
  const leftoverFt = exteriorWidthFt - doorsTotalFt - piersTotalFt;
  const perSideFt = leftoverFt / 2;

  if (perSideFt &lt; minCornerReturnFt) {
    return {
      ok: false,
      remainingSideReturnFt: Number(perSideFt.toFixed(2)),
      note: `Corner returns drop to ${perSideFt.toFixed(1)} ft per side; widen shell or narrow door opening for lateral bracing.`,
    };
  }
  return {
    ok: true,
    remainingSideReturnFt: Number(perSideFt.toFixed(2)),
    note: `${perSideFt.toFixed(1)} ft corner return per side leaves room for shear wall panels and track hardware.`,
  };
}
</code></pre>
<h2>4. Monolithic Thickened-Edge Concrete Slab Takeoff</h2>
<p>A common estimating mistake is multiplying floor area by 4 inches (<code>sqFt * 0.333 / 27</code>) and forgetting the perimeter thickened edge (turndown haunch) plus waste factor. On a <code>24x24</code> garage slab with a 4-inch field slab and a 12-inch wide by 12-inch deep extra perimeter turndown below the slab bottom:</p>
<pre><code class="language-ts">export interface SlabTakeoff {
  fieldCubicYards: number;
  perimeterTurndownCubicYards: number;
  totalWithWasteCubicYards: number;
}

export function estimateMonolithicGarageSlab(
  widthFt: number,
  depthFt: number,
  slabThicknessIn = 4,
  edgeExtraDepthIn = 12,
  edgeWidthIn = 12,
  wasteFactor = 1.1
): SlabTakeoff {
  const areaSqFt = widthFt * depthFt;
  const perimeterFt = 2 * (widthFt + depthFt);

  const fieldCuFt = areaSqFt * (slabThicknessIn / 12);
  // Subtract 4 corners once to avoid double-counting corner overlaps
  const netPerimeterFt = Math.max(0, perimeterFt - 4 * (edgeWidthIn / 12));
  const haunchCuFt = netPerimeterFt * (edgeWidthIn / 12) * (edgeExtraDepthIn / 12);

  const fieldCubicYards = fieldCuFt / 27;
  const perimeterTurndownCubicYards = haunchCuFt / 27;
  const totalWithWasteCubicYards =
    (fieldCubicYards + perimeterTurndownCubicYards) * wasteFactor;

  return {
    fieldCubicYards: Number(fieldCubicYards.toFixed(2)),
    perimeterTurndownCubicYards: Number(perimeterTurndownCubicYards.toFixed(2)),
    totalWithWasteCubicYards: Number(totalWithWasteCubicYards.toFixed(2)),
  };
}
</code></pre>
<p>For a 24x24 shell, the field slab is <code>7.11 yd3</code>, the thickened perimeter edge adds <code>3.41 yd3</code>, and a 10% allowance brings the preliminary concrete order to <code>11.57 yd3</code> (versus <code>7.8 yd3</code> if the turndown were omitted). Check soil frost depth and rebar schedules locally, or run custom slab thicknesses in our <a href="https://www.plancaliber.com/calculators/concrete-slab-footing-calculator">concrete slab and footing calculator</a>.</p>
<h2>5. Encoding IRC R302.6 Attached-Garage Fire Separation Flags</h2>
<p>When a garage shares a wall or ceiling with living space, US model residential code (IRC Table R302.6 and R302.5.1) sets baseline gypsum and door separation rules:</p>
<pre><code class="language-ts">export interface FireSeparationChecklist {
  wallGypsumRequired: string;
  ceilingGypsumRequired: string;
  houseDoorRequirement: string;
}

export function buildFireSeparationChecklist(
  input: GarageShellInput
): FireSeparationChecklist | null {
  if (!input.attachedToDwelling) return null;

  return {
    wallGypsumRequired:
      "Minimum 1/2-inch gypsum board applied on the garage side of walls separating garage and dwelling (IRC Table R302.6).",
    ceilingGypsumRequired: input.hasHabitableRoomAbove
      ? "Minimum 5/8-inch Type X gypsum board on garage ceiling beneath habitable rooms above, plus 1/2-inch gypsum on supporting framing."
      : "Minimum 1/2-inch gypsum board across garage ceiling if attic/truss space connects to dwelling.",
    houseDoorRequirement:
      "Solid wood &gt;= 1-3/8 in, solid/honeycomb steel &gt;= 1-3/8 in, or 20-minute fire-rated door with self-closing/latching device; no opening directly into a sleeping room (IRC R302.5.1).",
  };
}
</code></pre>
<h2>Exporting Scaled Garage Layouts Without Subscription Lock-In</h2>
<p>Inside <a href="https://www.plancaliber.com/templates/garage_2car_24x24">PlanCaliber</a>, you can start from the 24x24 2-car garage or 24x36 3-car shop templates, resize walls to exact US feet and inches, preview the 3D framing cutaway, and save watermarked proof PNGs free. When you are ready for clean deliverables, one-time passes unlock unwatermarked 2-sheet vector PDFs (<code>$9</code>) or full 5-sheet <code>1/4"=1'-0"</code> vector PDFs, layered AutoCAD R12 <code>.DXF</code> files (<code>$INSUNITS=1</code> US inches, 8 AIA layers), 3D <code>.OBJ</code> models, and framing/drywall takeoff CSVs (<code>$19</code>), with permanent edits and 14-day instant refunds.</p>
<p>All outputs are intended for preliminary space planning, budgeting, and visualization; always verify dimensions, footings, shear bracing, and fire separation details on site with your local building official (AHJ) or licensed professional.</p>
]]></content:encoded></item><item><title><![CDATA[Post-Frame Barndominium Grid Spacing, Shop-to-Living Split & ANSI GLA Math in TypeScript]]></title><description><![CDATA[Post-frame barndominium shells (30x40, 30x50, 40x60, 40x80) do not follow conventional stick-built framing grids. Exterior columns sit on 8-foot, 10-foot…]]></description><link>https://plancaliber.hashnode.dev/post-frame-barndominium-grid-spacing-shop-to-living-split-ansi-gla-math-in-typescript</link><guid isPermaLink="true">https://plancaliber.hashnode.dev/post-frame-barndominium-grid-spacing-shop-to-living-split-ansi-gla-math-in-typescript</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Clara Sutton]]></dc:creator><pubDate>Sat, 28 Nov 2026 15:35:50 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b07d6b9e447de416c07f0c8/45460dcc-b34b-43ca-8c20-3e0d5f17b50d.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Post-frame barndominium shells (<code>30x40</code>, <code>30x50</code>, <code>40x60</code>, <code>40x80</code>) do not follow conventional stick-built framing grids. Exterior columns sit on <strong>8-foot, 10-foot, or 12-foot on-center bays</strong>, which means every overhead shop door, man-door, bedroom wall, and kitchen window needs to align cleanly with post bays to avoid costly engineered headers.</p>
<p>When we built <a href="https://www.plancaliber.com/barndominium-floor-plans?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article105_barndominium_floor_plans_ts">PlanCaliber's Barndominium Floor Plan Studio</a>, we added post-bay snapping and separate <strong>Heated Living GLA vs. Unheated Shop Bay</strong> accounting right into our TypeScript solver.</p>
<h2>1. Snapping Partitions &amp; Overhead Doors to Post-Frame Bays</h2>
<p>A <code>40' x 60'</code> barndominium built on <code>10'-0"</code> exterior post bays has 6 clean bays along the 60-foot eave wall and 4 bays across the 40-foot gable end. Placing a <code>12'-0"</code> wide RV door inside a <code>10'-0"</code> bay forces cutting an intermediate load-bearing post; placing it centered inside a <code>12'-0"</code> bay or on the gable end keeps truss loading clean.</p>
<pre><code class="language-ts">export interface BarndoShell {
  widthFt: number;        // gable width, e.g., 40
  lengthFt: number;       // eave length, e.g., 60
  postBaySpacingFt: 8 | 10 | 12;
  shopLengthFt: number;   // length allocated to unheated shop/garage bay
  hasLoft: boolean;
  loftSqFt?: number;
}

export interface BarndoSplitReport {
  totalUnderRoofSqFt: number;
  heatedLivingSqFt: number;
  unheatedShopSqFt: number;
  eaveBayCount: number;
  partitionAlignsToPostBay: boolean;
  maxCleanEaveDoorWidthFt: number;
}

export function analyzeBarndominiumShell(shell: BarndoShell): BarndoSplitReport {
  const totalUnderRoofSqFt = shell.widthFt * shell.lengthFt;
  const unheatedShopSqFt = Math.max(0, Math.min(shell.lengthFt, shell.shopLengthFt)) * shell.widthFt;
  const mainLivingSqFt = Math.max(0, totalUnderRoofSqFt - unheatedShopSqFt);
  const heatedLivingSqFt = mainLivingSqFt + (shell.hasLoft ? Math.max(0, shell.loftSqFt ?? 0) : 0);

  const eaveBayCount = Math.floor(shell.lengthFt / shell.postBaySpacingFt);
  const partitionAlignsToPostBay = shell.shopLengthFt % shell.postBaySpacingFt === 0;

  // Clear rough opening between nominal 6x6 laminated columns (~5.5" each side + jambs -&gt; ~1 ft deduction)
  const maxCleanEaveDoorWidthFt = Math.max(0, shell.postBaySpacingFt - 2);

  return {
    totalUnderRoofSqFt,
    heatedLivingSqFt,
    unheatedShopSqFt,
    eaveBayCount,
    partitionAlignsToPostBay,
    maxCleanEaveDoorWidthFt,
  };
}
</code></pre>
<h2>2. Keeping Fire Separation &amp; ANSI Z765 GLA Accurate</h2>
<p>Under US residential code (IRC R302.6), the partition wall separating an attached shop/garage bay from living quarters typically requires <code>1/2"</code> gypsum board on the garage side (<code>5/8"</code> Type X if living space sits above the shop) and a self-closing solid-core or 20-minute fire-rated man-door. Separating heated living area (<code>heatedLivingSqFt</code>) from unheated shop area (<code>unheatedShopSqFt</code>) also keeps ANSI Z765 appraisal square footage and HVAC tonnage sizing honest.</p>
<p>Explore footprint splits live in our free <a href="https://www.plancaliber.com/calculators/barndominium-footprint-calculator?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article105_barndominium_floor_plans_ts">Barndominium Footprint Calculator</a>, or jump straight into editable US templates in Chrome or Safari:</p>
<ul>
<li><a href="https://www.plancaliber.com/templates/barndominium_40x60?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article105_barndominium_floor_plans_ts">40'x60' Barndominium CAD Template (2,400 sq ft Living + Shop)</a></li>
<li><a href="https://www.plancaliber.com/templates/barndominium_30x50?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article105_barndominium_floor_plans_ts">30'x50' Barndominium CAD Template (1,500 sq ft 2-Bed + 540 sq ft Shop)</a></li>
</ul>
<h2>3. Export Scaled Blueprints &amp; 8-Layer AutoCAD <code>.DXF</code> for Your Metal Building Builder</h2>
<p>Metal building suppliers and pole-barn builders love receiving a clean <code>1/4"=1'-0"</code> dimensioned sheet (<code>A-101</code>) or a real AutoCAD R12 <code>.DXF</code> so they can locate plumbing stubs, electrical conduits, and door jambs before pouring the monolithic slab.</p>
<p>In <a href="https://www.plancaliber.com/barndominium-floor-plans?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article105_barndominium_floor_plans_ts">PlanCaliber</a>, drafting in 2D/3D, scanning sketches/PDFs (2 free/day), and downloading a watermarked proof PNG are free. Unlock clean files once with <strong>no subscription</strong>: <strong><code>$9</code> Print Pass</strong> (unwatermarked 2-sheet vector PDF + <code>2400px</code> PNG + SVG + unbranded 3D link) or <strong><code>$19</code> Single Plan</strong> (5-sheet scaled vector PDF + 8-layer AutoCAD R12 <code>.DXF</code> + 3D <code>.OBJ</code> + Framing/Drywall <code>.CSV</code> takeoff, with 14-day instant refund).</p>
<p><em>Note: PlanCaliber barndominium layouts and calculators are for preliminary space planning and estimating only. Post-frame structural engineering, foundation slabs, wind/snow loads, and fire separations must be engineered and verified by your metal building supplier, licensed local engineer, and Authority Having Jurisdiction (AHJ).</em></p>
]]></content:encoded></item><item><title><![CDATA[NKBA Kitchen Island Work-Aisle & IRC R307 Bathroom Fixture Clearance Validator in TypeScript]]></title><description><![CDATA[Kitchen and bathroom remodels are the most expensive square feet in any US home, and almost every layout regret traces back to 3 to 6 missing inches: a…]]></description><link>https://plancaliber.hashnode.dev/nkba-kitchen-island-work-aisle-irc-r307-bathroom-fixture-clearance-validator-in-typescript</link><guid isPermaLink="true">https://plancaliber.hashnode.dev/nkba-kitchen-island-work-aisle-irc-r307-bathroom-fixture-clearance-validator-in-typescript</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Clara Sutton]]></dc:creator><pubDate>Sat, 28 Nov 2026 15:29:16 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b07d6b9e447de416c07f0c8/34114017-a87d-4c83-9626-387bbe0d69c8.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Kitchen and bathroom remodels are the most expensive square feet in any US home, and almost every layout regret traces back to 3 to 6 missing inches: a dishwasher door colliding with an island overhang, a bathroom entry door hitting knees in front of the toilet, or a vanity crowded inside the <strong>IRC R307.1 15-inch toilet centerline minimum</strong>.</p>
<p>Inside <a href="https://www.plancaliber.com/kitchen-bath-plans?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article104_kitchen_bath_plans_ts">PlanCaliber's Kitchen &amp; Bathroom Floor Plan Studio</a>, we validate both <strong>NKBA Kitchen Planning Guidelines</strong> and <strong>IRC R307 bathroom clearances</strong> in real time as you drag walls, cabinets, and fixtures. Here is the clean TypeScript validator behind those checks.</p>
<h2>1. NKBA Kitchen Work-Aisle &amp; Seating Overhang Rules</h2>
<p>Three numbers govern whether a kitchen island feels effortless or constantly jams traffic:</p>
<ul>
<li><strong>One-cook work aisle</strong>: <code>42"</code> minimum between opposing countertops (<code>48"</code> for two-cook kitchens).</li>
<li><strong>Walkway behind barstool seating</strong>: <code>36"</code> minimum edge-to-wall when nobody walks behind seated guests, <code>44"</code> minimum for pass-through behind stools.</li>
<li><strong>Barstool knee overhang</strong>: <code>15"</code> at counter height (<code>36"</code> tall) with <code>24"</code> width per stool; stone overhangs exceeding <code>10"</code> on 3cm quartz/granite typically require concealed steel support brackets.</li>
</ul>
<pre><code class="language-ts">export interface KitchenIslandInput {
  workAisleIn: number;
  isTwoCookKitchen: boolean;
  seatingPassThroughIn: number;
  counterOverhangIn: number;
  islandLengthIn: number;
  stoolCount: number;
}

export interface ValidationIssue {
  rule: string;
  severity: 'error' | 'warn';
  message: string;
}

export function validateKitchenIsland(k: KitchenIslandInput): ValidationIssue[] {
  const issues: ValidationIssue[] = [];
  const minWorkAisle = k.isTwoCookKitchen ? 48 : 42;

  if (k.workAisleIn &lt; minWorkAisle) {
    issues.push({
      rule: 'NKBA Guideline #11',
      severity: 'error',
      message: `Work aisle ${k.workAisleIn}" is under the ${minWorkAisle}" minimum.`,
    });
  }

  if (k.stoolCount &gt; 0 &amp;&amp; k.seatingPassThroughIn &lt; 44) {
    issues.push({
      rule: 'NKBA Guideline #12',
      severity: k.seatingPassThroughIn &lt; 36 ? 'error' : 'warn',
      message: `Behind-stool clearance ${k.seatingPassThroughIn}" (36" edge min, 44" pass-through).`,
    });
  }

  if (k.stoolCount &gt; 0 &amp;&amp; k.islandLengthIn / k.stoolCount &lt; 24) {
    issues.push({
      rule: 'NKBA Guideline #22',
      severity: 'warn',
      message: `Allow at least 24" linear island width per stool (${(k.islandLengthIn / k.stoolCount).toFixed(1)}" actual).`,
    });
  }

  if (k.counterOverhangIn &gt; 10) {
    issues.push({
      rule: 'Stone Fabrication Support',
      severity: 'warn',
      message: `${k.counterOverhangIn}" overhang exceeds 10"; specify concealed steel brackets every 18-24".`,
    });
  }

  return issues;
}
</code></pre>
<p>Test any island dimension interactively in our free <a href="https://www.plancaliber.com/calculators/kitchen-island-clearance?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article104_kitchen_bath_plans_ts">Kitchen Island Clearance Calculator</a> or verify slab + backsplash tile area with our <a href="https://www.plancaliber.com/calculators/countertop-square-footage-backsplash-calculator?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article104_kitchen_bath_plans_ts">Countertop Square Footage Calculator</a>.</p>
<h2>2. IRC R307.1 Bathroom Fixture Clearance &amp; Exhaust CFM Check</h2>
<p>In US residential bathrooms, a <code>5'-0" x 7'-0"</code> footprint often fails when an inward-swinging <code>28"</code> door arcs into the <code>21"</code> clear zone in front of the water closet or crowds the <code>15"</code> minimum toilet centerline (<code>30"</code> total alcove width).</p>
<pre><code class="language-ts">export interface BathClearanceInput {
  toiletCenterlineLeftIn: number;
  toiletCenterlineRightIn: number;
  toiletFrontClearIn: number;
  showerInteriorWidthIn: number;
  bathAreaSqFt: number;
}

export function validateBathroom(b: BathClearanceInput) {
  const failures: string[] = [];
  if (Math.min(b.toiletCenterlineLeftIn, b.toiletCenterlineRightIn) &lt; 15) {
    failures.push('IRC R307.1: Toilet centerline must be &gt;= 15" from side wall or vanity.');
  }
  if (b.toiletFrontClearIn &lt; 21) {
    failures.push('IRC R307.1: Clear space in front of toilet must be &gt;= 21" (24"+ recommended).');
  }
  if (b.showerInteriorWidthIn &lt; 30) {
    failures.push('IRC P2708.1: Minimum finished shower interior width is 30".');
  }
  // HVI / ASHRAE 62.2 baseline: &gt;= 50 CFM intermittent (or 1 CFM / sq ft up to 100 sq ft)
  const recommendedFanCfm = Math.max(50, Math.ceil(b.bathAreaSqFt / 10) * 10);

  return { pass: failures.length === 0, recommendedFanCfm, failures };
}
</code></pre>
<p>Check bathroom ventilation duct sizing in our <a href="https://www.plancaliber.com/calculators/bathroom-exhaust-fan-cfm-calculator?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article104_kitchen_bath_plans_ts">Bathroom Exhaust Fan CFM Calculator</a> or open our ready-to-edit <a href="https://www.plancaliber.com/templates/kitchen_island_remodel?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article104_kitchen_bath_plans_ts">Kitchen Island Remodel Template</a>.</p>
<h2>3. Draft Free in 2D/3D, Unlock Clean Scaled PDFs ($9) or <code>.DXF</code> ($19) Once</h2>
<p>Start free in <a href="https://www.plancaliber.com/kitchen-bath-plans?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article104_kitchen_bath_plans_ts">PlanCaliber's Kitchen &amp; Bath Floor Plan Studio</a> (draft in 2D &amp; live 3D cutaway, scan up to 2 hand sketches/PDFs per day, save a free watermarked proof PNG). When you are ready to hand scaled sheets to cabinet makers, tile setters, or contractors, pay once with zero subscription:</p>
<ul>
<li><strong><code>$9</code> Clean Print &amp; Share Pass</strong>: Unwatermarked 2-sheet <code>1/4"=1'-0"</code> vector PDF (<code>A-101</code> + <code>M-101</code>), <code>2400px</code> PNG, vector SVG, unbranded 3D share link, and permanent edits.</li>
<li><strong><code>$19</code> Single Plan Full CAD Pack</strong>: 5-sheet scaled vector PDF (<code>A-101</code>, <code>A-102</code> Clearances, <code>E-101</code> Electrical, <code>A-201</code> Elevations, <code>M-101</code>), 8-layer AutoCAD R12 <code>.DXF</code> (<code>$INSUNITS=1</code> US inches), 3D <code>.OBJ</code>, framing/drywall <code>.CSV</code> takeoff, and 14-day instant no-questions-asked refund.</li>
</ul>
<p><em>Note: PlanCaliber layouts and calculators are built for preliminary space planning and estimating only. Always field-verify rough-ins on site and confirm code requirements with your local Authority Having Jurisdiction (AHJ).</em></p>
]]></content:encoded></item><item><title><![CDATA[ANSI Z765 Gross Living Area (GLA) Polygon Subtraction & MLS Floor Plan Rendering in TypeScript]]></title><description><![CDATA[Since April 2022, Fannie Mae has required single-family residential appraisals to measure Gross Living Area (GLA) strictly under ANSI Z765-2021. Yet…]]></description><link>https://plancaliber.hashnode.dev/ansi-z765-gross-living-area-gla-polygon-subtraction-mls-floor-plan-rendering-in-typescript</link><guid isPermaLink="true">https://plancaliber.hashnode.dev/ansi-z765-gross-living-area-gla-polygon-subtraction-mls-floor-plan-rendering-in-typescript</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Clara Sutton]]></dc:creator><pubDate>Sat, 28 Nov 2026 15:22:54 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b07d6b9e447de416c07f0c8/29028254-a94a-49b7-8b7c-ad9d25b07d80.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Since April 2022, Fannie Mae has required single-family residential appraisals to measure Gross Living Area (GLA) strictly under <strong>ANSI Z765-2021</strong>. Yet listing agents and home sellers still misstate square footage by 150-400 sq ft because generic drawing apps sum interior room rectangles instead of running <strong>exterior-wall polygon math</strong> minus stairs, open-to-below voids, garages, and low sloped ceilings.</p>
<p>Getting GLA wrong triggers appraisal gaps and contract renegotiations mid-escrow. Here is the exact TypeScript shoelace-area and ceiling-height exclusion algorithm we use inside <a href="https://www.plancaliber.com/real-estate-floor-plans?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article103_real_estate_floor_plans_ts">PlanCaliber's Real Estate &amp; MLS Floor Plan Studio</a> so agents, photographers, and sellers get clean dimensioned marketing plans in minutes.</p>
<h2>1. ANSI Z765 Core Geometry Rules</h2>
<p>Four rules account for nearly every listing-vs-appraisal discrepancy:</p>
<ol>
<li><strong>Measure to the exterior finished surface of exterior walls</strong> (to the nearest tenth of a foot or inch), not interior paint-to-paint room boxes.</li>
<li><strong>Exclude below-grade levels entirely from GLA</strong>: if any portion of a level's floor sits below surrounding earth grade, the entire level is reported separately as finished basement area, never mixed into above-grade GLA.</li>
<li><strong>Ceiling height 7'-0" rule (sloped ceilings 5'-0" floor)</strong>: rooms require at least <code>7'-0"</code> ceiling height; for sloped ceilings (Cape Cods, A-frames, dormers), at least 50% of the room's finished floor area must have <code>&gt;= 7'-0"</code> height, and only floor area with <code>&gt;= 5'-0"</code> height counts toward GLA.</li>
<li><strong>Subtract unheated garages, covered porches, and open-to-below two-story foyers</strong>, while including interior stair footprint on the floor it ascends from (and open stairwells only once).</li>
</ol>
<h2>2. TypeScript Shoelace Polygon + ANSI Z765 GLA Engine</h2>
<pre><code class="language-ts">export interface PointFt {
  x: number;
  y: number;
}

export interface FloorPolygon {
  label: string;
  kind: 'exterior_heated' | 'open_to_below_void' | 'garage_unheated' | 'porch_unheated' | 'below_grade';
  vertices: PointFt[];
  slopedAreaBelow5FtSqFt?: number;
  percentAreaAtLeast7Ft?: number; // 0..100
}

export function polygonAreaSqFt(pts: PointFt[]): number {
  if (pts.length &lt; 3) return 0;
  let twiceArea = 0;
  for (let i = 0; i &lt; pts.length; i++) {
    const a = pts[i];
    const b = pts[(i + 1) % pts.length];
    twiceArea += a.x * b.y - b.x * a.y;
  }
  return Math.abs(twiceArea) / 2;
}

export function calculateAnsiZ765Gla(polys: FloorPolygon[]) {
  let grossHeatedAboveGrade = 0;
  let excludedVoids = 0;
  let nonGlaAccessory = 0;
  const warnings: string[] = [];

  for (const p of polys) {
    const rawArea = polygonAreaSqFt(p.vertices);

    if (p.kind === 'below_grade' || p.kind === 'garage_unheated' || p.kind === 'porch_unheated') {
      nonGlaAccessory += rawArea;
      continue;
    }

    if (p.kind === 'open_to_below_void') {
      excludedVoids += rawArea;
      continue;
    }

    // Sloped ceiling ANSI Z765 check
    if (p.percentAreaAtLeast7Ft !== undefined &amp;&amp; p.percentAreaAtLeast7Ft &lt; 50) {
      warnings.push(`${p.label}: &lt; 50% floor area at &gt;= 7'-0" ceiling height; excluded from ANSI GLA.`);
      nonGlaAccessory += rawArea;
      continue;
    }

    const lowSlopeCut = Math.max(0, p.slopedAreaBelow5FtSqFt ?? 0);
    grossHeatedAboveGrade += Math.max(0, rawArea - lowSlopeCut);
  }

  return {
    ansiGlaSqFt: Math.round(Math.max(0, grossHeatedAboveGrade - excludedVoids)),
    nonGlaAreaSqFt: Math.round(nonGlaAccessory),
    excludedVoidsSqFt: Math.round(excludedVoids),
    warnings,
  };
}
</code></pre>
<h2>3. Why Real Estate Teams Skip $40-$99 Per-Scan Apps for Static &amp; Editable MLS Floor Plans</h2>
<p>Traditional real estate scanning services either charge per-property add-on fees for fixed dimensions (<code>$25-$55</code> per listing with 6-24 hour turnaround) or lock simple edits behind monthly subscriptions. Check our side-by-side breakdown in the <a href="https://www.plancaliber.com/cubicasa-alternative?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article103_real_estate_floor_plans_ts">CubiCasa Alternative Guide</a> or open our ready-to-edit <a href="https://www.plancaliber.com/templates/realtor_3bed_2bath?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article103_real_estate_floor_plans_ts">3-Bed + 2-Car Garage MLS Floor Plan Template</a> right in Chrome or Safari.</p>
<p>With <a href="https://www.plancaliber.com/real-estate-floor-plans?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article103_real_estate_floor_plans_ts">PlanCaliber</a>, you can upload an existing broker sketch, appraisal diagram, or laser-measure notes, calibrate 1 known wall length, and export clean MLS-ready marketing graphics in the same browser session:</p>
<ul>
<li><strong>Free Draft ($0)</strong>: Full 2D/3D editing, 2 free AI sketch/PDF scans/day, live room labels &amp; ANSI-style exterior area readout, <code>1400x1050</code> watermarked proof PNG, and free shareable 2D/3D viewer link.</li>
<li><strong>Print Pass ($9 one-time, no subscription)</strong>: Unwatermarked <code>2400px</code> crisp PNG for MLS/Zillow/brochures, clean 2-sheet vector PDF (<code>A-101</code> + <code>M-101</code>), vector SVG, custom brokerage title block, unbranded shareable 3D link, and unlimited edits forever.</li>
<li><strong>Full CAD Pack ($19 one-time or $49 5-Pack = $9.80/listing)</strong>: 5-sheet <code>1/4"=1'-0"</code> vector PDF + 8-layer AutoCAD R12 <code>.DXF</code> + 3D <code>.OBJ</code> + CSV takeoff, backed by an instant 14-day no-questions-asked refund.</li>
</ul>
<p><em>Note: PlanCaliber floor plans and area calculations are intended for marketing, preliminary space planning, and estimating only. Measurements are approximate; always field-verify on site and defer to a licensed appraiser for official ANSI Z765 appraisal square footage.</em></p>
]]></content:encoded></item><item><title><![CDATA[Detached ADU & Garage Apartment Floor Plan Math: Setbacks, Egress Windows & 1/4-Inch Scale PDFs in TypeScript]]></title><description><![CDATA[Homeowners planning a detached backyard ADU, garage apartment, or finished egress basement usually hit the same two bottlenecks: first, discovering their…]]></description><link>https://plancaliber.hashnode.dev/detached-adu-garage-apartment-floor-plan-math-setbacks-egress-windows-1-4-inch-scale-pdfs-in-typescript</link><guid isPermaLink="true">https://plancaliber.hashnode.dev/detached-adu-garage-apartment-floor-plan-math-setbacks-egress-windows-1-4-inch-scale-pdfs-in-typescript</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Clara Sutton]]></dc:creator><pubDate>Sat, 28 Nov 2026 15:17:17 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b07d6b9e447de416c07f0c8/723aef4b-b33c-47e1-9c5d-a9ad80cc5c2b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Homeowners planning a detached backyard ADU, garage apartment, or finished egress basement usually hit the same two bottlenecks: first, discovering their lot's rear and side setbacks shrink the buildable rectangle far more than expected; second, discovering a bedroom window or stair landing fails <strong>IRC R310 emergency escape and rescue opening</strong> rules after framing starts.</p>
<p>When we built <a href="https://www.plancaliber.com/adu-basement-plans?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article102_adu_basement_plans_ts">PlanCaliber's ADU &amp; Basement Floor Plan Studio</a>, we encoded both the buildable lot envelope AND exact IRC R310 egress checks directly in TypeScript so you can verify footprint geometry before paying for full construction drawings.</p>
<h2>1. Computing the Buildable Backyard ADU Envelope</h2>
<p>Start with the parcel width, rear yard depth, zoning side/rear setbacks, and maximum local ADU square-footage cap (commonly <code>800</code>, <code>850</code>, <code>1,000</code>, or <code>1,200</code> sq ft across US municipalities):</p>
<pre><code class="language-ts">export interface LotEnvelopeInput {
  lotWidthFt: number;
  availableRearDepthFt: number;
  sideSetbackFt: number;        // e.g., 4 ft in CA/WA/OR ADU rules, 5-10 ft elsewhere
  rearSetbackFt: number;        // e.g., 4 ft rear setback
  mainHouseSeparationFt: number; // often 6-10 ft fire separation between structures
  maxAllowedSqFt: number;       // local cap, e.g., 850 or 1000 sq ft
}

export interface BuildableFootprint {
  maxWidthFt: number;
  maxDepthFt: number;
  envelopeSqFt: number;
  effectiveMaxSqFt: number;
  fits28x36GarageApt: boolean;
  fits20x30OneBedAdu: boolean;
}

export function solveAduEnvelope(input: LotEnvelopeInput): BuildableFootprint {
  const maxWidthFt = Math.max(0, input.lotWidthFt - input.sideSetbackFt * 2);
  const maxDepthFt = Math.max(
    0,
    input.availableRearDepthFt - input.rearSetbackFt - input.mainHouseSeparationFt
  );
  const envelopeSqFt = Math.floor(maxWidthFt * maxDepthFt);
  const effectiveMaxSqFt = Math.min(envelopeSqFt, input.maxAllowedSqFt);

  return {
    maxWidthFt,
    maxDepthFt,
    envelopeSqFt,
    effectiveMaxSqFt,
    fits28x36GarageApt: maxWidthFt &gt;= 36 &amp;&amp; maxDepthFt &gt;= 28 &amp;&amp; input.maxAllowedSqFt &gt;= 1008,
    fits20x30OneBedAdu: maxWidthFt &gt;= 30 &amp;&amp; maxDepthFt &gt;= 20 &amp;&amp; input.maxAllowedSqFt &gt;= 600,
  };
}
</code></pre>
<p>Test this live with your own parcel dimensions in our free <a href="https://www.plancaliber.com/calculators/adu-size-setback-calculator?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article102_adu_basement_plans_ts">ADU Size &amp; Setback Calculator</a>, or load our <a href="https://www.plancaliber.com/templates/garage_apt_28x36?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article102_adu_basement_plans_ts">36'x28' Garage Apartment &amp; Workshop CAD Template</a> directly in the browser.</p>
<h2>2. IRC R310 Egress Window Geometry Check (Double-Hung vs. Casement)</h2>
<p>Every sleeping room in a detached ADU or finished basement requires an emergency escape and rescue opening. The mistake that catches contractors off guard is confusing <strong>nominal rough-opening size</strong> with <strong>actual net clear opening</strong> when the sash is open:</p>
<ul>
<li>Minimum net clear opening area: <strong><code>5.7</code> sq ft</strong> (<code>5.0</code> sq ft at grade floor)</li>
<li>Minimum net clear opening height: <strong><code>24"</code></strong></li>
<li>Minimum net clear opening width: <strong><code>20"</code></strong></li>
<li>Maximum finished sill height above floor: <strong><code>44"</code></strong></li>
</ul>
<p>A <code>36" x 48"</code> double-hung window looks big on paper (<code>12</code> sq ft nominal), yet only the bottom half opens, cutting clear height to ~`21"<code>and **failing IRC R310.2.1**! Switching that same opening to a single casement hinge clears</code>32" x 44"<code> (</code>9.78` sq ft) and passes with room to spare.</p>
<pre><code class="language-ts">export interface EgressCheckInput {
  netClearWidthIn: number;
  netClearHeightIn: number;
  sillHeightFromFloorIn: number;
  isGradeFloor: boolean;
}

export function checkIrcR310Egress(w: EgressCheckInput) {
  const netAreaSqFt = (w.netClearWidthIn * w.netClearHeightIn) / 144;
  const minAreaSqFt = w.isGradeFloor ? 5.0 : 5.7;

  const failures: string[] = [];
  if (w.netClearWidthIn &lt; 20) failures.push('Net clear width &lt; 20 in (IRC R310.2.1)');
  if (w.netClearHeightIn &lt; 24) failures.push('Net clear height &lt; 24 in (IRC R310.2.1)');
  if (netAreaSqFt &lt; minAreaSqFt) {
    failures.push(`Net clear area ${netAreaSqFt.toFixed(2)} sq ft &lt; ${minAreaSqFt} sq ft min`);
  }
  if (w.sillHeightFromFloorIn &gt; 44) {
    failures.push(`Sill height ${w.sillHeightFromFloorIn} in &gt; 44 in max (IRC R310.2.2)`);
  }

  return {
    pass: failures.length === 0,
    netAreaSqFt: Number(netAreaSqFt.toFixed(2)),
    failures,
  };
}
</code></pre>
<p>Verify any basement or ADU window plus window-well dimensions (<code>9</code> sq ft min area, <code>36"</code> projection, ladder if <code>&gt; 44"</code> deep) in our free <a href="https://www.plancaliber.com/calculators/irc-egress-window?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article102_adu_basement_plans_ts">IRC Egress Window Calculator</a>.</p>
<h2>3. From Editable 2D/3D ADU Template to Scaled <code>1/4"=1'-0"</code> PDF &amp; <code>.DXF</code></h2>
<p>Instead of drawing an ADU from scratch or paying <code>$49/mo</code> for bloated CAD subscriptions you only need for one weekend, open any of PlanCaliber's pre-dimensioned US ADU templates (<code>420</code> sq ft Studio, <code>600</code> sq ft 1-Bed, <code>850</code> sq ft 2-Bed, <code>750</code> sq ft In-Law Suite, or <code>28'x36'</code> Garage Apartment) free in your browser:</p>
<ol>
<li>Drag walls, doors, windows, kitchen appliances, and laundry clearances to fit your exact lot setbacks.</li>
<li>Inspect live 3D cutaway view and automatic exterior/interior dimension strings (<code>ft-in</code>).</li>
<li>Download a free <code>1400x1050</code> watermarked proof PNG to share with family or contractors, or unlock clean deliverables once with <strong>no subscription</strong>:<ul>
<li><strong><code>$9</code> Print Pass</strong>: Clean unwatermarked 2-sheet vector PDF (<code>A-101</code> Floor Plan + <code>M-101</code> Materials Schedule), <code>2400px</code> PNG, vector SVG, custom title block, and permanent re-edits.</li>
<li><strong><code>$19</code> Single Plan Full CAD Pack</strong>: 5-sheet <code>1/4"=1'-0"</code> vector PDF (<code>A-101</code>, <code>A-102</code> Framing/Dimensions, <code>E-101</code> Electrical, <code>A-201</code> Elevations, <code>M-101</code> Finish Schedule), layered AutoCAD R12 <code>.DXF</code> across 8 AIA layers (<code>A-WALL</code>, <code>A-DOOR</code>, <code>A-GLAZ</code>, <code>A-CABN</code>, <code>A-FURN</code>, <code>E-POWR</code>, <code>A-ROOM</code>, <code>A-DIMS</code>), 3D <code>.OBJ</code>, Framing &amp; Drywall <code>.CSV</code> takeoff, and 14-day instant refund.</li>
</ul>
</li>
</ol>
<p>Launch the <a href="https://www.plancaliber.com/adu-basement-plans?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article102_adu_basement_plans_ts">ADU &amp; Basement Floor Plan Studio</a> free right now.</p>
<p><em>Note: PlanCaliber layouts and IRC calculators are for preliminary design, feasibility planning, and estimating only. Always verify local zoning setbacks, utility easements, and building code requirements on site and with your local Authority Having Jurisdiction (AHJ).</em></p>
]]></content:encoded></item><item><title><![CDATA[Commercial Office Floor Plan & IBC Table 1004.5 Occupancy Load Engine in TypeScript]]></title><description><![CDATA[When a US small business, dental clinic, or startup signs a commercial lease, the first floor plan mistake rarely happens in drywall. It happens on paper…]]></description><link>https://plancaliber.hashnode.dev/commercial-office-floor-plan-ibc-table-1004-5-occupancy-load-engine-in-typescript</link><guid isPermaLink="true">https://plancaliber.hashnode.dev/commercial-office-floor-plan-ibc-table-1004-5-occupancy-load-engine-in-typescript</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[webdev]]></category><category><![CDATA[cad]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Clara Sutton]]></dc:creator><pubDate>Sat, 28 Nov 2026 14:58:53 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b07d6b9e447de416c07f0c8/7ac7ac73-5b5c-45b4-ad59-bc59e359ab8b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When a US small business, dental clinic, or startup signs a commercial lease, the first floor plan mistake rarely happens in drywall. It happens on paper when someone drops 28 desks, a break room, and a 12-seat conference room into a 2,400 sq ft shell without running <strong>IBC Table 1004.5 occupancy load factors</strong> or <strong>IBC Table 1006.2.1 single-exit triggers</strong>.</p>
<p>Crossing 49 occupants in a Group B business suite (or 49 occupants in a Group A-2 café / conference space) can trigger a second remote exit door, panic hardware, or an additional ADA restroom. Catching that threshold in a browser floor plan takes 50 lines of TypeScript and saves tens of thousands in tenant-improvement surprises.</p>
<p>Here is the exact TypeScript occupancy, corridor width, and workstation layout math we run inside <a href="https://www.plancaliber.com/office-space-plans?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article101_office_space_plans_ts">PlanCaliber's Commercial Office Floor Plan Studio</a> and our free <a href="https://www.plancaliber.com/calculators/commercial-office-occupancy-load-calculator?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article101_office_space_plans_ts">Commercial Office Occupancy Load Calculator</a>.</p>
<h2>1. IBC Table 1004.5 Mixed-Use Occupancy Factors</h2>
<p>A real office floor plan is never one uniform load factor. Open workstations (Business areas, <code>150</code> gross sq ft per person under 2018/2021 IBC Table 1004.5) sit right next to high-density conference rooms (<code>15</code> net sq ft per person unconcentrated) and server/mechanical closets (<code>300</code> gross sq ft per person).</p>
<pre><code class="language-ts">export type OfficeZoneType =
  | 'business_workstations'   // IBC 1004.5: 150 gross sq ft / occupant
  | 'conference_unconcentrated' // IBC 1004.5: 15 net sq ft / occupant
  | 'break_room_dining'       // IBC 1004.5: 15 net sq ft / occupant
  | 'storage_mechanical'      // IBC 1004.5: 300 gross sq ft / occupant
  | 'reception_lobby';        // IBC 1004.5: 150 gross sq ft / occupant (Group B accessory)

export interface OfficeZone {
  name: string;
  type: OfficeZoneType;
  areaSqFt: number;
}

const IBC_LOAD_FACTOR_SQFT: Record&lt;OfficeZoneType, number&gt; = {
  business_workstations: 150,
  conference_unconcentrated: 15,
  break_room_dining: 15,
  storage_mechanical: 300,
  reception_lobby: 150,
};

export interface OccupancyReport {
  zoneLoads: Array&lt;{ name: string; occupants: number }&gt;;
  totalOccupants: number;
  requiresTwoExits: boolean;
  minCorridorWidthIn: number;
  adaTurningClearanceIn: number;
}

export function evaluateOfficePlan(zones: OfficeZone[]): OccupancyReport {
  const zoneLoads = zones.map((z) =&gt; ({
    name: z.name,
    occupants: Math.ceil(Math.max(0, z.areaSqFt) / IBC_LOAD_FACTOR_SQFT[z.type]),
  }));

  const totalOccupants = zoneLoads.reduce((sum, z) =&gt; sum + z.occupants, 0);

  // IBC Table 1006.2.1: Group B spaces with occupant load &gt; 49 require at least 2 exits.
  const requiresTwoExits = totalOccupants &gt; 49;

  // IBC Table 1020.2: 44 in minimum corridor width when occupant load &gt;= 50, else 36 in.
  const minCorridorWidthIn = totalOccupants &gt;= 50 ? 44 : 36;

  return {
    zoneLoads,
    totalOccupants,
    requiresTwoExits,
    minCorridorWidthIn,
    adaTurningClearanceIn: 60, // 2010 ADA Standards 304.3.1 circular turning space
  };
}
</code></pre>
<h2>2. Why One Conference Room Flips the Whole Suite</h2>
<p>Plug a typical 2,600 sq ft commercial suite into <code>evaluateOfficePlan</code>:</p>
<pre><code class="language-ts">const suite = evaluateOfficePlan([
  { name: 'Open Bullpen (14 desks)', type: 'business_workstations', areaSqFt: 1800 },
  { name: 'Main Conference Room', type: 'conference_unconcentrated', areaSqFt: 420 },
  { name: 'Kitchenette &amp; Break', type: 'break_room_dining', areaSqFt: 240 },
  { name: 'IT &amp; Storage Closet', type: 'storage_mechanical', areaSqFt: 140 },
]);
// Open Bullpen: ceil(1800 / 150) = 12
// Main Conference Room: ceil(420 / 15) = 28
// Kitchenette &amp; Break: ceil(240 / 15) = 16
// IT &amp; Storage: ceil(140 / 300) = 1
// Total = 57 occupants -&gt; requiresTwoExits: true, minCorridorWidthIn: 44"!
</code></pre>
<p>Look closely at what happened: the 1,800 sq ft open office only counted for <code>12</code> occupants, yet the <code>420</code> sq ft conference room (<code>28</code>) plus <code>240</code> sq ft break room (<code>16</code>) pushed the calculated load to <strong><code>57</code></strong>, tripping BOTH the 2-exit rule (<code>&gt; 49</code>) AND the <code>44"</code> main corridor width minimum!</p>
<p>Trimming the conference room to <code>300</code> sq ft (<code>20</code> occupants) and break area to <code>195</code> sq ft (<code>13</code> occupants) drops the calculated load to <code>46</code> (under <code>49</code>), keeping preliminary layout geometry inside single-exit Group B space-planning bounds before engaging a licensed local professional for formal tenant-improvement drawings.</p>
<h2>3. ADA Accessibility &amp; Workstation Ergonomics on the Same Sheet</h2>
<p>In addition to occupancy counts, every US office space plan has three clearance numbers that collide immediately in 2D if you draw walls freehand:</p>
<ol>
<li><strong>Main Accessible Route</strong>: <code>36"</code> clear minimum (<code>44"</code> when occupant load hits <code>50+</code>, plus <code>60" x 60"</code> passing/turning zones under 2010 ADA 403.5.3).</li>
<li><strong>Door Clear Opening</strong>: <code>32"</code> clear width when opened 90 degrees (requiring a <code>36"</code> nominal commercial door leaf, <code>38"</code> rough opening).</li>
<li><strong>Desk Chair Pull-Back Zone</strong>: <code>36"</code> minimum behind a <code>30"</code> deep workstation (<code>48"</code> recommended behind back-to-back rows so seated employees do not collide).</li>
</ol>
<p>If your entry has a step or threshold change, verify the ramp run with our free <a href="https://www.plancaliber.com/calculators/ada-wheelchair-ramp-slope-calculator?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article101_office_space_plans_ts">ADA Wheelchair Ramp Slope Calculator</a> (<code>1:12</code> max slope, <code>60" x 60"</code> landings every <code>30"</code> of rise).</p>
<h2>4. Export Scaled <code>1/4"=1'-0"</code> PDFs or 8-Layer AutoCAD R12 <code>.DXF</code> Without a Monthly Seat</h2>
<p>Commercial drafting suites lock simple tenant test-fits behind <code>$50-$250/month</code> seats. In <a href="https://www.plancaliber.com/office-space-plans?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article101_office_space_plans_ts">PlanCaliber</a>, you can start from a blank grid, upload a landlord PDF shell (<code>pdf-to-cad</code>), or open our pre-built office templates directly in your browser for <strong>$0</strong>:</p>
<ul>
<li><strong>Free Studio Draft ($0)</strong>: Full 2D/3D CAD drafting, 2 free AI sketch/PDF scans per day, 40 US templates, 50 live US code calculators, instant <code>1400x1050</code> watermarked proof PNG, and free shareable 2D/3D preview link.</li>
<li><strong>Print Pass ($9 one-time)</strong>: Clean unwatermarked 2-sheet vector PDF (<code>A-101</code> Dimensioned Floor Plan + <code>M-101</code> Materials &amp; Finish Schedule), <code>2400px</code> PNG, vector SVG, custom title block, unbranded share link, and permanent edits.</li>
<li><strong>Full CAD Pack ($19 one-time)</strong>: 5-sheet <code>1/4"=1'-0"</code> vector PDF (<code>A-101</code> / <code>A-102</code> / <code>E-101</code> / <code>A-201</code> / <code>M-101</code>), layered AutoCAD R12 <code>AC1009</code> ASCII <code>.DXF</code> (<code>$INSUNITS=1</code> US inches across 8 AIA layers: <code>A-WALL</code>, <code>A-DOOR</code>, <code>A-GLAZ</code>, <code>A-CABN</code>, <code>A-FURN</code>, <code>E-POWR</code>, <code>A-ROOM</code>, <code>A-DIMS</code>), 3D <code>.OBJ</code>/<code>.MTL</code>, Framing &amp; Drywall CSV takeoff, and 14-day instant no-questions-asked refund.</li>
</ul>
<p><em>Note: PlanCaliber outputs and code calculators are designed for preliminary space planning, landlord test-fits, and estimating only. Always field-verify dimensions on site and confirm formal code, egress, and accessibility requirements with your local Authority Having Jurisdiction (AHJ) and licensed professionals.</em></p>
]]></content:encoded></item><item><title><![CDATA[Building 50 Zero-Backend US Building Code Calculators in SvelteKit 5 and TypeScript]]></title><description><![CDATA[When we set out to build 50 interactive US remodel & building code calculators covering IRC framing spans, NEC electrical panel loads, NKBA kitchen…]]></description><link>https://plancaliber.hashnode.dev/building-50-zero-backend-us-building-code-calculators-in-sveltekit-5-and-typescript</link><guid isPermaLink="true">https://plancaliber.hashnode.dev/building-50-zero-backend-us-building-code-calculators-in-sveltekit-5-and-typescript</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Svelte]]></category><category><![CDATA[webdev]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Clara Sutton]]></dc:creator><pubDate>Sat, 28 Nov 2026 14:54:35 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b07d6b9e447de416c07f0c8/2e7cfe1c-4c8d-45fd-aa1e-e91a4c23ccad.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When we set out to build <a href="https://www.plancaliber.com/calculators?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article100_50_us_calculators_ts">50 interactive US remodel &amp; building code calculators</a> covering IRC framing spans, NEC electrical panel loads, NKBA kitchen clearances, IBC commercial occupancy, and 2010 ADA ramp slopes, we made one strict engineering rule: <strong>zero round-trip API calls, zero floating-point rounding drift, and a live scaled SVG diagram on every page.</strong></p>
<p>Every calculation runs deterministically in the visitor's browser using Svelte 5 runes (<code>$state</code> and <code>$derived</code>) backed by plain TypeScript rule modules. Here is the exact pattern that let us ship 50 fast, testable calculators without duplicating UI boilerplate or breaking US imperial fractions.</p>
<h2>1. Never Format US Feet-and-Inches with Naive <code>toFixed()</code></h2>
<p>Construction math in the United States lives in feet, inches, and sixteenths (<code>1/16"</code>). A classic bug in web calculators is doing <code>feet = Math.floor(totalIn / 12)</code> and <code>inches = Math.round(totalIn % 12)</code> without handling rollover when <code>inches === 12</code> (producing ugly strings like <code>9'-12"</code> instead of <code>10'-0"</code>).</p>
<p>Here is the exact rollover-safe imperial formatter we share across all 50 calculators:</p>
<pre><code class="language-ts">export function formatFeetInches(totalInches: number, precisionDenom = 16): string {
  const safeInches = Math.max(0, Number.isFinite(totalInches) ? totalInches : 0);
  const roundedTicks = Math.round(safeInches * precisionDenom);
  const totalWholeInches = Math.floor(roundedTicks / precisionDenom);
  const remTicks = roundedTicks % precisionDenom;

  const feet = Math.floor(totalWholeInches / 12);
  const inches = totalWholeInches % 12;

  if (remTicks === 0) {
    return `${feet}'-${inches}"`;
  }

  // Reduce fraction to lowest terms (e.g. 8/16 -&gt; 1/2)
  let num = remTicks;
  let den = precisionDenom;
  while (num % 2 === 0 &amp;&amp; den % 2 === 0) {
    num /= 2;
    den /= 2;
  }

  return `${feet}'-${inches} ${num}/${den}"`;
}
</code></pre>
<p>Edge case check: <code>formatFeetInches(119.99)</code> rounds to <code>1920 / 16 = 120</code> whole inches -&gt; <code>10'-0"</code> cleanly, never <code>9'-12"</code>.</p>
<h2>2. Separating Pure Code Rules from Svelte 5 Reactive SVG Views</h2>
<p>Every calculator follows a strict two-layer split:</p>
<ol>
<li><strong>Pure TypeScript rule module</strong> (<code>src/lib/calculators/&lt;name&gt;.ts</code>): takes typed inputs, returns structured pass/fail code checks, material quantities, and SVG coordinate geometry. Zero DOM or Svelte imports, so we test boundaries directly with Node's built-in test runner (<code>node --experimental-strip-types --test</code>).</li>
<li><strong>Thin Svelte 5 page</strong> (<code>src/routes/calculators/&lt;slug&gt;/+page.svelte</code>): binds sliders/number inputs via <code>$state</code> and computes both the readout table and the scaled <code>&lt;svg viewBox="..."&gt;</code> via <code>$derived</code>.</li>
</ol>
<pre><code class="language-ts">export interface ClearCheck {
  codeRef: string;
  label: string;
  actualIn: number;
  requiredIn: number;
  pass: boolean;
}

export function evaluateBathroomClearances(
  toiletCenterlineIn: number,
  toiletFrontClearIn: number,
  doorWidthIn: number
): ClearCheck[] {
  return [
    {
      codeRef: 'IRC R307.1',
      label: 'Toilet Centerline to Side Wall / Vanity',
      actualIn: toiletCenterlineIn,
      requiredIn: 15,
      pass: toiletCenterlineIn &gt;= 15,
    },
    {
      codeRef: 'IRC R307.1',
      label: 'Clear Floor Space in Front of Toilet',
      actualIn: toiletFrontClearIn,
      requiredIn: 21,
      pass: toiletFrontClearIn &gt;= 21,
    },
    {
      codeRef: 'NKBA / Common Practice',
      label: 'Bathroom Door Leaf Width',
      actualIn: doorWidthIn,
      requiredIn: 28,
      pass: doorWidthIn &gt;= 28,
    },
  ];
}
</code></pre>
<p>Because the calculation function is pure and synchronous, dragging a slider updates the pass/fail badge, dimension leader lines, and material takeoff at 60 FPS with zero network latency or Cloudflare Worker CPU overhead.</p>
<h2>3. Turning Calculator Inputs Straight into a 2D/3D Floor Plan</h2>
<p>The biggest flaw with standalone web calculators is that once a homeowner or contractor confirms a span or clearance, they still have to re-draw the room in CAD from scratch. Every calculator in our <a href="https://www.plancaliber.com/calculators?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article100_50_us_calculators_ts">50 Free US Code Calculators Hub</a> hands off cleanly into matching pre-scaled CAD templates (for example, our <a href="https://www.plancaliber.com/calculators/electrical-panel-load-calculator?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article100_50_us_calculators_ts">Electrical Panel Load Calculator</a>, <a href="https://www.plancaliber.com/calculators/commercial-office-occupancy-load-calculator?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article100_50_us_calculators_ts">Commercial Office Occupancy Calculator</a>, and <a href="https://www.plancaliber.com/calculators/ada-wheelchair-ramp-slope-calculator?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article100_50_us_calculators_ts">ADA Wheelchair Ramp Slope Calculator</a>).</p>
<p>Inside <a href="https://www.plancaliber.com/?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article100_50_us_calculators_ts">PlanCaliber</a>, drafting in 2D/3D, running all 50 calculators, opening all 40 US templates, uploading up to 2 sketches/PDFs per day, and saving a watermarked proof PNG are completely free. When you need clean deliverables for a bid or review, you unlock once with no subscription: <strong><code>$9</code> Print Pass</strong> (unwatermarked 2-sheet vector PDF + <code>2400px</code> PNG + SVG + unbranded 3D share link) or <strong><code>$19</code> Single Plan</strong> (5-sheet <code>1/4"=1'-0"</code> vector PDF + 8-layer AutoCAD R12 <code>.DXF</code> + 3D <code>.OBJ</code> + CSV takeoff, backed by a 14-day instant no-questions-asked refund).</p>
<p><em>Note: All 50 calculators and PlanCaliber floor plan exports are built for preliminary space planning, feasibility checks, and estimating only. Always field-verify dimensions on site and confirm code requirements with your local Authority Having Jurisdiction (AHJ).</em></p>
]]></content:encoded></item><item><title><![CDATA[Converting Scanned Blueprint PDFs to Editable 2D/3D Floor Plans and AutoCAD .DXF Without Redrawing Every Wall]]></title><description><![CDATA[Homeowners remodeling an existing US house, contractors bidding a commercial tenant improvement, and real estate investors evaluating an ADU conversion…]]></description><link>https://plancaliber.hashnode.dev/converting-scanned-blueprint-pdfs-to-editable-2d-3d-floor-plans-and-autocad-dxf-without-redrawing-every-wall</link><guid isPermaLink="true">https://plancaliber.hashnode.dev/converting-scanned-blueprint-pdfs-to-editable-2d-3d-floor-plans-and-autocad-dxf-without-redrawing-every-wall</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[webdev]]></category><category><![CDATA[cad]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Clara Sutton]]></dc:creator><pubDate>Sat, 28 Nov 2026 14:49:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b07d6b9e447de416c07f0c8/634f545f-1920-43bc-93f2-b1c99beb90f0.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Homeowners remodeling an existing US house, contractors bidding a commercial tenant improvement, and real estate investors evaluating an ADU conversion constantly face the same headache: the only floor plan available is a <strong>flat scanned PDF</strong> or a <strong>MLS listing image</strong> from ten years ago. You cannot drag a wall, check kitchen island clearance, recalculate Gross Living Area (GLA), or send a <code>.DXF</code> to your cabinet shop because it is trapped in static pixels.</p>
<p>In this guide, we show how a browser <strong>PDF-to-CAD</strong> pipeline extracts editable wall graphs, doors, windows, and room polygons from flat PDFs, locks real-world imperial scale via <strong>1-wall calibration</strong>, and lets you export updated <strong><code>1/4"=1'-0"</code> vector PDF sheets</strong> and <strong>layered AutoCAD R12 <code>.DXF</code></strong>.</p>
<p>Upload your own floor plan PDF directly in the browser (<code>2</code> free AI scans/day): <a href="https://www.plancaliber.com/pdf-to-cad-floor-plan?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article99_pdf_to_cad_bofu">PlanCaliber PDF-to-CAD Floor Plan Converter</a>.</p>
<hr />
<h2>1. Rasterizing Flat PDFs Safely in the Browser</h2>
<p>Legacy residential floor plan PDFs fall into two buckets:</p>
<ul>
<li><strong>Scanned / raster PDFs</strong> (flat bitmap images wrapped in a PDF container, often skewed by <code>1</code> to <code>3</code> degrees from a flatbed scanner).</li>
<li><strong>Flattened vector PDFs</strong> (hundreds of unlabeled line strokes with broken hatch fills and zero wall-vs-furniture separation).</li>
</ul>
<p>Rendering the target PDF page at crisp <code>150–200 DPI</code> in the browser creates a uniform normalized bitmap input that feeds cleanly into structural wall, opening, and room-label extraction while discarding cluttered title-block borders and dimension callout noise.</p>
<hr />
<h2>2. Locking Exact Imperial Scale with One Known Dimension</h2>
<p>Never trust a PDF's claimed <code>"1/4\" = 1'-0\""</code> scale note blindly: scans are routinely printed <code>"Fit to Page"</code> (<code>94%</code> to <code>97%</code> shrink!), which quietly throws off every room dimension and drywall takeoff by <code>6"</code> to <code>18"</code>.</p>
<p>Instead, anchor the traced plan to <strong>one printed dimension string or field-measured span</strong> (for example, an overall <code>36'-0"</code> exterior width or a <code>16'-0"</code> garage door opening):</p>
<pre><code class="language-ts">export function computeCalibratedRoomSqFt(
  polygonPx: { x: number; y: number }[],
  refWallPx: number,
  refWallInches: number
): number {
  if (polygonPx.length &lt; 3 || refWallPx &lt;= 0 || refWallInches &lt;= 0) return 0;
  const inPerPx = refWallInches / refWallPx;

  // Shoelace polygon area in square inches, then convert to square feet
  let twiceAreaPx = 0;
  for (let i = 0; i &lt; polygonPx.length; i++) {
    const a = polygonPx[i];
    const b = polygonPx[(i + 1) % polygonPx.length];
    twiceAreaPx += a.x * b.y - b.x * a.y;
  }
  const areaSqIn = Math.abs(twiceAreaPx / 2) * inPerPx * inPerPx;
  return Number((areaSqIn / 144).toFixed(1));
}
</code></pre>
<h3>Real-World Check: Catching a <code>"Fit-to-Page"</code> <code>95%</code> Scan Shrink</h3>
<p>A <code>20' x 30'</code> (<code>600 sq ft</code>) basement printed at <code>95%</code> shrink measures <code>19' x 28'-6"</code> (<code>541.5 sq ft</code>), missing <strong><code>58.5 sq ft</code></strong> (<code>~10%</code> error in area!) because area scales with the square of linear scale (<code>0.95^2 = 0.9025</code>). Anchoring one exterior wall corrects every room area, wall stud count, and framing takeoff automatically.</p>
<hr />
<h2>3. Remodeling the Converted Plan &amp; Exporting Clean Deliverables</h2>
<p>Once the PDF is converted into live parametric walls, you can:</p>
<ol>
<li>Delete a non-bearing partition, drop in a <code>36"</code> kitchen island, add a <code>32"</code> interior door swing, or verify <code>36"</code> / <code>42"</code> NKBA kitchen aisle clearance and <code>30"</code> toilet clearances directly in 2D and live 3D cutaway view.</li>
<li>Export what your exact job requires without recurring subscriptions:<ul>
<li><strong>Free Studio Draft (<code>$0</code>)</strong>: <code>2</code> free AI PDF/sketch scans per day, full 2D/3D edits, free <code>1400x1050</code> watermarked proof PNG, and free watermarked 2D/3D share link.</li>
<li><strong>One-Time Print Pass (<code>$9</code>)</strong>: Clean unwatermarked 2-sheet vector PDF (<code>A-101</code> scaled <code>1/4"=1'-0"</code> + <code>M-101</code> presentation sheet), <code>2400px</code> PNG, vector SVG, custom title block, unbranded share link, and permanent edits.</li>
<li><strong>One-Time Full CAD Pack (<code>$19</code>, or <code>$49</code> 5-Plan Pack)</strong>: 5-sheet <code>1/4"=1'-0"</code> vector PDF (<code>A-101</code>, <code>A-102</code>, <code>E-101</code>, <code>A-201</code>, <code>M-101</code>), 8-layer AutoCAD R12 <code>AC1009</code> <code>.DXF</code> (<code>$INSUNITS=1</code>), 3D <code>.OBJ</code>/<code>.MTL</code>, and framing/drywall takeoff <code>.CSV</code>.</li>
</ul>
</li>
</ol>
<p>Every purchase includes instant 14-day no-questions-asked refunds.</p>
<blockquote>
<p><strong>Disclaimer</strong>: Converted floor plans, blueprints, and takeoffs are for preliminary space planning and estimating only. Always verify structural bearing walls and dimensions on site and confirm local AHJ requirements before demolition or construction.</p>
</blockquote>
<hr />
<h2>Convert Your Floor Plan PDF Today</h2>
<ul>
<li><a href="https://www.plancaliber.com/pdf-to-cad-floor-plan?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article99_pdf_to_cad_bofu">Open PDF-to-CAD Floor Plan Converter</a></li>
<li><a href="https://www.plancaliber.com/sketch-to-cad?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article99_pdf_to_cad_bofu">Try Hand Sketch to CAD</a></li>
<li><a href="https://www.plancaliber.com/calculators/ansi-z765-gla?utm_source=devto&amp;utm_medium=article&amp;utm_campaign=article99_pdf_to_cad_bofu">Check ANSI Z765 GLA Square Footage Calculator</a></li>
</ul>
]]></content:encoded></item></channel></rss>