with dist

This commit is contained in:
Robert Nasarek 2026-06-25 09:19:26 +02:00
parent 05c65aad4d
commit ddd716c0a0
64 changed files with 262892 additions and 1 deletions

373
dist/library/assets/ifc/LICENSE.md vendored Normal file
View file

@ -0,0 +1,373 @@
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.

113
dist/library/assets/ifc/README.md vendored Normal file
View file

@ -0,0 +1,113 @@
<p align="center">
<a href="https://thatopen.com/">TOC</a>
|
<a href="https://thatopen.github.io/engine_web-ifc/docs">web-ifc documentation</a>
|
<a href="https://docs.thatopen.com/intro"> platform documentation</a>
|
<a href="https://thatopen.github.io/engine_web-ifc/demo">demo</a>
|
<a href="https://people.thatopen.com/">community</a>
|
<a href="https://www.npmjs.com/package/web-ifc">npm package</a>
</p>
![cover](banner.png)
<h1>Web IFC <img src="https://thatopen.github.io/engine_components/resources/favicon.ico" width="32"/></h1>
[![NPM Package][npm]][npm-url]
[![NPM Package][npm-downloads]][npm-url]
**web-ifc** is a javascript library to read and write ifc files, at native speeds. **web-ifc** is part of the [That Open Company](https://thatopen.com) project, which aims to lower the threshold for developing open BIM applications.
## Install
`npm install web-ifc`
## Quick setup
```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);
```
See [examples](https://github.com/ThatOpen/engine_web-ifc/tree/main/examples/usage) for more details on how to use web-ifc.
## Current Build
The current live build of web-ifc is available [here](https://thatopen.github.io/engine_web-ifc/build.zip). 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](https://emscripten.org/docs/getting_started/downloads.html) 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](https://cmake.org/download/) and (on windows) MINGW [see here](https://sourceforge.net/projects/mingw/) - 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](https://github.com/ThatOpen/engine_web-ifc/blob/main/src/cpp/test/web-ifc-test.cpp) for a simple entry point to get started.
[npm]: https://img.shields.io/npm/v/web-ifc
[npm-url]: https://www.npmjs.com/package/web-ifc
[npm-downloads]: https://img.shields.io/npm/dw/web-ifc

View file

@ -0,0 +1,18 @@
/**
* Web-IFC Logging Helper
* @module Logging
*/
export declare enum LogLevel {
LOG_LEVEL_DEBUG = 1,
LOG_LEVEL_WARN = 3,
LOG_LEVEL_ERROR = 4,
LOG_LEVEL_OFF = 6
}
export declare abstract class Log {
private static logLevel;
static setLogLevel(level: number): void;
static log(msg: string, ...args: any[]): void;
static debug(msg: string, ...args: any[]): void;
static warn(msg: string, ...args: any[]): void;
static error(msg: string, ...args: any[]): void;
}

View file

@ -0,0 +1,81 @@
/**
* Web-IFC Properties
* @module Properties
*/
import { IfcAPI } from "../web-ifc-api";
interface Node {
expressID: number;
type: string;
children: Node[];
}
export declare class Properties {
private api;
/** @ignore */
constructor(api: IfcAPI);
/**
*
* @param modelID model handle
* @param id expressID of IfcElement
* @param recursive default false, if true get all nested properties recursively
* @param inverse default false, if true get all inverse properties recursively
* @returns IfcElement
*/
getItemProperties(modelID: number, id: number, recursive?: boolean, inverse?: boolean): Promise<any>;
/**
* Get IfcPropertySets of IfcElements
* @param modelID model handle
* @param elementID expressID of IfcElement, default 0 (all psets in model)
* @param recursive default false, if true get all nested properties recursively
* @returns array of IfcElements inheriting from IfcPropertySetDefinition
*/
getPropertySets(modelID: number, elementID?: number, recursive?: boolean, includeTypeProperties?: boolean): Promise<any[]>;
/**
* Set IfcRelDefinesByProperties relations of IfcElements and IfcPropertySets
* @param modelID model handle
* @param elementID expressID or array of expressIDs of IfcElements
* @param psetID expressID or array of expressIDs of IfcPropertySets
* @returns true if success or false if error
*/
setPropertySets(modelID: number, elementID: number | number[], psetID: number | number[]): Promise<boolean>;
/**
* Get TypeObject of IfcElements
* @param modelID model handle
* @param elementID expressID of IfcElement, default 0 (all type objects in model)
* @param recursive default false, if true get all nested properties of the type object recursively
* @returns array of objects inheriting from IfcTypeObject
*/
getTypeProperties(modelID: number, elementID?: number, recursive?: boolean): Promise<any[]>;
/**
* Get materials of IfcElement
* @param modelID model handle
* @param elementID expressID of IfcElement, default 0 (all materials in model)
* @param recursive default false, if true get all nested properties recursively
* @returns array of IfcElements inheriting from IfcMaterialDefinition
*/
getMaterialsProperties(modelID: number, elementID?: number, recursive?: boolean, includeTypeMaterials?: boolean): Promise<any[]>;
/**
* Set IfcRelAssociatesMaterial relations of IfcElements and IfcMaterialDefinitions
* @param modelID model handle
* @param elementID expressID or array of expressIDs of IfcElements
* @param materialID expressID or array of expressIDs of IfcMaterialDefinitions
* @returns true if success or false if error
*/
setMaterialsProperties(modelID: number, elementID: number | number[], materialID: number | number[]): Promise<boolean>;
/**
* Get Spatial Structure of IfcProject
* @param modelID model handle
* @param includeProperties default false
* @returns IfcProject as Node
*/
getSpatialStructure(modelID: number, includeProperties?: boolean): Promise<Node>;
private getRelatedProperties;
private getChunks;
private static newIfcProject;
private getSpatialNode;
private getChildren;
private newNode;
private getSpatialTreeChunks;
private saveChunk;
private setItemProperties;
}
export {};

34217
dist/library/assets/ifc/ifc-schema.d.ts vendored Normal file

File diff suppressed because it is too large Load diff

90
dist/library/assets/ifc/package.json vendored Normal file
View file

@ -0,0 +1,90 @@
{
"name": "web-ifc",
"version": "0.0.77",
"description": "ifc loading on the web",
"module": "./web-ifc-api.js",
"main": "./web-ifc-api-node.js",
"license": "MPL-2.0",
"exports": {
".": {
"require": "./web-ifc-api-node.js",
"node": "./web-ifc-api-node.js",
"import": "./web-ifc-api.js"
},
"./web-ifc.wasm": "./web-ifc.wasm",
"./web-ifc-mt.wasm": "./web-ifc-mt.wasm",
"./web-ifc-node.wasm": "./web-ifc-node.wasm"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ThatOpen/engine_web-ifc.git"
},
"pckg-gui": {},
"scripts": {
"gen-schema": "cd src/schema-generator && ts-node gen_functional_types.ts",
"setup-env": "emsdk_env",
"setup-mingw": "mingw-get instal msys-make gettext",
"build-release": "npm run build-wasm-release && npm run build-api && npm run build-cleanup",
"build-cleanup": "rimraf dist/helpers/log.ts && rimraf dist/helpers/properties.ts && rimraf dist/web-ifc-api.ts && rimraf dist/ifc-schema.ts",
"build-debug": "npm run build-wasm-debug && npm run build-api && npm run build-cleanup",
"copy-to-dist": "make-dir dist && cpy \"src/cpp/build_wasm/*.js\" dist && cpy \"src/cpp/build_wasm/*.wasm\" dist && cp ./LICENSE.md ./dist",
"copy-debug-to-dist": "make-dir dist && cpy \"src/cpp/build_wasm_debug/*.js\" dist && cpy \"src/cpp/build_wasm_debug/*.wasm\" dist ",
"build-wasm-debug": "make-dir src/cpp/build_wasm_debug && cd src/cpp/build_wasm_debug && emcmake cmake .. -DEMSCRIPTEN=true -DCMAKE_BUILD_TYPE=Debug && emmake make && npm run copy-debug-to-dist",
"build-wasm-release": "make-dir src/cpp/build_wasm && cd src/cpp/build_wasm && emcmake cmake .. -DEMSCRIPTEN=true -DCMAKE_BUILD_TYPE=Release && emmake make && npm run copy-to-dist",
"build-api": "make-dir dist/helpers && npm run build-ts-api && npm run build-web-ifc-api-browser && npm run build-web-ifc-api-node && npm run build-web-ifc-api-iife &&cpy README.md dist && cpy package.json dist",
"build-ts-api": "make-dir dist/helpers && cpy \"src/ts/*.ts\" dist && cpy \"src/ts/helpers/*\" dist/helpers --flat && tsc --incremental --emitDeclarationOnly && cpy dist/web-ifc-api.d.ts . --rename=web-ifc-api-node.d.ts",
"build-web-ifc-api-node": "make-dir dist && esbuild dist/web-ifc-api.ts --define:__WASM_PATH__=\\\"./web-ifc-node\\\" --bundle --platform=node --outfile=./dist/web-ifc-api-node.js",
"build-web-ifc-api-browser": "make-dir dist && esbuild dist/web-ifc-api.ts --bundle --format=esm --define:__WASM_PATH__=\\\"./web-ifc\\\" --outfile=./dist/web-ifc-api.js",
"build-web-ifc-api-iife": "make-dir dist && esbuild dist/web-ifc-api.ts --bundle --format=iife --define:__WASM_PATH__=\\\"./web-ifc\\\" --global-name=WebIFC --outfile=./dist/web-ifc-api-iife.js",
"build-viewer": "cd examples/viewer/ && make-dir dist && node makesrc.js && esbuild --bundle web-ifc-viewer.ts --outfile=./dist/web-ifc-viewer.js && rimraf ts_src.js && cpy index.html dist && cpy ../../dist/web-ifc.wasm dist/web-ifc.wasm && cpy ../../dist/web-ifc-mt.js dist/web-ifc-mt.js && cpy ../../dist/web-ifc-mt.wasm dist/web-ifc-mt.wasm && cpy ../example.ifc dist/example.ifc",
"dev": "npm run build-viewer && cd examples/viewer/dist && ws -p 8080",
"docker-build": "docker build -t web-ifc .",
"docker-run": "npm run docker-run-container && npm run docker-get-compiled-files ",
"docker-run-container": "docker run --rm -d -p 3000:5000 --name web-ifc-container web-ifc",
"docker-get-compiled-files": "docker cp web-ifc-container:/web-ifc-app/dist .",
"postversion": "node src/setversion.js",
"benchmark": "ts-node ./tests/benchmark/benchmark.ts",
"regression": "node --max-old-space-size=8192 ./tests/regression/regression.mjs",
"regression-update": "node --max-old-space-size=8192 ./tests/regression/regression.mjs update",
"test": "jest --runInBand ",
"gen-docs": "typedoc --out dist/docs && cpy ./banner.png ./dist/docs",
"usage_example": "cd examples/usage && ts-node index.ts"
},
"author": "web-ifc",
"files": [
"web-ifc.wasm",
"web-ifc-mt.wasm",
"web-ifc-node.wasm",
"web-ifc-api-node.js",
"web-ifc-api-node.d.ts",
"web-ifc-api.js",
"web-ifc-api.d.ts",
"web-ifc-api-iife.js",
"ifc-schema.d.ts",
"helpers/properties.d.ts",
"helpers/log.d.ts",
"web-ifc-mt.worker.js",
"LICENSE.md"
],
"devDependencies": {
"@types/jest": "^30.0.0",
"@types/three": "^0.183.1",
"adm-zip": "^0.5.10",
"cpy-cli": "^7.0.0",
"esbuild": "^0.27.0",
"jest": "^30.0.3",
"local-web-server": "^5.2.1",
"make-dir-cli": "^4.0.0",
"rimraf": "^6.0.0",
"three": "^0.183.1",
"ts-jest": "^29.3.2",
"ts-node": "^10.9.2",
"typedoc": "^0.28.3",
"typescript": "^5.8.3"
},
"browser": {
"crypto": false,
"path": false,
"fs": false
}
}

73617
dist/library/assets/ifc/web-ifc-api-iife.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,552 @@
/**
* Web-IFC Main API Class
* @module web-ifc
*/
import { IfcLineObject } from "./ifc-schema";
export * from "./ifc-schema";
import { Properties } from "./helpers/properties";
export { Properties };
import { LogLevel } from "./helpers/log";
export { LogLevel };
export declare const UNKNOWN = 0;
export declare const STRING = 1;
export declare const LABEL = 2;
export declare const ENUM = 3;
export declare const REAL = 4;
export declare const REF = 5;
export declare const EMPTY = 6;
export declare const SET_BEGIN = 7;
export declare const SET_END = 8;
export declare const LINE_END = 9;
export declare const INTEGER = 10;
/**
* Settings for the IFCLoader
* @property {boolean} COORDINATE_TO_ORIGIN - If true, the model will be translated to the origin.
* @property {number} CIRCLE_SEGMENTS - Number of segments used to approximate circles.
* @property {number} MEMORY_LIMIT - Maximum memory (in bytes) to be reserved for IFC data in memory.
* @property {number} TAPE_SIZE - Size of the internal buffer tape for the loader (in bytes or units).
* @property {number} LINEWRITER_BUFFER - Number of lines to write to memory at a time when writing an IFC file.
* @property {number} TOLERANCE_PLANE_INTERSECTION - Numerical tolerance when checking plane intersections.
* @property {number} TOLERANCE_PLANE_DEVIATION - Tolerance to consider a plane on a boundary.
* @property {number} TOLERANCE_BACK_DEVIATION_DISTANCE - Used to determine if a point lies in front or behind a plane based on normal orientation.
* @property {number} TOLERANCE_INSIDE_OUTSIDE_PERIMETER - Tolerance for point-in-perimeter calculations.
* @property {number} TOLERANCE_SCALAR_EQUALITY - Tolerance used to compare scalar values as equal.
* @property {number} PLANE_REFIT_ITERATIONS - Number of iterations used when adjusting triangles to a plane.
* @property {number} BOOLEAN_UNION_THRESHOLD - Minimum number of solids before triggering a boolean union operation.
*/
export interface LoaderSettings {
COORDINATE_TO_ORIGIN?: boolean;
CIRCLE_SEGMENTS?: number;
MEMORY_LIMIT?: number;
TAPE_SIZE?: number;
LINEWRITER_BUFFER?: number;
TOLERANCE_PLANE_INTERSECTION?: number;
TOLERANCE_PLANE_DEVIATION?: number;
TOLERANCE_BACK_DEVIATION_DISTANCE?: number;
TOLERANCE_INSIDE_OUTSIDE_PERIMETER?: number;
TOLERANCE_SCALAR_EQUALITY?: number;
PLANE_REFIT_ITERATIONS?: number;
BOOLEAN_UNION_THRESHOLD?: number;
}
export interface Vector<T> extends Iterable<T> {
get(index: number): T;
size(): number;
}
export interface Color {
x: number;
y: number;
z: number;
w: number;
}
export interface RawLineData {
ID: number;
type: number;
arguments: any[];
}
export interface PlacedGeometry {
color: Color;
geometryExpressID: number;
flatTransformation: Array<number>;
}
export interface FlatMesh {
geometries: Vector<PlacedGeometry>;
expressID: number;
delete(): void;
}
export interface Point {
x: number;
y: number;
z?: number;
}
export interface Curve {
points: Array<Point>;
userData: Array<string>;
arcSegments: Array<number>;
}
export interface SweptDiskSolid {
profile: Profile;
axis: Array<Curve>;
profileRadius: number;
}
export interface Profile {
curve: Curve;
holes: Array<Curve>;
profiles: Array<Profile>;
isConvex: boolean;
isComposite: boolean;
}
export interface CrossSection {
curves: Array<Curve>;
expressID: Array<number>;
}
export interface AlignmentSegment {
curves: Array<Curve>;
}
export interface Alignment {
FlatCoordinationMatrix: Array<number>;
Horizontal: AlignmentSegment;
Vertical: AlignmentSegment;
Absolute: AlignmentSegment;
}
export interface IfcGeometry {
GetVertexData(): number;
GetVertexDataSize(): number;
GetIndexData(): number;
GetIndexDataSize(): number;
GetSweptDiskSolid(): SweptDiskSolid;
delete(): void;
}
export interface Buffers {
fvertexData: Array<number>;
indexData: Array<number>;
}
export interface AABB {
GetBuffers(): Buffers;
SetValues(minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number): void;
}
export interface Extrusion {
GetBuffers(): Buffers;
SetValues(profile_: Array<number>, dir_: Array<number>, len_: number, cuttingPlaneNormal_: Array<number>, cuttingPlanePos_: Array<number>, cap_: boolean): void;
SetHoles(profile_: Array<number>): void;
ClearHoles(): void;
}
export interface Sweep {
GetBuffers(): Buffers;
SetValues(scaling: number, closed: boolean, profile: Array<number>, directrix: Array<number>, initialNormal?: Array<number>, rotate90?: boolean, optimize?: boolean): void;
}
export interface CircularSweep {
GetBuffers(): Buffers;
SetValues(scaling: number, closed: boolean, profile: Array<number>, radius: number, directrix: Array<number>, initialNormal?: Array<number>, rotate90?: boolean): void;
}
export interface Revolution {
GetBuffers(): Buffers;
SetValues(profile_: Array<number>, transform_: Array<number>, startDegrees_: number, endDegrees_: number, numRots_: number): void;
}
export interface CylindricalRevolve {
GetBuffers(): Buffers;
SetValues(transform_: Array<number>, startDegrees_: number, endDegrees_: number, minZ_: number, maxZ_: number, numRots_: number, radius_: number): void;
}
export interface Parabola {
GetBuffers(): Buffers;
SetValues(segments: number, startPointX: number, startPointY: number, startPointZ: number, horizontalLength: number, startHeight: number, startGradient: number, endGradient: number): void;
}
export interface Clothoid {
GetBuffers(): Buffers;
SetValues(segments: number, startPointX: number, startPointY: number, startPointZ: number, ifcStartDirection: number, StartRadiusOfCurvature: number, EndRadiusOfCurvature: number, SegmentLength: number): void;
}
export interface Arc {
GetBuffers(): Buffers;
SetValues(radiusX: number, radiusY: number, numSegments: number, placement: Array<number>, startRad?: number, endRad?: number, swap?: boolean, normalToCenterEnding?: boolean): void;
}
export interface Alignment {
GetBuffers(): Buffers;
SetValues(horizontal: Array<number>, vertical: Array<number>): void;
}
export interface BooleanOperator {
GetBuffers(): Buffers;
SetValues(triangles_: Array<number>, type_: string): void;
SetSecond(triangles_: Array<number>): void;
clear(): void;
}
export interface ProfileSection {
GetBuffers(): Buffers;
SetValues(pType: number, width: number, depth: number, webThickness: number, flangeThickness: number, hasFillet: boolean, filletRadius: number, radius: number, slope: number, circleSegments: number, placement: Array<number>): void;
}
export interface IfcType {
typeID: number;
typeName: string;
}
export interface NewIfcModel {
schema: string;
name?: string;
description?: string[];
authors?: string[];
organizations?: string[];
authorization?: string;
}
export type ModelLoadCallback = (offset: number, size: number) => Uint8Array;
export type ModelSaveCallback = (data: Uint8Array) => void;
/** @ignore */
export declare function ms(): number;
export type LocateFileHandlerFn = (path: string, prefix: string) => string;
export declare class IfcAPI {
/** @ignore */
wasmModule: undefined | any;
private wasmPath;
private isWasmPathAbsolute;
private modelSchemaList;
private modelSchemaNameList;
/** @ignore */
ifcGuidMap: Map<number, Map<string | number, string | number>>;
private deletedLines;
/**
* Contains all the logic and methods regarding properties, psets, qsets, etc.
*/
properties: Properties;
/**
* Initializes the WASM module (WebIFCWasm), required before using any other functionality.
*
* @param customLocateFileHandler An optional locateFile function that let's
* you override the path from which the wasm module is loaded.
*/
Init(customLocateFileHandler?: LocateFileHandlerFn, forceSingleThread?: boolean): Promise<void>;
/**
* Opens a set of models and returns model IDs
* @param dataSets Array of Buffers containing IFC data (bytes)
* @param settings Settings for loading the model @see LoaderSettings
* @returns Array of model IDs
*/
OpenModels(dataSets: Array<Uint8Array>, settings?: LoaderSettings): Array<number>;
private CreateSettings;
private LookupSchemaId;
/**
* Opens a model and returns a modelID number
* @param data Buffer containing IFC data (bytes)
* @param settings Settings for loading the model @see LoaderSettings
* @returns ModelID or -1 if model fails to open
*/
OpenModel(data: Uint8Array, settings?: LoaderSettings): number;
/**
* Opens a model and returns a modelID number
* @param callback a function of signature (offset:number, size: number) => Uint8Array that will retrieve the IFC data
* @param settings Settings for loading the model @see LoaderSettings
* @returns ModelID or -1 if model fails to open
*/
OpenModelFromCallback(callback: ModelLoadCallback, settings?: LoaderSettings): number;
/**
* Fetches the ifc schema version of a given model
* @param modelID Model ID
* @returns IFC Schema version
*/
GetModelSchema(modelID: number): string;
/**
* Creates a new model and returns a modelID number
* @param schema ifc schema version
* @returns ModelID
*/
CreateModel(model: NewIfcModel, settings?: LoaderSettings): number;
/**
* Saves a model to a Buffer
* @param modelID Model ID
* @returns Buffer containing the model data
*/
SaveModel(modelID: number): Uint8Array;
/**
* Saves a model to a Buffer
* @param modelID Model ID
* @returns Buffer containing the model data
*/
SaveModelToCallback(modelID: number, callback: ModelSaveCallback): void;
/**
* Retrieves the geometry of an element
* @param modelID Model handle retrieved by OpenModel
* @param geometryExpressID express ID of the element
* @returns Geometry of the element as a list of vertices and indices
*/
GetGeometry(modelID: number, geometryExpressID: number): IfcGeometry;
CreateAABB(): any;
CreateExtrusion(): any;
CreateSweep(): any;
CreateCircularSweep(): any;
CreateRevolution(): any;
CreateCylindricalRevolution(): any;
CreateParabola(): any;
CreateClothoid(): any;
CreateArc(): any;
CreateAlignment(): any;
CreateBooleanOperator(): any;
CreateProfile(): any;
/**
* Gets the header information required by the user
* @param modelID Model handle retrieved by OpenModel
* @param headerType Type of header data you want to retrieve
* ifc.FILE_NAME, ifc.FILE_DESCRIPTION or ifc.FILE_SCHEMA
* @returns An object with parameters ID, type and arguments
*/
GetHeaderLine(modelID: number, headerType: number): any;
/**
* Gets the list of all ifcTypes contained in the model
* @param modelID Model handle retrieved by OpenModel
* @returns Array of objects containing typeID and typeName
*/
GetAllTypesOfModel(modelID: number): IfcType[];
/**
* Gets the ifc line data for a given express ID
* @param modelID Model handle retrieved by OpenModel
* @param expressID express ID of the line
* @param flatten recursively flatten the line, default false
* @param inverse get the inverse properties of the line, default false
* @param inversePropKey filters out all other properties from a inverse search, for a increase in performance. Default null
* @returns lineObject
*/
GetLine(modelID: number, expressID: number, flatten?: boolean, inverse?: boolean, inversePropKey?: string | null | undefined): any;
/**
* Gets the ifc line data for a given express ID
* @param modelID Model handle retrieved by OpenModel
* @param a list of expressID express ID of the line
* @param flatten recursively flatten the line, default false
* @param inverse get the inverse properties of the line, default false
* @param inversePropKey filters out all other properties from a inverse search, for a increase in performance. Default null
* @returns lineObject
*/
GetLines(modelID: number, expressIDs: Array<number>, flatten?: boolean, inverse?: boolean, inversePropKey?: string | null | undefined): any[];
/**
* Gets the next unused expressID
* @param modelID Model handle retrieved by OpenModel
* @param expressID Starting expressID value
* @returns The next unused expressID starting from the value provided
*/
GetNextExpressID(modelID: number, expressID: number): number;
/**
* Creates a new ifc entity
* @param modelID Model handle retrieved by OpenModel
* @param type Type code
* @param args Arguments required by the entity
* @returns An object contining the parameters of the new entity
*/
CreateIfcEntity(modelID: number, type: number, ...args: any[]): IfcLineObject;
/**
* Creates a new ifc globally unqiue ID
* @param modelID Model handle retrieved by OpenModel
* @returns An randomly generated globally unique ID
*/
CreateIFCGloballyUniqueId(modelID: number): any;
/**
* Creates a new ifc type i.e. IfcLabel, IfcReal, ...
* @param modelID Model handle retrieved by OpenModel
* @param type Type code
* @param value Type value
* @returns An object with the parameters of the type
*/
CreateIfcType(modelID: number, type: number, value: any): any;
/**
* Gets the name from a type code
* @param type Code
* @returns Name
*/
GetNameFromTypeCode(type: number): string;
/**
* Gets the type code from a name code
* @param name
* @returns type code
*/
GetTypeCodeFromName(typeName: string): number;
/**
* Evaluates if a type is subtype of IfcElement
* @param type Type code
* @returns True if subtype of Ifcelement, False if it is not subtype
*/
IsIfcElement(type: number): boolean;
/**
* Returns a list with all entity types that are present in the current schema
* @param modelID Model handle retrieved by OpenModel
* @returns Array of type codes
*/
GetIfcEntityList(modelID: number): Array<number>;
/**
* Deletes an IFC line from the model
* @param modelID Model handle retrieved by OpenModel
* @param expressID express ID of the line to remove
*/
DeleteLine(modelID: number, expressID: number): void;
/**
* Writes a line to the model, can be used to write new lines or to update existing lines
* @param modelID Model handle retrieved by OpenModel
* @param lineObject array of line object to write
*/
WriteLines<Type extends IfcLineObject>(modelID: number, lineObjects: Array<Type>): void;
/**
* Writes a set of line to the model, can be used to write new lines or to update existing lines
* @param modelID Model handle retrieved by OpenModel
* @param lineObject line object to write
*/
WriteLine<Type extends IfcLineObject>(modelID: number, lineObject: Type): void;
/** @ignore */
FlattenLine(modelID: number, line: any): void;
/** @ignore */
GetRawLinesData(modelID: number, expressIDs: Array<number>): Array<RawLineData>;
/** @ignore */
GetRawLineData(modelID: number, expressID: number): RawLineData;
/** @ignore */
WriteRawLineData(modelID: number, data: RawLineData): void;
/** @ignore */
WriteRawLinesData(modelID: number, data: Array<RawLineData>): void;
/**
* Get all line IDs of a specific ifc type
* @param modelID model ID
* @param type ifc type, @see IfcEntities
* @param includeInherited if true, also returns all inherited types
* @returns vector of line IDs
*/
GetLineIDsWithType(modelID: number, type: number, includeInherited?: boolean): Vector<number>;
/**
* Get all line IDs of a model
* @param modelID model ID
* @returns vector of all line IDs
*/
GetAllLines(modelID: number): Vector<number>;
/**
* Returns all crossSections in 2D contained in IFCSECTIONEDSOLID, IFCSECTIONEDSURFACE, IFCSECTIONEDSOLIDHORIZONTAL (IFC4x3 or superior)
* @param modelID model ID
* @returns Lists with the cross sections curves as sets of points
*/
GetAllCrossSections2D(modelID: number): Array<CrossSection>;
/**
* Returns all crossSections in 3D contained in IFCSECTIONEDSOLID, IFCSECTIONEDSURFACE, IFCSECTIONEDSOLIDHORIZONTAL (IFC4x3 or superior)
* @param modelID model ID
* @returns Lists with the cross sections curves as sets of points
*/
GetAllCrossSections3D(modelID: number): Array<CrossSection>;
/**
* Returns all alignments contained in the IFC model (IFC4x3 or superior)
* @param modelID model ID
* @returns Lists with horizontal and vertical curves as sets of points
*/
GetAllAlignments(modelID: number): any;
/**
* Set the transformation matrix
* @param modelID model ID
* @param transformationMatrix transformation matrix, flat 4x4 matrix as array[16]
*/
SetGeometryTransformation(modelID: number, transformationMatrix: Array<number>): void;
/**
* Get the coordination matrix
* @param modelID model ID
* @returns flat 4x4 matrix as array[16]
*/
GetCoordinationMatrix(modelID: number): Array<number>;
GetWorldTransformMatrix(modelID: number, placementExpressId: number): Array<number>;
GetVertexArray(ptr: number, size: number): Float32Array;
GetIndexArray(ptr: number, size: number): Uint32Array;
getSubArray(heap: any, startPtr: number, sizeBytes: number): any;
/**
* Closes a model and frees all related memory
* @param modelID Model handle retrieved by OpenModel, model must be closed after use
*/
CloseModel(modelID: number): void;
/**
* Closes all models and frees all related memory. Please note that after calling this you must call Init() again to ensure web-ifc is in a working state.
*/
Dispose(): void;
/**
* Streams meshes of a model with specific express id
* @param modelID Model handle retrieved by OpenModel
* @param expressIDs expressIDs of elements to stream
* @param meshCallback callback function that is called for each mesh
*/
StreamMeshes(modelID: number, expressIDs: Array<number>, meshCallback: (mesh: FlatMesh, index: number, total: number) => void): void;
/**
* Streams all meshes of a model
* @param modelID Model handle retrieved by OpenModel
* @param meshCallback callback function that is called for each mesh
*/
StreamAllMeshes(modelID: number, meshCallback: (mesh: FlatMesh, index: number, total: number) => void): void;
/**
* Streams all meshes of a model with a specific ifc type
* @param modelID Model handle retrieved by OpenModel
* @param types types of elements to stream
* @param meshCallback callback function that is called for each mesh
*/
StreamAllMeshesWithTypes(modelID: number, types: Array<number>, meshCallback: (mesh: FlatMesh, index: number, total: number) => void): void;
/**
* Checks if a specific model ID is open or closed
* @param modelID Model handle retrieved by OpenModel
* @returns true if model is open, false if model is closed
*/
IsModelOpen(modelID: number): boolean;
/**
* Load all geometry in a model
* @param modelID Model handle retrieved by OpenModel
* @returns Vector of FlatMesh objects
*/
LoadAllGeometry(modelID: number): Vector<FlatMesh>;
/**
* Load geometry for a single element
* @param modelID Model handle retrieved by OpenModel
* @param expressID ExpressID of the element
* @returns FlatMesh object
*/
GetFlatMesh(modelID: number, expressID: number): FlatMesh;
/**
* Returns the maximum ExpressID value in the IFC file, ex.- #9999999
* @param modelID Model handle retrieved by OpenModel
* @returns Express numerical value
*/
GetMaxExpressID(modelID: number): number;
/**
* Returns the type of a given ifc entity in the fiule.
* @param modelID Model handle retrieved by OpenModel
* @param expressID Line Number
* @returns IFC Type Code
*/
GetLineType(modelID: number, expressID: number): any;
/**
* Returns the version number of web-ifc
* @returns The current version number as a string
*/
GetVersion(): any;
/**
* Looks up an entities express ID from its GlobalID.
* @param modelID Model handle retrieved by OpenModel
* @param guid GobalID to be looked up
* @returns expressID numerical value
*/
GetExpressIdFromGuid(modelID: number, guid: string): string | number | undefined;
/**
* Looks up an entities GlobalID from its ExpressID.
* @param modelID Model handle retrieved by OpenModel
* @param expressID express ID to be looked up
* @returns globalID string value
*/
GetGuidFromExpressId(modelID: number, expressID: number): string | number | undefined;
/** @ignore */
CreateIfcGuidToExpressIdMapping(modelID: number): void;
/**
* Sets the path to the wasm file
* @param path path to the wasm file
* @param absolute if true, path is absolute, otherwise it is relative to executing script
*/
SetWasmPath(path: string, absolute?: boolean): void;
/**
* Sets the log level
* @param level Log level to set
*/
SetLogLevel(level: LogLevel): void;
/**
* Encodes test using IFC Encoding
* @text the text to encode
* @returns the text encoded
*/
EncodeText(text: string): any;
/**
* Decodes test using IFC Encoding
* @text the text to decode
* @returns the text decoded
*/
DecodeText(text: string): any;
/**
* Resets the Cached IFC Data - useful when changing the geometry of a model
* @param modelID Model handle retrieved by OpenModel
*/
ResetCache(modelID: number): any;
}

74426
dist/library/assets/ifc/web-ifc-api-node.js vendored Normal file

File diff suppressed because one or more lines are too long

552
dist/library/assets/ifc/web-ifc-api.d.ts vendored Normal file
View file

@ -0,0 +1,552 @@
/**
* Web-IFC Main API Class
* @module web-ifc
*/
import { IfcLineObject } from "./ifc-schema";
export * from "./ifc-schema";
import { Properties } from "./helpers/properties";
export { Properties };
import { LogLevel } from "./helpers/log";
export { LogLevel };
export declare const UNKNOWN = 0;
export declare const STRING = 1;
export declare const LABEL = 2;
export declare const ENUM = 3;
export declare const REAL = 4;
export declare const REF = 5;
export declare const EMPTY = 6;
export declare const SET_BEGIN = 7;
export declare const SET_END = 8;
export declare const LINE_END = 9;
export declare const INTEGER = 10;
/**
* Settings for the IFCLoader
* @property {boolean} COORDINATE_TO_ORIGIN - If true, the model will be translated to the origin.
* @property {number} CIRCLE_SEGMENTS - Number of segments used to approximate circles.
* @property {number} MEMORY_LIMIT - Maximum memory (in bytes) to be reserved for IFC data in memory.
* @property {number} TAPE_SIZE - Size of the internal buffer tape for the loader (in bytes or units).
* @property {number} LINEWRITER_BUFFER - Number of lines to write to memory at a time when writing an IFC file.
* @property {number} TOLERANCE_PLANE_INTERSECTION - Numerical tolerance when checking plane intersections.
* @property {number} TOLERANCE_PLANE_DEVIATION - Tolerance to consider a plane on a boundary.
* @property {number} TOLERANCE_BACK_DEVIATION_DISTANCE - Used to determine if a point lies in front or behind a plane based on normal orientation.
* @property {number} TOLERANCE_INSIDE_OUTSIDE_PERIMETER - Tolerance for point-in-perimeter calculations.
* @property {number} TOLERANCE_SCALAR_EQUALITY - Tolerance used to compare scalar values as equal.
* @property {number} PLANE_REFIT_ITERATIONS - Number of iterations used when adjusting triangles to a plane.
* @property {number} BOOLEAN_UNION_THRESHOLD - Minimum number of solids before triggering a boolean union operation.
*/
export interface LoaderSettings {
COORDINATE_TO_ORIGIN?: boolean;
CIRCLE_SEGMENTS?: number;
MEMORY_LIMIT?: number;
TAPE_SIZE?: number;
LINEWRITER_BUFFER?: number;
TOLERANCE_PLANE_INTERSECTION?: number;
TOLERANCE_PLANE_DEVIATION?: number;
TOLERANCE_BACK_DEVIATION_DISTANCE?: number;
TOLERANCE_INSIDE_OUTSIDE_PERIMETER?: number;
TOLERANCE_SCALAR_EQUALITY?: number;
PLANE_REFIT_ITERATIONS?: number;
BOOLEAN_UNION_THRESHOLD?: number;
}
export interface Vector<T> extends Iterable<T> {
get(index: number): T;
size(): number;
}
export interface Color {
x: number;
y: number;
z: number;
w: number;
}
export interface RawLineData {
ID: number;
type: number;
arguments: any[];
}
export interface PlacedGeometry {
color: Color;
geometryExpressID: number;
flatTransformation: Array<number>;
}
export interface FlatMesh {
geometries: Vector<PlacedGeometry>;
expressID: number;
delete(): void;
}
export interface Point {
x: number;
y: number;
z?: number;
}
export interface Curve {
points: Array<Point>;
userData: Array<string>;
arcSegments: Array<number>;
}
export interface SweptDiskSolid {
profile: Profile;
axis: Array<Curve>;
profileRadius: number;
}
export interface Profile {
curve: Curve;
holes: Array<Curve>;
profiles: Array<Profile>;
isConvex: boolean;
isComposite: boolean;
}
export interface CrossSection {
curves: Array<Curve>;
expressID: Array<number>;
}
export interface AlignmentSegment {
curves: Array<Curve>;
}
export interface Alignment {
FlatCoordinationMatrix: Array<number>;
Horizontal: AlignmentSegment;
Vertical: AlignmentSegment;
Absolute: AlignmentSegment;
}
export interface IfcGeometry {
GetVertexData(): number;
GetVertexDataSize(): number;
GetIndexData(): number;
GetIndexDataSize(): number;
GetSweptDiskSolid(): SweptDiskSolid;
delete(): void;
}
export interface Buffers {
fvertexData: Array<number>;
indexData: Array<number>;
}
export interface AABB {
GetBuffers(): Buffers;
SetValues(minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number): void;
}
export interface Extrusion {
GetBuffers(): Buffers;
SetValues(profile_: Array<number>, dir_: Array<number>, len_: number, cuttingPlaneNormal_: Array<number>, cuttingPlanePos_: Array<number>, cap_: boolean): void;
SetHoles(profile_: Array<number>): void;
ClearHoles(): void;
}
export interface Sweep {
GetBuffers(): Buffers;
SetValues(scaling: number, closed: boolean, profile: Array<number>, directrix: Array<number>, initialNormal?: Array<number>, rotate90?: boolean, optimize?: boolean): void;
}
export interface CircularSweep {
GetBuffers(): Buffers;
SetValues(scaling: number, closed: boolean, profile: Array<number>, radius: number, directrix: Array<number>, initialNormal?: Array<number>, rotate90?: boolean): void;
}
export interface Revolution {
GetBuffers(): Buffers;
SetValues(profile_: Array<number>, transform_: Array<number>, startDegrees_: number, endDegrees_: number, numRots_: number): void;
}
export interface CylindricalRevolve {
GetBuffers(): Buffers;
SetValues(transform_: Array<number>, startDegrees_: number, endDegrees_: number, minZ_: number, maxZ_: number, numRots_: number, radius_: number): void;
}
export interface Parabola {
GetBuffers(): Buffers;
SetValues(segments: number, startPointX: number, startPointY: number, startPointZ: number, horizontalLength: number, startHeight: number, startGradient: number, endGradient: number): void;
}
export interface Clothoid {
GetBuffers(): Buffers;
SetValues(segments: number, startPointX: number, startPointY: number, startPointZ: number, ifcStartDirection: number, StartRadiusOfCurvature: number, EndRadiusOfCurvature: number, SegmentLength: number): void;
}
export interface Arc {
GetBuffers(): Buffers;
SetValues(radiusX: number, radiusY: number, numSegments: number, placement: Array<number>, startRad?: number, endRad?: number, swap?: boolean, normalToCenterEnding?: boolean): void;
}
export interface Alignment {
GetBuffers(): Buffers;
SetValues(horizontal: Array<number>, vertical: Array<number>): void;
}
export interface BooleanOperator {
GetBuffers(): Buffers;
SetValues(triangles_: Array<number>, type_: string): void;
SetSecond(triangles_: Array<number>): void;
clear(): void;
}
export interface ProfileSection {
GetBuffers(): Buffers;
SetValues(pType: number, width: number, depth: number, webThickness: number, flangeThickness: number, hasFillet: boolean, filletRadius: number, radius: number, slope: number, circleSegments: number, placement: Array<number>): void;
}
export interface IfcType {
typeID: number;
typeName: string;
}
export interface NewIfcModel {
schema: string;
name?: string;
description?: string[];
authors?: string[];
organizations?: string[];
authorization?: string;
}
export type ModelLoadCallback = (offset: number, size: number) => Uint8Array;
export type ModelSaveCallback = (data: Uint8Array) => void;
/** @ignore */
export declare function ms(): number;
export type LocateFileHandlerFn = (path: string, prefix: string) => string;
export declare class IfcAPI {
/** @ignore */
wasmModule: undefined | any;
private wasmPath;
private isWasmPathAbsolute;
private modelSchemaList;
private modelSchemaNameList;
/** @ignore */
ifcGuidMap: Map<number, Map<string | number, string | number>>;
private deletedLines;
/**
* Contains all the logic and methods regarding properties, psets, qsets, etc.
*/
properties: Properties;
/**
* Initializes the WASM module (WebIFCWasm), required before using any other functionality.
*
* @param customLocateFileHandler An optional locateFile function that let's
* you override the path from which the wasm module is loaded.
*/
Init(customLocateFileHandler?: LocateFileHandlerFn, forceSingleThread?: boolean): Promise<void>;
/**
* Opens a set of models and returns model IDs
* @param dataSets Array of Buffers containing IFC data (bytes)
* @param settings Settings for loading the model @see LoaderSettings
* @returns Array of model IDs
*/
OpenModels(dataSets: Array<Uint8Array>, settings?: LoaderSettings): Array<number>;
private CreateSettings;
private LookupSchemaId;
/**
* Opens a model and returns a modelID number
* @param data Buffer containing IFC data (bytes)
* @param settings Settings for loading the model @see LoaderSettings
* @returns ModelID or -1 if model fails to open
*/
OpenModel(data: Uint8Array, settings?: LoaderSettings): number;
/**
* Opens a model and returns a modelID number
* @param callback a function of signature (offset:number, size: number) => Uint8Array that will retrieve the IFC data
* @param settings Settings for loading the model @see LoaderSettings
* @returns ModelID or -1 if model fails to open
*/
OpenModelFromCallback(callback: ModelLoadCallback, settings?: LoaderSettings): number;
/**
* Fetches the ifc schema version of a given model
* @param modelID Model ID
* @returns IFC Schema version
*/
GetModelSchema(modelID: number): string;
/**
* Creates a new model and returns a modelID number
* @param schema ifc schema version
* @returns ModelID
*/
CreateModel(model: NewIfcModel, settings?: LoaderSettings): number;
/**
* Saves a model to a Buffer
* @param modelID Model ID
* @returns Buffer containing the model data
*/
SaveModel(modelID: number): Uint8Array;
/**
* Saves a model to a Buffer
* @param modelID Model ID
* @returns Buffer containing the model data
*/
SaveModelToCallback(modelID: number, callback: ModelSaveCallback): void;
/**
* Retrieves the geometry of an element
* @param modelID Model handle retrieved by OpenModel
* @param geometryExpressID express ID of the element
* @returns Geometry of the element as a list of vertices and indices
*/
GetGeometry(modelID: number, geometryExpressID: number): IfcGeometry;
CreateAABB(): any;
CreateExtrusion(): any;
CreateSweep(): any;
CreateCircularSweep(): any;
CreateRevolution(): any;
CreateCylindricalRevolution(): any;
CreateParabola(): any;
CreateClothoid(): any;
CreateArc(): any;
CreateAlignment(): any;
CreateBooleanOperator(): any;
CreateProfile(): any;
/**
* Gets the header information required by the user
* @param modelID Model handle retrieved by OpenModel
* @param headerType Type of header data you want to retrieve
* ifc.FILE_NAME, ifc.FILE_DESCRIPTION or ifc.FILE_SCHEMA
* @returns An object with parameters ID, type and arguments
*/
GetHeaderLine(modelID: number, headerType: number): any;
/**
* Gets the list of all ifcTypes contained in the model
* @param modelID Model handle retrieved by OpenModel
* @returns Array of objects containing typeID and typeName
*/
GetAllTypesOfModel(modelID: number): IfcType[];
/**
* Gets the ifc line data for a given express ID
* @param modelID Model handle retrieved by OpenModel
* @param expressID express ID of the line
* @param flatten recursively flatten the line, default false
* @param inverse get the inverse properties of the line, default false
* @param inversePropKey filters out all other properties from a inverse search, for a increase in performance. Default null
* @returns lineObject
*/
GetLine(modelID: number, expressID: number, flatten?: boolean, inverse?: boolean, inversePropKey?: string | null | undefined): any;
/**
* Gets the ifc line data for a given express ID
* @param modelID Model handle retrieved by OpenModel
* @param a list of expressID express ID of the line
* @param flatten recursively flatten the line, default false
* @param inverse get the inverse properties of the line, default false
* @param inversePropKey filters out all other properties from a inverse search, for a increase in performance. Default null
* @returns lineObject
*/
GetLines(modelID: number, expressIDs: Array<number>, flatten?: boolean, inverse?: boolean, inversePropKey?: string | null | undefined): any[];
/**
* Gets the next unused expressID
* @param modelID Model handle retrieved by OpenModel
* @param expressID Starting expressID value
* @returns The next unused expressID starting from the value provided
*/
GetNextExpressID(modelID: number, expressID: number): number;
/**
* Creates a new ifc entity
* @param modelID Model handle retrieved by OpenModel
* @param type Type code
* @param args Arguments required by the entity
* @returns An object contining the parameters of the new entity
*/
CreateIfcEntity(modelID: number, type: number, ...args: any[]): IfcLineObject;
/**
* Creates a new ifc globally unqiue ID
* @param modelID Model handle retrieved by OpenModel
* @returns An randomly generated globally unique ID
*/
CreateIFCGloballyUniqueId(modelID: number): any;
/**
* Creates a new ifc type i.e. IfcLabel, IfcReal, ...
* @param modelID Model handle retrieved by OpenModel
* @param type Type code
* @param value Type value
* @returns An object with the parameters of the type
*/
CreateIfcType(modelID: number, type: number, value: any): any;
/**
* Gets the name from a type code
* @param type Code
* @returns Name
*/
GetNameFromTypeCode(type: number): string;
/**
* Gets the type code from a name code
* @param name
* @returns type code
*/
GetTypeCodeFromName(typeName: string): number;
/**
* Evaluates if a type is subtype of IfcElement
* @param type Type code
* @returns True if subtype of Ifcelement, False if it is not subtype
*/
IsIfcElement(type: number): boolean;
/**
* Returns a list with all entity types that are present in the current schema
* @param modelID Model handle retrieved by OpenModel
* @returns Array of type codes
*/
GetIfcEntityList(modelID: number): Array<number>;
/**
* Deletes an IFC line from the model
* @param modelID Model handle retrieved by OpenModel
* @param expressID express ID of the line to remove
*/
DeleteLine(modelID: number, expressID: number): void;
/**
* Writes a line to the model, can be used to write new lines or to update existing lines
* @param modelID Model handle retrieved by OpenModel
* @param lineObject array of line object to write
*/
WriteLines<Type extends IfcLineObject>(modelID: number, lineObjects: Array<Type>): void;
/**
* Writes a set of line to the model, can be used to write new lines or to update existing lines
* @param modelID Model handle retrieved by OpenModel
* @param lineObject line object to write
*/
WriteLine<Type extends IfcLineObject>(modelID: number, lineObject: Type): void;
/** @ignore */
FlattenLine(modelID: number, line: any): void;
/** @ignore */
GetRawLinesData(modelID: number, expressIDs: Array<number>): Array<RawLineData>;
/** @ignore */
GetRawLineData(modelID: number, expressID: number): RawLineData;
/** @ignore */
WriteRawLineData(modelID: number, data: RawLineData): void;
/** @ignore */
WriteRawLinesData(modelID: number, data: Array<RawLineData>): void;
/**
* Get all line IDs of a specific ifc type
* @param modelID model ID
* @param type ifc type, @see IfcEntities
* @param includeInherited if true, also returns all inherited types
* @returns vector of line IDs
*/
GetLineIDsWithType(modelID: number, type: number, includeInherited?: boolean): Vector<number>;
/**
* Get all line IDs of a model
* @param modelID model ID
* @returns vector of all line IDs
*/
GetAllLines(modelID: number): Vector<number>;
/**
* Returns all crossSections in 2D contained in IFCSECTIONEDSOLID, IFCSECTIONEDSURFACE, IFCSECTIONEDSOLIDHORIZONTAL (IFC4x3 or superior)
* @param modelID model ID
* @returns Lists with the cross sections curves as sets of points
*/
GetAllCrossSections2D(modelID: number): Array<CrossSection>;
/**
* Returns all crossSections in 3D contained in IFCSECTIONEDSOLID, IFCSECTIONEDSURFACE, IFCSECTIONEDSOLIDHORIZONTAL (IFC4x3 or superior)
* @param modelID model ID
* @returns Lists with the cross sections curves as sets of points
*/
GetAllCrossSections3D(modelID: number): Array<CrossSection>;
/**
* Returns all alignments contained in the IFC model (IFC4x3 or superior)
* @param modelID model ID
* @returns Lists with horizontal and vertical curves as sets of points
*/
GetAllAlignments(modelID: number): any;
/**
* Set the transformation matrix
* @param modelID model ID
* @param transformationMatrix transformation matrix, flat 4x4 matrix as array[16]
*/
SetGeometryTransformation(modelID: number, transformationMatrix: Array<number>): void;
/**
* Get the coordination matrix
* @param modelID model ID
* @returns flat 4x4 matrix as array[16]
*/
GetCoordinationMatrix(modelID: number): Array<number>;
GetWorldTransformMatrix(modelID: number, placementExpressId: number): Array<number>;
GetVertexArray(ptr: number, size: number): Float32Array;
GetIndexArray(ptr: number, size: number): Uint32Array;
getSubArray(heap: any, startPtr: number, sizeBytes: number): any;
/**
* Closes a model and frees all related memory
* @param modelID Model handle retrieved by OpenModel, model must be closed after use
*/
CloseModel(modelID: number): void;
/**
* Closes all models and frees all related memory. Please note that after calling this you must call Init() again to ensure web-ifc is in a working state.
*/
Dispose(): void;
/**
* Streams meshes of a model with specific express id
* @param modelID Model handle retrieved by OpenModel
* @param expressIDs expressIDs of elements to stream
* @param meshCallback callback function that is called for each mesh
*/
StreamMeshes(modelID: number, expressIDs: Array<number>, meshCallback: (mesh: FlatMesh, index: number, total: number) => void): void;
/**
* Streams all meshes of a model
* @param modelID Model handle retrieved by OpenModel
* @param meshCallback callback function that is called for each mesh
*/
StreamAllMeshes(modelID: number, meshCallback: (mesh: FlatMesh, index: number, total: number) => void): void;
/**
* Streams all meshes of a model with a specific ifc type
* @param modelID Model handle retrieved by OpenModel
* @param types types of elements to stream
* @param meshCallback callback function that is called for each mesh
*/
StreamAllMeshesWithTypes(modelID: number, types: Array<number>, meshCallback: (mesh: FlatMesh, index: number, total: number) => void): void;
/**
* Checks if a specific model ID is open or closed
* @param modelID Model handle retrieved by OpenModel
* @returns true if model is open, false if model is closed
*/
IsModelOpen(modelID: number): boolean;
/**
* Load all geometry in a model
* @param modelID Model handle retrieved by OpenModel
* @returns Vector of FlatMesh objects
*/
LoadAllGeometry(modelID: number): Vector<FlatMesh>;
/**
* Load geometry for a single element
* @param modelID Model handle retrieved by OpenModel
* @param expressID ExpressID of the element
* @returns FlatMesh object
*/
GetFlatMesh(modelID: number, expressID: number): FlatMesh;
/**
* Returns the maximum ExpressID value in the IFC file, ex.- #9999999
* @param modelID Model handle retrieved by OpenModel
* @returns Express numerical value
*/
GetMaxExpressID(modelID: number): number;
/**
* Returns the type of a given ifc entity in the fiule.
* @param modelID Model handle retrieved by OpenModel
* @param expressID Line Number
* @returns IFC Type Code
*/
GetLineType(modelID: number, expressID: number): any;
/**
* Returns the version number of web-ifc
* @returns The current version number as a string
*/
GetVersion(): any;
/**
* Looks up an entities express ID from its GlobalID.
* @param modelID Model handle retrieved by OpenModel
* @param guid GobalID to be looked up
* @returns expressID numerical value
*/
GetExpressIdFromGuid(modelID: number, guid: string): string | number | undefined;
/**
* Looks up an entities GlobalID from its ExpressID.
* @param modelID Model handle retrieved by OpenModel
* @param expressID express ID to be looked up
* @returns globalID string value
*/
GetGuidFromExpressId(modelID: number, expressID: number): string | number | undefined;
/** @ignore */
CreateIfcGuidToExpressIdMapping(modelID: number): void;
/**
* Sets the path to the wasm file
* @param path path to the wasm file
* @param absolute if true, path is absolute, otherwise it is relative to executing script
*/
SetWasmPath(path: string, absolute?: boolean): void;
/**
* Sets the log level
* @param level Log level to set
*/
SetLogLevel(level: LogLevel): void;
/**
* Encodes test using IFC Encoding
* @text the text to encode
* @returns the text encoded
*/
EncodeText(text: string): any;
/**
* Decodes test using IFC Encoding
* @text the text to decode
* @returns the text decoded
*/
DecodeText(text: string): any;
/**
* Resets the Cached IFC Data - useful when changing the geometry of a model
* @param modelID Model handle retrieved by OpenModel
*/
ResetCache(modelID: number): any;
}

73594
dist/library/assets/ifc/web-ifc-api.js vendored Normal file

File diff suppressed because one or more lines are too long

BIN
dist/library/assets/ifc/web-ifc-mt.wasm vendored Executable file

Binary file not shown.

BIN
dist/library/assets/ifc/web-ifc-node.wasm vendored Executable file

Binary file not shown.

BIN
dist/library/assets/ifc/web-ifc.wasm vendored Executable file

Binary file not shown.