qaecy-obc-1.5.0
v0.0.3
Published
This is a library that implements [That Open Company](https://thatopen.com/)'s IFC viewing capabilities (Open BIM Components) in one web component.
Downloads
6
Readme
QAECY OBC
This is a library that implements That Open Company's IFC viewing capabilities (Open BIM Components) in one web component.
There web component supports several ways to load a model, which from slowest to fastest covers 1) raw IFC, 2) IFC converted to Fragments and 3) IFC converted to QAECY's customized Tiles implementation.
Use
npm i qaecy-obc-1.5.0
<qaecy-tile-streamer id="viewer" bucketURL="https://my-bucket/"></qaecy-tile-streamer>
NB! This is a rather large build of approximately 4.3 MB (844 KB gzipped)
Loading model data
Loading an IFC
The simplest and least performant way to load a file is from an IFC. This processes the file using the web-ifc wasm module and converts it to a ThreeJS compliant Fragments file.
The optional parameters modelUUID and idMap are necessary to fetch server data about model entities. QAECY derives the modelUUID from the IFC file content which makes it unique for every IFC and important for history tracking. The idMap maps expressIDs used internally by OBC to element UUIDs used by qaecy.
const viewer = document.getElementById("viewer");
const modelUUID = "9481b101-5a11-4d36-b8bf-710559ab64b2";
const idMap = {
"1": "29b3e491-76b9-535d-a699-af6ddc5e6d16",
"5": "ac377c7c-0e1c-5cf4-b29d-b71f9f15ed25",
"35": "761cfe32-9f76-5a7d-8c65-1e31f047caf4",
...
}
await viewer.loadIFC(new Uint8Array(ifcArrayBuffer), modelUUID, idMap);
Loading a Fragments file
This approach skips the IFC-Fragments conversion and loads the Fragments file directly.
Viewer, modelUUID and idMap are the same as when loading an IFC.
await viewer.loadFragments(new Uint8Array(fragmentsArrayBuffer), modelUUID, idMap);
Loading Tiles
The Tiles loading is the most efficient way as it only loads the parts of the model that are visible in the current view. In this approach the model data is located on a server and only the instructions on how to access them are given to the loader. The GeometryData
interface describes what these instructions contain and in QAECY's setup it's usually generated from a query on the triplestore.
await viewer.loadStream(geometryData);
Functionality
Highlighter/Selection
The default behavior is that multi selection is enabled, but highlighter can be configured, styled and disabled through settings.
When clicking an element or the canvas, the "selection-changed" event will be emitted. To listen to this event, simply use a standard JavaScript event listener:
const viewer = document.getElementById("viewer");
viewer.addEventListener('selection-change', (event) => {
console.log('Selection changed:', event.detail);
});
The data emitted reflects both the element and model UUID which means that it is possible to have multiple (historical) representations of the same element in the same viewer.