Hacker News

Favorites Setup
Comment by wren6991 | original | OpenSCAD the Programmers Solid 3D CAD Modeller
[−]wren6991 · 2026-10-10 Sat 21:23 UTC · link
If you look at this and you think "wow, I love the idea of CAD-as-code but I wish it was a more sane language" then have a look at CadQuery: https://cadquery.readthedocs.io/en/latest/quickstart.html#qu...

(I recommend CQ-editor for an easy install: https://github.com/CadQuery/CQ-editor/releases/)

It's a similar idea to OpenSCAD, but embedded in Python and using a better geometry kernel. Want to fillet a box in OpenSCAD? Sure, either take the convex hull of 8 spheres, or the minkowski sum of a box and a sphere. Want to fillet a box in CadQuery? .edges().fillet()

Now I'm hearing some protests about Python, but consider this example OpenSCAD code:

    x = 1;
    echo(x);
    x = 2;
In most languages you would expect this to print "1". In OpenSCAD, the last assignment wins and it prints "2".
[−]retatop · 2026-10-10 Sat 22:01 UTC · link
I certainly have my complaints about openscad (mostly that the geometry isn't something you can operate on), but as far as I'm concerned a declarative language is perfect for describing an object. I don't want your example to do what you expect. I would have preferred if it didn't compile
[−]coryrc · 2026-10-11 Sun 04:13 UTC · link
What's worse is:

    x = 1;
    a = 2;
    echo(x);
    x = a;
Errors out with "line 1: a is not defined", because the override is implemented as is the tokens were present wherever the first declaration is. (If anybody looks up me, you'll see I've made a bunch of contributions and bitched about this particular thing which really fucks up a bunch of optimizations you'd want to do)