Skip to content

Commit

Permalink
fix: ifcPropertiesProcessor.getProperties (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanLecallier authored Mar 29, 2024
1 parent 7d42dca commit 9aa8ba1
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/ifc/IfcPropertiesProcessor/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as WEBIFC from "web-ifc";
import { FragmentsGroup } from "bim-fragment";
import { FragmentsGroup, IfcProperties } from "bim-fragment";
import { IfcPropertiesUtils } from "../IfcPropertiesUtils";
import { Button, FloatingWindow, SimpleUIComponent, TreeView } from "../../ui";
import { Disposable, Event, UI, UIElement, Component } from "../../base-types";
@@ -158,11 +158,19 @@ export class IfcPropertiesProcessor

async getProperties(model: FragmentsGroup, id: string) {
if (!model.hasProperties) return null;
const modelProperties: IfcProperties | undefined =
model.getLocalProperties();
if (modelProperties === undefined) {
return null;
}
const map = this._indexMap[model.uuid];
if (!map) return null;
const indices = map[id];
const idNumber = parseInt(id, 10);
const props = model.getProperties(idNumber);
const props = await model.getProperties(idNumber);
if (!props) {
throw new Error("Properties not found!");
}
const nativeProperties = this.cloneProperty(props);

if (!nativeProperties) {
@@ -173,12 +181,12 @@ export class IfcPropertiesProcessor

if (indices) {
for (const index of indices) {
const props = model.getProperties(index);
const props = await model.getProperties(index);
if (!props) continue;
const pset = this.cloneProperty(props);
if (!pset) continue;
this.getPsetProperties(pset, model);
this.getNestedPsets(pset, model);
this.getPsetProperties(pset, modelProperties);
this.getNestedPsets(pset, modelProperties);
properties.push(pset);
}
}

0 comments on commit 9aa8ba1

Please sign in to comment.