Introduction to the Web IFC Project
Web IFC is an innovative JavaScript library designed to facilitate the reading and writing of IFC files at native speeds. Part of the ambitious That Open Company project, Web IFC aims to simplify the development of open Building Information Modeling (BIM) applications, breaking down the barriers for developers in this space.
Getting Started
To begin utilizing Web IFC, developers can easily install the library using npm with the command:
npm install web-ifc
After installation, developers can incorporate Web IFC into their projects by setting up the API, opening models, and accessing geometry or properties. An example setup involves initializing the library, opening a model from data, and eventually closing the model to free memory.
const WebIFC = require("web-ifc/web-ifc-api.js");
// Initialize the API
const ifcApi = new WebIFC.IfcAPI();
// Initialize the library
await ifcApi.Init();
// Open a model from data
let modelID = ifcApi.OpenModel(/* IFC data as a string or UInt8Array */, /* optional settings object */);
// Use modelID to fetch geometry or properties
// Close the model, freeing up memory
ifcApi.CloseModel(modelID);
For more details on using Web IFC, developers can explore various examples provided in the documentation.
Live Builds and Updates
The most recent build of Web IFC is readily accessible, allowing users to test the newest enhancements before official release. To use this version, users can download the required files and replace them in the appropriate directory within their project setup. This ensures developers are working with the latest features and fixes.
Technical Requirements
For those interested in building their own version of Web IFC, certain software prerequisites are necessary:
- Node.js version 16 or later
- NPM version 7 or later
- EMSCRIPTEN version 3.1.44 or later
- CMAKE version 3.18 or later
Regression Testing
Web IFC provides a comprehensive suite of regression tests designed to verify model consistency. Developers can contribute to this testing library or run their models to ensure reliability within their projects. Commands like npm run regression
allow for seamless testing, alerting developers to any changes in model geometry.
Building the WASM Module
The Web IFC library is primarily built through WebAssembly, offering both browser and Node.js compatibility. To set up for development, developers must install EMSCRIPTEN, CMAKE, and on Windows, MINGW. The setup process involves configuring the environment and compiling the WASM binary for different operational contexts, enabling efficient execution on both web and server environments.
Files produced from the build process include various WASM binaries, JavaScript wrappers, and TypeScript definitions. These outputs facilitate integration and development within diverse project structures leveraging Web IFC.
C++ Standalone Usage
Besides its main focus on WebAssembly, Web IFC can also operate as a standalone C++ library or executable. This flexibility allows developers to integrate C++ capabilities directly with their projects, showcased through simple entry points in the project repository.
In summary, Web IFC is a powerhouse library in the open BIM application domain. Its straightforward installation, robust feature set, and detailed documentation make it a valuable tool for developers seeking to manage IFC files effectively and efficiently.