-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
serialize and de-serialize dxfViewer scene #65
Comments
It must be the second time you load this model as I can see "Loaded DxfData from indexedDb in 0.436s". For the first time, we parse the dxf file and save it to indexeddb, so the second time just load from indexeddb. And loadEntities() for the second load, means generating threejs objects from dxf data. We should be able to serialize theejs scene, and directly load it. The problem is, threejs objects are large, indexeddb is not large enough to store many of them. |
Yes, my application has to switch across several CAD drawings back and forth. The ideal user experience would be that when user switch to a CAD drawing the 2nd time or onward, the application should skip the loadEntities() and "adding model to scene", instead it should simply load the scene. Regarding the threejs scene object being large, there are several options: Option 1. Zip up the threejs scene JSON before storing into indexedDB. |
How large is your drawings usually? Is it ok to create several DxfViewers, and don't destroy them if user is likely to switch back? By seralizing the scene, we are ok to see objects, while there are other data in memory, like layouts, layers and many others. Many features won't work without these data. |
For a large dxf file, it takes about 10 seconds before user can see the model. Below is the timeline from the console log:
[DxfViewer] Initialized in 0.027s
[DxfViewer] Font file(s) load time in 0.046s
[DxfLoader] Loaded DxfData from indexedDb in 0.436s
[DxfLoader] loadEntities() done in 4.493s
[DxfViewer] Loaded 'data/Large_Model.dxf' in 4.933s, adding to scene...
[DxfViewer] Activated layout 'Model' in 0.004s
[DxfViewer] Added 'data/Large_Model.dxf' to scene in 5.163s
As can be seen here, the loadEntities() took ~4.5 seconds (despite the function name, I think this is the parsing step), and the adding to scene took ~5 seconds.
How can I serialize the scene in the dxfViewer and de-serialize the scene in the dxfViewer to reduce this 10 seconds to sub second? Please refer to the following discussion for what I am talking about.
https://discourse.threejs.org/t/the-best-way-to-save-and-open-three-js-scene/16158
The text was updated successfully, but these errors were encountered: