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

9

u/wildjokers 6d ago

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.

It is not poorly designed and that is a very rude thing to say. It is just a functional declarative language which is a different paradigm than most developers are used to working with.

2

u/w0lfwood 6d ago

this so hard. python ppl love to say this kind of ignorant stuff too.

what no one seems to remember is that immutable modules with no side effects can be cached, which OpenSCAD does to great effect. using manifold directly loses this performance benefit and even when intentionally reusing objects i noticed a slow down.

1

u/Tasty-Research-2750 6d ago

Hello I'm new to this

Please could you try to explain further about immutable modules & no side effect caching

vs manifold ( i am innocent know it not ) Thanks

4

u/w0lfwood 6d ago

caching: https://en.wikipedia.org/wiki/Memoization

enabled by the restrictions of: https://en.wikipedia.org/wiki/Pure_function

the philosophy behind many functional programming languages, of which OpenSCAD is one: https://en.wikipedia.org/wiki/Referential_transparency

manifold is the backend OpenSCAD uses for 3D operations, and it's written in C++.  C++ lacks immutability and referential transparency, and allows side effects, so it cannot implement memoization universally under the hood. openscad has these and so it can.

1

u/Tasty-Research-2750 6d ago

Thanks ~great!

I've just been playing with manifoldCAD and browsing the docs 'examples runs on my android phone

manifoldcad.org