Contact me: hanno@braun-odw.eu

Hanno Braun

making and small-scale manufacturing

🢐🢐 back to Notes

Code-CAD Applications

Published: 2021-09-16 (updated 2022-01-17)

CAD software usually comes with a graphical user interface, but this is not the only approach. It's 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 Code-CAD or programmatic CAD.

As a software developer, Code-CAD makes complete sense to me. You get all the power of a programming language and you can use all the established tools for programming. Creating intricate models with no repetitive work, collaborating with other team members, adding comments to document your model... all this and more is available without needing to be explicitly supported by the CAD software.

I'm always on the look-out for applications using this approach, and 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 CAD programs can build on on top of.

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.

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 modeling 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. It is built on the libfive kernel, and made by the same author.

Advantages:

Disadvantages:

I've used it for one project and it worked well enough. In the end, I found no good reason to keep using it over OpenSCAD.

CadQuery

CadQuery is written in Python and based on OCCT.

Advantages:

Disadvantages:

I tried to use it on multiple occasions, but it's not packaged for Arch Linux (which is what I use), and compiling it from source always failed for one reason or another.

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 modeling language.

Advantages:

Disadvantages:

sdfx

sdfx is another not-that-well-known contender, written in Go. It also uses function representation.

Advantages:

Disadvantages:

JSCAD

JSCAD is a CAD application written in JavaScript.

Advantages:

Disadvantages:

Fornjot

Last, and also least, my own effort, Fornjot. After experimenting with function representation and other techniques for a while, I finally settled on a more traditional approach based on boundary representation.

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.

2022-01-17

Renamed to "Code-CAD Applications" (from "Programmatic CAD"). Updated a bunch of things all over. Added JSCAD.

🢐🢐 back to Notes