Module @xeokit/dotbim - v0.1.0

npm version

xeokit .BIM Importer


Import building models from the open, free and simple .BIM file format


The xeokit SDK allows us to import 3D models from .BIM, a JSON-based file format specifically designed for lightweight, user-friendly, and human-readable storage and sharing of 3D BIM models.

.BIM is an open-source and minimalist file format for BIM that's built to be easy to read and write. Essentially, .BIM is a transfer format that contains triangulated meshes with a dictionary of information attached to them.

To import a .BIM model into xeokit, simply use the loadDotBIM function, which will load the file into both a SceneModel and a DataModel.



Installation

npm install @xeokit/dotbim

Usage

In the example below, we'll import a .BIM file into a SceneModel and a DataModel. The @xeokit/core!SDKError class is used to handle errors that may occur during the process:

import { Scene } from "@xeokit/scene";
import { Data } from "@xeokit/data";
import { loadDotBIM } from "@xeokit/dotbim";

const scene = new Scene();
const data = new Data();
const dataModel = data.createModel({ id: "myModel" });
const sceneModel = scene.createModel({ id: "myModel" });

if (dataModel instanceof SDKError) {
console.error(dataModel.message);
} else if (sceneModel instanceof SDKError) {
console.error(dataModel.message);
} else {
fetch("myModel.bim")
.then(response => response.json())
.then(data => {

const fileData = JSON.parse(data);

return loadDotBIM({
data: fileData,
sceneModel,
dataModel
});

}).then(() => {
sceneModel.build();
dataModel.build();
});
}

@xeokit/dotbim

Index

Functions

Generated using TypeDoc