I recently used their sister library (build123d, same devs) to build a rotary slide rule bracelet for multiplying three-digit numbers. It was a great experience and wouldn't generally be easy to do with Fusion 360. My bracelet gets quite a lot of comments when I wear it in public. :-)
Nice model, but also a great notebook. Really like this "literal coding" style for CAD in a notebook. I still sometimes prefer GUI cad for simple stuff, CadQuery is not always that easy to write. But when iterating over something complicated, the notebook style development is really nice. And being to compose a model using functions and iterators instead of the clumsy GUI workflows is a godsend. Also time I tried Opus was more helpful and capable than I would have thought. Not good enough to one-shot yet, but it is very helpful nonetheless
Thanks for this! It's really fun. My older kid now has a vanilla sliderule bracelet. The younger is getting a smaller bracelet of the same design, but with dragons on it :-)
Happy to share source if you like, but it was nothing complicated:
- ask aistudio.google.com to draw a bunch of dragons
- trace one to svg
- make the bracelet a little smaller
Sure but like, that is specifically NOT easier if you need to iterate once initial implementation is complete. At least in my opinion as an industrial designer turned software engineer, which I only mention to assert I’m experienced in both sets of tools.
True, the logarithmic scale lends itself to programmatic creation. I just wanted to show that the wrapping part is easy. Actually much easier – that code looks non-trivial.
Are you asking how the bracelet multiplies two numbers? It's the same idea used by slide rules -- you take the logarithm of the two numbers, then add the logarithms instead of multiplying -- same result, with somewhat less accuracy depending on available decimal places.
This method was widely used in the pre-computer era to save time in calculations. Tables of logarithms (and slide rules) were a mathematician's best friend.
CadQuery and build123d have been very handy for prototyping stuff for 3d printing. AI still isn't quite good enough to generate correct scripts, but AI autocomplete at least helps with putting together small snippets.
My last project involved making a cosplay helmet. I modeled the shell in blender, it was a low poly design, so I exported it to an OBJ, then put together some Python to load the OBJ, give the triangles some configurable thickness etc. Then I used it to explore how to print the helmet in such a way that the outer surface would be too clean to tell it's FDM printed, without needing to do any sanding.
Initially I explored having cadquery put a number on the back of each triangle and I'd assemble it like a puzzle, but that didn't work out. Eventually I figured out how to cut it up into parts that would also eliminate the need for painting and outer surfaces would be clean, and because it was in code, changing which part a triangle belonged to was a matter of moving the corresponding index into another list.
I probably could've managed it all in blender too, but being much more comfortable with code, it was easier for me to play with normals and manually turning each piece into a solid.
I also go for it for functional designs because, again, tweaking code is more comfortable to me than dealing with constraints and sketches and multiple planes in, say, FreeCAD.
yeah -- have been playing with this as well, ai's spatial reasoning is not quite there yet but with precise construction instructions it can often do the job
for shapes that are hard to print with a traditional slicer, LLMs are also surprisingly good at generating gcode with fullcontrolxyz if you're specific
My particular immediate use case would be to export the board outline and mounting holes from a kicad project (SVG or DXF, whatever works) and build a chassis for it. Obviously I can do this in freecad but I've been looking for an intuitive cad-as-code system to check into git instead. So this would be awesome!
While not code as CAD, Dune 3D has the creation of enclosures for electronics projects as its _raison d’être_, and has a facility for Python scripting:
Replicad is designed primarily to be used as a library with the web editor as a helper.
FluidCAD is designed to be used as full CAD package code + UI. I've outlined some of my motives in recent post: https://news.ycombinator.com/item?id=47721997
Big fan overall. Designed a tension sensitive winch with this a few years back.
Doing CAD with code seems like obviously the right move to me. The ability to just write new functions in python and do version control with git are super powerful.
The big thing that struck me as innovative with CadQuery is the design intent query part. Selecting model geometry by relation to other geometry is way more resilient to changes ealier in the model's history than the regular "that point right there" you get with just clicking a point.
That the developers acknowledge that seeing the model at various steps in the script is important, and so have the CQ-editor, is also a point in their favour.
I do have a gripe though:
Having to keep all the geometry selection stuff relating to the model in my head is hard. I want gui tools that write code.
Like if I have a complex model, and variables assigned to various parts of the geometry. I want to be able to see that geometry highlighted and labeled, so I know what's easily selectable, and I want to be able to click buttons based on my design intent and get immediate visual feedback, and have each of those button presses added as code as I do them.
The OCP CAD Viewer extension for VS Code (works with both CadQuery and build123d) gets partway there - you can click on faces/edges in the 3D view and it shows you the selection info you'd need for your code. It's not full "click to generate code" but it helps a lot with the "keeping geometry in my head" problem. Still a long way from the OnShape FeatureScript model where GUI and code are truly bidirectional though.
I create CAD instructional videos based on SolveSpace, and I sometimes try to get people interested in CADQuery as well, but many people interested in CAD will learn SolveSpace or another similar design program, but don't have the programming background for CADQuery.
Too bad -- in many ways, for many projects, CADQuery gives better results, especially if a single design needs to be recreated in a range of sizes.
OpenSCAD is all triangles and vertices. Fillets are difficult to do. Outputting circles/spheres generally requires you to for-loop over vertices a lot.
Libraries like build123d and cadquery use OpenCASCADE, a boundary representation kernel. You think in terms of the enclosed solid and perform operations - boolean add/subtract, fillet/chamfer, stamp text, etc - that return a new solid.
Oh boy. The major difference is coordinate transformations, global/local/face. OpenScad basically leaves you alone with math you should figure out on your own. Also it's math heavy for all other stuff, for example tangents, smooth connections, intersection coordinates, etc.
I used cadquery to programmatically generate 3D models for an electronics library for a 1000 or so parts that only differ slightly in their measurements. It literally saved me days of manual work.
There are a lot of tools in this space, esp. these days when "Vibe Coding" allows folks to knock one out w/ a prompt. Most folks jus use OpenSCAD which with its large user base and weaknesses which are (mostly) not exposed by 3D printing is great, so long as what one wants to model is easily described using mathematics/programming techniques which are familiar to the user.
I'd really like to see an interactive opensource project follow OnShape's lead where a scripting language (for OS, FeatureScript) is used as a wrapper around the geometry kernel, then the graphical UI creates the model using that language, and one can always inspect the resultant code. It seems to me that this should be workable given the observation:
>Parametric CAD, in my view, is a perfect example of "visual programming",
>you have variables, iteration/patterning reducing repetition, composability
>of objects/sketches again reducing repetition, modularity of design though a
>hierarchy of assemblies. The alignment between programming principles and
>CAD modelling principles, while not immediately obvious, are very much
>there. An elegantly designed CAD model is just as beautiful (in its construction)
>as elegantly written code.
but these days, I'm mostly using Open(Python)SCAD (which is in the process of getting merged in to the main project).
This will be interesting to try. I'm not an engineer. I decided to try "vibe coding" a CAD model, by letting AI generate Python code within VS Code. I was able to make a primitive but useful part, and sent it off to Xometry. Just a "bracket with holes" kind of thing for a prototype.
It was fun, but I still appreciate what our mechanical designers can do.
I have written a lot of openSCAD code, I learned about BOSL(2) and wrote even more, I tried getting into build123d (and failed, as running openSCAD/BOSL2 is way too comfortable to leave it)... the only downside is that AI fails horribly with those libs and frameworks.
I think I heard of cadquery before and decided against it, in favor of build123d.
I used build123d (a similar system) and the help of Claude Code to code a modern replica of historic guitar tuners from the 1760s. I had the results CNC cut in China directly from the STEP outputs and they are currently sitting on an instrument working great. Build123d (and CadQuery) are fantastic...
Back when I was actively trying to keep track of CAD/CAM software being developed which was applicable to a hobbyist CNC project, just the Python projects, esp. those which extended/enabled/replaced OpenSCAD was a full-time endeavour.
Using a coding CLI I was able to create a computed shape would otherwise by incredibly challenging to make (impossible in parametric CAD GUIs at least) LLMs + CadQuery is a powerful combo, this will be more and more common I think. It's just too powerful to ignore.
I'm working on a CAD kernel in Rust with a frontend either as a Blender plugin or a Blender fork (leaning towards fork at this point) It's not at all ready but I have reached first part status (before going back and rewriting a large chunk of the kernel)
Another library I have to integrate and benchmark against OpenSCAD for my AI SaaS[0]. I am really curious how constructive solid geometry compares to sketching and extruding that CadQuery is build on.
Anyone curious in the writeup? I have a pretty good harness for evaluating 3d generation performance.
At the time of writing this there are 24 comments, of which 4 promote alternatives. I feel that recently the number of shameless plugs and check-out-my-SaaS's surged drastically
CadQuery is one of those tools that really clicks once you think of CAD as code instead of clicks. Being able to parametrize everything and version it like any other Python project is a huge win, especially for iterative designs.
It’s not as beginner-friendly as GUI tools, but for automation, reproducibility, and generating families of parts, it feels way more scalable. Curious how others here are using CadQuery in real workflows—production or mostly prototyping?
65 comments
I recently used their sister library (build123d, same devs) to build a rotary slide rule bracelet for multiplying three-digit numbers. It was a great experience and wouldn't generally be easy to do with Fusion 360. My bracelet gets quite a lot of comments when I wear it in public. :-)
Here's an IPython notebook with lots of pictures so you can see how the different operations come together: https://github.com/gcr/sliderule-bracelet/blob/main/version-...
build123d is quite different stylistically from cadquery, but this should give you the flavor of programming-oriented CAD at least.
Happy to share source if you like, but it was nothing complicated: - ask aistudio.google.com to draw a bunch of dragons - trace one to svg - make the bracelet a little smaller
> wouldn't generally be easy to do with Fusion 360
Actually...
https://www.youtube.com/watch?v=DNiQJyRTs50
You would create the numbers and marks in a vector drawing program (Inkscape, Affinity Studio, Illustrator) and import that into Fusion.
[0]: https://en.wikipedia.org/wiki/Slide_rule
This method was widely used in the pre-computer era to save time in calculations. Tables of logarithms (and slide rules) were a mathematician's best friend.
My last project involved making a cosplay helmet. I modeled the shell in blender, it was a low poly design, so I exported it to an OBJ, then put together some Python to load the OBJ, give the triangles some configurable thickness etc. Then I used it to explore how to print the helmet in such a way that the outer surface would be too clean to tell it's FDM printed, without needing to do any sanding.
Initially I explored having cadquery put a number on the back of each triangle and I'd assemble it like a puzzle, but that didn't work out. Eventually I figured out how to cut it up into parts that would also eliminate the need for painting and outer surfaces would be clean, and because it was in code, changing which part a triangle belonged to was a matter of moving the corresponding index into another list.
I probably could've managed it all in blender too, but being much more comfortable with code, it was easier for me to play with normals and manually turning each piece into a solid.
I also go for it for functional designs because, again, tweaking code is more comfortable to me than dealing with constraints and sketches and multiple planes in, say, FreeCAD.
for shapes that are hard to print with a traditional slicer, LLMs are also surprisingly good at generating gcode with fullcontrolxyz if you're specific
https://fluidcad.io
If I have a DXF or something of the outline of something (a PCB in this case) can I import it and build around it somehow?
https://docs.dune3d.org/en/latest/python.html
Doing CAD with code seems like obviously the right move to me. The ability to just write new functions in python and do version control with git are super powerful.
The big thing that struck me as innovative with CadQuery is the design intent query part. Selecting model geometry by relation to other geometry is way more resilient to changes ealier in the model's history than the regular "that point right there" you get with just clicking a point.
That the developers acknowledge that seeing the model at various steps in the script is important, and so have the CQ-editor, is also a point in their favour.
I do have a gripe though:
Having to keep all the geometry selection stuff relating to the model in my head is hard. I want gui tools that write code.
Like if I have a complex model, and variables assigned to various parts of the geometry. I want to be able to see that geometry highlighted and labeled, so I know what's easily selectable, and I want to be able to click buttons based on my design intent and get immediate visual feedback, and have each of those button presses added as code as I do them.
Look at this example model: https://cadquery.readthedocs.io/en/latest/examples.html#a-pa...
This bit that selects some points?
Each of those lines should be a gui tool interaction that generates that line of code.Would it limit and hold a maximum force? Slip beyond a certain limit?
I'd be very interested if one of them compares/contrasts SolveSpace and CADQuery.
Libraries like build123d and cadquery use OpenCASCADE, a boundary representation kernel. You think in terms of the enclosed solid and perform operations - boolean add/subtract, fillet/chamfer, stamp text, etc - that return a new solid.
Previous discussions:
https://news.ycombinator.com/item?id=24520014 (6 years, 49 comments)
https://news.ycombinator.com/item?id=30232344 (4 years, 43 comments)
https://news.ycombinator.com/item?id=30219940 (on Hackaday, 4 years, 28 comments)
https://news.ycombinator.com/item?id=17038257 (8 years, 16 comments)
https://news.ycombinator.com/item?id=28083578 (a Show HN from 5 years ago w/ 1 comment)
There are a lot of tools in this space, esp. these days when "Vibe Coding" allows folks to knock one out w/ a prompt. Most folks jus use OpenSCAD which with its large user base and weaknesses which are (mostly) not exposed by 3D printing is great, so long as what one wants to model is easily described using mathematics/programming techniques which are familiar to the user.
I'd really like to see an interactive opensource project follow OnShape's lead where a scripting language (for OS, FeatureScript) is used as a wrapper around the geometry kernel, then the graphical UI creates the model using that language, and one can always inspect the resultant code. It seems to me that this should be workable given the observation:
https://news.ycombinator.com/item?id=31471109
>Parametric CAD, in my view, is a perfect example of "visual programming",
>you have variables, iteration/patterning reducing repetition, composability
>of objects/sketches again reducing repetition, modularity of design though a
>hierarchy of assemblies. The alignment between programming principles and
>CAD modelling principles, while not immediately obvious, are very much
>there. An elegantly designed CAD model is just as beautiful (in its construction)
>as elegantly written code.
but these days, I'm mostly using Open(Python)SCAD (which is in the process of getting merged in to the main project).
It was fun, but I still appreciate what our mechanical designers can do.
I think I heard of cadquery before and decided against it, in favor of build123d.
Community built examples: https://modelrift.com/models
https://paulfremantleluthier.substack.com/p/gibsons-tuners-v...
Now that there is:
https://pythonscad.org/
my hope is that this effort will begin to coalesce and focus on that tool/environment, and that further effort will be made to improve it.
Anyone has used it?
I'm working on a CAD kernel in Rust with a frontend either as a Blender plugin or a Blender fork (leaning towards fork at this point) It's not at all ready but I have reached first part status (before going back and rewriting a large chunk of the kernel)
https://github.com/ginkgo/trackball/
Anyone curious in the writeup? I have a pretty good harness for evaluating 3d generation performance.
[0]: https://grandpacad.com
https://news.ycombinator.com/item?id=47803846 https://news.ycombinator.com/item?id=47803475 https://news.ycombinator.com/item?id=47802988 https://news.ycombinator.com/item?id=47803416
It’s not as beginner-friendly as GUI tools, but for automation, reproducibility, and generating families of parts, it feels way more scalable. Curious how others here are using CadQuery in real workflows—production or mostly prototyping?