Xceno / web-ifc

IFC parsing and geometry generation in WASM!

Home Page:https://tomvandig.github.io/web-ifc/examples/viewer/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

web-ifc

Build

Warning: this is pre-alpha software, an experimental backend for IFC.js

Web ifc is a WASM-based ifc parser & geometry generator. This repository contains the c++/typescript source code.

https://www.npmjs.com/package/web-ifc

Example viewer application using ThreeJS

Installing the library as an npm dependency

npm install web-ifc

Using the library

See examples for different ways to use web-ifc.

For a short intro, this is how to use the library from javascript:

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 */, );

// the model is now loaded! use modelID to fetch geometry or properties
// checkout examples/usage for some details on how to read/write IFC

// close the model, all memory is freed
ifcApi.CloseModel(modelID);

Building the library

Setting up emscripten

The WASM library is built through emscripten, please see the emscripten installation guide for information on how to set up emscripten. Afterwards both setup-env and em++ need to be in your path.

WASM library

Run npm install to install all dependencies.

Run npm run setup-env whenever you open a new terminal, this will set up the required emscripten environment variables for you to compile code.

Run npm run build-release to build a release version of the wasm binary and the accompanying web-ifc api. It will be placed in ./dist.

Run npm run dev to launch a development server with a basic ifc file viewer.

Stand alone C++ executable

Compiling the library to a standalone executable requires use of CMAKE. For visual studio code, the easiest way is by installing cmake-tools.

Using the library as a C++ dependency

The library is header only, the files in web-ifc-cpp can be trivially included in any project. The library depends on GLM and earcut.

Contributing

Want to help out? Great!

Please checkout our contribution suggestsions.

About

IFC parsing and geometry generation in WASM!

https://tomvandig.github.io/web-ifc/examples/viewer/index.html

License:Mozilla Public License 2.0


Languages

Language:C++ 50.7%Language:TypeScript 21.7%Language:JavaScript 18.4%Language:Java 3.2%Language:C 2.9%Language:Objective-C++ 1.6%Language:Python 0.8%Language:Objective-C 0.4%Language:Kotlin 0.1%Language:SourcePawn 0.1%Language:POV-Ray SDL 0.0%Language:CMake 0.0%Language:AIDL 0.0%Language:Dockerfile 0.0%