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

BIM: Speedup and refactor WebGL exporting #18843

Merged
merged 2 commits into from
Jan 7, 2025

Conversation

je-cook
Copy link
Contributor

@je-cook je-cook commented Jan 3, 2025

Hi,

I was using the webgl exporter which works great for simple shapes but once the objects become more complicated the compression step takes a long time because of the nested for loops.

In the first commit I have taken the opportunity while I was in the file to refactor it slightly and split some functionality out into standalone functions.

With the second commit I have used numpy to avoid some of the python nested for loops used in compression. For me this makes the saving of more complex shapes nearly instantaneous.

@github-actions github-actions bot added the Mod: BIM Related to the BIM/Arch Workbench label Jan 3, 2025
@je-cook je-cook changed the title Speedup and refactor WebGL exporting BIM: Speedup and refactor WebGL exporting Jan 3, 2025
@maxwxyz maxwxyz requested a review from yorikvanhavre January 3, 2025 13:04
@maxwxyz
Copy link
Collaborator

maxwxyz commented Jan 3, 2025

@je-cook
Copy link
Contributor Author

je-cook commented Jan 3, 2025

It partially helps with #18792 but I havent touched the encoding mismatch (not really my area of expertise).

EDIT:
Actually it may close #9805 as it seems to just be a performance problem reading the comments

@yorikvanhavre
Copy link
Member

Great job! I'm only a bit worried by the added numpy dependency... The webGL exporter could just stop working for some users.

Could you check if it's included in our builds first?

@yorikvanhavre yorikvanhavre removed their request for review January 6, 2025 09:34
@je-cook
Copy link
Contributor Author

je-cook commented Jan 6, 2025

Thanks @yorikvanhavre I guessed that numpy was because it is already imported in a few modules in BIM/Dice3DS as well as https://github.com/FreeCAD/FreeCAD/blob/main/src/Mod/BIM/importers/importSH3DHelper.py. A quick search shows quite a few imports in the CAM, Fem and PartDesign too.

Its definitely in the pixi.toml and the conda build and import numpy works in the python console on the flatpak.

numpy = "*"

@yorikvanhavre
Copy link
Member

Okay indeed it is, and it's used in many place in FreeCAD already (CAM, FEM,...) so I suppose it's good to go!

@yorikvanhavre yorikvanhavre merged commit 278ce80 into FreeCAD:main Jan 7, 2025
10 checks passed
@je-cook je-cook deleted the webgl_speedup branch January 7, 2025 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mod: BIM Related to the BIM/Arch Workbench
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants