<aside> ℹ️ See also: Viewing an IFC Model with WebIFCLoaderPlugin

</aside>



Introduction

In this mini-tutorial, we'll use xeokit's convert2xkt CLI tool to convert an IFC 4.3 model into xeokit's native XKT geometry format, which we'll then view in the browser using a xeokit Viewer.

The XKT format compresses models into a compact payload from which xeokit can load large numbers of objects over the Web in seconds, at full geometric precision.

For our IFC model, we'll use an architectural model from the Revit Sample Project Files. When that's converted and loaded into our viewer, it will look like the example below.

This model contains 5512 visible objects, with 283238 triangles, and a xeokit Viewer can usually load it over a good Internet connection in ~2 seconds.

<aside> ▶️ Run this example

</aside>

68747470733a2f2f78656f6b69742e6769746875622e696f2f78656f6b69742d6966632d746f2d786b742f6173736574732f7261635f616476616e6365645f73616d706c655f70726f6a6563742e706e67.png

1. Install convert2xkt

Using git and npm, clone and install our xeokit-convert repository, which contains the convert2xkt tool that we'll use to convert our IFC into XKT.

Be sure to use the latest versions of both xeokit-convert and xeokit-sdk.

git clone <https://github.com/xeokit/xeokit-convert.git>
cd xeokit-convert
npm install

2. Convert IFC to XKT

Let's convert our IFC model.

First, we'll get the tool to print out some usage info:

node convert2xkt.js -h

Usage: convert2xkt [options]

Options:

    -v, --version            output the version number
    -s, --source [file]      path to source file
    -f, --format [string]    source file format (optional); supported formats are gltf, ifc, laz, las, pcd, ply, stl and cityjson
    -m, --metamodel [file]   path to source metamodel JSON file (optional)
    -o, --output [file]      path to target .xkt file; creates directories on path automatically if not existing
    -p, --properties [file]  path to target directory for object property files; creates directories on path automatically if not existing
    -l, --log                enable logging
    -h, --help               output usage information