GithubHelp home page GithubHelp logo

thatopen / engine_web-ifc Goto Github PK

View Code? Open in Web Editor NEW
549.0 18.0 163.0 189.3 MB

Reading and writing IFC files with Javascript, at native speeds.

Home Page: https://thatopen.github.io/engine_web-ifc/demo

License: Mozilla Public License 2.0

C++ 10.73% TypeScript 88.99% JavaScript 0.14% CMake 0.14% Dockerfile 0.01%
wasm ifc cpp emscripten webassembly javascript

engine_web-ifc's Introduction

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

cover

Web IFC

NPM Package NPM Package Tests

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.

Status

Although it is quite stable and fast already, web-ifc is in pre-alpha status until ifc support matures. The list of currently supported ifc elements, or level of support for different ifc types, is an undocumented work in progress.

Depending on your models, web-ifc may be quick and correct, or slow and broken. If your model does not work as expected please raise an issue and attach the model if possible, or contact us and we can discuss passing the model confidentially.

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 avaialble 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 v3.1.44 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.

engine_web-ifc's People

Contributors

agviegas avatar ajaxjiang96 avatar aka-blackboots avatar awmartin avatar beachtom avatar bschafer01 avatar cbenghi avatar d4ve-r avatar daulatojha17 avatar deadman2000 avatar dependabot[bot] avatar edlundnwp avatar engthiago avatar fernandocamporredondo avatar harrycollin avatar jespa007 avatar kovacsv avatar makc avatar mivit avatar pablo-mayrgundter avatar phabramich avatar quimmoya avatar simquat avatar szamocza avatar tomvandig avatar txtony avatar vegarringdal avatar wsw0108 avatar xceno avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

engine_web-ifc's Issues

Make the WASM location configurable

So far we have been working on the assumption that the WASM file is in the root directory of the project. However, this may not always be the case, and it would be interesting if the user could define where their WASM file is. I've had to set this up by hand for the Three.js IFC Loader, and I think it would be interesting to incorporate it into web-ifc.

The path to the WASM file resides in the wasmBinaryFile variable generated by Emscripten.

image

The solution provided for Three.js was to add a global variable containing the relative path of the WASM that could be set through a function of the API. Something like:

var WasmPath = "";

//...

var wasmBinaryFile = WasmPath + "web-ifc.wasm";

//...

var IfcAPI = class {
   //...
   SetWasmPath(path){
     WasmPath = path;
   }
};

export {
  IfcAPI,
  ms
};

This setter function will be also present in web-ifc-three. This way, we will be able to use the Loader like this:

   const IfcLoader = new IfcLoader();
   ifcLoader.SetWasmPath("./whatever/path/");
   ifcLoader.load();

A minimal example of how this looks can be found here.

I suppose that the SetWasmPath can be added to web-ifc-api.ts. As for the global variable and the wasmBinaryFile initialization, we can probably write a JS file with a script to add these two lines to the bundled file.

Geometries are not displayed properly

ping @agviegas
I have two models attached.

model1.zip
model2.zip

I opened them with IFC.js. Some geometries were not displayed, or not displayed properly. I use BlenderBIM addon to compare visually. Here are some images:

Model 1

IFC.js
image

BlenderBIM
image

Model 2

IFC.js
image

BlenderBIM
image

If you knows how to inspect all objects parsed by IFC.js, please let me know so I could compare the objects in details (such as comparing their volume)
Thanks!

Not able to load IFC-file, possible due to `Unexpected profile type`

