Import and export the open, free, and simple .BIM model format.
The xeokit SDK provides first-class support for the .BIM format: a lightweight, JSON-based 3D model format designed for:
A .bim file contains:
.bim
This makes it well suited for streamlined BIM and conversion workflows where simplicity and transparency are important.
Use DotBIMLoader to load .bim file data into xeokit:
The loader is data-driven: you provide already-parsed JSON, along with target models, and the loader populates them.
Use DotBIMExporter to serialize xeokit models back into .bim data.
You can export:
into a single .bim JSON structure suitable for storage or transfer.
npm install @xeokit/sdk Copy
npm install @xeokit/sdk
The following example shows the full flow for loading and displaying a .bim model in a Viewer.
import { Scene } from "@xeokit/sdk/scene";import { Data } from "@xeokit/sdk/data";import { Viewer } from "@xeokit/sdk/viewer";import { WebGLRenderer } from "@xeokit/sdk/webglrenderer";import { CameraControl } from "@xeokit/sdk/cameracontrol";import { DotBIMLoader } from "@xeokit/sdk/formats/dotbim";// 1) Create core containers for geometry and metadataconst scene = new Scene();const data = new Data();// 2) Create a Viewer to render the Sceneconst viewer = new Viewer({ scene });new WebGLRenderer({ viewer });// 3) Create a View bound to a canvas elementconst view = viewer.createView({ id: "myView", elementId: "myCanvas"}).value;// 4) Position the cameraview.camera.eye = [1841982.93, 10.03, -5173286.74];view.camera.look = [1842009.49, 9.68, -5173295.85];view.camera.up = [0, 1, 0];// 5) Enable interactive camera controlnew CameraControl(view, {});// 6) Create target models for the loaderconst sceneModel = scene.createModel({ id: "myModel" }).value;const dataModel = data.createModel({ id: "myModel" }).value;// 7) Create the .BIM loaderconst dotBIMLoader = new DotBIMLoader();// 8) Fetch and parse the .BIM JSONfetch("model.bim") .then(r => r.json()) .then(fileData => { // 9) Load geometry + metadata into the models return dotBIMLoader.load({ fileData, sceneModel, dataModel }); }) .then(() => { // Model successfully loaded and visible }) .catch(err => { // Clean up on failure sceneModel.destroy(); dataModel.destroy(); console.error("Error loading .BIM:", err); }); Copy
import { Scene } from "@xeokit/sdk/scene";import { Data } from "@xeokit/sdk/data";import { Viewer } from "@xeokit/sdk/viewer";import { WebGLRenderer } from "@xeokit/sdk/webglrenderer";import { CameraControl } from "@xeokit/sdk/cameracontrol";import { DotBIMLoader } from "@xeokit/sdk/formats/dotbim";// 1) Create core containers for geometry and metadataconst scene = new Scene();const data = new Data();// 2) Create a Viewer to render the Sceneconst viewer = new Viewer({ scene });new WebGLRenderer({ viewer });// 3) Create a View bound to a canvas elementconst view = viewer.createView({ id: "myView", elementId: "myCanvas"}).value;// 4) Position the cameraview.camera.eye = [1841982.93, 10.03, -5173286.74];view.camera.look = [1842009.49, 9.68, -5173295.85];view.camera.up = [0, 1, 0];// 5) Enable interactive camera controlnew CameraControl(view, {});// 6) Create target models for the loaderconst sceneModel = scene.createModel({ id: "myModel" }).value;const dataModel = data.createModel({ id: "myModel" }).value;// 7) Create the .BIM loaderconst dotBIMLoader = new DotBIMLoader();// 8) Fetch and parse the .BIM JSONfetch("model.bim") .then(r => r.json()) .then(fileData => { // 9) Load geometry + metadata into the models return dotBIMLoader.load({ fileData, sceneModel, dataModel }); }) .then(() => { // Model successfully loaded and visible }) .catch(err => { // Clean up on failure sceneModel.destroy(); dataModel.destroy(); console.error("Error loading .BIM:", err); });
import { DotBIMExporter } from "@xeokit/sdk/formats/dotbim";const exporter = new DotBIMExporter();// 1) Serialize models to .BIM JSONexporter.write({ sceneModel, dataModel, version: "1.1.0" // Optional; defaults to latest supported version}).then(fileData => { // fileData is a plain JS object ready for JSON.stringify(...)}).catch(err => { console.error("Error exporting .BIM:", err);}); Copy
import { DotBIMExporter } from "@xeokit/sdk/formats/dotbim";const exporter = new DotBIMExporter();// 1) Serialize models to .BIM JSONexporter.write({ sceneModel, dataModel, version: "1.1.0" // Optional; defaults to latest supported version}).then(fileData => { // fileData is a plain JS object ready for JSON.stringify(...)}).catch(err => { console.error("Error exporting .BIM:", err);});
dotbim — .BIM Importer and Exporter
Import and export the open, free, and simple .BIM model format.
Overview
The xeokit SDK provides first-class support for the .BIM format: a lightweight, JSON-based 3D model format designed for:
A
.bimfile contains:This makes it well suited for streamlined BIM and conversion workflows where simplicity and transparency are important.
Importing .BIM
Use DotBIMLoader to load
.bimfile data into xeokit:The loader is data-driven: you provide already-parsed JSON, along with target models, and the loader populates them.
Exporting .BIM
Use DotBIMExporter to serialize xeokit models back into
.bimdata.You can export:
into a single
.bimJSON structure suitable for storage or transfer.Installation
Example: loading a .BIM model
The following example shows the full flow for loading and displaying a
.bimmodel in a Viewer.Example: exporting to .BIM
Notes
.bimis intentionally minimal; xeokit does not attempt to infer missing BIM semantics beyond what the format provides..bimand exporting it again will preserve structure where possible.