diff --git a/docs/index.html b/docs/index.html index 8f12817..82930a0 100644 --- a/docs/index.html +++ b/docs/index.html @@ -115,7 +115,7 @@
XKT format compresses large double-precision models to a compact payload that loads quickly over the Web into a xeokit viewer running in the browser. We can use xeokit-convert -to convert several source formats into XKT, such as IFC, glTF and CityJSON.
+to convert several source formats into XKT, such as IFC, GLB and CityJSON.Our thanks to the authors of these open source libraries, which we use internally within xeokit-convert
:
Listed below these are the steps for insta -c, --configs [file] optional path to JSON configs file; overrides convert2xkt.conf.js -s, --source [file] path to source file -a, --sourcemanifest [file] path to source manifest file (for converting split file output from ifcgltf -s) --f, --format [string] source file format (optional); supported formats are gltf, ifc, laz, las, pcd, ply, stl and cityjson +-f, --format [string] source file format (optional); supported formats are glb, ifc, laz, las, pcd, ply, stl and cityjson -m, --metamodel [file] path to source metamodel JSON file (optional) -i, --include [types] only convert these types (optional) -x, --exclude [types] never convert these types (optional) @@ -212,11 +212,7 @@
The table below lists the components provi
XKTModel
. Supports all glTF formats, along with textures.XKTModel
. Our original lightweight glTF parser that does not support .glb
and textures.XKTModel
. Supports textures.convert2xkt
Th -v, --version output the version number -s, --source [file] path to source file -a, --sourcemanifest [file] path to source manifest file (for converting split file output from ifcgltf -s) - -f, --format [string] source file format (optional); supported formats are gltf, ifc, laz, las, pcd, ply, stl and cityjson + -f, --format [string] source file format (optional); supported formats are glb, ifc, laz, las, pcd, ply, stl and cityjson -m, --metamodel [file] path to source metamodel JSON file (optional) -i, --include [types] only convert these types (optional) -x, --exclude [types] never convert these types (optional) @@ -362,7 +358,7 @@
ifc2gltf
The ifc2gltf
tool has the option to convert IFC files into multiple glTF/GLB and JSON metadata files. We can then use convert2xkt
to convert each of these
+
ifc2gltf
The ifc2gltf
tool has the option to convert IFC files into multiple GLB and JSON metadata files. We can then use convert2xkt
to convert each of these
files individually. This allows us to convert a huge IFC files into several, smaller XKT files, then load
those XKT files individually into a xeokit Viewer.
Run ifc2gltf
with the -s
option, to convert an IFC file into a set of multiple glb
geometry and json
metadata files:
Let&ap (errMsg) => { }); -
Let's +
Let's
use parseGLTFIntoXKTModel
-to import glTF into
+to import binary glTF into
an XKTModel
.
We'll also use the classes and functions introduced in the previous examples to serialize
the XKTModel
to
@@ -756,11 +752,11 @@
Let&
const xktLoader = new XKTLoaderPlugin(viewer);
-utils.loadArraybuffer("./assets/models/gltf/MAP/glTF-Embedded/MAP.gltf", (gltf) => {
+utils.loadArraybuffer("./assets/models/glb/MAP/MAP.glb", (glb) => {
const xktModel = new XKTModel();
- parseGLTFIntoXKTModel({data: gltf, xktModel: xktModel}).then(() => {
+ parseGLTFIntoXKTModel({data: glb, xktModel: xktModel}).then(() => {
xktModel.finalize().then(() => {
diff --git a/docs/index.json b/docs/index.json
index f784e88..e482c8f 100644
--- a/docs/index.json
+++ b/docs/index.json
@@ -14234,7 +14234,7 @@
},
{
"kind": "index",
- "content": "# xeokit-convert\n\n[![Twitter Follow](https://img.shields.io/twitter/follow/xeolabs?style=social)](https://twitter.com/xeolabs)\n[![npm version](https://badge.fury.io/js/%40xeokit%2Fxeokit-convert.svg)](https://badge.fury.io/js/%40xeokit%2Fxeokit-convert)\n\nUse **xeokit-convert** to:\n\n* Convert BIM and AEC models directly into XKT files for super fast loading into [xeokit](https://xeokit.io)\n* Generate XKT files with JavaScript\n\n> xeokit-convert replaces [xeokit-gltf-to-xkt](https://github.com/xeokit/xeokit-gltf-to-xkt) and [xeokit-xkt-utils](https://github.com/xeokit/xeokit-xkt-utils), which are deprecated.\n\n> CAUTION: Direct IFC conversion is an alpha status feature, since it depends on [web-ifc](https://github.com/tomvandig/web-ifc), a 3rd-party library, which is also alpha at this time. As such, some IFC models may not convert properly. If this is the case for your models, consider using our [standard conversion setup](https://www.notion.so/xeokit/Converting-IFC-Models-using-3rd-Party-Open-Source-Tools-c373e48bc4094ff5b6e5c5700ff580ee)\nuntil issues have been resolved. Also, direct IFC conversion does not currently support all property sets.\n\n---\n\n# Contents\n\n- [Introduction](#introduction)\n- [Acknowledgements](#acknowledgements)\n- [Resources](#resources)\n- [Features](#features)\n- [Installing](#installing)\n- [Components](#components)\n- [Using ````convert2xkt````](#using-----convert2xkt----)\n + [Converting an IFC file into an XKT file on the command line](#converting-an-ifc-file-into-an-xkt-file-on-the-command-line)\n + [Viewing the XKT file with xeokit](#viewing-the-xkt-file-with-xeokit)\n + [Querying the XKT version in Node.js](#querying-the-xkt-version-in-nodejs)\n + [Converting an IFC file into an XKT file in Node.js](#converting-an-ifc-file-into-an-xkt-file-in-nodejs)\n + [Converting IFC file data into XKT data in Node.js](#converting-ifc-file-data-into-xkt-data-in-nodejs)\n- [Converting Split Files Output from ````ifc2gltf````](#converting-split-files-from-ifc2gltf)\n- [Using ````XKTModel````](#using-----xktmodel----)\n + [Programmatically Building an XKT File](#programmatically-building-an-xkt-file)\n + [Serializing the XKTModel to an ArrayBuffer](#serializing-the-xktmodel-to-an-arraybuffer)\n + [Loading the ArrayBuffer into a Viewer](#loading-the-arraybuffer-into-a-viewer)\n + [Loading IFC into an XKTModel](#loading-ifc-into-an-xktmodel)\n + [Loading LAS into an XKTModel](#loading-las-into-an-xktmodel)\n + [Loading glTF into an XKTModel](#loading-gltf-into-an-xktmodel)\n + [Loading STL into an XKTModel](#loading-stl-into-an-xktmodel)\n- [Building](#building)\n + [Building Binaries](#building-binaries)\n\n---\n\n# Introduction\n\n[````xeokit-convert````](https://github.com/xeokit/xeokit-convert) provides the means to convert 3D BIM and AEC models\ninto XKT files for super fast loading into [xeokit](https://xeokit.io), along with programming tools to generate XKT\nfiles with JavaScript on Node.js.\n\nThe [XKT format](https://github.com/xeokit/xeokit-convert/tree/master/specs) compresses large double-precision models to\na compact payload that loads quickly over the Web into a xeokit viewer running in the browser. We can use xeokit-convert\nto convert several source formats into XKT, such as IFC, glTF and CityJSON.\n\n# Acknowledgements\n\nOur thanks to the authors of these open source libraries, which we use internally within ````xeokit-convert````:\n\n* [loaders.gl](https://loaders.gl) - Copyright (C) 2015 Uber Technologies,\n Inc. ([MIT License](http://www.opensource.org/licenses/mit-license.php))\n* [Basis Universal](https://github.com/BinomialLLC/basis_universal) - Binomal\n LLC, ([Apache 2 License](http://www.apache.org/licenses/LICENSE-2.0))\n* [Pako](https://github.com/nodeca/pako) - Copyright (C) 2014-2017 by Vitaly Puzrin and Andrei\n Tuputcyn ([MIT License](http://www.opensource.org/licenses/mit-license.php))\n* [earcut](https://github.com/mapbox/earcut) - Copyright (C) 2016,\n Mapbox ([ISC License](https://opensource.org/licenses/ISC))\n* [web-ifc](https://github.com/tomvandig/web-ifc) - Copyright (C) 2020-2021 web-ifc\n contributors ([Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/))\n\n# Resources\n\n* [npm](https://www.npmjs.com/package/@xeokit/xeokit-convert)\n* [API Docs](https://xeokit.github.io/xeokit-convert/docs)\n* [Source Code](https://github.com/xeokit/xeokit-convert)\n* [Releases / Changelog](https://github.com/xeokit/xeokit-convert/releases)\n* [XKT Specifications](https://xeokit.github.io/xeokit-convert/specs/)\n\n# Features\n\n* A Node-based CLI tool to convert various 3D model formats to XKT files.\n* A JavaScript toolkit of components for loading, generating and saving XKT files.\n\n# Installing\n\nListed below these are the steps for installing and running `convert2xkt` on Linux. Make sure you have first installed \n`git` and that your version of `NodeJS` is at least `v16.10.0.`\n\n````bash\ngit clone https://github.com/xeokit/xeokit-convert.git\ncd xeokit-convert/\nnpm install\nnode convert2xkt.js -h\n\nUsage: convert2xkt [options]\n\nOptions:\n-v, --version output the version number\n-c, --configs [file] optional path to JSON configs file; overrides convert2xkt.conf.js\n-s, --source [file] path to source file\n-a, --sourcemanifest [file] path to source manifest file (for converting split file output from ifcgltf -s)\n-f, --format [string] source file format (optional); supported formats are gltf, ifc, laz, las, pcd, ply, stl and cityjson\n-m, --metamodel [file] path to source metamodel JSON file (optional)\n-i, --include [types] only convert these types (optional)\n-x, --exclude [types] never convert these types (optional)\n-r, --rotatex rotate model 90 degrees about X axis (for las and cityjson)\n-g, --disablegeoreuse disable geometry reuse (optional)\n-z, --minTileSize [number] minimum diagonal tile size (optional, default 500)\n-t, --disabletextures ignore textures (optional)\n-n, --disablenormals ignore normals (optional)\n-o, --output [file] path to target .xkt file when -s option given, or JSON manifest for multiple .xkt files when source manifest\nfile given with -a; creates directories on path automatically if not existing\n-l, --log enable logging (optional)\n-h, --help display help for command\n````\n\nIf you get ````RuntimeError: memory access out of bounds```` while converting IFC, then you'll need to compile the\n3rd-party web-ifc WASM module for your system - see [Building Binaries](#building-binaries).\n\n# Components\n\nThe table below lists the components provided by ````xeokit-convert````.\n\nAt the center of the toolkit, we've got the converter tool, provided as both a Node.js function and CLI executable.\n\nBundled with the converter, we've got the XKT document model, a bunch of loaders for different formats, and a function\nto serialize the document model to a BLOB. We use these components within the converter tool, and also provide them as\npart of the public API for extensibility.\n\n| Component | Description |\n| --- | --- |\n| [convert2xkt](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-convert2xkt) (function)
[convert2xkt](https://github.com/xeokit/xeokit-convert/blob/master/convert2xkt.js) (Node script)| A Node-based JavaScript function and CLI tool that converts various AEC model formats into xeokit's native, super-fast-loading XKT format. |\n| [XKTModel](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html) | A JavaScript document model that represents the contents of an XKT file in memory. Using this, we can programmatically build a document model in JavaScript, adding geometries, materials, objects etc, then serialize it to an XKT file. |\n| [parseIFCIntoXKTModel](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-parseIFCIntoXKTModel) | Parses IFC data into an ````XKTModel````. This is an alpha-status feature. |\n| [parseGLTFIntoXKTModel](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-parseGLTFIntoXKTModel) | Parses glTF into an ````XKTModel````. Supports all glTF formats, along with textures. |\n| [parseGLTFJSONIntoXKTModel](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-parseGLTFJSONIntoXKTModel) | Parses glTF JSON into an ````XKTModel````. Our original lightweight glTF parser that does not support ````.glb```` and textures. |\n| [parseCityJSONIntoXKTModel](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-parseJSONIntoXKTModel) | Parses CityJSON into an ````XKTModel```` |\n| [parseLASIntoXKTModel](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-parseLASIntoXKTModel) | Parses LAS and LAZ into an ````XKTModel```` |\n| [parseSTLIntoXKTModel](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-parseSTLIntoXKTModel) | Parses STL into an ````XKTModel```` |\n| [writeXKTModelToArrayBuffer](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-writeXKTModelToArrayBuffer) | Serializes an ````XKTModel```` to an XKT file |\n\n# Using ````convert2xkt````\n\nThe ````convert2xkt```` tool converts various model formats into xeokit's native XKT format, which is designed to load\nsuper fast over the Web into a xeokit viewer. We provide this tool as both a [CLI script]() and as\na [function](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-convert2xkt) to use within\nour own Node scripts.\n\n````bash\nnode convert2xkt.js -h\n\nUsage: convert2xkt [options]\n\nOptions:\n -v, --version output the version number\n -s, --source [file] path to source file\n -a, --sourcemanifest [file] path to source manifest file (for converting split file output from ifcgltf -s)\n -f, --format [string] source file format (optional); supported formats are gltf, ifc, laz, las, pcd, ply, stl and cityjson\n -m, --metamodel [file] path to source metamodel JSON file (optional)\n -i, --include [types] only convert these types (optional)\n -x, --exclude [types] never convert these types (optional)\n -r, --rotatex rotate model 90 degrees about X axis (for las and cityjson)\n -g, --disablegeoreuse disable geometry reuse (optional)\n -z, --mintilesize [number] minimum diagonal tile size (optional, default 500)\n -t, --disabletextures ignore textures (optional)\n -n, --disablenormals ignore normals (optional)\n -o, --output [file] path to target .xkt file when -s option given, or JSON manifest for multiple .xkt files when source manifest file given with -a; creates directories on path automatically if not existing\n -l, --log enable logging (optional)\n -h, --help display help for command\n\nXKT version: 10\n````\n\n### Converting an IFC file into an XKT file on the command line\n\nLet's use the [convert2xkt](https://github.com/xeokit/xeokit-convert/blob/master/convert2xkt.js) Node script to convert\nan IFC file to XKT on the command line.\n\n````bash\nnode convert2xkt.js -s rme_advanced_sample_project.ifc -o rme_advanced_sample_project.ifc.xkt -l\n\n[convert2xkt] Reading input file: rme_advanced_sample_project.ifc\n[convert2xkt] Input file size: 35309.94 kB\n[convert2xkt] Geometry reuse is enabled\n[convert2xkt] Converting...\n[convert2xkt] Converted to: XKT v9\n[convert2xkt] XKT size: 1632.98 kB\n[convert2xkt] Compression ratio: 21.62\n[convert2xkt] Conversion time: 54.41 s\n[convert2xkt] Converted metaobjects: 0\n[convert2xkt] Converted property sets: 0\n[convert2xkt] Converted drawable objects: 1986\n[convert2xkt] Converted geometries: 3897\n[convert2xkt] Converted triangles: 286076\n[convert2xkt] Converted vertices: 547740\n[convert2xkt] reuseGeometries: false\n[convert2xkt] minTileSize: 10000\n[convert2xkt] Writing XKT file: rme_advanced_sample_project.ifc.xkt\n````\n\n### Viewing the XKT file with xeokit\n\nNow that we've got an XKT file, we can now view it in the browser using a\nxeokit [Viewer](https://xeokit.github.io/xeokit-sdk/docs/class/src/viewer/Viewer.js~Viewer.html) configured with\nan [XKTLoaderPlugin](https://xeokit.github.io/xeokit-sdk/docs/class/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin.html)\n.\n\n````javascript\nimport {Viewer, XKTLoaderPlugin} from\n \"https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk@1/dist/xeokit-sdk.es.min.js\";\n\nconst viewer = new Viewer({\n canvasId: \"myCanvas\"\n});\n\nconst xktLoader = new XKTLoaderPlugin(viewer);\n\nconst modelNode = xktLoader.load({\n id: \"myModel\",\n src: \"./rme_sample_project.ifc.xkt\"\n});\n````\n\n### Querying the XKT version in Node.js\n\nFrom with a Node script, we can query which XKT version ````xeokit-convert```` currently generates:\n\n````javascript\nconst {XKT_INFO} = require(\"./dist/xeokit-convert.cjs.js\");\n\nconst xktVersion = XKT_INFO.xktVersion; // Unsigned integer\nconsole.log(`XKT version: ${xktVersion}`);\n````\n\n### Converting an IFC file into an XKT file in Node.js\n\nWe can use\nthe [convert2xkt](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-convert2xkt)\nfunction from within our Nodejs scripts to programmatically convert files to XKT.\n\n````javascript\nconst convert2xkt = require(\"@xeokit/xeokit-convert/dist/convert2xkt.cjs.js\");\n\nconvert2xkt({\n source: \"rme_advanced_sample_project.ifc\",\n output: \"rme_advanced_sample_project.ifc.xkt\",\n log: (msg) => {\n console.log(msg)\n }\n}).then(() => {\n console.log(\"Converted.\");\n}, (errMsg) => {\n console.error(\"Conversion failed: \" + errMsg)\n});\n````\n\n### Converting IFC file data into XKT data in Node.js\n\nWhen using\nthe [convert2xkt](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-convert2xkt)\nfunction in our Node scripts, we can manage all file data in memory.\n\nThis is great for when we want more control over where we read and write the files.\n\n````javascript\nconst convert2xkt = require(\"@xeokit/xeokit-convert/dist/convert2xkt.cjs.js\");\nconst fs = require('fs');\n\nconvert2xkt({\n sourceData: fs.readFileSync(\"rme_advanced_sample_project.ifc\"),\n outputXKT: (xtkArrayBuffer) => {\n fs.writeFileSync(\"rme_advanced_sample_project.ifc.xkt\", xtkArrayBuffer);\n }\n}).then(() => {\n console.log(\"Converted.\");\n}, (errMsg) => {\n console.error(\"Conversion failed: \" + errMsg)\n});\n````\n\nWhen using\nthe [convert2xkt](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-convert2xkt)\nfunction in our Node scripts, we can manage all file data in memory.\n\nThis is great for when we want more control over where we read and write the files.\n\n````javascript\nconst convert2xkt = require(\"@xeokit/xeokit-convert/dist/convert2xkt.cjs.js\");\nconst fs = require('fs');\n\nconvert2xkt({\n sourceData: fs.readFileSync(\"rme_advanced_sample_project.ifc\"),\n outputXKT: (xtkArrayBuffer) => {\n fs.writeFileSync(\"rme_advanced_sample_project.ifc.xkt\", xtkArrayBuffer);\n }\n}).then(() => {\n console.log(\"Converted.\");\n}, (errMsg) => {\n console.error(\"Conversion failed: \" + errMsg)\n});\n````\n\n# Converting Split Files Output from ````ifc2gltf````\n\nThe ````ifc2gltf```` tool has the option to convert IFC files into multiple glTF/GLB and JSON metadata files. We can then use ````convert2xkt```` to convert each of these \nfiles individually. This allows us to convert a huge IFC files into several, smaller XKT files, then load \nthose XKT files individually into a xeokit Viewer.\n\n## Usage\n\nRun ````ifc2gltf```` with the ````-s```` option, to convert an IFC file into a set of multiple ````glb```` geometry and ````json```` metadata files:\n\n````\nifc2gltfcxconverter -i model.ifc -o myGLBFiles/model.glb -m myGLBFiles/model.json -s 5 -e 3\n````\n\nThe ````ifc2gltf```` ````-s 5```` option causes ````ifc2gltf```` to split the output into these multiple files, each no bigger than 5Gb.\n\nThe contents of the ````myGLBFiles```` directory then looks like this:\n\n````\nmyGLBFiles\n├── model.glb\n├── model.json\n├── model_1.glb\n├── model_1.json\n├── model_2.glb\n├── model_2.json\n├── model_3.glb\n├── model_3.json\n└── model.glb.manifest.json\n````\n\nNow run ````convert2xkt```` with the ````-a```` option, pointing to the ````myGLBFiles/model.glb.manifest.json```` file:\n\n````bash\nnode convert2xkt.js -a myGLBFiles/model.glb.manifest.json -o myXKTFiles -l\n````\n\nThe contents of ````myXKTFiles```` now look like this:\n\n````\nmyXKTFiles\n├── model.xkt\n├── model_1.xkt\n├── model_2.xkt\n├── model_3.xkt\n└── model.xkt.manifest.json\n````\n\nThe ````model.xkt.manifest```` file looks like this:\n\n````json\n{\n \"inputFile\": \"/absolute/path/myGLBFiles/model.glb.manifest.json\",\n \"converterApplication\": \"convert2xkt\",\n \"converterApplicationVersion\": \"v1.1.8\",\n \"conversionDate\": \"09-08-2023- 23-53-30\",\n \"outputDir\": \"/absolute/path/myXKTFiles\",\n \"xktFiles\": [\n \"model.xkt\",\n \"model_1.xkt\",\n \"model_2.xkt\",\n \"model_3.xkt\"\n ]\n}\n````\n\nWe can then load those XKT files into a xeokit Viewer, and the Viewer will automaticlly combine their geometry and metadata into the same scene. \n# Using ````XKTModel````\n\n````XKTModel```` is a JavaScript class that represents the contents of an XKT file in memory.\n\nIt's a sort of *XKT document model*, with methods to build 3D objects within it, functions to import various model\nformats, and a function to serialize it to an XKT file.\n\nWe can use these tools to:\n\n* programmatically XKT files,\n* combine multiple models into an XKT file, from different formats,\n* develop custom XKT converters, and\n* extend ````convert2xkt```` to support more formats.\n\n### Programmatically Building an XKT File\n\nTo demonstrate the API, let's\nuse [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html) 's\nbuilder methods to programmatically build a model that resembles the screenshot below. Then we'll serialize\nthe ````XKTModel```` to an\n````ArrayBuffer````, which we'll finally load that into a\nxeokit [````Viewer````](https://xeokit.github.io/xeokit-sdk/docs/class/src/viewer/Viewer.js~Viewer.html)\nusing [````XKTLoaderPlugin````](https://xeokit.github.io/xeokit-sdk/docs/class/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin.html)\n.\n\nWe'll code this example to run in the browser, using the ES module\nin [xeokit-convert.es.js](./dist/xeokit-convert.es.js). We could also code it to run on node, using the CommonJS module\nin [xeokit-convert.cjs.js](./dist/xeokit-convert.cjs.js).\n\n![XKTModel Example](http://xeokit.io/img/docs/PerformanceModel/PerformanceModel.png)\n\n````javascript\nconst {\n XKTModel,\n writeXKTModelToArrayBuffer\n} = require(\"@xeokit/xeokit-convert/dist/xeokit-convert.cjs.js\");\nconst fs = require('fs');\n\nconst xktModel = new XKTModel();\n\n// Create metamodel - this part is optional\n\n// Create property sets to hold info about the model\n\nxktModel.createPropertySet({\n propertySetId: \"tableTopPropSet\",\n propertySetType: \"Default\",\n propertySetName: \"Table Top\",\n properties: [\n {\n id: \"tableTopMaterial\",\n type: \"Default\",\n name: \"Table top material\",\n value: \"Marble\"\n },\n {\n id: \"tableTopDimensions\",\n type: \"Default\",\n name: \"Table top dimensions\",\n value: \"90x90x3 cm\"\n }\n ]\n});\n\nxktModel.createPropertySet({\n propertySetId: \"tableLegPropSet\",\n propertySetType: \"Default\",\n propertySetName: \"Table Leg\",\n properties: [\n {\n id: \"tableLegMaterial\",\n type: \"Default\",\n name: \"Table leg material\",\n value: \"Pine\"\n },\n {\n id: \"tableLegDimensions\",\n type: \"Default\",\n name: \"Table leg dimensions\",\n value: \"5x5x50 cm\"\n }\n ]\n});\n\n// Create a hierarchy of metaobjects to describe the structure of the model\n\nxktModel.createMetaObject({ // Root XKTMetaObject, has no XKTEntity\n metaObjectId: \"table\",\n metaObjectName: \"The Table\",\n metaObjectType: \"furniture\"\n});\n\nxktModel.createMetaObject({\n metaObjectId: \"redLeg\",\n metaObjectName: \"Red Table Leg\",\n metaObjectType: \"furniturePart\",\n parentMetaObjectId: \"table\",\n propertySetIds: [\"tableLegPropSet\"]\n});\n\nxktModel.createMetaObject({\n metaObjectId: \"greenLeg\",\n metaObjectName: \"Green Table Leg\",\n metaObjectType: \"furniturePart\",\n parentMetaObjectId: \"table\",\n propertySetIds: [\"tableLegPropSet\"]\n});\n\nxktModel.createMetaObject({\n metaObjectId: \"blueLeg\",\n metaObjectName: \"Blue Table Leg\",\n metaObjectType: \"furniturePart\",\n parentMetaObjectId: \"table\",\n propertySetIds: [\"tableLegPropSet\"]\n});\n\nxktModel.createMetaObject({\n metaObjectId: \"yellowLeg\",\n metaObjectName: \"Yellow Table Leg\",\n metaObjectType: \"furniturePart\",\n parentMetaObjectId: \"table\",\n propertySetIds: [\"tableLegPropSet\"]\n});\n\nxktModel.createMetaObject({\n metaObjectId: \"pinkTop\",\n metaObjectName: \"The Pink Table Top\",\n metaObjectType: \"furniturePart\",\n parentMetaObjectId: \"table\",\n propertySetIds: [\"tableTopPropSet\"]\n});\n\n// Create an XKTGeometry that defines a box shape, as a triangle mesh \n\nxktModel.createGeometry({\n geometryId: \"boxGeometry\",\n primitiveType: \"triangles\", // Also \"lines\" and \"points\"\n positions: [\n 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1,\n -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1,\n -1, -1, -1, -1, -1, 1, -1, 1, 1, -1\n ],\n normals: [ // Only for \"triangles\"\n 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0,\n -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0,\n -1, 0, 0, -1\n ],\n indices: [\n 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 12, 13, 14, 12, 14, 15, 16, 17, 18, 16, 18, 19,\n 20, 21, 22, 20, 22, 23\n ]\n});\n\n// Create five XKTMeshes, which represent the table top and legs.\n// Each XKTMesh has its own color, position, orientation and size, \n// and uses the XKTGeometry to define its shape. \n// An XKTGeometry can be used by multiple XKTMeshes.\n\nxktModel.createMesh({\n meshId: \"redLegMesh\",\n geometryId: \"boxGeometry\",\n position: [-4, -6, -4],\n scale: [1, 3, 1],\n rotation: [0, 0, 0],\n color: [1, 0, 0],\n opacity: 1\n});\n\nxktModel.createMesh({\n meshId: \"greenLegMesh\",\n geometryId: \"boxGeometry\",\n position: [4, -6, -4],\n scale: [1, 3, 1],\n rotation: [0, 0, 0],\n color: [0, 1, 0],\n opacity: 1\n});\n\nxktModel.createMesh({\n meshId: \"blueLegMesh\",\n geometryId: \"boxGeometry\",\n position: [4, -6, 4],\n scale: [1, 3, 1],\n rotation: [0, 0, 0],\n color: [0, 0, 1],\n opacity: 1\n});\n\nxktModel.createMesh({\n meshId: \"yellowLegMesh\",\n geometryId: \"boxGeometry\",\n position: [-4, -6, 4],\n scale: [1, 3, 1],\n rotation: [0, 0, 0],\n color: [1, 1, 0],\n opacity: 1\n});\n\nxktModel.createMesh({\n meshId: \"pinkTopMesh\",\n geometryId: \"boxGeometry\",\n position: [0, -3, 0],\n scale: [6, 0.5, 6],\n rotation: [0, 0, 0],\n color: [1, 0, 1],\n opacity: 1\n});\n\n// Create five XKTEntities, which represent abstract, named objects in the model. \n// Each XKTEntity has an XKTMesh.\n// An XKTEntity can have multiple XKTMeshes. \n// An XKTMesh can only belong to one XKTEntity.\n\nxktModel.createEntity({\n entityId: \"redLeg\",\n meshIds: [\"redLegMesh\"]\n});\n\nxktModel.createEntity({\n entityId: \"greenLeg\",\n meshIds: [\"greenLegMesh\"]\n});\n\nxktModel.createEntity({\n entityId: \"blueLeg\",\n meshIds: [\"blueLegMesh\"]\n});\n\nxktModel.createEntity({\n entityId: \"yellowLeg\",\n meshIds: [\"yellowLegMesh\"]\n});\n\nxktModel.createEntity({\n entityId: \"pinkTop\",\n meshIds: [\"pinkTopMesh\"]\n});\n````\n\nOnce we've built\nour [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html), we\nneed to finalize it. Then it's ready to use. Note that finalizing is an asynhronous operation, so we await its\ncompletion before continuing.\n\n````javascript\nawait xktModel.finalize();\n````\n\n### Serializing the XKTModel to an ArrayBuffer\n\nNext, we'll\nuse [````writeXKTModelToArrayBuffer````](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-writeXKTModelToArrayBuffer)\nto serialize\nour [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html) to\nan ````ArrayBuffer````.\n\n````javascript\nconst xktArrayBuffer = writeXKTModelToArrayBuffer(xktModel);\n\nfs.writeFileSync(\"./myModel.xkt\", xktArrayBuffer);\n````\n\n### Loading the ArrayBuffer into a Viewer\n\nLet's now create a [````Viewer````](https://xeokit.github.io/xeokit-sdk/docs/class/src/viewer/Viewer.js~Viewer.html),\nthen load the ````ArrayBuffer```` into it using\nan [````XKTLoaderPlugin````](https://xeokit.github.io/xeokit-sdk/docs/class/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin.html)\n.\n\n````javascript\nconst viewer = new Viewer({\n canvasId: \"myCanvas\"\n});\n\nconst xktLoader = new XKTLoaderPlugin(viewer);\n\nconst model = xktLoader.load({\n id: \"myModel\",\n src: \"./myModel.xkt\"\n});\n````\n\nFinally, when the model has loaded, let's fit it in view.\n\n````javascript\nmodel.on(\"loaded\", () => {\n viewer.cameraFlight.flyTo(model);\n});\n````\n\n### Loading IFC into an XKTModel\n\nLet's\nuse [````parseIFCIntoXKTModel````](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-parseIFCIntoXKTModel)\nto import IFC into\nan [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html).\n\nAs before, we'll also use the classes and functions introduced in the previous examples to serialize\nthe [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html) to\nan ````ArrayBuffer````, then load it into\na [````Viewer````](https://xeokit.github.io/xeokit-sdk/docs/class/src/viewer/Viewer.js~Viewer.html).\n\n````javascript\nconst viewer = new Viewer({\n canvasId: \"myCanvas\"\n});\n\nconst xktLoader = new XKTLoaderPlugin(viewer);\n\nutils.loadArraybuffer(\"./assets/models/ifc/rac_advanced_sample_project.ifc\", async (data) => {\n\n const xktModel = new XKTModel();\n\n parseIFCIntoXKTModel({data, xktModel, wasmPath: \"../dist/\"}).then(() => {\n\n xktModel.finalize().then(() => {\n\n const xktArrayBuffer = writeXKTModelToArrayBuffer(xktModel);\n\n xktLoader.load({\n id: \"myModel\",\n xkt: xktArrayBuffer,\n edges: true\n });\n\n viewer.cameraFlight.flyTo(viewer.scene);\n });\n });\n },\n (errMsg) => {\n });\n````\n\n### Loading LAS into an XKTModel\n\nLet's\nuse [````parseLASIntoXKTModel````](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-parseLASIntoXKTModel)\nto import LAS into\nan [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html).\n\nAs before, we'll also use the classes and functions introduced in the previous examples to serialize\nthe [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html) to\nan ````ArrayBuffer````, then load it into\na [````Viewer````](https://xeokit.github.io/xeokit-sdk/docs/class/src/viewer/Viewer.js~Viewer.html).\n\n````javascript\nconst viewer = new Viewer({\n canvasId: \"myCanvas\"\n});\n\nconst xktLoader = new XKTLoaderPlugin(viewer);\n\nutils.loadArraybuffer(\"./assets/models/laz/indoor.0.1.laz\", async (data) => {\n\n const xktModel = new XKTModel();\n\n parseLASIntoXKTModel({data, xktModel, rotateX: true}).then(() => {\n\n xktModel.finalize().then(() => {\n\n const xktArrayBuffer = writeXKTModelToArrayBuffer(xktModel);\n\n xktLoader.load({\n id: \"myModel\",\n xkt: xktArrayBuffer,\n edges: true\n });\n\n viewer.cameraFlight.flyTo(viewer.scene);\n });\n });\n },\n (errMsg) => {\n });\n````\n\n### Loading glTF into an XKTModel\n\nLet's\nuse [````parseGLTFIntoXKTModel````](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-parseGLTFIntoXKTModel)\nto import glTF into\nan [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html).\n\nWe'll also use the classes and functions introduced in the previous examples to serialize\nthe [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html) to\nan ````ArrayBuffer````, then validate the ````ArrayBuffer```` and load it into\na [````Viewer````](https://xeokit.github.io/xeokit-sdk/docs/class/src/viewer/Viewer.js~Viewer.html).\n\n````javascript\nconst viewer = new Viewer({\n canvasId: \"myCanvas\"\n});\n\nconst xktLoader = new XKTLoaderPlugin(viewer);\n\nutils.loadArraybuffer(\"./assets/models/gltf/MAP/glTF-Embedded/MAP.gltf\", (gltf) => {\n\n const xktModel = new XKTModel();\n\n parseGLTFIntoXKTModel({data: gltf, xktModel: xktModel}).then(() => {\n\n xktModel.finalize().then(() => {\n\n const xktArrayBuffer = writeXKTModelToArrayBuffer(xktModel);\n\n xktLoader.load({\n id: \"myModel\",\n xkt: xktArrayBuffer\n });\n\n viewer.cameraFlight.flyTo(viewer.scene);\n });\n });\n },\n (errMsg) => {\n });\n````\n\n### Loading STL into an XKTModel\n\nLet's\nuse [````parseSTLIntoXKTModel````](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-parseSTLIntoXKTModel)\nto import STL into\nan [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html).\n\nAs before, we'll also use the classes and functions introduced in the previous examples to serialize\nthe [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html) to\nan ````ArrayBuffer````, then load it into\na [````Viewer````](https://xeokit.github.io/xeokit-sdk/docs/class/src/viewer/Viewer.js~Viewer.html).\n\n````javascript\nconst viewer = new Viewer({\n canvasId: \"myCanvas\"\n});\n\nconst xktLoader = new XKTLoaderPlugin(viewer);\n\nutils.loadArraybuffer(\"./assets/models/stl/binary/spurGear.stl\", (json) => {\n\n const xktModel = new XKTModel();\n\n parseSTLIntoXKTModel({stlData: json, xktModel: xktModel}).then(() => {\n\n xktModel.finalize().then(() => {\n\n const xktArrayBuffer = writeXKTModelToArrayBuffer(xktModel);\n\n xktLoader.load({\n id: \"myModel\",\n xkt: xktArrayBuffer\n });\n\n viewer.cameraFlight.flyTo(viewer.scene);\n });\n });\n },\n (errMsg) => {\n });\n````\n\n# Building\n\n### Building Binaries\n\nBuilding the binaries in [````./dist````](https://github.com/xeokit/xeokit-convert/tree/main/dist):\n\n````bash\nnpm update\nnpm run build\n````\n\nThis will build:\n\n* [./dist/convert2xkt.cjs.js](./dist/convert2xkt.cjs.js) - Nodejs CLI converter tool\n* [./dist/xeokit-convert.cjs.js](./dist/xeokit-convert.cjs.js) - CommonJS module library of XKT classes and functions\n* [./dist/xeokit-convert.es.js](./dist/xeokit-convert.es.js) - ES module library of XKT classes and functions\n* [./dist/web-ifc.wasm](./dist/web-ifc.wasm) - 3rd-party web-ifc WASM module\n\nBuilding the JavaScript API documentation in [````./docs````](https://xeokit.github.io/xeokit-convert/docs):\n\n````bash\nnpm run docs\n````\n\n### RuntimeError: memory access out of bounds\n\nWith luck, the WASM module already be compiled appropriately for your target x86 system.\n\nHowever, if you get this error:\n\n````bash\nRuntimeError: memory access out of bounds\n````\n\nthen you will need to compile that WASM module for your target system. Please follow the instructions for that on the\n[web-ifc](https://github.com/tomvandig/web-ifc) project page, then replace [./dist/web-ifc.wasm](./dist/web-ifc.wasm)\nwith your compiled binary.\n\n### TypeError: fetch failed\n\nThis error is possible in in nodejs version 17+. As fix you will have to add the --no-experimental-fetch flag to the command.\n````bash\nnode --no-experimental-fetch convert2xkt.js ...\n````\n",
+ "content": "# xeokit-convert\n\n[![Twitter Follow](https://img.shields.io/twitter/follow/xeolabs?style=social)](https://twitter.com/xeolabs)\n[![npm version](https://badge.fury.io/js/%40xeokit%2Fxeokit-convert.svg)](https://badge.fury.io/js/%40xeokit%2Fxeokit-convert)\n\nUse **xeokit-convert** to:\n\n* Convert BIM and AEC models directly into XKT files for super fast loading into [xeokit](https://xeokit.io)\n* Generate XKT files with JavaScript\n\n> xeokit-convert replaces [xeokit-gltf-to-xkt](https://github.com/xeokit/xeokit-gltf-to-xkt) and [xeokit-xkt-utils](https://github.com/xeokit/xeokit-xkt-utils), which are deprecated.\n\n> CAUTION: Direct IFC conversion is an alpha status feature, since it depends on [web-ifc](https://github.com/tomvandig/web-ifc), a 3rd-party library, which is also alpha at this time. As such, some IFC models may not convert properly. If this is the case for your models, consider using our [standard conversion setup](https://www.notion.so/xeokit/Converting-IFC-Models-using-3rd-Party-Open-Source-Tools-c373e48bc4094ff5b6e5c5700ff580ee)\nuntil issues have been resolved. Also, direct IFC conversion does not currently support all property sets.\n\n---\n\n# Contents\n\n- [Introduction](#introduction)\n- [Acknowledgements](#acknowledgements)\n- [Resources](#resources)\n- [Features](#features)\n- [Installing](#installing)\n- [Components](#components)\n- [Using ````convert2xkt````](#using-----convert2xkt----)\n + [Converting an IFC file into an XKT file on the command line](#converting-an-ifc-file-into-an-xkt-file-on-the-command-line)\n + [Viewing the XKT file with xeokit](#viewing-the-xkt-file-with-xeokit)\n + [Querying the XKT version in Node.js](#querying-the-xkt-version-in-nodejs)\n + [Converting an IFC file into an XKT file in Node.js](#converting-an-ifc-file-into-an-xkt-file-in-nodejs)\n + [Converting IFC file data into XKT data in Node.js](#converting-ifc-file-data-into-xkt-data-in-nodejs)\n- [Converting Split Files Output from ````ifc2gltf````](#converting-split-files-from-ifc2gltf)\n- [Using ````XKTModel````](#using-----xktmodel----)\n + [Programmatically Building an XKT File](#programmatically-building-an-xkt-file)\n + [Serializing the XKTModel to an ArrayBuffer](#serializing-the-xktmodel-to-an-arraybuffer)\n + [Loading the ArrayBuffer into a Viewer](#loading-the-arraybuffer-into-a-viewer)\n + [Loading IFC into an XKTModel](#loading-ifc-into-an-xktmodel)\n + [Loading LAS into an XKTModel](#loading-las-into-an-xktmodel)\n + [Loading GLB into an XKTModel](#loading-glb-into-an-xktmodel)\n + [Loading STL into an XKTModel](#loading-stl-into-an-xktmodel)\n- [Building](#building)\n + [Building Binaries](#building-binaries)\n\n---\n\n# Introduction\n\n[````xeokit-convert````](https://github.com/xeokit/xeokit-convert) provides the means to convert 3D BIM and AEC models\ninto XKT files for super fast loading into [xeokit](https://xeokit.io), along with programming tools to generate XKT\nfiles with JavaScript on Node.js.\n\nThe [XKT format](https://github.com/xeokit/xeokit-convert/tree/master/specs) compresses large double-precision models to\na compact payload that loads quickly over the Web into a xeokit viewer running in the browser. We can use xeokit-convert\nto convert several source formats into XKT, such as IFC, GLB and CityJSON.\n\n# Acknowledgements\n\nOur thanks to the authors of these open source libraries, which we use internally within ````xeokit-convert````:\n\n* [loaders.gl](https://loaders.gl) - Copyright (C) 2015 Uber Technologies,\n Inc. ([MIT License](http://www.opensource.org/licenses/mit-license.php))\n* [Basis Universal](https://github.com/BinomialLLC/basis_universal) - Binomal\n LLC, ([Apache 2 License](http://www.apache.org/licenses/LICENSE-2.0))\n* [Pako](https://github.com/nodeca/pako) - Copyright (C) 2014-2017 by Vitaly Puzrin and Andrei\n Tuputcyn ([MIT License](http://www.opensource.org/licenses/mit-license.php))\n* [earcut](https://github.com/mapbox/earcut) - Copyright (C) 2016,\n Mapbox ([ISC License](https://opensource.org/licenses/ISC))\n* [web-ifc](https://github.com/tomvandig/web-ifc) - Copyright (C) 2020-2021 web-ifc\n contributors ([Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/))\n\n# Resources\n\n* [npm](https://www.npmjs.com/package/@xeokit/xeokit-convert)\n* [API Docs](https://xeokit.github.io/xeokit-convert/docs)\n* [Source Code](https://github.com/xeokit/xeokit-convert)\n* [Releases / Changelog](https://github.com/xeokit/xeokit-convert/releases)\n* [XKT Specifications](https://xeokit.github.io/xeokit-convert/specs/)\n\n# Features\n\n* A Node-based CLI tool to convert various 3D model formats to XKT files.\n* A JavaScript toolkit of components for loading, generating and saving XKT files.\n\n# Installing\n\nListed below these are the steps for installing and running `convert2xkt` on Linux. Make sure you have first installed \n`git` and that your version of `NodeJS` is at least `v16.10.0.`\n\n````bash\ngit clone https://github.com/xeokit/xeokit-convert.git\ncd xeokit-convert/\nnpm install\nnode convert2xkt.js -h\n\nUsage: convert2xkt [options]\n\nOptions:\n-v, --version output the version number\n-c, --configs [file] optional path to JSON configs file; overrides convert2xkt.conf.js\n-s, --source [file] path to source file\n-a, --sourcemanifest [file] path to source manifest file (for converting split file output from ifcgltf -s)\n-f, --format [string] source file format (optional); supported formats are glb, ifc, laz, las, pcd, ply, stl and cityjson\n-m, --metamodel [file] path to source metamodel JSON file (optional)\n-i, --include [types] only convert these types (optional)\n-x, --exclude [types] never convert these types (optional)\n-r, --rotatex rotate model 90 degrees about X axis (for las and cityjson)\n-g, --disablegeoreuse disable geometry reuse (optional)\n-z, --minTileSize [number] minimum diagonal tile size (optional, default 500)\n-t, --disabletextures ignore textures (optional)\n-n, --disablenormals ignore normals (optional)\n-o, --output [file] path to target .xkt file when -s option given, or JSON manifest for multiple .xkt files when source manifest\nfile given with -a; creates directories on path automatically if not existing\n-l, --log enable logging (optional)\n-h, --help display help for command\n````\n\nIf you get ````RuntimeError: memory access out of bounds```` while converting IFC, then you'll need to compile the\n3rd-party web-ifc WASM module for your system - see [Building Binaries](#building-binaries).\n\n# Components\n\nThe table below lists the components provided by ````xeokit-convert````.\n\nAt the center of the toolkit, we've got the converter tool, provided as both a Node.js function and CLI executable.\n\nBundled with the converter, we've got the XKT document model, a bunch of loaders for different formats, and a function\nto serialize the document model to a BLOB. We use these components within the converter tool, and also provide them as\npart of the public API for extensibility.\n\n| Component | Description |\n| --- |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [convert2xkt](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-convert2xkt) (function)
[convert2xkt](https://github.com/xeokit/xeokit-convert/blob/master/convert2xkt.js) (Node script)| A Node-based JavaScript function and CLI tool that converts various AEC model formats into xeokit's native, super-fast-loading XKT format. |\n| [XKTModel](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html) | A JavaScript document model that represents the contents of an XKT file in memory. Using this, we can programmatically build a document model in JavaScript, adding geometries, materials, objects etc, then serialize it to an XKT file. |\n| [parseIFCIntoXKTModel](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-parseIFCIntoXKTModel) | Parses IFC data into an ````XKTModel````. This is an alpha-status feature. |\n| [parseGLTFIntoXKTModel](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-parseGLTFIntoXKTModel) | Parses GLB into an ````XKTModel````. Supports textures. |\n| [parseCityJSONIntoXKTModel](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-parseJSONIntoXKTModel) | Parses CityJSON into an ````XKTModel```` |\n| [parseLASIntoXKTModel](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-parseLASIntoXKTModel) | Parses LAS and LAZ into an ````XKTModel```` |\n| [parseSTLIntoXKTModel](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-parseSTLIntoXKTModel) | Parses STL into an ````XKTModel```` |\n| [writeXKTModelToArrayBuffer](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-writeXKTModelToArrayBuffer) | Serializes an ````XKTModel```` to an XKT file |\n\n# Using ````convert2xkt````\n\nThe ````convert2xkt```` tool converts various model formats into xeokit's native XKT format, which is designed to load\nsuper fast over the Web into a xeokit viewer. We provide this tool as both a [CLI script]() and as\na [function](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-convert2xkt) to use within\nour own Node scripts.\n\n````bash\nnode convert2xkt.js -h\n\nUsage: convert2xkt [options]\n\nOptions:\n -v, --version output the version number\n -s, --source [file] path to source file\n -a, --sourcemanifest [file] path to source manifest file (for converting split file output from ifcgltf -s)\n -f, --format [string] source file format (optional); supported formats are glb, ifc, laz, las, pcd, ply, stl and cityjson\n -m, --metamodel [file] path to source metamodel JSON file (optional)\n -i, --include [types] only convert these types (optional)\n -x, --exclude [types] never convert these types (optional)\n -r, --rotatex rotate model 90 degrees about X axis (for las and cityjson)\n -g, --disablegeoreuse disable geometry reuse (optional)\n -z, --mintilesize [number] minimum diagonal tile size (optional, default 500)\n -t, --disabletextures ignore textures (optional)\n -n, --disablenormals ignore normals (optional)\n -o, --output [file] path to target .xkt file when -s option given, or JSON manifest for multiple .xkt files when source manifest file given with -a; creates directories on path automatically if not existing\n -l, --log enable logging (optional)\n -h, --help display help for command\n\nXKT version: 10\n````\n\n### Converting an IFC file into an XKT file on the command line\n\nLet's use the [convert2xkt](https://github.com/xeokit/xeokit-convert/blob/master/convert2xkt.js) Node script to convert\nan IFC file to XKT on the command line.\n\n````bash\nnode convert2xkt.js -s rme_advanced_sample_project.ifc -o rme_advanced_sample_project.ifc.xkt -l\n\n[convert2xkt] Reading input file: rme_advanced_sample_project.ifc\n[convert2xkt] Input file size: 35309.94 kB\n[convert2xkt] Geometry reuse is enabled\n[convert2xkt] Converting...\n[convert2xkt] Converted to: XKT v9\n[convert2xkt] XKT size: 1632.98 kB\n[convert2xkt] Compression ratio: 21.62\n[convert2xkt] Conversion time: 54.41 s\n[convert2xkt] Converted metaobjects: 0\n[convert2xkt] Converted property sets: 0\n[convert2xkt] Converted drawable objects: 1986\n[convert2xkt] Converted geometries: 3897\n[convert2xkt] Converted triangles: 286076\n[convert2xkt] Converted vertices: 547740\n[convert2xkt] reuseGeometries: false\n[convert2xkt] minTileSize: 10000\n[convert2xkt] Writing XKT file: rme_advanced_sample_project.ifc.xkt\n````\n\n### Viewing the XKT file with xeokit\n\nNow that we've got an XKT file, we can now view it in the browser using a\nxeokit [Viewer](https://xeokit.github.io/xeokit-sdk/docs/class/src/viewer/Viewer.js~Viewer.html) configured with\nan [XKTLoaderPlugin](https://xeokit.github.io/xeokit-sdk/docs/class/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin.html)\n.\n\n````javascript\nimport {Viewer, XKTLoaderPlugin} from\n \"https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk@1/dist/xeokit-sdk.es.min.js\";\n\nconst viewer = new Viewer({\n canvasId: \"myCanvas\"\n});\n\nconst xktLoader = new XKTLoaderPlugin(viewer);\n\nconst modelNode = xktLoader.load({\n id: \"myModel\",\n src: \"./rme_sample_project.ifc.xkt\"\n});\n````\n\n### Querying the XKT version in Node.js\n\nFrom with a Node script, we can query which XKT version ````xeokit-convert```` currently generates:\n\n````javascript\nconst {XKT_INFO} = require(\"./dist/xeokit-convert.cjs.js\");\n\nconst xktVersion = XKT_INFO.xktVersion; // Unsigned integer\nconsole.log(`XKT version: ${xktVersion}`);\n````\n\n### Converting an IFC file into an XKT file in Node.js\n\nWe can use\nthe [convert2xkt](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-convert2xkt)\nfunction from within our Nodejs scripts to programmatically convert files to XKT.\n\n````javascript\nconst convert2xkt = require(\"@xeokit/xeokit-convert/dist/convert2xkt.cjs.js\");\n\nconvert2xkt({\n source: \"rme_advanced_sample_project.ifc\",\n output: \"rme_advanced_sample_project.ifc.xkt\",\n log: (msg) => {\n console.log(msg)\n }\n}).then(() => {\n console.log(\"Converted.\");\n}, (errMsg) => {\n console.error(\"Conversion failed: \" + errMsg)\n});\n````\n\n### Converting IFC file data into XKT data in Node.js\n\nWhen using\nthe [convert2xkt](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-convert2xkt)\nfunction in our Node scripts, we can manage all file data in memory.\n\nThis is great for when we want more control over where we read and write the files.\n\n````javascript\nconst convert2xkt = require(\"@xeokit/xeokit-convert/dist/convert2xkt.cjs.js\");\nconst fs = require('fs');\n\nconvert2xkt({\n sourceData: fs.readFileSync(\"rme_advanced_sample_project.ifc\"),\n outputXKT: (xtkArrayBuffer) => {\n fs.writeFileSync(\"rme_advanced_sample_project.ifc.xkt\", xtkArrayBuffer);\n }\n}).then(() => {\n console.log(\"Converted.\");\n}, (errMsg) => {\n console.error(\"Conversion failed: \" + errMsg)\n});\n````\n\nWhen using\nthe [convert2xkt](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-convert2xkt)\nfunction in our Node scripts, we can manage all file data in memory.\n\nThis is great for when we want more control over where we read and write the files.\n\n````javascript\nconst convert2xkt = require(\"@xeokit/xeokit-convert/dist/convert2xkt.cjs.js\");\nconst fs = require('fs');\n\nconvert2xkt({\n sourceData: fs.readFileSync(\"rme_advanced_sample_project.ifc\"),\n outputXKT: (xtkArrayBuffer) => {\n fs.writeFileSync(\"rme_advanced_sample_project.ifc.xkt\", xtkArrayBuffer);\n }\n}).then(() => {\n console.log(\"Converted.\");\n}, (errMsg) => {\n console.error(\"Conversion failed: \" + errMsg)\n});\n````\n\n# Converting Split Files Output from ````ifc2gltf````\n\nThe ````ifc2gltf```` tool has the option to convert IFC files into multiple GLB and JSON metadata files. We can then use ````convert2xkt```` to convert each of these \nfiles individually. This allows us to convert a huge IFC files into several, smaller XKT files, then load \nthose XKT files individually into a xeokit Viewer.\n\n## Usage\n\nRun ````ifc2gltf```` with the ````-s```` option, to convert an IFC file into a set of multiple ````glb```` geometry and ````json```` metadata files:\n\n````\nifc2gltfcxconverter -i model.ifc -o myGLBFiles/model.glb -m myGLBFiles/model.json -s 5 -e 3\n````\n\nThe ````ifc2gltf```` ````-s 5```` option causes ````ifc2gltf```` to split the output into these multiple files, each no bigger than 5Gb.\n\nThe contents of the ````myGLBFiles```` directory then looks like this:\n\n````\nmyGLBFiles\n├── model.glb\n├── model.json\n├── model_1.glb\n├── model_1.json\n├── model_2.glb\n├── model_2.json\n├── model_3.glb\n├── model_3.json\n└── model.glb.manifest.json\n````\n\nNow run ````convert2xkt```` with the ````-a```` option, pointing to the ````myGLBFiles/model.glb.manifest.json```` file:\n\n````bash\nnode convert2xkt.js -a myGLBFiles/model.glb.manifest.json -o myXKTFiles -l\n````\n\nThe contents of ````myXKTFiles```` now look like this:\n\n````\nmyXKTFiles\n├── model.xkt\n├── model_1.xkt\n├── model_2.xkt\n├── model_3.xkt\n└── model.xkt.manifest.json\n````\n\nThe ````model.xkt.manifest```` file looks like this:\n\n````json\n{\n \"inputFile\": \"/absolute/path/myGLBFiles/model.glb.manifest.json\",\n \"converterApplication\": \"convert2xkt\",\n \"converterApplicationVersion\": \"v1.1.8\",\n \"conversionDate\": \"09-08-2023- 23-53-30\",\n \"outputDir\": \"/absolute/path/myXKTFiles\",\n \"xktFiles\": [\n \"model.xkt\",\n \"model_1.xkt\",\n \"model_2.xkt\",\n \"model_3.xkt\"\n ]\n}\n````\n\nWe can then load those XKT files into a xeokit Viewer, and the Viewer will automaticlly combine their geometry and metadata into the same scene. \n# Using ````XKTModel````\n\n````XKTModel```` is a JavaScript class that represents the contents of an XKT file in memory.\n\nIt's a sort of *XKT document model*, with methods to build 3D objects within it, functions to import various model\nformats, and a function to serialize it to an XKT file.\n\nWe can use these tools to:\n\n* programmatically XKT files,\n* combine multiple models into an XKT file, from different formats,\n* develop custom XKT converters, and\n* extend ````convert2xkt```` to support more formats.\n\n### Programmatically Building an XKT File\n\nTo demonstrate the API, let's\nuse [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html) 's\nbuilder methods to programmatically build a model that resembles the screenshot below. Then we'll serialize\nthe ````XKTModel```` to an\n````ArrayBuffer````, which we'll finally load that into a\nxeokit [````Viewer````](https://xeokit.github.io/xeokit-sdk/docs/class/src/viewer/Viewer.js~Viewer.html)\nusing [````XKTLoaderPlugin````](https://xeokit.github.io/xeokit-sdk/docs/class/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin.html)\n.\n\nWe'll code this example to run in the browser, using the ES module\nin [xeokit-convert.es.js](./dist/xeokit-convert.es.js). We could also code it to run on node, using the CommonJS module\nin [xeokit-convert.cjs.js](./dist/xeokit-convert.cjs.js).\n\n![XKTModel Example](http://xeokit.io/img/docs/PerformanceModel/PerformanceModel.png)\n\n````javascript\nconst {\n XKTModel,\n writeXKTModelToArrayBuffer\n} = require(\"@xeokit/xeokit-convert/dist/xeokit-convert.cjs.js\");\nconst fs = require('fs');\n\nconst xktModel = new XKTModel();\n\n// Create metamodel - this part is optional\n\n// Create property sets to hold info about the model\n\nxktModel.createPropertySet({\n propertySetId: \"tableTopPropSet\",\n propertySetType: \"Default\",\n propertySetName: \"Table Top\",\n properties: [\n {\n id: \"tableTopMaterial\",\n type: \"Default\",\n name: \"Table top material\",\n value: \"Marble\"\n },\n {\n id: \"tableTopDimensions\",\n type: \"Default\",\n name: \"Table top dimensions\",\n value: \"90x90x3 cm\"\n }\n ]\n});\n\nxktModel.createPropertySet({\n propertySetId: \"tableLegPropSet\",\n propertySetType: \"Default\",\n propertySetName: \"Table Leg\",\n properties: [\n {\n id: \"tableLegMaterial\",\n type: \"Default\",\n name: \"Table leg material\",\n value: \"Pine\"\n },\n {\n id: \"tableLegDimensions\",\n type: \"Default\",\n name: \"Table leg dimensions\",\n value: \"5x5x50 cm\"\n }\n ]\n});\n\n// Create a hierarchy of metaobjects to describe the structure of the model\n\nxktModel.createMetaObject({ // Root XKTMetaObject, has no XKTEntity\n metaObjectId: \"table\",\n metaObjectName: \"The Table\",\n metaObjectType: \"furniture\"\n});\n\nxktModel.createMetaObject({\n metaObjectId: \"redLeg\",\n metaObjectName: \"Red Table Leg\",\n metaObjectType: \"furniturePart\",\n parentMetaObjectId: \"table\",\n propertySetIds: [\"tableLegPropSet\"]\n});\n\nxktModel.createMetaObject({\n metaObjectId: \"greenLeg\",\n metaObjectName: \"Green Table Leg\",\n metaObjectType: \"furniturePart\",\n parentMetaObjectId: \"table\",\n propertySetIds: [\"tableLegPropSet\"]\n});\n\nxktModel.createMetaObject({\n metaObjectId: \"blueLeg\",\n metaObjectName: \"Blue Table Leg\",\n metaObjectType: \"furniturePart\",\n parentMetaObjectId: \"table\",\n propertySetIds: [\"tableLegPropSet\"]\n});\n\nxktModel.createMetaObject({\n metaObjectId: \"yellowLeg\",\n metaObjectName: \"Yellow Table Leg\",\n metaObjectType: \"furniturePart\",\n parentMetaObjectId: \"table\",\n propertySetIds: [\"tableLegPropSet\"]\n});\n\nxktModel.createMetaObject({\n metaObjectId: \"pinkTop\",\n metaObjectName: \"The Pink Table Top\",\n metaObjectType: \"furniturePart\",\n parentMetaObjectId: \"table\",\n propertySetIds: [\"tableTopPropSet\"]\n});\n\n// Create an XKTGeometry that defines a box shape, as a triangle mesh \n\nxktModel.createGeometry({\n geometryId: \"boxGeometry\",\n primitiveType: \"triangles\", // Also \"lines\" and \"points\"\n positions: [\n 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1,\n -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1,\n -1, -1, -1, -1, -1, 1, -1, 1, 1, -1\n ],\n normals: [ // Only for \"triangles\"\n 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0,\n -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0,\n -1, 0, 0, -1\n ],\n indices: [\n 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 12, 13, 14, 12, 14, 15, 16, 17, 18, 16, 18, 19,\n 20, 21, 22, 20, 22, 23\n ]\n});\n\n// Create five XKTMeshes, which represent the table top and legs.\n// Each XKTMesh has its own color, position, orientation and size, \n// and uses the XKTGeometry to define its shape. \n// An XKTGeometry can be used by multiple XKTMeshes.\n\nxktModel.createMesh({\n meshId: \"redLegMesh\",\n geometryId: \"boxGeometry\",\n position: [-4, -6, -4],\n scale: [1, 3, 1],\n rotation: [0, 0, 0],\n color: [1, 0, 0],\n opacity: 1\n});\n\nxktModel.createMesh({\n meshId: \"greenLegMesh\",\n geometryId: \"boxGeometry\",\n position: [4, -6, -4],\n scale: [1, 3, 1],\n rotation: [0, 0, 0],\n color: [0, 1, 0],\n opacity: 1\n});\n\nxktModel.createMesh({\n meshId: \"blueLegMesh\",\n geometryId: \"boxGeometry\",\n position: [4, -6, 4],\n scale: [1, 3, 1],\n rotation: [0, 0, 0],\n color: [0, 0, 1],\n opacity: 1\n});\n\nxktModel.createMesh({\n meshId: \"yellowLegMesh\",\n geometryId: \"boxGeometry\",\n position: [-4, -6, 4],\n scale: [1, 3, 1],\n rotation: [0, 0, 0],\n color: [1, 1, 0],\n opacity: 1\n});\n\nxktModel.createMesh({\n meshId: \"pinkTopMesh\",\n geometryId: \"boxGeometry\",\n position: [0, -3, 0],\n scale: [6, 0.5, 6],\n rotation: [0, 0, 0],\n color: [1, 0, 1],\n opacity: 1\n});\n\n// Create five XKTEntities, which represent abstract, named objects in the model. \n// Each XKTEntity has an XKTMesh.\n// An XKTEntity can have multiple XKTMeshes. \n// An XKTMesh can only belong to one XKTEntity.\n\nxktModel.createEntity({\n entityId: \"redLeg\",\n meshIds: [\"redLegMesh\"]\n});\n\nxktModel.createEntity({\n entityId: \"greenLeg\",\n meshIds: [\"greenLegMesh\"]\n});\n\nxktModel.createEntity({\n entityId: \"blueLeg\",\n meshIds: [\"blueLegMesh\"]\n});\n\nxktModel.createEntity({\n entityId: \"yellowLeg\",\n meshIds: [\"yellowLegMesh\"]\n});\n\nxktModel.createEntity({\n entityId: \"pinkTop\",\n meshIds: [\"pinkTopMesh\"]\n});\n````\n\nOnce we've built\nour [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html), we\nneed to finalize it. Then it's ready to use. Note that finalizing is an asynhronous operation, so we await its\ncompletion before continuing.\n\n````javascript\nawait xktModel.finalize();\n````\n\n### Serializing the XKTModel to an ArrayBuffer\n\nNext, we'll\nuse [````writeXKTModelToArrayBuffer````](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-writeXKTModelToArrayBuffer)\nto serialize\nour [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html) to\nan ````ArrayBuffer````.\n\n````javascript\nconst xktArrayBuffer = writeXKTModelToArrayBuffer(xktModel);\n\nfs.writeFileSync(\"./myModel.xkt\", xktArrayBuffer);\n````\n\n### Loading the ArrayBuffer into a Viewer\n\nLet's now create a [````Viewer````](https://xeokit.github.io/xeokit-sdk/docs/class/src/viewer/Viewer.js~Viewer.html),\nthen load the ````ArrayBuffer```` into it using\nan [````XKTLoaderPlugin````](https://xeokit.github.io/xeokit-sdk/docs/class/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin.html)\n.\n\n````javascript\nconst viewer = new Viewer({\n canvasId: \"myCanvas\"\n});\n\nconst xktLoader = new XKTLoaderPlugin(viewer);\n\nconst model = xktLoader.load({\n id: \"myModel\",\n src: \"./myModel.xkt\"\n});\n````\n\nFinally, when the model has loaded, let's fit it in view.\n\n````javascript\nmodel.on(\"loaded\", () => {\n viewer.cameraFlight.flyTo(model);\n});\n````\n\n### Loading IFC into an XKTModel\n\nLet's\nuse [````parseIFCIntoXKTModel````](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-parseIFCIntoXKTModel)\nto import IFC into\nan [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html).\n\nAs before, we'll also use the classes and functions introduced in the previous examples to serialize\nthe [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html) to\nan ````ArrayBuffer````, then load it into\na [````Viewer````](https://xeokit.github.io/xeokit-sdk/docs/class/src/viewer/Viewer.js~Viewer.html).\n\n````javascript\nconst viewer = new Viewer({\n canvasId: \"myCanvas\"\n});\n\nconst xktLoader = new XKTLoaderPlugin(viewer);\n\nutils.loadArraybuffer(\"./assets/models/ifc/rac_advanced_sample_project.ifc\", async (data) => {\n\n const xktModel = new XKTModel();\n\n parseIFCIntoXKTModel({data, xktModel, wasmPath: \"../dist/\"}).then(() => {\n\n xktModel.finalize().then(() => {\n\n const xktArrayBuffer = writeXKTModelToArrayBuffer(xktModel);\n\n xktLoader.load({\n id: \"myModel\",\n xkt: xktArrayBuffer,\n edges: true\n });\n\n viewer.cameraFlight.flyTo(viewer.scene);\n });\n });\n },\n (errMsg) => {\n });\n````\n\n### Loading LAS into an XKTModel\n\nLet's\nuse [````parseLASIntoXKTModel````](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-parseLASIntoXKTModel)\nto import LAS into\nan [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html).\n\nAs before, we'll also use the classes and functions introduced in the previous examples to serialize\nthe [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html) to\nan ````ArrayBuffer````, then load it into\na [````Viewer````](https://xeokit.github.io/xeokit-sdk/docs/class/src/viewer/Viewer.js~Viewer.html).\n\n````javascript\nconst viewer = new Viewer({\n canvasId: \"myCanvas\"\n});\n\nconst xktLoader = new XKTLoaderPlugin(viewer);\n\nutils.loadArraybuffer(\"./assets/models/laz/indoor.0.1.laz\", async (data) => {\n\n const xktModel = new XKTModel();\n\n parseLASIntoXKTModel({data, xktModel, rotateX: true}).then(() => {\n\n xktModel.finalize().then(() => {\n\n const xktArrayBuffer = writeXKTModelToArrayBuffer(xktModel);\n\n xktLoader.load({\n id: \"myModel\",\n xkt: xktArrayBuffer,\n edges: true\n });\n\n viewer.cameraFlight.flyTo(viewer.scene);\n });\n });\n },\n (errMsg) => {\n });\n````\n\n### Loading GLB into an XKTModel\n\nLet's\nuse [````parseGLTFIntoXKTModel````](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-parseGLTFIntoXKTModel)\nto import binary glTF into\nan [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html).\n\nWe'll also use the classes and functions introduced in the previous examples to serialize\nthe [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html) to\nan ````ArrayBuffer````, then validate the ````ArrayBuffer```` and load it into\na [````Viewer````](https://xeokit.github.io/xeokit-sdk/docs/class/src/viewer/Viewer.js~Viewer.html).\n\n````javascript\nconst viewer = new Viewer({\n canvasId: \"myCanvas\"\n});\n\nconst xktLoader = new XKTLoaderPlugin(viewer);\n\nutils.loadArraybuffer(\"./assets/models/glb/MAP/MAP.glb\", (glb) => {\n\n const xktModel = new XKTModel();\n\n parseGLTFIntoXKTModel({data: glb, xktModel: xktModel}).then(() => {\n\n xktModel.finalize().then(() => {\n\n const xktArrayBuffer = writeXKTModelToArrayBuffer(xktModel);\n\n xktLoader.load({\n id: \"myModel\",\n xkt: xktArrayBuffer\n });\n\n viewer.cameraFlight.flyTo(viewer.scene);\n });\n });\n },\n (errMsg) => {\n });\n````\n\n### Loading STL into an XKTModel\n\nLet's\nuse [````parseSTLIntoXKTModel````](https://xeokit.github.io/xeokit-convert/docs/function/index.html#static-function-parseSTLIntoXKTModel)\nto import STL into\nan [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html).\n\nAs before, we'll also use the classes and functions introduced in the previous examples to serialize\nthe [````XKTModel````](https://xeokit.github.io/xeokit-convert/docs/class/src/XKTModel/XKTModel.js~XKTModel.html) to\nan ````ArrayBuffer````, then load it into\na [````Viewer````](https://xeokit.github.io/xeokit-sdk/docs/class/src/viewer/Viewer.js~Viewer.html).\n\n````javascript\nconst viewer = new Viewer({\n canvasId: \"myCanvas\"\n});\n\nconst xktLoader = new XKTLoaderPlugin(viewer);\n\nutils.loadArraybuffer(\"./assets/models/stl/binary/spurGear.stl\", (json) => {\n\n const xktModel = new XKTModel();\n\n parseSTLIntoXKTModel({stlData: json, xktModel: xktModel}).then(() => {\n\n xktModel.finalize().then(() => {\n\n const xktArrayBuffer = writeXKTModelToArrayBuffer(xktModel);\n\n xktLoader.load({\n id: \"myModel\",\n xkt: xktArrayBuffer\n });\n\n viewer.cameraFlight.flyTo(viewer.scene);\n });\n });\n },\n (errMsg) => {\n });\n````\n\n# Building\n\n### Building Binaries\n\nBuilding the binaries in [````./dist````](https://github.com/xeokit/xeokit-convert/tree/main/dist):\n\n````bash\nnpm update\nnpm run build\n````\n\nThis will build:\n\n* [./dist/convert2xkt.cjs.js](./dist/convert2xkt.cjs.js) - Nodejs CLI converter tool\n* [./dist/xeokit-convert.cjs.js](./dist/xeokit-convert.cjs.js) - CommonJS module library of XKT classes and functions\n* [./dist/xeokit-convert.es.js](./dist/xeokit-convert.es.js) - ES module library of XKT classes and functions\n* [./dist/web-ifc.wasm](./dist/web-ifc.wasm) - 3rd-party web-ifc WASM module\n\nBuilding the JavaScript API documentation in [````./docs````](https://xeokit.github.io/xeokit-convert/docs):\n\n````bash\nnpm run docs\n````\n\n### RuntimeError: memory access out of bounds\n\nWith luck, the WASM module already be compiled appropriately for your target x86 system.\n\nHowever, if you get this error:\n\n````bash\nRuntimeError: memory access out of bounds\n````\n\nthen you will need to compile that WASM module for your target system. Please follow the instructions for that on the\n[web-ifc](https://github.com/tomvandig/web-ifc) project page, then replace [./dist/web-ifc.wasm](./dist/web-ifc.wasm)\nwith your compiled binary.\n\n### TypeError: fetch failed\n\nThis error is possible in in nodejs version 17+. As fix you will have to add the --no-experimental-fetch flag to the command.\n````bash\nnode --no-experimental-fetch convert2xkt.js ...\n````\n",
"longname": "/home/lindsay/xeolabs/xeokit-convert-mar14/README.md",
"name": "./README.md",
"static": true,
@@ -14242,7 +14242,7 @@
},
{
"kind": "packageJSON",
- "content": "{\n \"name\": \"@xeokit/xeokit-convert\",\n \"version\": \"1.1.15\",\n \"description\": \"JavaScript utilities to create .XKT files\",\n \"main\": \"index.js\",\n \"bin\": \"/convert2xkt.js\",\n \"directories\": {},\n \"scripts\": {\n \"build\": \"webpack --mode=production --node-env=production --progress; rollup --config rollup.config.dist.js; rollup --config rollup.config.convert2xkt.js; rm -Rf ./docs/*; ./node_modules/.bin/esdoc\",\n \"build-node\": \"webpack --mode=production --node-env=production --progress\",\n \"build-browser\": \"rollup --config rollup.config.dist.js\",\n \"docs\": \"rm -Rf ./docs/*; ./node_modules/.bin/esdoc\",\n \"publish\": \"npm publish --access public\",\n \"changelog\": \"auto-changelog --commit-limit false --package --template changelog-template.hbs\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/xeokit/xeokit-convert.git\"\n },\n \"keywords\": [\n \"xeolabs\",\n \"xeokit\",\n \"bim\",\n \"opensource\",\n \"ifc\",\n \"webgl\",\n \"xkt\",\n \"gltf\",\n \"glb\",\n \"cityjson\",\n \"laz\",\n \"gis\"\n ],\n \"author\": \"Lindsay Kay\",\n \"license\": \"LICENSE\",\n \"bugs\": {\n \"url\": \"https://github.com/xeokit/xeokit-convert/issues\"\n },\n \"homepage\": \"https://github.com/xeokit/xeokit-convert#readme\",\n \"dependencies\": {\n \"@loaders.gl/core\": \"^3.2.6\",\n \"@loaders.gl/gltf\": \"^3.2.6\",\n \"@loaders.gl/images\": \"^3.2.6\",\n \"@loaders.gl/json\": \"^3.2.6\",\n \"@loaders.gl/las\": \"^3.2.6\",\n \"@loaders.gl/obj\": \"^3.2.6\",\n \"@loaders.gl/ply\": \"^3.2.6\",\n \"@loaders.gl/polyfills\": \"^3.2.6\",\n \"@loaders.gl/textures\": \"^3.2.6\",\n \"@typeonly/validator\": \"^0.5.2\",\n \"commander\": \"^11.0.0\",\n \"core-js\": \"^3.22.5\",\n \"fs\": \"0.0.1-security\",\n \"pako\": \"^2.0.4\",\n \"path\": \"^0.12.7\",\n \"web-ifc\": \"0.0.40\"\n },\n \"devDependencies\": {\n \"@babel/core\": \"^7.17.10\",\n \"@babel/plugin-external-helpers\": \"^7.17.12\",\n \"@babel/preset-env\": \"^7.17.12\",\n \"@rollup/plugin-alias\": \"^3.1.9\",\n \"@rollup/plugin-commonjs\": \"^21.1.0\",\n \"@rollup/plugin-node-resolve\": \"^13.2.1\",\n \"@xeokit/xeokit-sdk\": \"^2.3.0\",\n \"babel-loader\": \"^8.2.5\",\n \"copy-webpack-plugin\": \"^11.0.0\",\n \"esdoc\": \"^1.1.0\",\n \"esdoc-node\": \"^1.0.5\",\n \"esdoc-standard-plugin\": \"^1.0.0\",\n \"http-server\": \"^14.1.0\",\n \"npm-upgrade\": \"^3.1.0\",\n \"rimraf\": \"^3.0.2\",\n \"rollup\": \"^2.70.2\",\n \"rollup-plugin-copy\": \"^3.4.0\",\n \"rollup-plugin-minify-es\": \"^1.1.1\",\n \"typeonly\": \"^0.4.6\",\n \"webpack\": \"^5.72.1\",\n \"webpack-cli\": \"^4.9.2\",\n \"webpack-node-externals\": \"^3.0.0\",\n \"auto-changelog\": \"^2.4.0\"\n },\n \"files\": [\n \"/dist\",\n \"/convert2xkt.js\",\n \"/convert2xkt.conf.js\"\n ]\n}\n",
+ "content": "{\n \"name\": \"@xeokit/xeokit-convert\",\n \"version\": \"1.1.16\",\n \"description\": \"JavaScript utilities to create .XKT files\",\n \"main\": \"index.js\",\n \"bin\": \"/convert2xkt.js\",\n \"directories\": {},\n \"scripts\": {\n \"build\": \"webpack --mode=production --node-env=production --progress; rollup --config rollup.config.dist.js; rollup --config rollup.config.convert2xkt.js; rm -Rf ./docs/*; ./node_modules/.bin/esdoc\",\n \"build-node\": \"webpack --mode=production --node-env=production --progress\",\n \"build-browser\": \"rollup --config rollup.config.dist.js\",\n \"docs\": \"rm -Rf ./docs/*; ./node_modules/.bin/esdoc\",\n \"publish\": \"npm publish --access public\",\n \"changelog\": \"auto-changelog --commit-limit false --package --template changelog-template.hbs\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/xeokit/xeokit-convert.git\"\n },\n \"keywords\": [\n \"xeolabs\",\n \"xeokit\",\n \"bim\",\n \"opensource\",\n \"ifc\",\n \"webgl\",\n \"xkt\",\n \"gltf\",\n \"glb\",\n \"cityjson\",\n \"laz\",\n \"gis\"\n ],\n \"author\": \"Lindsay Kay\",\n \"license\": \"LICENSE\",\n \"bugs\": {\n \"url\": \"https://github.com/xeokit/xeokit-convert/issues\"\n },\n \"homepage\": \"https://github.com/xeokit/xeokit-convert#readme\",\n \"dependencies\": {\n \"@loaders.gl/core\": \"^3.2.6\",\n \"@loaders.gl/gltf\": \"^3.2.6\",\n \"@loaders.gl/images\": \"^3.2.6\",\n \"@loaders.gl/json\": \"^3.2.6\",\n \"@loaders.gl/las\": \"^3.2.6\",\n \"@loaders.gl/obj\": \"^3.2.6\",\n \"@loaders.gl/ply\": \"^3.2.6\",\n \"@loaders.gl/polyfills\": \"^3.2.6\",\n \"@loaders.gl/textures\": \"^3.2.6\",\n \"@typeonly/validator\": \"^0.5.2\",\n \"commander\": \"^11.0.0\",\n \"core-js\": \"^3.22.5\",\n \"fs\": \"0.0.1-security\",\n \"pako\": \"^2.0.4\",\n \"path\": \"^0.12.7\",\n \"web-ifc\": \"0.0.40\"\n },\n \"devDependencies\": {\n \"@babel/core\": \"^7.17.10\",\n \"@babel/plugin-external-helpers\": \"^7.17.12\",\n \"@babel/preset-env\": \"^7.17.12\",\n \"@rollup/plugin-alias\": \"^3.1.9\",\n \"@rollup/plugin-commonjs\": \"^21.1.0\",\n \"@rollup/plugin-node-resolve\": \"^13.2.1\",\n \"@xeokit/xeokit-sdk\": \"^2.3.0\",\n \"babel-loader\": \"^8.2.5\",\n \"copy-webpack-plugin\": \"^11.0.0\",\n \"esdoc\": \"^1.1.0\",\n \"esdoc-node\": \"^1.0.5\",\n \"esdoc-standard-plugin\": \"^1.0.0\",\n \"http-server\": \"^14.1.0\",\n \"npm-upgrade\": \"^3.1.0\",\n \"rimraf\": \"^3.0.2\",\n \"rollup\": \"^2.70.2\",\n \"rollup-plugin-copy\": \"^3.4.0\",\n \"rollup-plugin-minify-es\": \"^1.1.1\",\n \"typeonly\": \"^0.4.6\",\n \"webpack\": \"^5.72.1\",\n \"webpack-cli\": \"^4.9.2\",\n \"webpack-node-externals\": \"^3.0.0\",\n \"auto-changelog\": \"^2.4.0\"\n },\n \"files\": [\n \"/dist\",\n \"/convert2xkt.js\",\n \"/convert2xkt.conf.js\"\n ]\n}\n",
"longname": "/home/lindsay/xeolabs/xeokit-convert-mar14/package.json",
"name": "package.json",
"static": true,