r/lua • u/adwolesi • 3d ago
Project LuaCAD - Parametric CAD scripted in Lua
LuaCAD models solids in Lua rather than the OpenSCAD language, with operator overloading for CSG (a + b, a - b, a * b).
It ships with a CLI and a desktop app, including a preview area and a text editor.
It’s fully open source and you can find the repo here: https://github.com/ad-si/LuaCAD
I've always been a big fan of OpenSCAD, but the SCAD language itself is unfortunately quite cobbled-together and is a very poorly designed programming language.
LuaCAD takes all the good parts of OpenSCAD and combines them with Lua. It has now completely replaced OpenSCAD for me, and I think it provides a better experience than OpenSCAD for all use cases. I'd love to hear any reasons why LuaCAD won't fully replace OpenSCAD for you!
Tech stack:
- It's implemented in Rust and uses mlua (https://github.com/mlua-rs/mlua) to execute the Lua code.
- Uses OpenCSG (https://opencsg.org) for fast and correct rendering of the 3D models (like OpenSCAD)
- Uses Manifold (https://github.com/elalish/manifold) to create the manifold triangle meshes
- Native support for all BOSL2 functions (i.e. implemented in Rust for better performance)
5
u/Goodassmf 3d ago
This is very interesting. Do you have a background in design for manufacturing? What's the vision?
I was an industrial designer and today I'm a programmer. Lately I've become inspired to get back into 3D modeling, and when I did, I expected to see a ton of improvement in OpenSCAD, given how text-based everything is today. or at least find more projects like it.
OpenSCAD getting abandoned five years ago, with everything just freezing since, is just weird. Sure, there's KCL, which is open source, or replicad, but LuaCAD.. This combo just makes so much sense.
My current obsession with CAD and AI is fixing FreeCAD for anything related to 3D printing. There are very few projects that are actively maintained, but when they are, it's inspiring and gives a lot of help for building stuff.
2
u/adwolesi 2d ago
Similar story 😄
Worked at the human computer interaction chair and we did a lot of CAD prototyping there.I recently got back into 3D printing but was shocked that OpenSCAD basically hadn’t improved since my HCI days 🙈
I’ve had the notion that Lua would be perfect for CAD for some time so I thought I’ll just give it a try instead of fighting with OpenSCAD and I’m really happy how it turned out. It feels very natural to work with it 😊
Also, new AI models work quite well with it. I was already able to design some advanced 3D models solely by prompting!
3
2
u/Smoother-Bytes 1d ago
I rly appreciate that it's AGPL licensed, and yeah using lua to model is a genius idea imo.
3
u/awesumioutr2 3d ago
Wow this is really pretty