Big congrats on the library - this is really awesome!! I have been testing the lib with the PR at threejs (mrdoob/three.js#20598), but I can only get the example IFC-files to load. I have tried with some of my other IFC files, but with no luck. These are files works when converted from IFC to gTLF.

When importing a file, this is the result from console.log:

Log: Importing IFC file
Wrote file
web-ifc-api.js:881 Loading: example.ifc
web-ifc-api.js:881 Read 
web-ifc-api.js:881 Loading 
web-ifc-api.js:881 Tape 11656886
web-ifc-api.js:881 Lines normal 276111
web-ifc-api.js:881 Max express ID 487286
web-ifc-api.js:881 Loaded 276111 lines in 55 ms!
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 50197
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 50292
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 51095
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 51178
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 51260
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 51342
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 51424
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 51506
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 51588
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 51670
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 51752
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 51834
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 51916
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 51998
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 52080
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 52162
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 52244
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 52326
web-ifc-api.js:881 Unexpected mesh type: 2736907675 at 57833
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 57994
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 58076
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 58158
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 68216
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 68293
web-ifc-api.js:881 Unexpected mesh type: 2736907675 at 73356
web-ifc-api.js:881 asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfUnexpected profile type: 1484403080 at 331613
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 331695
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 331776
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 331857
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 331938
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 332019
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 332100
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 332181
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 332262
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 332343
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 332424
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 332505
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 332586
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 332667
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 332748
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 332829
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 332910
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 332991
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 335722
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 335803
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 336120
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 336201
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 336518
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 336599
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 336916
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 336997
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 337314
web-ifc-api.js:881 Unexpected profile type: 1484403080 at 337395
web-ifc-api.js:881 asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfUnexpected profile type: 1484403080 at 68368
6web-ifc-api.js:881 Unexpected profile type: 1484403080 at 68368
web-ifc-api.js:881 asdfasdfasdfasdfasdfasdfasdfasdfUnexpected profile type: 1484403080 at 333871
25

The corresponding lines in the IFC-file is:

Log: Corresponding lines in IFC file
#50197= IFCISHAPEPROFILEDEF(.AREA.,'Beam_Steel_HE300A',#50196,300.000000000001,289.999999999999,8.49999999999807,14.0000000000011,27.0000000000003);
...
#51342= IFCISHAPEPROFILEDEF(.AREA.,'Beam_Steel_IPE300',#51341,150.000000000009,300.,7.09999999979711,10.7000000000008,14.9999999999923);
#51424= IFCISHAPEPROFILEDEF(.AREA.,'Beam_Steel_IPE300',#51423,150.000000000009,300.,7.09999999979711,10.7000000000008,14.9999999999923);
#51506= IFCISHAPEPROFILEDEF(.AREA.,'Beam_Steel_IPE300',#51505,150.000000000009,300.,7.09999999979711,10.7000000000008,14.9999999999923);
#51588= IFCISHAPEPROFILEDEF(.AREA.,'Beam_Steel_IPE300',#51587,150.000000000009,300.,7.09999999979711,10.7000000000008,14.9999999999923);
#73356= IFCBOOLEANRESULT(.DIFFERENCE.,#73347,#73355);
#331613= IFCISHAPEPROFILEDEF(.AREA.,'Beam_Steel_IPE140',#331612,73.0000000000007,140.,4.69999999999893,6.90000000000083,6.99999999999873);
...
#331695= IFCISHAPEPROFILEDEF(.AREA.,'Beam_Steel_IPE140',#331694,73.0000000000007,140.,4.69999999999893,6.90000000000083,6.99999999999873);
#331776= IFCISHAPEPROFILEDEF(.AREA.,'Beam_Steel_IPE140',#331775,73.0000000000007,140.,4.69999999999893,6.90000000000083,7.00000000000207);
#331857= IFCISHAPEPROFILEDEF(.AREA.,'Beam_Steel_IPE140',#331856,73.0000000000007,140.,4.69999999999893,6.90000000000083,7.00000000000207);
#331938= IFCISHAPEPROFILEDEF(.AREA.,'Beam_Steel_IPE140',#331937,73.0000000000007,140.,4.69999999999893,6.90000000000083,7.00000000000207);
...
#332910= IFCISHAPEPROFILEDEF(.AREA.,'Beam_Steel_IPE140',#332909,73.0000000000007,140.,4.69999999999893,6.90000000000083,7.00000000000207);
...
#336916= IFCISHAPEPROFILEDEF(.AREA.,'Beam_Steel_IPE140',#336915,73.0000000000007,140.,4.69999999999893,6.90000000000083,7.00000000000207);
...
#337395= IFCISHAPEPROFILEDEF(.AREA.,'Beam_Steel_IPE140',#337394,73.0000000000007,140.,4.69999999999893,6.90000000000083,7.00000000000207);
#68368= IFCISHAPEPROFILEDEF(.AREA.,'Column_Steel_HE200B',#68367,200.,200.,9.,15.,18.);
#333871= IFCISHAPEPROFILEDEF(.AREA.,'Column_Steel_IPE140',#333870,73.,140.,4.70000000000001,6.9,6.99999999999997);

Can I provide any other debugging info for you?

windows and doors not rendering properly

Using web-ifc in Angular app - loading IFC file from Firebase. All seems to go well, except windows and doors from model not rendering properly:
Screen Shot 2021-03-27 at 9 02 48 PM

Example of screenshot from same model in other application:
Screen Shot 2021-03-27 at 9 02 41 PM

I can't see anything clearly identifying the problem in the console:
Screen Shot 2021-03-28 at 9 57 11 AM

Trying to show some property details from the IFC file (but I'm totally new to IFC, so not sure what information is really valuable here :) )
Screen Shot 2021-03-28 at 10 10 45 AM

Unexpected Style Type

Hey guys, I've tried loading a project exported from Rhino, using VisualARQ tools to design and export in IFC2x3. I get these 'Unexpected Style Type' errors in the console. Thanks! Awesome work btw :)

Console Log
1622037044905.log

Screenshot
image

IFC file
HouseZ.zip

Does this library contain the full IFC object model?

I've been following the development of @agviegas' web IFC viewer, and was wondering whether it supported the entire IFC object model, or just the geometric representations. I was linked through from that repo to here and took a poke around and couldn't find an implementation of the object model. Is that something that someone is currently working on?

I previously built a project called IFC-gen which has a full IFC parser and code generator. At Hypar, we will soon need the ability to load full IFC models in the browser (not just the geometry), and I was going to use IFC-gen to generate an IFC4 Typescript lib. I'm wondering whether it would be a useful complement to the work that you and @agviegas are doing.

npm run start in Benchmark: module.Init() is not a function

When starting the benchmark code, the following error appears in the console. This might be due to the last changes in the API. This project is clean (no changes have been made).

(node:6520) UnhandledPromiseRejectionWarning: TypeError: module.Init is not a function
    at C:\Users\CYPE\Desktop\DEV\_proyectos\tomvandig\web-ifc\benchmark\benchmark.ts:48:18
    at Generator.next (<anonymous>)
    at C:\Users\CYPE\Desktop\DEV\_proyectos\tomvandig\web-ifc\benchmark\benchmark.ts:8:71
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\CYPE\Desktop\DEV\_proyectos\tomvandig\web-ifc\benchmark\benchmark.ts:4:12)
    at BenchmarkWebIFC (C:\Users\CYPE\Desktop\DEV\_proyectos\tomvandig\web-ifc\benchmark\benchmark.ts:39:12)
    at BenchmarkWebIFC (C:\Users\CYPE\Desktop\DEV\_proyectos\tomvandig\web-ifc\benchmark\benchmark.ts:39:12)
    at C:\Users\CYPE\Desktop\DEV\_proyectos\tomvandig\web-ifc\benchmark\benchmark.ts:86:27
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\CYPE\Desktop\DEV\_proyectos\tomvandig\web-ifc\benchmark\benchmark.ts:5:58)
(node:6520) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)       
(node:6520) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
PS C:\Users\CYPE\Desktop\DEV\_proyectos\tomvandig\web-ifc\benchmark>

