thatopen / engine_fragment Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://ifcjs.github.io/fragment/example
License: MIT License
Home Page: https://ifcjs.github.io/fragment/example
License: MIT License
I suggest moving three js dependency out of dependencies, to peerDependencies and devDependencies, this way i believe we can reduce total size of a library.
"dependencies": {
"flatbuffers": "^23.3.3",
"three": "0.152.2",
"three-mesh-bvh": "0.6.0"
}
->
"dependencies": {
"flatbuffers": "^23.3.3",
"three-mesh-bvh": "0.6.0"
}
"devDependencies": {
...
"three": "0.152.2",
}
"peerDependencies": {
"three": "0.152.2",
}
No response
I beleive this direct dependency to be primary suspect of really heavy size of the bundle.
FragmentGroup.getFragmentMap returns "FragmentMap", but APIs such as OBC.Highlighter.highlightByID requests "FragmentIdMap". Therefore, I need to write the following conversion code myself. I think this is a bug because "FragmentMap" and "FragmentIdMap" are the same concept.
const item: any = OBC.IfcPropertiesUtils.findItemByGuid(this.groups[0].properties!, guid);
const expressID = item.expressID as number;
const found = this.groups[0].getFragmentMap([expressID]);
const result: OBC.FragmentIdMap = {};
for (const fragmentId in found) {
const expressIds = new Set<string>();
const expressIdsInNumber = found[fragmentId];
for (const expressIdInNumber of expressIdsInNumber) {
expressIds.add(expressIdInNumber.toString());
}
result[fragmentId] = expressIds;
}
this.highlighter.highlightByID('default', result);
No response
No response
System:
OS: Windows 10 10.0.19045
CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
Memory: 5.58 GB / 15.75 GB
Binaries:
Node: 16.20.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
npm: 9.7.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.1266.0), Chromium (117.0.2045.43)
Internet Explorer: 11.0.19041.1566
npmPackages:
openbim-components: ^1.1.0 => 1.1.0
npm
No response
asdfa
No response
afsdfa
asdfa
npm
afasdfa
As an engineer, I'd like to be able to send incremental updates to a FragmentsGroup
over a network.
I'm using this set of libraries to make a server-client BIM detailing application for steel wall framing. The basic flow of the application is as follows:
Unfortunately, it is quite wasteful to send the entire BIM down again every time a user has made a tiny little tweak to their project settings. Usually, I am only changing a very small percentage of all serialized data on each request. So I am wasting user bandwidth and CPU cycles by making them fetch the entire BIM once more and then parse it and stuff it into a THREE scene.
FragmentsGroupDiff
class representing mutation of FragmentsGroup
FragmentsGroupDiff
FragmentsGroupDiff
to a FragmentsGroup
I considered hacking this on my own by just computing a diff on the serialized bytes of FragmentsGroup
. The binary diff would go over the network and the client would combine that diff and the previous FragmentsGroup
serialization to get the new serialized bytes, which it would then parse to get the new FragmentsGroup
.
It would save some bandwidth, but I don't think it's a good alternative:
No response
I'm having trouble upgrading openbim-components
, because there's a conflict.
Perhaps the issue is that package-lock.json
of fragment
still has "three": "0.152.2"
.
No response
Download this package.json
.
{
"name": "demo-web",
"private": true,
"version": "0.0.0",
"type": "module",
"dependencies": {
"openbim-components": "^1.3.2",
"three": "^0.160.1",
"web-ifc": "^0.0.50"
}
}
Run npm i
in the same directory
Get a conflict error
System:
OS: Linux 6.6 Pop!_OS 22.04 LTS
CPU: (20) x64 13th Gen Intel(R) Core(TM) i5-13600KF
Memory: 20.21 GB / 31.19 GB
Container: Yes
Shell: 5.8.1 - /usr/bin/zsh
Binaries:
Node: 20.11.0 - /usr/bin/node
npm: 10.2.4 - /usr/bin/npm
Browsers:
Chromium: 121.0.6167.85
npm
npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/three
npm ERR! three@"^0.160.1" from the root project
npm ERR! peer three@">=0.126.1" from [email protected]
npm ERR! node_modules/camera-controls
npm ERR! camera-controls@"^1.36.0" from [email protected]
npm ERR! node_modules/openbim-components
npm ERR! openbim-components@"^1.3.1" from the root project
npm ERR! 3 more (n8ao, postprocessing, three-mesh-bvh)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer three@"0.152.2" from [email protected]
npm ERR! node_modules/bim-fragment
npm ERR! peer bim-fragment@"1.3.1" from [email protected]
npm ERR! node_modules/openbim-components
npm ERR! openbim-components@"^1.3.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/three
npm ERR! peer three@"0.152.2" from [email protected]
npm ERR! node_modules/bim-fragment
npm ERR! peer bim-fragment@"1.3.1" from [email protected]
npm ERR! node_modules/openbim-components
npm ERR! openbim-components@"^1.3.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
I'm using bim-fragment in Nodejs, it throw error
https://github.com/RyugaRyuzaki/bim-fragment-server.git
Nodejs 20.0.5
npm
No response
The viewer becomes data-intensive due to the repeated requests for property files, which are not cached and must be retrieved anew each time properties need to be accessed.
In the FragmentsGroup class, which contains the getProperties method that appears to be the primary function for retrieving properties, we could implement a caching system same as the one used for geometries.
import Dexie from "dexie";
interface IStreamedFile {
id: string;
file: JSON;
}
export class StreamFileDatabase extends Dexie {
// Declare implicit table properties.
// (just to inform Typescript. Instantiated by Dexie in stores() method)
files!: Dexie.Table<IStreamedFile, string>; // number = type of the primkey
constructor() {
super("MyAppDatabase");
this.version(1).stores({
files: "id, file",
});
}
}
export class FragmentsGroup extends THREE.Group {
private _fileCache = new StreamFileDatabase();
private async getPropertiesData(url: string) {
const found = await this._fileCache.files.get(url);
if (found) {
return found.file;
} else {
const fetched = await fetch(url);
const fileData = await fetched.json();
this._fileCache.files.add({ id: url, file: fileData.data });
return fileData && fileData.data ? fileData.data : null;
}
}
No response
It would be cool if, just as the FragmentsGroup is able to create FragmentIdMaps, that it also provides a method to combine them.
Create something like FragmentsGroup.combineFragmentIdMaps
.
No response
No response
I am upgrading from 2.0.4
to the latest version (2.1.6
) and all my old fragment files have stopped working. The geometryIDs have changed. I've pinpointed that this commit introduced the regression.
c53ac59
I'm getting the error malformatted fragment because the fragment groups don't seem to contain geometryIDs that are stored in the streamedGeometries https://github.com/ThatOpen/engine_components/blob/23c99ee54aa30046e84bda902d45b171ceb504bf/packages/core/src/fragments/IfcGeometryTiler/src/base-types.ts#L4
My understanding was that fragment files should be persisted and should therefore be backwards compatible. Or will I have to regenerate all my fragment files?
No response
System:
OS: macOS 14.4.1
CPU: (12) arm64 Apple M2 Max
Memory: 72.89 MB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.19.1 - ~/.nvm/versions/node/v18.19.1/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v18.19.1/bin/yarn
npm: 10.2.4 - ~/.nvm/versions/node/v18.19.1/bin/npm
Browsers:
Chrome: 127.0.6533.89
Safari: 17.4.1
yarn
No response
I'm trying to clone a FragmentsGroup
. I assumed this would be possible, because FragmentsGroup
extends Group
. However, it fails with Cannot read properties of undefined
.
The root of the problem seems to be that FragmentMesh
(or maybe FragmentsGroup
) doesn't defined a clone-method which results in the default clone
being called. The default implementation is the following:
clone(recursive) {
return new this.constructor().copy(this, recursive);
}
This calls the constructor of FragmentMesh
. Unfortunately, FragmentMesh
doesn't define default arguments which leads to problems, such as geometry
being undefined
.
To fix the issue, either a clone
that calls the constructor with proper arguments should be implemented, or a constructor
with defaults arguments should be implemented. I feel that the latter would be the Three.js way, but I haven't read enough fragment
code to make a judgement.
No response
FragmentsGroup
anyway you want. In my case: const file = await selectFile();
if (!file) {
console.warn('File not loaded');
return;
}
const data = await file.arrayBuffer();
const buffer = new Uint8Array(data);
const model = await fragmentIfcLoader.load(buffer, "example");
components.scene.get().add(model);
FragmentsGroup
. For example, after loading the model call:// fragments is a FragmentsManager
const group = fragments.groups[0];
group.clone(true);
Result:
Cannot read properties of undefined
System:
OS: Linux 6.6 Pop!_OS 22.04 LTS
CPU: (20) x64 13th Gen Intel(R) Core(TM) i5-13600KF
Memory: 13.53 GB / 31.19 GB
Container: Yes
Shell: 5.8.1 - /usr/bin/zsh
Binaries:
Node: 20.10.0 - /usr/bin/node
npm: 10.2.3 - /usr/bin/npm
Browsers:
Chromium: 120.0.6099.71
npmPackages:
openbim-components: ^1.2.0 => 1.2.0
npm
openbim-components.js?v=4bd4a061:45990 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'index')
at _FragmentMesh.newFragmentGeometry (openbim-components.js?v=4bd4a061:45990:19)
at new _FragmentMesh (openbim-components.js?v=4bd4a061:45942:26)
at _FragmentMesh.clone (chunk-ADNH2OTW.js?v=4bd4a061:5238:12)
at FragmentsGroup2.copy (chunk-ADNH2OTW.js?v=4bd4a061:5263:24)
at FragmentsGroup2.clone (chunk-ADNH2OTW.js?v=4bd4a061:5238:35)
at cloneAndUnravel (ifcmain.ts:107:23)
at produceGlb (ifcmain.ts:102:17)
at exportGlb (ifcmain.ts:137:21)
at Object.exportGlb (ifcmain.ts:163:20)
at HTMLButtonElement.<anonymous> (three_examples_jsm_libs_lil-gui__module__min.js?v=4bd4a061:145:44)
Test issue description!
asdfa dffadfa
fadsfaasdfa
afadfaaafdsa aada
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.