Skip to content

Commit

Permalink
fix: various corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
agviegas committed Feb 29, 2024
1 parent cf27dfa commit 03c70f4
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 47 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openbim-components",
"version": "1.4.5",
"version": "1.4.9",
"main": "src/index.js",
"author": "harry collin, antonio gonzalez viegas",
"license": "MIT",
Expand Down
15 changes: 10 additions & 5 deletions resources/openbim-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -101522,6 +101522,11 @@ class FragmentIfcLoader extends Component {
console.log(`Streaming the IFC took ${performance.now() - before} ms!`);
const fragments = this.components.tools.get(FragmentManager);
fragments.groups.push(group);
for (const frag of group.items) {
fragments.list[frag.id] = frag;
frag.mesh.uuid = frag.id;
frag.group = group;
}
await this.onIfcLoaded.trigger(group);
return group;
}
Expand Down Expand Up @@ -102107,16 +102112,16 @@ class FragmentHighlighter extends Component {
if (removePrevious) {
await this.clear(name);
}
if (!this.selection[name][mesh.uuid]) {
this.selection[name][mesh.uuid] = new Set();
if (!this.selection[name][mesh.fragment.id]) {
this.selection[name][mesh.fragment.id] = new Set();
}
fragList.push(mesh.fragment);
const itemID = mesh.fragment.getItemID(instanceID);
if (itemID === null) {
throw new Error("Item ID not found!");
}
this.selection[name][mesh.uuid].add(itemID);
await this.regenerate(name, mesh.uuid);
this.selection[name][mesh.fragment.id].add(itemID);
await this.regenerate(name, mesh.fragment.id);
const group = mesh.fragment.group;
if (group) {
const data = group.data.get(itemID);
Expand All @@ -102130,7 +102135,7 @@ class FragmentHighlighter extends Component {
if (!fragID) {
throw new Error("Fragment ID not found!");
}
if (fragID === mesh.uuid)
if (fragID === mesh.fragment.id)
continue;
const fragment = fragments.list[fragID];
fragList.push(fragment);
Expand Down
10 changes: 5 additions & 5 deletions src/fragments/FragmentHighlighter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ export class FragmentHighlighter
await this.clear(name);
}

if (!this.selection[name][mesh.uuid]) {
this.selection[name][mesh.uuid] = new Set<number>();
if (!this.selection[name][mesh.fragment.id]) {
this.selection[name][mesh.fragment.id] = new Set<number>();
}

fragList.push(mesh.fragment);
Expand All @@ -270,8 +270,8 @@ export class FragmentHighlighter
throw new Error("Item ID not found!");
}

this.selection[name][mesh.uuid].add(itemID);
await this.regenerate(name, mesh.uuid);
this.selection[name][mesh.fragment.id].add(itemID);
await this.regenerate(name, mesh.fragment.id);

const group = mesh.fragment.group;
if (group) {
Expand All @@ -288,7 +288,7 @@ export class FragmentHighlighter
throw new Error("Fragment ID not found!");
}

if (fragID === mesh.uuid) continue;
if (fragID === mesh.fragment.id) continue;
const fragment = fragments.list[fragID];
fragList.push(fragment);

Expand Down
6 changes: 6 additions & 0 deletions src/fragments/FragmentIfcLoader/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ export class FragmentIfcLoader
const fragments = this.components.tools.get(FragmentManager);
fragments.groups.push(group);

for (const frag of group.items) {
fragments.list[frag.id] = frag;
frag.mesh.uuid = frag.id;
frag.group = group;
}

await this.onIfcLoaded.trigger(group);

return group;
Expand Down
8 changes: 6 additions & 2 deletions src/fragments/FragmentIfcLoader/src/ifc-fragment-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ export class IfcFragmentSettings {
coordinate = true;

/** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
wasm = {
wasm: {
path: string;
absolute: boolean;
logLevel?: WEBIFC.LogLevel;
} = {
path: "",
absolute: false,
logLevel: WEBIFC.LogLevel.LOG_LEVEL_OFF as WEBIFC.LogLevel | undefined,
logLevel: WEBIFC.LogLevel.LOG_LEVEL_OFF,
};

/** List of categories that won't be converted to fragments. */
Expand Down
18 changes: 18 additions & 0 deletions src/fragments/FragmentIfcStreamer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,24 @@
const customEffects = components.renderer.postproduction.customEffects;
customEffects.excludedMeshes.push(grid.get());

/*MD
### 🔥🚀 Let's go BIG
___
Some BIM models are really heavy, so displaying them using normal methods is not possible.
Luckily for you, we have created a system that can load gigabytes of IFC even in modest
devices: BIM Tiles! 🧩
:::info Are you using a library/framework like React, Angular or vue?
Then probably you have other mechanisms for getting a reference to the
HTML div element. However you do it, as long as you get a reference
in your code, you are good to go!
:::
*/

// GEOMETRY STREAMING - OK

// const streamer = new OBC.FragmentIfcStreamConverter(components);
Expand Down
14 changes: 2 additions & 12 deletions src/fragments/FragmentTree/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@
const buffer = new Uint8Array(data);
const model = await fragments.load(buffer);

const file2 = await fetch("../../../resources/small2.frag");
const data2 = await file2.arrayBuffer();
const buffer2 = new Uint8Array(data2);
const model2 = await fragments.load(buffer2);

/*MD
### 🕹 Selection of Fragments
Expand Down Expand Up @@ -163,9 +158,6 @@
const properties = await fetch("../../../resources/small.json");
model.setLocalProperties(await properties.json());

const properties2 = await fetch("../../../resources/small2.json");
model2.setLocalProperties(await properties2.json());

/*MD
Now that we have the properties, we will pass the model to classifier and use `classifier.byStorey()` which will group the Fragments according to Floors.
Expand All @@ -174,11 +166,9 @@
*/

// classifier.byStorey(model);
// classifier.byEntity(model);
classifier.byStorey(model);
classifier.byEntity(model);

classifier.byStorey(model2);
classifier.byEntity(model2);

/*MD
Expand Down
14 changes: 3 additions & 11 deletions src/ifc/IfcPropertiesManager/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,9 @@
(selection) => {
const fragmentID = Object.keys(selection)[0];
const expressID = [...selection[fragmentID]][0];
let model
for (const group of fragments.groups) {
for(const [_key, value] of group.keyFragments) {
if(value === fragmentID) {
model = group;
break;
}
}
}
if(model) {
propsProcessor.renderProperties(model, expressID);
const fragment = fragments.list[fragmentID];
if(fragment.group) {
propsProcessor.renderProperties(fragment.group, expressID);
}
}
);
Expand Down
14 changes: 3 additions & 11 deletions src/ifc/IfcPropertiesProcessor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,9 @@
(selection) => {
const fragmentID = Object.keys(selection)[0];
const expressID = [...selection[fragmentID]][0];
let model
for (const group of fragments.groups) {
for(const [_key, value] of group.keyFragments) {
if(value === fragmentID) {
model = group;
break;
}
}
}
if(model) {
propsProcessor.renderProperties(model, expressID);
const fragment = fragments.list[fragmentID];
if(fragment.group) {
propsProcessor.renderProperties(fragment.group, expressID);
}
}
);
Expand Down

0 comments on commit 03c70f4

Please sign in to comment.