diff --git a/package.json b/package.json index f9716c4..0e3f19d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bim-fragment", - "version": "1.3.20", + "version": "1.3.22", "description": "3D BIM Geometry API", "main": "src/index.js", "scripts": { diff --git a/resources/fragment.js b/resources/fragment.js index e6ac50c..8c78998 100644 --- a/resources/fragment.js +++ b/resources/fragment.js @@ -7516,6 +7516,28 @@ class FragmentsGroup extends THREE.Group { this.items = []; this.ifcCivil = undefined; } + setProperties(properties) { + this._properties = properties; + } + getAllIDs() { + if (this._properties) { + return Object.keys(this._properties).map((id) => parseInt(id, 10)); + } + return Array.from(this.streamSettings.ids.keys()); + } + getAllTypes() { + if (this._properties) { + const types = new Set(); + for (const id in this._properties) { + const property = this._properties[id]; + if (property.type !== undefined) { + types.add(property.type); + } + } + return Array.from(types); + } + return Array.from(this.streamSettings.types.keys()); + } getProperties(id) { if (!this._properties) { throw new Error("Properties not initialized!"); diff --git a/src/fragments-group.ts b/src/fragments-group.ts index 37b3664..413fa57 100644 --- a/src/fragments-group.ts +++ b/src/fragments-group.ts @@ -77,6 +77,31 @@ export class FragmentsGroup extends THREE.Group { this.ifcCivil = undefined; } + setProperties(properties: IfcProperties) { + this._properties = properties; + } + + getAllIDs() { + if (this._properties) { + return Object.keys(this._properties).map((id) => parseInt(id, 10)); + } + return Array.from(this.streamSettings.ids.keys()); + } + + getAllTypes() { + if (this._properties) { + const types = new Set(); + for (const id in this._properties) { + const property = this._properties[id]; + if (property.type !== undefined) { + types.add(property.type); + } + } + return Array.from(types); + } + return Array.from(this.streamSettings.types.keys()); + } + getProperties(id: number): IfcProperties | null { if (!this._properties) { throw new Error("Properties not initialized!");