Where is ifc2x4.h?

I'm trying to load an IFC file in a simple cpp program.

However I noticed web-ifc-geometry.h and web-ifc.h include "ifc2x4.h".
Does this file exist somewhere?

how to import lib properly?

I can't find anything in the dist folder.
Just doing npm install doesn't work.
require and import doesn't work.

thanks

Retrieve IFC data by ExpressID

Currently, the library is able to generate geometry based on an IFC. However, in almost all use cases it will be necessary to be able to access the data associated with each instance.

Probably the simplest way to do this would be to create an endpoint that has an ExpressID as input and returns a javascript object / dictionary with the retrieved properties. This presents two problems: how the user has access to the ID whose information they want to know, and where the data is stored where web-ifc is able to retrieve information from that ID.

Regarding the first problem, the most immediate is that every time a geometry is created, the API should return the ExpressID of the instance created. In this way, this ID could be associated to the geometry (e.g. each THREE Mesh would have an additional field with the ExpressID), so that when the user clicks on an object, a request is sent to the API with this data.

Storing this information in memory can be very penalising in medium and large projects. For this reason, we may want to use Emscripten's communication with IndexedDB, called IDBFS. This would allow us to make calls to this "small frontend database" and retrieve the information while keeping memory usage low.

IFC file doesnt load correctly

