Skip to main content

Contribute

Web-ifc guide#

👩‍💻 web-ifc is a javascript library to read and write ifc files, at native speeds. web-ifc is part of the ifc.js project, which aims to lower the threshold for developing open BIM applications.

But I know nothing about the project!#

👩‍🏫 Don't worry: if you want to participate, we will give top priority to your onboarding so that you can start using the library right away and help us with whatever you want.

Cloning the repository locally#

📁 The first thing to do is to clone the repository to your local machine.
Start by forking the project (click on fork button on the top right) and choosing yourself as the owner of the fork (if asked).
Now go to the forked repository, click on code button (generally green in color) and copy the https URL.

📦 Now open terminal on your machine and change the current working directory to the location where you want to clone the directory. Enter these commands:

//Type git clone, and then paste the URL you copied earlier like this
git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
//change the current directory and enter the cloned repository using cd, and then name of the repository like this
cd web-ifc
// Using git checkout -b will create a new branch and immediately switch to it
git checkout -b <new-branch-name>
//<new-branch-name> -> name your branch exactly same as the bounty name or the name starts with bounty ID
//Minimise this terminal instead of closing it

Setting up the project#

Build it locally#

//To install web-ifc
npm install web-ifc

Quick setup#

//Use these in your project whenever needed not in the terminal right now
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);

See examples for more details on how to use web-ifc.

Building WASM module#

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 emsdk_env needs to be in your path(environment variable).

WASM library#

🌏 Open the terminal again and run these commands:

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-all 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.

Writing code on it#

Using an IDE (Integrated Development Environment)#

📝 VS Code - You can install VS Code from here.

Compiler for code#

📚 GCC with MinGW (for windows) - You can configure GCC C++ compiler from here. Clang (for macOS) - You can configure Clang compiler from here.

☝ Although the primary focus of the library is to be used through WebAssembly in the browser/nodejs, the project can be used stand-alone as a c++ library or executable. See here for a simple entry point to get started.

Creating a submit pull request#

🔢 Open you terminal and enter these commands:

use git status to review your changes.
use git checkout master to checkout to master branch.
use git pull to sync your cloned repository with the origin repository.
use git checkout <branch-name> to go back to your working branch.
use git pull to sync with the the main branch.
use git add . to stage your changes.
use git commit -m "type a message to display for changes" to commit the changes made.
use git push to push the changes to the main repository.

Now go to your github, inside the forked version of the repository. You will see a notification on the right (if not click on pull requests) 'compare & pull request' (generally green color button), click on it. Now describe the changes you made in short and click on 'create pull request'.

How do I get started?#

😊 Talk to us! Tell us about your situation and your ideas and we will help you get started as soon as possible.