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

Two-Click Vector Blueprint Previews & Parametric Template Resizing in SvelteKit

Most online floor plan galleries force visitors through an awkward funnel: pick a static image, create an account, wait for an editor to load, hunt for the export button, and only then discover what the output actually l

Most online floor plan galleries force visitors through an awkward funnel: pick a static image, create an account, wait for an editor to load, hunt for the export button, and only then discover what the output actually looks like, or what it costs.

In PlanCaliber, every one of our 40 editable US CAD templates is backed by live TypeScript geometry rather than flat raster pictures. That lets us wire two high-intent URL shortcuts directly into SvelteKit without adding any database round-trips or account walls:

  1. Direct Blueprint Sheet Preview (?template=<id>&openExport=1): opens the live editable 2D/3D studio with the template loaded and immediately renders the interactive 5-sheet vector preview (A-101, M-101, A-102, E-101, plus .DXF inspection) so a builder or homeowner can verify exact dimensions and download a free watermarked proof PNG in two clicks.
  2. Inline Parametric Shell Resizing (?calc=1&type=<type>&w=<W>&d=<D>&src=tpl_<id>): lets a visitor browsing a 24x24 2-Car Detached Garage or 30x50 Barndominium type 26 x 28 or 36 x 60 right in the sidebar and launch a watertight custom-sized 2D/3D shell with one click.

1. Mapping Any Static Template to Its Parametric Shell Family

A static template library has specific pre-furnished layouts (e.g., garage_2car_24x24, backyard_studio_12x16, basement_rec_bar_24x40, laundry_mudroom_12x16). When a user wants different exterior dimensions, we map the template ID and category to a strictly typed ParametricProjectType in a pure helper (src/lib/cad/calc-handoff.ts):

export type ParametricProjectType =
  | 'kitchen'
  | 'bathroom'
  | 'garage'
  | 'adu'
  | 'barndominium'
  | 'closet'
  | 'addition'
  | 'laundry'
  | 'basement'
  | 'office'
  | 'dining'
  | 'shed'
  | 'bedroom'
  | 'living'
  | 'home';

export function getParametricTypeForTemplate(
  templateId: string,
  category: string
): ParametricProjectType {
  const id = templateId.toLowerCase();
  const cat = category.toLowerCase();
  if (id.includes('garage') || id.includes('shop')) return 'garage';
  if (id.includes('shed') || id.includes('backyard_studio')) return 'shed';
  if (id.includes('barndominium')) return 'barndominium';
  if (id.includes('basement')) return 'basement';
  if (id.includes('adu') || id.includes('inlaw')) return 'adu';
  if (id.includes('laundry') || id.includes('mudroom')) return 'laundry';
  if (id.includes('closet')) return 'closet';
  if (id.includes('kitchen')) return 'kitchen';
  if (id.includes('bath')) return 'bathroom';
  if (id.includes('office')) return 'office';
  if (id.includes('addition') || id.includes('sunroom')) return 'addition';
  if (cat.includes('garage')) return 'garage';
  return 'home';
}

Because every ParametricProjectType defines explicit min/max exterior bounds ([minW, maxW], [minD, maxD]), any user-entered dimensions are clamped deterministically before generating walls, door swings, glazing, fixtures, and ANSI Z765 area totals.

2. Clean One-Shot ?openExport=1 Modal Handoff

When a visitor clicks Preview 5-Sheet PDF & AutoCAD .DXF from a template detail page such as our 12x16 Backyard Studio or 3-Bed / 2-Bath Residence, the browser navigates to /?template=<id>&openExport=1.

The critical UX detail is making the trigger one-shot and non-trapping:

onMount(() => {
  const params = new URLSearchParams(window.location.search);
  if (params.get('openExport') === '1') {
    showExportModal = true;
    params.delete('openExport');
    const cleanUrl = params.toString()
      ? `${window.location.pathname}?${params.toString()}`
      : window.location.pathname;
    window.history.replaceState({}, '', cleanUrl);
  }
});

Two benefits happen immediately:

  1. Refreshing the page does not trap the user inside the export preview modal after they dismiss it to edit walls or move fixtures.
  2. Inside the preview modal, the user inspects live vector sheets rendered straight from the active geometry, can download a free 1400x1050 watermarked proof PNG immediately, or unlock clean deliverables ($9 2-sheet PDF + 2400px PNG/SVG + unbranded share link, or $19 5-sheet 1/4"=1'-0" PDF + 8-layer AutoCAD R12 .DXF + 3D .OBJ + framing takeoff .CSV, backed by a 14-day instant refund).

3. Consistent Zero-Friction Flow Across Templates, Hubs, and Calculators

With this pattern wired into all 40 templates, all 20 US code calculators, and vertical planning hubs like Finished Basements, Backyard Sheds & Studios, and Walk-In Closets & Laundry Rooms, every static SEO page becomes an instant interactive entry point into real browser CAD.

Note: PlanCaliber is a preliminary space-planning and CAD drafting tool. Always field-verify dimensions, structural framing, and local building codes on site before construction or permit submission.

📰 Read the original article on Dev.to WebDev

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