When I open a IFC file into the model loader it shows like this:
afbeelding

and it should look like this:
afbeelding

What can I do to let it load correctly?

Models issues - Unexpected mesh type: 1856042241

@tomvandig Ill send IFC files in discord like last time :-)

Is it much work to add option on how detailed circles should be ?

brset1.ifc

in blender
image

web-ifc-v20
Unexpected mesh type: 1856042241
image


brset2.ifc

In Blender
image

web-ifc-v20
Unexpected mesh type: 1856042241
image

brset3.ifc

In blender
image

web-ifc-v20
Unexpected mesh type: 1856042241
image

npm run dev fails

After successful build, I run the suggested dev server, which ends in error below

pablo@top:~/web-ifc> sw_vers
ProductName:	Mac OS X
ProductVersion:	10.13.6
BuildVersion:	17G14042
pablo@top:~/web-ifc> git log -1
commit 5a3583e1c59d7bb446367d3fdfd1c6c6f4389f23 (grafted, HEAD -> main, origin/main, origin/HEAD)
Author: Tom van Diggelen <[email protected]>
Date:   Wed Mar 3 21:55:03 2021 +0100

    Add optional user transformation matrix
pablo@top:~/web-ifc> npm run dev

> [email protected] dev /Users/pablo/web-ifc
> concurrently --kill-others "npm-watch" "npm run serve-viewer"

[0] No task specified. Will go through all possible tasks
[1]
[1] > [email protected] serve-viewer /Users/pablo/web-ifc
[1] > serve dist
[1]
[0] [build-viewer] [nodemon] 2.0.7
[0] [build-viewer]  > threejs/web-ifc-three.ts: error: Could not resolve "web-ifc" (mark it as external to exclude it from the bundle)
[0]     6 │ import { IfcAPI, ms, PlacedGeometry, Color } from "web-ifc";
[0]       ╵                                                   ~~~~~~~~~
[0]
[1] INFO: Accepting connections at http://localhost:5000
[0] [build-viewer] 1 error
[0] [build-viewer] [nodemon] app crashed - waiting for file changes before starting...

Error messages that can help you more

First of all, thank you for making this, awesome work guys 👍 🥇

Ive added error messages I see when trying to convert xkt
https://github.com/xeokit/xeokit-ifc-to-xkt#readme

Is there any way to activate better error messages I can give you to help ?
My biggest issue is that I cant share the models I use since Im not the owner. But if it was able to extract the issue lines better then Im sure I would be able to give you this.

image

IFC not rendering correctly

I can send sample files on discord in a PM

With web-ifc I get this:
1
image

2 (overlook the red color)
image

In blender:
1
image
2
image

Memory access out of bounds

Hello,

I had a problem when I tried to open an IFC file that was part of a model.

web-ifc.wasm:0x8533 Uncaught RuntimeError: memory access out of bounds
    at web-ifc.wasm:0x8533
    at web-ifc.wasm:0x3dc7b
    at web-ifc.wasm:0x26629
    at Object.LoadAllGeometry (eval at new_ (web-ifc-viewer.js:3754), <anonymous>:8:10)
    at IfcAPI.LoadAllGeometry (web-ifc-viewer.js:74215)
    at IfcThree.getFlatMeshes (web-ifc-viewer.js:74243)
    at IfcThree.LoadAllGeometry (web-ifc-viewer.js:74232)
    at LoadModel (web-ifc-viewer.js:98567)
    at FileReader.reader.onload (web-ifc-viewer.js:98550)

Error loading model

I'll send you the model privately. Thanks!

main.js:68813 RuntimeError: abort(undefined). Build with -s ASSERTIONS=1 for more info.
    at abort (main.js:31757)
    at _abort (main.js:35480)
    at <anonymous>:wasm-function[48]:0x1189
    at <anonymous>:wasm-function[448]:0x2ecd6
    at <anonymous>:wasm-function[938]:0x53374
    at <anonymous>:wasm-function[939]:0x53396
    at Object.GetGeometry (eval at new_ (main.js:1), <anonymous>:9:10)
    at IfcAPI.GetGeometry (main.js:67378)
    at IFCParser.getBufferGeometry (main.js:68534)
    at IFCParser.savePlacedGeometryByMaterial (main.js:68527)

