I implement all the logic in Elm : model, translation, rotation, drawing ; use elm-scripting to generate the code for OpenSCAD which does the rendering, and supports live reload.
Sidebar: I looked into QuickJS and then went down this deep rabbit hole learning about Fabrice Bellard. His output and work ethic seems fascinating to me.
I discovered that it is using innerHTML attribute to store the result of toHtml which my code was not handling properly. BTW it also requires global to exist.
This has been fixed. Now the code first looks for text content, if not, looks for inner HTML content, if not, recurse to children.
I made an improvement to the tool today. Input content can be passed to the script via standard input. On script side, this is captured as a parameter of the init function.
Is the code for this available somewhere? I’d be very interested in checking it out
I’ve been playing around with using Lua as a frontend for OpenSCAD: GitHub - ad-si/LuaCAD: Create CAD models with Lua and OpenSCAD
But using Elm would actually be cooler!
Could you please share some code on OpenSCAD? I had never heard of it until you mentioned your first use case. Programmatic CAD with Elm will be really cool!
I’m very far from having anything similar to show.
Programmatic CAD in Elm is currently just an experimentation and elm-script is a side product born form the fact that I was tired of constantly copy-pasting code between the browser and the editor.
I may eventually publish something if it become usable.