diff --git a/packages/core/package.json b/packages/core/package.json index e637eecc..ef6cc752 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components", "description": "Collection of core functionalities to author BIM apps.", - "version": "2.1.9", + "version": "2.1.11", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", diff --git a/packages/core/src/core/Components/index.ts b/packages/core/src/core/Components/index.ts index 5dd2a827..79a41adb 100644 --- a/packages/core/src/core/Components/index.ts +++ b/packages/core/src/core/Components/index.ts @@ -14,7 +14,7 @@ export class Components implements Disposable { /** * The version of the @thatopen/components library. */ - static readonly release = "2.1.9"; + static readonly release = "2.1.11"; /** {@link Disposable.onDisposed} */ readonly onDisposed = new Event(); diff --git a/packages/core/src/fragments/Classifier/index.ts b/packages/core/src/fragments/Classifier/index.ts index e075add0..237b62e9 100644 --- a/packages/core/src/fragments/Classifier/index.ts +++ b/packages/core/src/fragments/Classifier/index.ts @@ -356,7 +356,7 @@ export class Classifier extends Component implements Disposable { */ async bySpatialStructure( model: FRAGS.FragmentsGroup, - config: { useProperties?: boolean; isolate?: Set }, + config: { useProperties?: boolean; isolate?: Set } = {}, ) { const indexer = this.components.get(IfcRelationsIndexer); const modelRelations = indexer.relationMaps[model.uuid]; @@ -368,8 +368,8 @@ export class Classifier extends Component implements Disposable { const systemName = "spatialStructures"; // If useProperties is undefined, use properties by default - const propsUndefined = config.useProperties === undefined; - const useProperties = propsUndefined || config.useProperties; + const noProps = config.useProperties === undefined; + const useProperties = noProps || config.useProperties; for (const [expressID] of modelRelations) { // E.g. if the user just wants the building storeys diff --git a/packages/core/src/fragments/Hider/example.ts b/packages/core/src/fragments/Hider/example.ts index c1c5ce4b..2d09d6e7 100644 --- a/packages/core/src/fragments/Hider/example.ts +++ b/packages/core/src/fragments/Hider/example.ts @@ -20,6 +20,7 @@ In this tutorial, we will import: import Stats from "stats.js"; import * as BUI from "@thatopen/ui"; +import * as WEBIFC from "web-ifc"; import * as OBC from "@thatopen/components"; /* MD @@ -109,7 +110,9 @@ const hider = components.get(OBC.Hider); const classifier = components.get(OBC.Classifier); classifier.byEntity(model); -await classifier.bySpatialStructure(model); +await classifier.bySpatialStructure(model, { + isolate: new Set([WEBIFC.IFCBUILDINGSTOREY]), +}); /* MD ### ⏱️ Measuring the performance (optional) diff --git a/packages/core/src/ifc/IfcRelationsIndexer/index.ts b/packages/core/src/ifc/IfcRelationsIndexer/index.ts index 2a46a629..761fa013 100644 --- a/packages/core/src/ifc/IfcRelationsIndexer/index.ts +++ b/packages/core/src/ifc/IfcRelationsIndexer/index.ts @@ -259,7 +259,7 @@ export class IfcRelationsIndexer extends Component implements Disposable { } const entityRelations = indexMap.get(expressID); const attributeIndex = this.getAttributeIndex(relationName); - if (!(entityRelations && attributeIndex)) { + if (entityRelations === undefined || attributeIndex === null) { return null; } const relations = entityRelations.get(attributeIndex);