Dockerize web-ifc

Dockerizing web-ifc could be useful both for collaboration (no emscripten installation needed) and for deployment in the backend.

bool - holter tower

Holter tower is missing a few windows
Tried this with v 0.20 with and without USE_FAST_BOOLS

image

Reduce memory overhead

  • Allow tokenizer to work with streamed data, operating on chunks instead of the full buffer.
  • Allow meshes to be queried one by one
  • Make mesh-caching optional, discard meshes after querying if caching is disabled
  • Improve mesh-caching to only cache what needs to be cached
  • Reduce memory fragmentation in geometry generation phase by using a custom allocator for the geometry buffers.

Module not found: Can't resolve 'fs'

I've been encountering this issue where 'fs' is trying to be used. I'm using NextJS and was able to fix it using some config mentioned here. I'm not sure if this should be fixed here or if it's up to the end-user to do it.

image

Walls starting above the ground

I have an issue with a Revit IFC, the walls are not from the ground but a bit above:
image

I tested with Solibri and everything is displayed correctly:
image

The ifc file is attached :
testnat1.zip

Thanks

Extra faces in extrusions with holes

The current implementation of extrusions with holes looked correctly on simple meshes, but a look at a more complicated mesh demonstrates that there is a problem: there are extra faces in the direction of the extrusion.

image

My guess is that this has something to do with the determination of the "vertical" faces of the extrusion: probably something like generating a vertical face foreach n and n + 1 vertices. I'll take a look at it and see if I can make this work for extrusion with holes (probably overloading the function).

Support for IFCPOLYGONALFACESET

Hi! I was checking out the wonderful new approach and tried to load some IFC files. Very fast indeed!

I got one error in a file, turns out we use IFCPOLYGONALFACESET a lot here. I think they are not supported yet, I got the error Unexpected mesh type: 2839578677 at line ...

Do you think you will be able to support that soon? I could provide you with an IFC file if you want an example.

cannot find module ./ifc2x4 and ./ifc2x4_helper

I'm trying to upgrade from 0.0.17 to 0.0.18 and I get the following error when trying to serve:

Error: node_modules/web-ifc/web-ifc-api.d.ts:1:15 - error TS2307: Cannot find module './ifc2x4' or its corresponding type declarations.

1 export * from "./ifc2x4";
~~~~~~~~~~
Error: node_modules/web-ifc/web-ifc-api.d.ts:2:15 - error TS2307: Cannot find module './ifc2x4_helper' or its corresponding type declarations.

2 export * from "./ifc2x4_helper";

Any help would be greatly appriciated!

Add error catching functionality

I believe we need to have a way to catch crashes/errors when loading the IFC. This issue isn't specific to any model in particular. I have not been able to find a way to catch the errors as shown below from the js side.

Screenshot 2021-06-03 151303

Perhaps an endpoint/callback function that is called when an error occurs in the wasm would be enough. This would help with both UI development & being able to effectively catch error to report back here.

Different wasm file path in Chrome and Firefox

The integration of web-ifc-viewer in my project works fine in Firefox but not completely in Chrome.

Firefox loads the .wasm file from root: my-project.com/web-ifc.wasm
Chrome loads it prepending "js/": my-project.com/js/web-ifc.wasm

Even if I use setWasmPath('my-dir') chrome still prepends "js/":
my-project.com/js/my-dir/web-ifc.wasm (chrome)
my-project.com/my-dir/web-ifc.wasm (firefox)

Finally I could resolve it setting setWasmPath('../'), so all browsers loads wasm file from root

Build errors for from-scratch build of 0.0.21

Hi Tom,

Trying to build from scratch.. everything goes well for awhile, then errors

There's a warning about using the right tsc.. hopefully it's just an env problem for me. The typescript lib is already installed, and I also tried using yarn, but same errors.

> [email protected] build-wasm-release
> em++ --bind -O3 -std=c++17 -flto -fno-exceptions ./src/wasm/web-ifc-api.cpp -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -s FORCE_FILESYSTEM=1 -s EXPORT_NAME=WebIFCWasm -s MODULARIZE=1 -s EXPORTED_RUNTIME_METHODS=["FS"] -O3 -o dist/web-ifc.js


> [email protected] build-api
> cpy src/*.ts dist && npm run build-ts-api && npm run build-web-ifc-api-mjs && npm run build-web-ifc-api-node && npm run copy-to-dist && npm run add-wasm-path


> [email protected] build-ts-api
> tsc --emitDeclarationOnly && cpy dist/web-ifc-api.d.ts dist && cpy dist/web-ifc-api.d.ts dist --rename=web-ifc-api-node.d.ts
{
  "name": "web-ifc",
  "version": "0.0.21",
  "description": "ifc loading on the web",
  "main": "web-ifc-api.js",
  "watch": {
    "build-viewer": {
      "patterns": [
        "./examples/viewer"
      ],
      "extensions": "ts"
    },
    "build-web-ifc-api-mjs": {
      "patterns": [
        "./src"
      ],



                This is not the tsc command you are looking for


To get access to the TypeScript compiler, tsc, from the command line either:

- Use npm install typescript to first add TypeScript to your project before using npx
- Use yarn to avoid accidentally running code from packages which haven't been installed
Cannot copy `dist/web-ifc-api.d.ts`: the file doesn't exist
npm ERR! code 1
npm ERR! path /Users/pablo/web-ifc
npm ERR! command failed
npm ERR! command sh -c tsc --emitDeclarationOnly && cpy dist/web-ifc-api.d.ts dist && cpy dist/web-ifc-api.d.ts dist --rename=web-ifc-api-node.d.ts

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/pablo/.npm/_logs/2021-07-24T08_32_02_049Z-debug.log
npm ERR! code 1
npm ERR! path /Users/pablo/web-ifc
npm ERR! command failed
npm ERR! command sh -c cpy src/*.ts dist && npm run build-ts-api && npm run build-web-ifc-api-mjs && npm run build-web-ifc-api-node && npm run copy-to-dist && npm run add-wasm-path

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/pablo/.npm/_logs/2021-07-24T08_32_02_085Z-debug.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Boolean geometry does not use spatial acceleration structure

Right now bool geometry is just doing a quadratic loop over all triangle pairs during intersection and inside/outside checks, this is fine for smaller meshes but quickly becomes problematic for larger ones.

Use BVH or similar as a first patch.

Additional prereqs for build

  1. Typescript needs to be installed
  2. Need to install node type defs. Got this error:
lib/web-ifc-api.ts:5:20 - error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.

5 const WebIFCWasm = require("./web-ifc");

The suggested fix worked.

Support for IFCPRODUCTREPRESENTATION

First, I'd like to thanks you for this wonderful project, it really helps getting up to speed with the IFC.

I setted up a little test env in which I'm able to view some IFC file but some of them are still not working.
In the console, I got the following kind of logs:
Unexpected mesh type: 2095639259 at 9999

After a quick analysis, the error seems to refer to line where I have IFCPRODUCTREPRESENTATION in the file.
I checked in the files that I'm able to display and non of them is using IFCPRODUCTREPRESENTATION.

For the record, I'm using the latest version of the wasm (0.19).
The non working ifc file is attached.

Thanks
test2.zip

Feature Request - Server side rendering for IFC

Many of our customers operate in low bandwidth environments such as remote areas, as such the idea of server rendering parts of the IFC model and streaming them to the client has much appeal for us.

In an ideal architecture, we'd be able to split the rendering across multiple Azure functions to make this scalable. Where the files are loaded from should be configurable to allow loading from Azure blob storage / AWS buckets or similar.

"this.wasmModule.OpenModel is not a function" Not sure why, I use npm to install web-ifc

IFCLoader.js?42f0:55 TypeError: this.wasmModule.OpenModel is not a function
at IfcAPI.OpenModel (VM2034 web-ifc-api.js:4789)
at _callee2$ (VM2033 IFCLoader.js:156)
at tryCatch (runtime.js?6a61:63)
at Generator.invoke [as _invoke] (runtime.js?6a61:293)
at Generator.eval [as next] (runtime.js?6a61:118)
at asyncGeneratorStep (VM2033 IFCLoader.js:9)
at _next (VM2033 IFCLoader.js:11)

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.