bldg

Embed a plan: <bldg-viewer>

One tag shows a bldg plan in any web page: a blog post, a client portal, your docs. Floor plan, reflected ceiling plan, roof plan, elevations, sections and 3D, drawn by the same engine as the editor. Free to embed on any site, commercial ones included (bldg Viewer License), no account, no server of ours: the plan stays where you put it.

<script type="module" src="https://cdn.jsdelivr.net/npm/@usebldg/viewer@0.1.0/dist/bldg-viewer.js"></script>
<bldg-viewer src="house.bldg.json"></bldg-viewer>

That is the whole embed: the plan of the lowest level, with a small switcher (Plan, 3D and the level). This one reads the demo house's plan file:

Drag to pan, Ctrl (⌘) + scroll to zoom, double-click to fit; click or tap a room, door or window for its details. On a touch screen: pinch to zoom, two fingers to move the plan (one finger still scrolls the page until you have zoomed in), double-tap to fit. Open the demo house in the editor.

One tag, one view

The attributes pick the view; tabs picks the switcher's buttons, or none at all for a figure.

AttributeValuesDefault
srca plan (.bldg.json) or a viewer file (.viewer.json, below); or put either inside the tag in a <script type="application/json">
viewplan · rcp (the Ceiling tab: the reflected ceiling plan) · roof (the Roof tab) · 3d · elevation · sectionplan
levela level id (plan and RCP)the lowest level
elevationN · S · E · W, or an elevation view's idS
sectiona section view's idthe first section
camerasw · se · ne · nw (the 3D view from that side, looking down at the building) · topframed from the south-east
tabsa comma list of the views above, or none: no switcher, a static figureplan,3d (and the view asked for)
enginethe folder holding the engine (dist/engine/), for a plan source when it is not beside the script (a bundler)beside the script
<bldg-viewer src="house.viewer.json" view="3d"
  camera="sw" tabs="plan,elevation,3d"></bldg-viewer>
<bldg-viewer src="house.viewer.json"
  view="elevation" elevation="S" tabs="none"></bldg-viewer>

Plans, elevations and sections are SVG drawings (light, sharp at any zoom, selectable text). three.js and the 3D view load only when 3D is shown.

A plan file or a viewer file

A plan (house.bldg.json, the file the editor's Save writes) is drawn in the browser by the bldg engine, WebAssembly fetched once from beside the script (about 3 MB gzipped). Edit the plan, reload the page, the views follow.

A viewer file (house.viewer.json) holds every view already drawn: each level's plan and ceiling plan, the roof plan, the elevations, the sections and the 3D model. No engine is fetched; the demo house's is 378 kB, 50 kB gzipped. Make one in the editor: Share ▾ › Embed in a web page… › Download viewer file (Pre-drawn, the default). Make it again after the plan changes.

Offline: one HTML file

The editor's Embed › Download offline HTML writes one file that opens by double-click, with no network and no server: the viewer file and the viewer itself inline (no WebAssembly). Send it to a client by email; it shows the plan, the elevations and the 3D view. The demo house as an offline file (1.1 MB, 249 kB gzipped).

From the editor

In the editor, Share ▾ › Embed in a web page… shows the tag for the view on screen (its tab, level, side or section, and the 3D camera's nearest preset), with Copy, the plan or viewer file to put beside your page, and Download offline HTML. Share keeps the view too: the link it copies opens on the same tab, level and camera.

Sizes

File (npm package @usebldg/viewer, dist/)RawgzipLoaded
bldg-viewer.js50 kB18 kBalways
bldg-viewer-3d.js (three.js)684 kB179 kBthe first time 3D is shown
engine/bldg_wasm_bg.wasm8.8 MB2.9 MBonly for a plan (.bldg.json) source
bldg-viewer.standalone.js731 kB197 kBoffline files carry it inline

Details

bldg · Editor · Editor guide · Viewer · Format · Benchmarks · Limitations · Terms · Privacy · hello@usebldg.com