Skip to content
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

Importing STLs with a relative path fails. #35

Open
nophead opened this issue Jul 2, 2024 · 4 comments
Open

Importing STLs with a relative path fails. #35

nophead opened this issue Jul 2, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@nophead
Copy link
Member

nophead commented Jul 2, 2024

https://github.com/nophead/NopSCADlib/tree/master/vitamins/microview.scad imports some STLs. E.g.

import("microview/GKM-003_R05_CHIP_LOWER_HOUSING.stl");

When running the test for it the log has these errors:

Importing with Assimp
ERROR: Error loading file '/libraries/NopSCADlib/vitamins/microview/GKM-002_R05_CHIP_UPPER_HOUSING-1.STL' with Assimp: Unable to open file "/libraries/NopSCADlib/vitamins/microview/GKM-002_R05_CHIP_UPPER_HOUSING-1.STL".
WARNING: Can't open import file '/libraries/NopSCADlib/vitamins/microview/GKM-002_R05_CHIP_UPPER_HOUSING-1.STL', import() at line 46
Importing with Assimp
ERROR: Error loading file '/libraries/NopSCADlib/vitamins/microview/GKM-003_R05_CHIP_LOWER_HOUSING.STL' with Assimp: Unable to open file "/libraries/NopSCADlib/vitamins/microview/GKM-003_R05_CHIP_LOWER_HOUSING.STL".
WARNING: Can't open import file '/libraries/NopSCADlib/vitamins/microview/GKM-003_R05_CHIP_LOWER_HOUSING.STL', import() at line 53
@ochafik
Copy link
Collaborator

ochafik commented Jul 8, 2024

Just a quick note here that the current mechanism to embed common libraries doesn't scale to large assets.

NopSCADlib.zip weighs 564kB w/ just its .scad files (+ license), but this jumps to 1.7MB with the STLs.

The proper fix for this will be to support lazy download of dependencies' ZIPs (maybe directly from their repo, e.g. https://github.com/nophead/NopSCADlib/archive/refs/heads/master.zip), probably based on the detected imports and/or some user input.

@nophead
Copy link
Member Author

nophead commented Jul 8, 2024

The size increase is due to one STL that is 1.2MB, the rest are tiny. I could probably reduce it but would that make any difference. or are all STLs excluded at the moment?

@ochafik
Copy link
Collaborator

ochafik commented Jul 9, 2024

@nophead not sure which ones are needed but I see a few chunk files, e.g. enviro_plus_case.stl = 2.5MB, all.stl = 2.1MB

Right now the web playground is quite slow to load (esp. on mobile) so I'd rather not make it any slower, but lazy loading is high on my list of priorities / will unlock this

Also, FYI, I've compiled the JS to a command line that should have the same features as the web playground (+ some extra limitations, e.g. fonts currently broken), it being incubated here: openscad/openscad#5210 (comment)

@nophead
Copy link
Member Author

nophead commented Jul 9, 2024

All the examples come with their STLs but they are not needed unless you want to print them. There are just 3 STLs that are part of the library that are needed for the tests to work. They are just shapes that I found too hard to model in OpenSCAD.

@ochafik ochafik added the enhancement New feature or request label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants