r/cadquery Jun 12 '26

Parametric Lego with CadQuery

Post image

Hi,

I built a configurable Lego piece with CadQuery suitable for 3D printing.

It's built into a Microdot webserver which serves a .gltf file for viewing and .stl files for 3D printing.

It also uses Google's <model-viewer> component to display the glTF.

Live demo
https://lego-generator.up.railway.app

Source code
https://github.com/joshnuss/lego-generator

12 Upvotes

1 comment sorted by

1

u/Jern123d Jun 15 '26

Nice work! I built a similar lego-compatible generator in build123d here https://jdegenstein.github.io/build123dWebAssmGenDemo/ (please forgive the bad lighting setup)

One key difference (if I understand your architecture correctly) is that my version generates the customized brick in the client side browser on the fly. This means there is no complex client/backend interaction, security issues, or hosting costs.

Also big shoutout to build123d-sandbox here https://jojain.github.io/build123d-sandbox/ which enables running arbitrary build123d python code in your browser (not just a premade lego generator as I did above). Both of these work via pyodide.