ifc-reader-2 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RenderMaterial = exports.FragmentInstance = exports.Fragment = void 0;
4
+ class Fragment {
5
+ constructor() {
6
+ this.normal = [];
7
+ this.position = [];
8
+ this.instances = [];
9
+ this.id = "";
10
+ }
11
+ }
12
+ exports.Fragment = Fragment;
13
+ class FragmentInstance {
14
+ constructor() {
15
+ this.id = "";
16
+ this.transform = [];
17
+ this.material = new RenderMaterial();
18
+ }
19
+ }
20
+ exports.FragmentInstance = FragmentInstance;
21
+ class RenderMaterial {
22
+ constructor() {
23
+ this.name = '';
24
+ this.opacity = 1;
25
+ this.metalness = 0;
26
+ this.roughness = 1;
27
+ this.red = 225;
28
+ this.green = 225;
29
+ this.blue = 225;
30
+ }
31
+ }
32
+ exports.RenderMaterial = RenderMaterial;
33
+ //# sourceMappingURL=base-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-types.js","sourceRoot":"","sources":["../src/base-types.ts"],"names":[],"mappings":";;;AAIA,MAAa,QAAQ;IAArB;QACE,WAAM,GAAa,EAAE,CAAC;QACtB,aAAQ,GAAa,EAAE,CAAC;QACxB,cAAS,GAAuB,EAAE,CAAC;QACnC,OAAE,GAAW,EAAE,CAAC;IAClB,CAAC;CAAA;AALD,4BAKC;AAGD,MAAa,gBAAgB;IAA7B;QACE,OAAE,GAAW,EAAE,CAAC;QAChB,cAAS,GAAU,EAAE,CAAC;QACtB,aAAQ,GAAkB,IAAI,cAAc,EAAE,CAAC;IACjD,CAAC;CAAA;AAJD,4CAIC;AAED,MAAa,cAAc;IAA3B;QACE,SAAI,GAAS,EAAE,CAAC;QAChB,YAAO,GAAS,CAAC,CAAC;QAClB,cAAS,GAAS,CAAC,CAAC;QACpB,cAAS,GAAS,CAAC,CAAC;QACpB,QAAG,GAAS,GAAG,CAAC;QAChB,UAAK,GAAS,GAAG,CAAC;QAClB,SAAI,GAAS,GAAG,CAAC;IACnB,CAAC;CAAA;AARD,wCAQC"}
@@ -0,0 +1,199 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.IFCReader = void 0;
13
+ const WEBIFC = require("web-ifc");
14
+ const ifc_fragment_settings_1 = require("./models/ifc-fragment-settings");
15
+ const spatial_structure_1 = require("./models/spatial-structure");
16
+ const THREE = require("three");
17
+ const ifc_json_exporter_1 = require("./models/ifc-json-exporter/ifc-json-exporter");
18
+ const base_types_1 = require("./base-types");
19
+ class IFCReader {
20
+ constructor() {
21
+ this._webIfc = new WEBIFC.IfcAPI();
22
+ this.settings = new ifc_fragment_settings_1.IfcFragmentSettings();
23
+ this._fragments = new Map();
24
+ this._spatialTree = new spatial_structure_1.SpatialStructure();
25
+ this._propertyExporter = new ifc_json_exporter_1.IfcJsonExporter();
26
+ this.release = "1.3.0";
27
+ this.settings.excludedCategories.add(WEBIFC.IFCOPENINGELEMENT);
28
+ }
29
+ setup() {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ if (this.settings.autoSetWasm) {
32
+ yield this.autoSetWasm();
33
+ }
34
+ });
35
+ }
36
+ autoSetWasm() {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ var _a;
39
+ const componentsPackage = yield fetch(`https://unpkg.com/openbim-components@${this.release}/package.json`);
40
+ if (!componentsPackage.ok) {
41
+ console.warn("Couldn't get openbim-components package.json. Set wasm settings manually.");
42
+ return;
43
+ }
44
+ const componentsPackageJSON = yield componentsPackage.json();
45
+ if (!((_a = "web-ifc" in componentsPackageJSON.peerDependencies) !== null && _a !== void 0 ? _a : {})) {
46
+ console.warn("Couldn't get web-ifc from peer dependencies in openbim-components. Set wasm settings manually.");
47
+ }
48
+ else {
49
+ const webIfcVer = componentsPackageJSON.peerDependencies["web-ifc"];
50
+ this.settings.wasm.path = `https://unpkg.com/web-ifc@${webIfcVer}/`;
51
+ this.settings.wasm.absolute = true;
52
+ }
53
+ });
54
+ }
55
+ //#region read file
56
+ loadByUrl(url) {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ //dispose before using, clear previous data
59
+ this._dispose();
60
+ const file = yield fetch(url);
61
+ const data = yield file.arrayBuffer();
62
+ const buffer = new Uint8Array(data);
63
+ return yield this.load(buffer);
64
+ });
65
+ }
66
+ load(data_1) {
67
+ return __awaiter(this, arguments, void 0, function* (data, coordinate = true) {
68
+ yield this.readIfcFile(data);
69
+ const group = yield this.getAllGeometries();
70
+ const properties = yield this.getAllProperties();
71
+ const coordinationMatrix = yield this.getWorldCoordinationMatrix();
72
+ console.log(properties);
73
+ // console.log(coordinationMatrix);
74
+ // console.log(this._visitedFragments);
75
+ // console.log(this._fragmentInstances);
76
+ return Array.from(this._fragments.values());
77
+ });
78
+ }
79
+ readIfcFile(data) {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ const { path, absolute, logLevel } = this.settings.wasm;
82
+ this._webIfc.SetWasmPath(path, absolute);
83
+ yield this._webIfc.Init();
84
+ if (logLevel) {
85
+ this._webIfc.SetLogLevel(logLevel);
86
+ }
87
+ return this._webIfc.OpenModel(data, this.settings.webIfc);
88
+ });
89
+ }
90
+ getAllGeometries() {
91
+ return __awaiter(this, void 0, void 0, function* () {
92
+ // Precompute the level and category to which each item belongs
93
+ this._spatialTree.setUp(this._webIfc);
94
+ // Get all entities in IFC file, it will the same with element type in revit
95
+ const allIfcEntities = this._webIfc.GetIfcEntityList(0);
96
+ const ids = [];
97
+ for (const type of allIfcEntities) {
98
+ if (!this._webIfc.IsIfcElement(type) && type !== WEBIFC.IFCSPACE) {
99
+ continue;
100
+ }
101
+ if (this.settings.excludedCategories.has(type)) {
102
+ continue;
103
+ }
104
+ //get all elements in that entity
105
+ const result = this._webIfc.GetLineIDsWithType(0, type);
106
+ const size = result.size();
107
+ for (let i = 0; i < size; i++) {
108
+ const itemID = result.get(i);
109
+ ids.push(itemID);
110
+ const level = this._spatialTree.itemsByFloor[itemID] || 0;
111
+ // group.data.set(itemID, [[], [level, type]]);
112
+ }
113
+ }
114
+ // retrieve geometries
115
+ this._webIfc.StreamMeshes(0, ids, (mesh) => {
116
+ // mesh like element geometries, group of solid
117
+ this.getMesh(mesh);
118
+ });
119
+ });
120
+ }
121
+ getMesh(mesh) {
122
+ const size = mesh.geometries.size();
123
+ // this is elementID
124
+ const id = mesh.expressID;
125
+ for (let i = 0; i < size; i++) {
126
+ // geometry like face in revit
127
+ const geometry = mesh.geometries.get(i);
128
+ const { x, y, z, w } = geometry.color;
129
+ const transparent = w !== 1;
130
+ const { geometryExpressID } = geometry;
131
+ //each solid will return buffer geometry
132
+ const geometryID = `${geometryExpressID}-${transparent}`;
133
+ // Check if fragment exist or not
134
+ let fragment = this._fragments.get(geometryID);
135
+ if (!fragment) {
136
+ const buffer = this.getGeometry(this._webIfc, geometryExpressID);
137
+ fragment = new base_types_1.Fragment();
138
+ fragment.normal = Array.from(buffer.attributes.normal.array);
139
+ fragment.position = Array.from(buffer.attributes.position.array);
140
+ fragment.id = geometryID;
141
+ this._fragments.set(geometryID, fragment);
142
+ }
143
+ // Save this instance of this geometry
144
+ const color = new THREE.Color().setRGB(x, y, z, "srgb");
145
+ const transform = new THREE.Matrix4();
146
+ transform.fromArray(geometry.flatTransformation);
147
+ let fragmentInstance = new base_types_1.FragmentInstance();
148
+ fragmentInstance.id = id.toString();
149
+ fragmentInstance.transform = transform.toArray();
150
+ fragmentInstance.material.red = color.r;
151
+ fragmentInstance.material.green = color.g;
152
+ fragmentInstance.material.blue = color.b;
153
+ fragmentInstance.material.opacity = transparent ? 0.5 : 1;
154
+ fragment.instances.push(fragmentInstance);
155
+ }
156
+ }
157
+ getGeometry(webIfc, geometryExpressID) {
158
+ const geometry = webIfc.GetGeometry(0, geometryExpressID);
159
+ const index = webIfc.GetIndexArray(geometry.GetIndexData(), geometry.GetIndexDataSize());
160
+ const vertexData = webIfc.GetVertexArray(geometry.GetVertexData(), geometry.GetVertexDataSize());
161
+ const position = new Float32Array(vertexData.length / 2);
162
+ const normal = new Float32Array(vertexData.length / 2);
163
+ for (let i = 0; i < vertexData.length; i += 6) {
164
+ position[i / 2] = vertexData[i];
165
+ position[i / 2 + 1] = vertexData[i + 1];
166
+ position[i / 2 + 2] = vertexData[i + 2];
167
+ normal[i / 2] = vertexData[i + 3];
168
+ normal[i / 2 + 1] = vertexData[i + 4];
169
+ normal[i / 2 + 2] = vertexData[i + 5];
170
+ }
171
+ const bufferGeometry = new THREE.BufferGeometry();
172
+ const posAttr = new THREE.BufferAttribute(position, 3);
173
+ const norAttr = new THREE.BufferAttribute(normal, 3);
174
+ bufferGeometry.setAttribute("position", posAttr);
175
+ bufferGeometry.setAttribute("normal", norAttr);
176
+ bufferGeometry.setIndex(Array.from(index));
177
+ geometry.delete();
178
+ return bufferGeometry;
179
+ }
180
+ getAllProperties() {
181
+ return __awaiter(this, void 0, void 0, function* () {
182
+ return yield this._propertyExporter.export(this._webIfc, 0);
183
+ });
184
+ }
185
+ getWorldCoordinationMatrix() {
186
+ return __awaiter(this, void 0, void 0, function* () {
187
+ const matrix = this._webIfc.GetCoordinationMatrix(0);
188
+ return matrix;
189
+ });
190
+ }
191
+ //#endregion
192
+ _dispose() {
193
+ return __awaiter(this, void 0, void 0, function* () {
194
+ this._fragments.clear();
195
+ });
196
+ }
197
+ }
198
+ exports.IFCReader = IFCReader;
199
+ //# sourceMappingURL=ifc-reader.api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ifc-reader.api.js","sourceRoot":"","sources":["../src/ifc-reader.api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kCAAkC;AAClC,0EAAqE;AACrE,kEAA8D;AAC9D,+BAA+B;AAC/B,oFAA+E;AAC/E,6CAA0D;AAE1D,MAAa,SAAS;IASpB;QARQ,YAAO,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QACtC,aAAQ,GAAG,IAAI,2CAAmB,EAAE,CAAC;QAC7B,eAAU,GAAG,IAAI,GAAG,EAAoB,CAAC;QACzC,iBAAY,GAAG,IAAI,oCAAgB,EAAE,CAAC;QACtC,sBAAiB,GAAG,IAAI,mCAAe,EAAE,CAAC;QAEjC,YAAO,GAAG,OAAO,CAAC;QAGjC,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IACjE,CAAC;IAEY,KAAK;;YAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;gBAC9B,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;YAC3B,CAAC;QACH,CAAC;KAAA;IACa,WAAW;;;YACvB,MAAM,iBAAiB,GAAG,MAAM,KAAK,CACnC,wCAAwC,IAAI,CAAC,OAAO,eAAe,CACpE,CAAC;YACF,IAAI,CAAC,iBAAiB,CAAC,EAAE,EAAE,CAAC;gBAC1B,OAAO,CAAC,IAAI,CACV,2EAA2E,CAC5E,CAAC;gBACF,OAAO;YACT,CAAC;YACD,MAAM,qBAAqB,GAAG,MAAM,iBAAiB,CAAC,IAAI,EAAE,CAAC;YAC7D,IAAI,CAAC,CAAC,MAAA,SAAS,IAAI,qBAAqB,CAAC,gBAAgB,mCAAI,EAAE,CAAC,EAAE,CAAC;gBACjE,OAAO,CAAC,IAAI,CACV,gGAAgG,CACjG,CAAC;YACJ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AG,CAAC,CAAC,CAAC;QACxC,CAAC;QAED,MAAM,cAAc,GAAG,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;QAClD,MAAM,OAAO,GAAG,IAAI,KAAK,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QACvD,MAAM,OAAO,GAAG,IAAI,KAAK,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACrD,cAAc,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACjD,cAAc,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC/C,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAE3C,QAAQ,CAAC,MAAM,EAAE,CAAC;QAElB,OAAO,cAAc,CAAC;IACxB,CAAC;IAEa,gBAAgB;;YAC5B,OAAO,MAAM,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC9D,CAAC;KAAA;IAEa,0BAA0B;;YACtC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;YACrD,OAAO,MAAM,CAAC;QAChB,CAAC;KAAA;IACD,YAAY;IAEE,QAAQ;;YACpB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QAC1B,CAAC;KAAA;CACF;AAxMD,8BAwMC"}
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ifc-reader.api"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAgC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IfcCategories = void 0;
4
+ const ifc_elements_map_1 = require("./ifc-elements-map");
5
+ class IfcCategories {
6
+ getAll(webIfc, modelID) {
7
+ const elementsCategories = {};
8
+ const categoriesIDs = Object.keys(ifc_elements_map_1.IfcElements).map((e) => parseInt(e, 10));
9
+ for (let i = 0; i < categoriesIDs.length; i++) {
10
+ const element = categoriesIDs[i];
11
+ const lines = webIfc.GetLineIDsWithType(modelID, element);
12
+ const size = lines.size();
13
+ for (let i = 0; i < size; i++) {
14
+ elementsCategories[lines.get(i)] = element;
15
+ }
16
+ }
17
+ return elementsCategories;
18
+ }
19
+ }
20
+ exports.IfcCategories = IfcCategories;
21
+ //# sourceMappingURL=ifc-categories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ifc-categories.js","sourceRoot":"","sources":["../../src/models/ifc-categories.ts"],"names":[],"mappings":";;;AACA,yDAAiD;AAQjD,MAAa,aAAa;IACxB,MAAM,CAAC,MAAqB,EAAE,OAAe;QAC3C,MAAM,kBAAkB,GAAuB,EAAE,CAAC;QAClD,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,8BAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAE3E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9C,MAAM,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;YACjC,MAAM,KAAK,GAAG,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC1D,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;YAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC9B,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;YAC7C,CAAC;QACH,CAAC;QAED,OAAO,kBAAkB,CAAC;IAC5B,CAAC;CACF;AAhBD,sCAgBC"}
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IfcElements = void 0;
4
+ exports.IfcElements = {
5
+ 103090709: "IFCPROJECT",
6
+ 4097777520: "IFCSITE",
7
+ 4031249490: "IFCBUILDING",
8
+ 3124254112: "IFCBUILDINGSTOREY",
9
+ 3856911033: "IFCSPACE",
10
+ 1674181508: "IFCANNOTATION",
11
+ 25142252: "IFCCONTROLLER",
12
+ 32344328: "IFCBOILER",
13
+ 76236018: "IFCLAMP",
14
+ 90941305: "IFCPUMP",
15
+ 177149247: "IFCAIRTERMINALBOX",
16
+ 182646315: "IFCFLOWINSTRUMENT",
17
+ 263784265: "IFCFURNISHINGELEMENT",
18
+ 264262732: "IFCELECTRICGENERATOR",
19
+ 277319702: "IFCAUDIOVISUALAPPLIANCE",
20
+ 310824031: "IFCPIPEFITTING",
21
+ 331165859: "IFCSTAIR",
22
+ 342316401: "IFCDUCTFITTING",
23
+ 377706215: "IFCMECHANICALFASTENER",
24
+ 395920057: "IFCDOOR",
25
+ 402227799: "IFCELECTRICMOTOR",
26
+ 413509423: "IFCSYSTEMFURNITUREELEMENT",
27
+ 484807127: "IFCEVAPORATOR",
28
+ 486154966: "IFCWINDOWSTANDARDCASE",
29
+ 629592764: "IFCLIGHTFIXTURE",
30
+ 630975310: "IFCUNITARYCONTROLELEMENT",
31
+ 635142910: "IFCCABLECARRIERFITTING",
32
+ 639361253: "IFCCOIL",
33
+ 647756555: "IFCFASTENER",
34
+ 707683696: "IFCFLOWSTORAGEDEVICE",
35
+ 738039164: "IFCPROTECTIVEDEVICE",
36
+ 753842376: "IFCBEAM",
37
+ 812556717: "IFCTANK",
38
+ 819412036: "IFCFILTER",
39
+ 843113511: "IFCCOLUMN",
40
+ 862014818: "IFCELECTRICDISTRIBUTIONBOARD",
41
+ 900683007: "IFCFOOTING",
42
+ 905975707: "IFCCOLUMNSTANDARDCASE",
43
+ 926996030: "IFCVOIDINGFEATURE",
44
+ 979691226: "IFCREINFORCINGBAR",
45
+ 987401354: "IFCFLOWSEGMENT",
46
+ 1003880860: "IFCELECTRICTIMECONTROL",
47
+ 1051757585: "IFCCABLEFITTING",
48
+ 1052013943: "IFCDISTRIBUTIONCHAMBERELEMENT",
49
+ 1062813311: "IFCDISTRIBUTIONCONTROLELEMENT",
50
+ 1073191201: "IFCMEMBER",
51
+ 1095909175: "IFCBUILDINGELEMENTPROXY",
52
+ 1156407060: "IFCPLATESTANDARDCASE",
53
+ 1162798199: "IFCSWITCHINGDEVICE",
54
+ 1329646415: "IFCSHADINGDEVICE",
55
+ 1335981549: "IFCDISCRETEACCESSORY",
56
+ 1360408905: "IFCDUCTSILENCER",
57
+ 1404847402: "IFCSTACKTERMINAL",
58
+ 1426591983: "IFCFIRESUPPRESSIONTERMINAL",
59
+ 1437502449: "IFCMEDICALDEVICE",
60
+ 1509553395: "IFCFURNITURE",
61
+ 1529196076: "IFCSLAB",
62
+ 1620046519: "IFCTRANSPORTELEMENT",
63
+ 1634111441: "IFCAIRTERMINAL",
64
+ 1658829314: "IFCENERGYCONVERSIONDEVICE",
65
+ 1677625105: "IFCCIVILELEMENT",
66
+ 1687234759: "IFCPILE",
67
+ 1904799276: "IFCELECTRICAPPLIANCE",
68
+ 1911478936: "IFCMEMBERSTANDARDCASE",
69
+ 1945004755: "IFCDISTRIBUTIONELEMENT",
70
+ 1973544240: "IFCCOVERING",
71
+ 1999602285: "IFCSPACEHEATER",
72
+ 2016517767: "IFCROOF",
73
+ 2056796094: "IFCAIRTOAIRHEATRECOVERY",
74
+ 2058353004: "IFCFLOWCONTROLLER",
75
+ 2068733104: "IFCHUMIDIFIER",
76
+ 2176052936: "IFCJUNCTIONBOX",
77
+ 2188021234: "IFCFLOWMETER",
78
+ 2223149337: "IFCFLOWTERMINAL",
79
+ 2262370178: "IFCRAILING",
80
+ 2272882330: "IFCCONDENSER",
81
+ 2295281155: "IFCPROTECTIVEDEVICETRIPPINGUNIT",
82
+ 2320036040: "IFCREINFORCINGMESH",
83
+ 2347447852: "IFCTENDONANCHOR",
84
+ 2391383451: "IFCVIBRATIONISOLATOR",
85
+ 2391406946: "IFCWALL",
86
+ 2474470126: "IFCMOTORCONNECTION",
87
+ 2769231204: "IFCVIRTUALELEMENT",
88
+ 2814081492: "IFCENGINE",
89
+ 2906023776: "IFCBEAMSTANDARDCASE",
90
+ 2938176219: "IFCBURNER",
91
+ 2979338954: "IFCBUILDINGELEMENTPART",
92
+ 3024970846: "IFCRAMP",
93
+ 3026737570: "IFCTUBEBUNDLE",
94
+ 3027962421: "IFCSLABSTANDARDCASE",
95
+ 3040386961: "IFCDISTRIBUTIONFLOWELEMENT",
96
+ 3053780830: "IFCSANITARYTERMINAL",
97
+ 3079942009: "IFCOPENINGSTANDARDCASE",
98
+ 3087945054: "IFCALARM",
99
+ 3101698114: "IFCSURFACEFEATURE",
100
+ 3127900445: "IFCSLABELEMENTEDCASE",
101
+ 3132237377: "IFCFLOWMOVINGDEVICE",
102
+ 3171933400: "IFCPLATE",
103
+ 3221913625: "IFCCOMMUNICATIONSAPPLIANCE",
104
+ 3242481149: "IFCDOORSTANDARDCASE",
105
+ 3283111854: "IFCRAMPFLIGHT",
106
+ 3296154744: "IFCCHIMNEY",
107
+ 3304561284: "IFCWINDOW",
108
+ 3310460725: "IFCELECTRICFLOWSTORAGEDEVICE",
109
+ 3319311131: "IFCHEATEXCHANGER",
110
+ 3415622556: "IFCFAN",
111
+ 3420628829: "IFCSOLARDEVICE",
112
+ 3493046030: "IFCGEOGRAPHICELEMENT",
113
+ 3495092785: "IFCCURTAINWALL",
114
+ 3508470533: "IFCFLOWTREATMENTDEVICE",
115
+ 3512223829: "IFCWALLSTANDARDCASE",
116
+ 3518393246: "IFCDUCTSEGMENT",
117
+ 3571504051: "IFCCOMPRESSOR",
118
+ 3588315303: "IFCOPENINGELEMENT",
119
+ 3612865200: "IFCPIPESEGMENT",
120
+ 3640358203: "IFCCOOLINGTOWER",
121
+ 3651124850: "IFCPROJECTIONELEMENT",
122
+ 3694346114: "IFCOUTLET",
123
+ 3747195512: "IFCEVAPORATIVECOOLER",
124
+ 3758799889: "IFCCABLECARRIERSEGMENT",
125
+ 3824725483: "IFCTENDON",
126
+ 3825984169: "IFCTRANSFORMER",
127
+ 3902619387: "IFCCHILLER",
128
+ 4074379575: "IFCDAMPER",
129
+ 4086658281: "IFCSENSOR",
130
+ 4123344466: "IFCELEMENTASSEMBLY",
131
+ 4136498852: "IFCCOOLEDBEAM",
132
+ 4156078855: "IFCWALLELEMENTEDCASE",
133
+ 4175244083: "IFCINTERCEPTOR",
134
+ 4207607924: "IFCVALVE",
135
+ 4217484030: "IFCCABLESEGMENT",
136
+ 4237592921: "IFCWASTETERMINAL",
137
+ 4252922144: "IFCSTAIRFLIGHT",
138
+ 4278956645: "IFCFLOWFITTING",
139
+ 4288193352: "IFCACTUATOR",
140
+ 4292641817: "IFCUNITARYEQUIPMENT",
141
+ 3009204131: "IFCGRID",
142
+ };
143
+ //# sourceMappingURL=ifc-elements-map.js.map
@@ -0,0 +1 @@
1
+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-0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IfcFragmentSettings = void 0;
4
+ const WEBIFC = require("web-ifc");
5
+ /** Configuration of the IFC-fragment conversion. */
6
+ class IfcFragmentSettings {
7
+ constructor() {
8
+ /** Whether to extract the IFC properties into a JSON. */
9
+ this.includeProperties = true;
10
+ /**
11
+ * Generate the geometry for categories that are not included by default,
12
+ * like IFCSPACE.
13
+ */
14
+ this.optionalCategories = [WEBIFC.IFCSPACE];
15
+ /** Whether to use the coordination data coming from the IFC files. */
16
+ this.coordinate = true;
17
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
18
+ this.wasm = {
19
+ path: "",
20
+ absolute: false,
21
+ logLevel: WEBIFC.LogLevel.LOG_LEVEL_OFF,
22
+ };
23
+ /** List of categories that won't be converted to fragments. */
24
+ this.excludedCategories = new Set();
25
+ /** Whether to save the absolute location of all IFC items. */
26
+ this.saveLocations = false;
27
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
28
+ this.webIfc = {
29
+ COORDINATE_TO_ORIGIN: true,
30
+ OPTIMIZE_PROFILES: true,
31
+ };
32
+ this.autoSetWasm = true;
33
+ this.customLocateFileHandler = null;
34
+ }
35
+ }
36
+ exports.IfcFragmentSettings = IfcFragmentSettings;
37
+ //# sourceMappingURL=ifc-fragment-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ifc-fragment-settings.js","sourceRoot":"","sources":["../../src/models/ifc-fragment-settings.ts"],"names":[],"mappings":";;;AAAA,kCAAkC;AAElC,oDAAoD;AACpD,MAAa,mBAAmB;IAAhC;QACE,yDAAyD;QACzD,sBAAiB,GAAG,IAAI,CAAC;QAEzB;;;WAGG;QACH,uBAAkB,GAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEjD,sEAAsE;QACtE,eAAU,GAAG,IAAI,CAAC;QAElB,kFAAkF;QAClF,SAAI,GAIA;YACF,IAAI,EAAE,EAAE;YACR,QAAQ,EAAE,KAAK;YACf,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,aAAa;SACxC,CAAC;QAEF,+DAA+D;QAC/D,uBAAkB,GAAG,IAAI,GAAG,EAAU,CAAC;QAEvC,8DAA8D;QAC9D,kBAAa,GAAG,KAAK,CAAC;QAEtB,iFAAiF;QACjF,WAAM,GAA0B;YAC9B,oBAAoB,EAAE,IAAI;YAC1B,iBAAiB,EAAE,IAAI;SACxB,CAAC;QAEF,gBAAW,GAAG,IAAI,CAAC;QAEnB,4BAAuB,GAAsC,IAAI,CAAC;IACpE,CAAC;CAAA;AAvCD,kDAuCC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GeometryTypes = void 0;
4
+ exports.GeometryTypes = new Set([
5
+ 1123145078, 574549367, 1675464909, 2059837836, 3798115385, 32440307,
6
+ 3125803723, 3207858831, 2740243338, 2624227202, 4240577450, 3615266464,
7
+ 3724593414, 220341763, 477187591, 1878645084, 1300840506, 3303107099,
8
+ 1607154358, 1878645084, 846575682, 1351298697, 2417041796, 3049322572,
9
+ 3331915920, 1416205885, 776857604, 3285139300, 3958052878, 2827736869,
10
+ 2732653382, 673634403, 3448662350, 4142052618, 2924175390, 803316827,
11
+ 2556980723, 1809719519, 2205249479, 807026263, 3737207727, 1660063152,
12
+ 2347385850, 3940055652, 2705031697, 3732776249, 2485617015, 2611217952,
13
+ 1704287377, 2937912522, 2770003689, 1281925730, 1484403080, 3448662350,
14
+ 4142052618, 3800577675, 4006246654, 3590301190, 1383045692, 2775532180,
15
+ 2047409740, 370225590, 3593883385, 2665983363, 4124623270, 812098782,
16
+ 3649129432, 987898635, 1105321065, 3510044353, 1635779807, 2603310189,
17
+ 3406155212, 1310608509, 4261334040, 2736907675, 3649129432, 1136057603,
18
+ 1260505505, 4182860854, 2713105998, 2898889636, 59481748, 3749851601,
19
+ 3486308946, 3150382593, 1062206242, 3264961684, 15328376, 1485152156,
20
+ 370225590, 1981873012, 2859738748, 45288368, 2614616156, 2732653382,
21
+ 775493141, 2147822146, 2601014836, 2629017746, 1186437898, 2367409068,
22
+ 1213902940, 3632507154, 3900360178, 476780140, 1472233963, 2804161546,
23
+ 3008276851, 738692330, 374418227, 315944413, 3905492369, 3570813810,
24
+ 2571569899, 178912537, 2294589976, 1437953363, 2133299955, 572779678,
25
+ 3092502836, 388784114, 2624227202, 1425443689, 3057273783, 2347385850,
26
+ 1682466193, 2519244187, 2839578677, 3958567839, 2513912981, 2830218821,
27
+ 427810014,
28
+ ]);
29
+ //# sourceMappingURL=ifc-geometry-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ifc-geometry-types.js","sourceRoot":"","sources":["../../../src/models/ifc-json-exporter/ifc-geometry-types.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG,IAAI,GAAG,CAAS;IAC3C,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ;IACnE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACtE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACpE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACrE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACrE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS;IACpE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU;IACrE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACtE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS;IACpE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACrE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU;IACpE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU;IACpE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU;IACnE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACrE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU;IACrE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU;IACnE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS;IACpE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACrE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACtE,SAAS;CACV,CAAC,CAAC"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.IfcJsonExporter = void 0;
13
+ const WEBIFC = require("web-ifc");
14
+ const ifc_geometry_types_1 = require("./ifc-geometry-types");
15
+ /**
16
+ * Object to export all the properties from an IFC to a JS object.
17
+ */
18
+ class IfcJsonExporter {
19
+ /**
20
+ * Exports all the properties of an IFC into an array of JS objects.
21
+ * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
22
+ * @param modelID ID of the IFC model whose properties to extract.
23
+ * @param indirect whether to get the indirect relationships as well.
24
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
25
+ * to make the location data available (e.g. absolute position of building).
26
+ */
27
+ export(webIfc_1, modelID_1) {
28
+ return __awaiter(this, arguments, void 0, function* (webIfc, modelID, indirect = false, recursiveSpatial = true) {
29
+ const properties = {};
30
+ const allIfcEntities = new Set(webIfc.GetIfcEntityList(modelID));
31
+ // let finalCount = 0;
32
+ // Spatial items get their properties recursively to make
33
+ // the location data available (e.g. absolute position of building)
34
+ const spatialStructure = new Set([
35
+ WEBIFC.IFCPROJECT,
36
+ WEBIFC.IFCSITE,
37
+ WEBIFC.IFCBUILDING,
38
+ WEBIFC.IFCBUILDINGSTOREY,
39
+ WEBIFC.IFCSPACE,
40
+ ]);
41
+ for (const type of spatialStructure) {
42
+ allIfcEntities.add(type);
43
+ }
44
+ for (const type of allIfcEntities) {
45
+ if (ifc_geometry_types_1.GeometryTypes.has(type)) {
46
+ continue;
47
+ }
48
+ const recursive = spatialStructure.has(type) && recursiveSpatial;
49
+ const ids = webIfc.GetLineIDsWithType(modelID, type);
50
+ // const allIDs = this._webIfc.GetAllLines(0);
51
+ for (const id of ids) {
52
+ const property = webIfc.GetLine(0, id, recursive, indirect);
53
+ properties[property.expressID] = property;
54
+ }
55
+ }
56
+ return properties;
57
+ });
58
+ }
59
+ }
60
+ exports.IfcJsonExporter = IfcJsonExporter;
61
+ //# sourceMappingURL=ifc-json-exporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ifc-json-exporter.js","sourceRoot":"","sources":["../../../src/models/ifc-json-exporter/ifc-json-exporter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kCAAkC;AAClC,6DAAqD;AAGrD;;GAEG;AACH,MAAa,eAAe;IAC1B;;;;;;;OAOG;IACG,MAAM;6DACV,MAAqB,EACrB,OAAe,EACf,QAAQ,GAAG,KAAK,EAChB,gBAAgB,GAAG,IAAI;YAEvB,MAAM,UAAU,GAAkB,EAAE,CAAC;YAErC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;YAEjE,sBAAsB;YAEtB,yDAAyD;YACzD,mEAAmE;YACnE,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;gBAC/B,MAAM,CAAC,UAAU;gBACjB,MAAM,CAAC,OAAO;gBACd,MAAM,CAAC,WAAW;gBAClB,MAAM,CAAC,iBAAiB;gBACxB,MAAM,CAAC,QAAQ;aAChB,CAAC,CAAC;YAEH,KAAK,MAAM,IAAI,IAAI,gBAAgB,EAAE,CAAC;gBACpC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC3B,CAAC;YAED,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE,CAAC;gBAClC,IAAI,kCAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC5B,SAAS;gBACX,CAAC;gBAED,MAAM,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,gBAAgB,CAAC;gBAEjE,MAAM,GAAG,GAAG,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;gBAErD,8CAA8C;gBAC9C,KAAK,MAAM,EAAE,IAAI,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