xeokit / xeokit-xkt-utils

Deprecated JavaScript tools to generate .XKT files; replaced by https://github.com/xeokit/xeokit-convert
Other
10 stars 9 forks source link

XKT Format V8 #14

Closed xeolabs closed 3 years ago

xeolabs commented 3 years ago

XKT V8

XKT V8 combines IFC metadata into the XKT file, making the use of a separate metadata JSON file redundant.

Advantages are:

For backward compatibility, XKTLoaderPlugin will continue to accept a separate metadata JSON file, if one is provided. In such a case, the JSON metadata would override the metadata embedded in the XKT.

Along with this update, we'll also update all docs, examples and tests to work with XKT V8. This means changing all code examples so that they load the single XKT file, without the JSON metadata file, since this is now the standard for xeokit.

IFC -> XKT Conversion

The open source conversion pipeline changes slightly, where we re-route the metadata JSON from the xeokit-metadata tool into the gltf2xkt tool, to combine the metadata into its XKT output.

./IfcConvert --use-element-guids HolterTower.ifc HolterTower.dae

./COLLADA2GLTF/build/COLLADA2GLTF-bin -i HolterTower.dae -o HolterTower.gltf 

xeokit-metadata HolterTower.ifc HolterTower.json

gltf2xkt.js -s HolterTower.gltf -m HolterTower.json -o HolterTower.xkt

oss_xkt_conversion

Loading XKT

Now, loading the XKT no longer requires loading an accompanying metadata JSON file:

import {Viewer, XKTLoaderPlugin} from "xeokit-sdk.es.js";

const viewer = new Viewer({
     canvasId: "myCanvas"
});

const xktLoader = new XKTLoaderPlugin(viewer);

const modelNode = xktLoader.load({
     id: "myModel",
     src: "./HolterTower.xkt"
});