Hacker News new | ask | show | jobs
by ajross 502 days ago
Standard comment in these threads that, while OpenSCAD is a ton of fun and absolutely a breath of fresh air for code geeks wanting to apply their skills to the 3D world without having to hand-draft an object in scary GUI software...

It's actually really limited, based on a needlessly simplified data model and using a kludged up DSL syntax instead of a proper software development environment.

Look at CadQuery and build123d, both of which are python packages build on top of OpenCASCADE[1]. They have wildly different syntax[2], but very similar capabilities. You can do the same CSG work in them that you do in OpenSCAD with similar complexity, but have access to a far more expressive underlying toolkit and a real programming language with which to manage your own parametrization needs.

[1] A CAD-focused boundary representation toolkit, which you can actually use directly if you want but which is aimed more at "build a CAD tool" use cases than "design a speaker cabinet".

[2] Truthfully I don't love either, but CadQuery is at least explicit in most cases about what is happening where build123d relies on some dynamic scoping tricks that irk me. Seems like most of the community disagrees with me though.

1 comments

Have you taken a look at the build123d "algebra API" yet? It is intended to be near zero magic without any of the with blocks from the "builder API". There are algebra and builder API versions of all of the introductory examples on this page https://build123d.readthedocs.io/en/latest/introductory_exam...
Algebra has its own magic though, c.f. the "vectorization" stuff which implements an IMHO really confusing syntax as a kludge to get around having to implement a lazy evaluator. And the placement operator syntax is... yikes. But yes, if you have a CSG problem you're porting naturally from a tool like OpenSCAD you should be using Algebra and not Builder, 100%.

Really it's just an odd area, without solid conventions, and so any API in the 3D space is going to look weird in some places. But IMHO build123d leans way too far out on the "clever" end of the spectrum for my taste. OpenSCAD is limited, but has the advantage of having stuck to a dry, dumb, obvious API.