Unfolder script for V2
-
I rewrote my unfolder for JSCAD 2 and I'm very happy with the result. It looks almost like an application as user can enter the model file name and choose between options to see the model, scale it and see resulting dimensions, and finally choose several options for the unfolded pattern (paper size, flaps or not, exclude links, change flap attachment). I cleaned the code as possible and now it doesn't use global variables. It was the first time I used align() and it's a very handy function that allowed me to group small pieces. Due to the complexity of the script, it freezes after some time, I suspect memory leak but did not see where it could be. What would be nice with such script that has lots of parameters would be to be able to save/load parameters sets.
The project can be found here, unzip the archive into a directory, then run jscad and open it as a project. I added some 3d files, but you can test others by putting them into the project directory and open it with jscad. It can also directly run on a script, but to do so you must edit the code and change main() (this way it can run as a standalone script file).
Here's a link to a demo video