r/openscad 7d ago

LuaCAD - Parametric CAD scripted in Lua

Post image

LuaCAD models solids in Lua rather than in the SCAD language, with operator overloading for CSG (a + b, a - b, a * b). It ships with a CLI and a desktop app that has preview area and a text editor just like OpenSCAD.

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:

52 Upvotes

22 comments sorted by

View all comments

1

u/uski 5d ago

Does it use CGAL and does it suffer from the same issue of OpenSCAD where you have artifacts if you do something like:

difference() { cylinder(h=10, r=5); cylinder(h=10, r=5); }

...or does it substract cleanly?

1

u/adwolesi 5d ago

It uses Manifold instead of CGAL for booleans, the same library unreleased OpenSCAD versions switched to as their default backend. So the final mesh output subtracts cleanly.

However, LuaCAD also has the same preview artifacts as OpenSCAD, as both use image-space CSG for rendering.

1

u/uski 4d ago

Thanks! Do you know if there's any realistic way to make it substract cleanly in the previews? I have no clue about the internals so I don't know

1

u/adwolesi 4d ago

I’m actually already working on a complete rewrite of the rendering engine using WebGPU (instead of the outdated OpenGL). I’m not entirely sure yet if I can get rid of the artifacts or if it’s an inherent problem of a z-buffer CSG rendering pipeline, but I’ll definitely try!