Code Monkey home page Code Monkey logo

web-ifc's Introduction

web-ifc

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(/* placeholder filename */, /* IFC data as a string or UInt8Array */);

// the model is now loaded! use modelID to fetch geometry

// 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 init-repo to download both dependencies of the project (glm and earcut.hpp) to the correct location. This only needs to happen once.

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.

web-ifc's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.