hanno@braun-odw.eu

@hanno:braun-odw.eu

Hanno Braun

making, automation, small-scale manufacturing

🢐 back to Notes

Programmatic CAD

Published: 2021-09-16 (updated 2021-10-13)

CAD software usually comes with a graphical user interface, but that is not the only way to approach that problem. It's also possible to write a CAD model as a computer program, either using a specialized programming language, or a general-purpose language with an appropriate API. This approach is called programmatic CAD or Code-CAD.

As a software developer, programmatic CAD makes complete sense to me. You can use established tools for programming and get all the advantages of a programming language built-in. Collaboration with other team members, adding comments to document aspects of your model, automating repetitive modelling tasks, generative design... all this and more is available without needing to be explicitly supported by the CAD software.

This note represents a snapshot of my research into this topic. I'm publishing it both for my own future reference, and in the hope that it might be useful for others too. If you think that I've missed or misrepresented something, please let me know!

CAD Kernels

A CAD kernel is a software library that provides the core data structures and algorithms required for building CAD software. While some CAD programs come with their own custom kernel (or might not make such a distinction), there are some independently developed kernels that can be used to build CAD programs on top off.

While building your own CAD program is a significant task, especially if it is meant to be generally usable, it might make sense to build a specialized one. For example to enable designs using some specialized system of components, or to support a customizable product.

I've restricted my research to open source CAD kernels.

Open CASCADE Technology (OCCT)

OCCT is a widely used kernel, being the basis for the well-known FreeCAD, as well as some of the CAD programs presented in the next section.

CGAL

CGAL is another example of a widely used CAD kernel, being the basis for OpenSCAD (see next section). It seems to be less advanced than OCCT, providing fewer features.

libfive

libfive seems to be less widely-used than OCCT or CGAL, but is still very interesting. In contrast to those other two, it is based on
function representation
, rather than a more traditional approach.

CAD Programs

CAD programs (sometimes called CAD packages), are intended for use by end users, as opposed to the CAD kernels they build on. Some of the CAD programs presented here are based on the aforementioned CAD kernels, others use their own custom code to handle geometry.

OpenSCAD

OpenSCAD is well-known in the open source CAD space. It's been around for a while and is widely used.

Advantages:

Disadvantages:

I've done most of my CAD modelling with OpenSCAD. Overall, I'm not too fond of it, but I still keep coming back to it, and it's the one I compare all the others to, which says a lot.

libfive Studio

libfive Studio seems less well-known than OpenSCAD, but looks promising. It is built on the libfive kernel, and made by the same author.

Advantages:

Disadvantages:

I'm currently looking to get into it more, maybe using it as my main CAD program going forward.

CadQuery

CadQuery is written in Python and based on OCCT.

Advantages:

Disadvantages:

ImplicitCAD

ImplicitCAD is an alternative to OpenSCAD that uses function representation under the hood, like libfive.

Advantages:

Disadvantages:

Cascade Studio

Cascade Studio is browser-based and uses JavaScript as the modelling language.

Advantages:

Disadvantages:

sdfx

sdfx is another not-that-well-known contender, written in Go.

Advantages:

Disadvantages:

Fornjot

Last, and also least, my own effort, Fornjot. It experiments with both function representation and more traditional approaches based on triangle meshes, and is written in Rust.

Advantages:

Disadvantages:

Changes

2021-09-16 Initial release.
2021-10-13 Added separate section about CAD kernels; updated section about programs to refer back to it. Other minor tweaks.

Did you like this? Or not? Any comments or suggestions? Please get in touch!

Don't have anything to say right now, but want to stay connected? Subscribe to this website!

🢐 back to Notes