<aside> 🆕 This feature was introduced in xeokit-sdk v2.4.

</aside>

To most efficiently view IFC model files in xeokit, we first convert them to XKT files. This conversion allows for fast loading into the browser. We have extended xeokit to automatically split IFC files into multiple XKT files during conversion. This feature enables us to view even bigger models in the browser, like the 2GB Baku Stadium IFC model, shown in the screenshot above.

By splitting models during conversion, we improve xeokit's performance and stability. This is achieved by reducing the memory stress on the converter tools and the xeokit viewer components. These components perform much more reliably and faster when dealing with smaller files (e.g., 20MB) than larger files (e.g., 500MB). Larger files may cause difficulty allocating sufficient system memory for conversion and parsing.

In this tutorial, we’ll show how to use this new feature with our conversion and model viewing components. The IFC file we’ll use for this tutorial is the Karhumaki Bridge model from [<http://drumbeat.cs.hut.fi/ifc/>](<http://drumbeat.cs.hut.fi/ifc/>). It’s not exactly a huge model, but good for demonstration purposes. It does contain a lot of rebar objects though (concrete reinforcing), so nevertheless is a fairly complex model, geometrically speaking.



How Splitting Helps

Splitting prevents NodeJS from crashing

Before we dive into how to use our new model splitting feature, let's briefly examine one of the issues that splitting is designed to avoid. As described in this tutorial, we use our ifc2gltfcxconverter tool to convert IFC files into glTF geometry and JSON metadata files. We then use our [convert2xkt](<https://github.com/xeokit/xeokit-convert>) tool to convert those glTF+JSON files into XKT files for fast loading into xeokit.

However, [convert2xkt](<https://github.com/xeokit/xeokit-convert>) runs on NodeJS, which has its own limitations. Sometimes, NodeJS cannot allocate all the necessary memory, and it always has a hard 1GB limit on how much memory it can allocate for text strings in memory. When we try to process large glTF and JSON files, users often encounter the error shown below. We can avoid this error by using the splitting feature described in this tutorial.

node convert2xkt.js -s myModel.glb -m myModel.json -o myModel.xkt -l

#
# Fatal error in , line 0
# Fatal JavaScript invalid size error 169220804
#
#
#FailureMessage Object: 0x7ffd9e6d5470
1: 0xbe67b1  [node]
2: 0x1e4d6a4 V8_Fatal(char const*, ...) [node]
3: 0xf00158  [node]
4: 0x10af622  [node]
5: 0x10af8e2  [node]
6: 0x12beb8b v8::internal::Runtime_GrowArrayElements(int, unsigned long*, v8::internal::Isolate*) [node]
7: 0x16fb6f9  [node]
Trace/breakpoint trap (core dumped)

Splitting Models with ifc2gltf

We use the ifc2gltfcxconverter tool to convert IFC files into glTF geometry and JSON metadata files.

We have now extended this tool with the option to split its output into multiple files, accompanied by a JSON manifest that list them.

This new option is activated using the -s parameter.

The parameters we use in this tutorial are: