MCPcopy Index your code
hub / github.com/ThatOpen/engine_web-ifc

github.com/ThatOpen/engine_web-ifc @0.77

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.77 ↗ · + Follow
977 symbols 2,779 edges 118 files 100 documented · 10%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

TOC | web-ifc documentation | platform documentation | demo | community | npm package

cover

Web IFC

NPM Package NPM Package

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

Install

npm install web-ifc

Quick setup

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.

Current Build

The current live build of web-ifc is available here. Using this allows you to test newest fixes before we make a release. If you wish to use this version then download the zip file and place the contents of the dist folder manually into your node_modules/web-ifc folder. I.e if you are using web-ifc-three then it will be node_modules/web-ifc-three/node_modules/web-ifc. Please note you must replace the javascript and the WASM.

Requirements

These are the requirements needed to build web-ifc (only for those that wish to build their own version).

  1. Node v16 or later
  2. NPM v7 or later
  3. EMSCRIPTEN v4.0.23 or later
  4. CMAKE v3.18 or later

Regression Testing

We have a library of test models in the tests/public folder. If you have a model you would like to contribute please open a PR.

You can run regression tests on all these models by running npm run regression. It will alert you if any of the sample model geometry has changed. If the change is correct you can refresh the regression tests by running npm run regression-update.

Building WASM module

Setting up emscripten and build system

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.

To build the WASM you also need CMAKE see here and (on windows) MINGW see here - once installed (and in your path) run npm run setup-mingw to configure the environment for web-ifc.

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.

If you wish to build the WASM with debugging enabled you can run npm run build-debug. This will enable you to inspect debugging information better when running web-ifc.

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

Build Files

The output of the build process consts of the following files:

  1. web-ifc.wasm - The wasm (compiled C++) to run in the browser
  2. web-ifc-mt.wasm - The wasm (compiled C++) to run in the browser if multi-threading is supported.
  3. web-ifc-node.wasm - The wasm (compiled C++) to run in node
  4. web-ifc-api-node.js - Compiled javascript wrapper for the wasm to run in node.
  5. web-ifc-api-node.d.ts - Typescript definitions for the web-ifc api (for node)
  6. web-ifc-api.js - Compiled javascript wrapper for the wasm to run in browser.
  7. web-ifc-api.d.ts - Typescript definitions for the main web-ifc API
  8. ifc-schema.d.ts - Typescript definitions for the IFC schema
  9. helpers/properties.d.ts - Typescript definitions for the properties aspect of the web-ifc API
  10. helpers/log.d.ts - Typescript definitions for the logger aspect of the web-ifc API
  11. web-ifc-mt.worker.js - Webworker javascript to enable multi-threading in the browser.

Stand alone C++

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.

Extension points exported contracts — how you extend this code

Alignment (Interface)
(no doc) [12 implementers]
src/ts/web-ifc-api.ts
Type (Interface)
(no doc)
src/schema-generator/gen_functional_types_interfaces.ts
pt (Interface)
(no doc)
tests/functional/Columns.spec.ts
TestInfo (Interface)
(no doc)
examples/usage/src/exporting.ts
AABB (Interface)
(no doc) [12 implementers]
src/ts/web-ifc-api.ts
Prop (Interface)
(no doc)
src/schema-generator/gen_functional_types_interfaces.ts
Matchers (Interface)
(no doc)
tests/functional/Properties.spec.ts
Sweep (Interface)
(no doc) [12 implementers]
src/ts/web-ifc-api.ts

Core symbols most depended-on inside this repo

size
called by 604
src/ts/web-ifc-api.ts
MoveToArgumentOffset
called by 274
src/cpp/web-ifc/parsing/IfcLoader.cpp
GetRefArgument
called by 192
src/cpp/web-ifc/parsing/IfcLoader.cpp
GetDoubleArgument
called by 105
src/cpp/web-ifc/parsing/IfcLoader.cpp
GetTokenType
called by 99
src/cpp/web-ifc/parsing/IfcLoader.cpp
StepBack
called by 78
src/cpp/web-ifc/parsing/IfcLoader.cpp
GetPoint
called by 73
src/cpp/web-ifc/geometry/operations/bim-geometry/geometry.cpp
GetStringArgument
called by 72
src/cpp/web-ifc/parsing/IfcLoader.cpp

Shape

Method 488
Function 332
Class 109
Interface 38
Enum 10

Languages

C++73%
TypeScript27%

Modules by API surface

src/ts/web-ifc-api.ts142 symbols
src/cpp/web-ifc/geometry/operations/boolean-utils/shared-position.h65 symbols
src/cpp/wasm/web-ifc-wasm.cpp59 symbols
src/cpp/web-ifc/parsing/IfcLoader.cpp42 symbols
src/cpp/web-ifc/geometry/IfcGeometryLoader.cpp36 symbols
src/cpp/web-ifc/geometry/operations/bim-geometry/utils.h31 symbols
src/cpp/web-ifc/geometry/operations/geometryutils.h28 symbols
src/cpp/web-ifc/geometry/operations/boolean-utils/math.h26 symbols
src/cpp/web-ifc/geometry/representation/geometry.h25 symbols
src/cpp/test/io_helpers.cpp24 symbols
tests/benchmark/benchmark.ts23 symbols
src/ts/helpers/properties.ts21 symbols

For agents

$ claude mcp add engine_web-ifc \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact