Irev-Dev / curated-code-cad

A list of the various code-cad projects out there.
https://kurthutten.com/blog/curated-code-cad
MIT License
243 stars 9 forks source link
3d-models cad cadquery cascadestudio curv dynfreecad freecad implicitcad jscad opencascade openjscad openscad parametric python pythonocc rapcad scad-clj shapescript solidpython sverchok

Curated Code Cad ⚙️ 👩‍🔧

FYI this readme has moved.

It's now maintain as part of the CadHub docs. This readme will be kept in sync with an changes there.

What is Code-CAD?

It's software that allows you to define 3D CAD models with code. It's a niche popular amongst software devs for obvious reasons — it gives you parametric models almost by default and it's easy to maintain and extend models within a team over time when paired with git. The coding nature of it allows teams to build their own abstraction for re-use and quick prototyping. The Cadhub docs has a good breakdown of the potential of the Code-CAD paradigm. Code-CAD is not to be confused with 3d geometry libraries, Code-CAD instead has opinionated abstractions for quickly developing mechanical parts.

Which one should you use?

I recommend reading through the entire list below to see if one chimes with you and your needs, beyond that I can make the following recommendation and points:

No matter which one is your tool of choice, if you're here and you love Code-CAD and you'll want to checkout Cadhub. Think of it as Codepen crossed with a thing repository, and it's our love letter to the Maker community. Currently there are integrations for OpenSCAD, CadQuery and JSCAD, and we're working on more. Site, repo.

Special mention

OpenSCAD

The rest of the packages are in alphabetical order, but OpenSCAD gets a special mention because it's the OG. Many of the projects below were inspired by OpenSCAD and is the most well-known choice. If you're new to code-cad this is the safest choice. The syntax is easy to pick up and there lots of guides around the internet.

OpenCascade

It's a c++ library that a number the projects below wrap. OpenCascade uses a Boundary representation (B-rep) kernel, which is a powerful way representing solid geometry, this is a point of difference for some many of the other projects that use a polygon mesh.

Contributing

There are a couple of ways you can help:

Here they are:

AngelCAD

AngelCAD aim to do two things: 1) Offer an embedded, but general-purpose scripting language for Constructive Solid Geometry, via AngelScript. This allows for a natural programming style with true variables, user-defined functions and even classes. Programmers should feel at home. See AngelCAD sample scripts.

2) Offer a fast boolean engine, which is powered by Carve is used for this purpose. This means that AngelCAD is generally many times faster than other mesh-based systems.

AngelCAD is capable of running OpenSCAD script for interoperability and has features like text support and DXF import coming soon.

bitbybit

bitbybit is both a node editor and Code-CAD as they have exposed a typescript interface that can be used in their app.

CadHub

A community hub for sharing code-cad projects. Currently integrates with CadQuery and OpenScad. Built and maintained by yours truly.

CadHub IDE screenshot

CadQuery

CadQuery is a Python library that wraps and extends OpenCascade. It has a philosophy of capturing design intent. The API has been designed to be as close as possible to how you’d describe the object to a human. An example of this is its ability to "select" parts of the model's geometry to run operations on, such as the following code that selects only the edges running along the Z-axis and fillets them.

result = cq.Workplane("XY" ).box(3, 3, 0.5).edges("|Z").fillet(0.125)

z edge select example

CascadeStudio

A javascript wrapper for OpenCascade that runs in the browser. (OpenCascade can run in the browser when compiled to web-assembly). CadHub integrates with CascadeStudio.

Curv

Curv is a programming language for creating art using mathematics. It’s a 2D and 3D geometric modelling tool that supports full colour, animation and 3D printing. It was inspired by OpenSCAD and shadertoy.

FreeCAD

FreeCad is a more traditional CAD package that supports python scripting, Both for modelling as well as controlling the FreeCAD GUI itself. Not only that it has a built in OpenSCAD workbench as well as an external CadQuery workbench, making it the best in this list at interoperability. FreeCAD uses OpenCascade under-the-hood.

Fornjot

Fornjot is an early-stage project to create a next-generation, code-first CAD application. Because the world needs another CAD program.

ImplicitCAD

Inspired by OpenSCAD with a very similar language, implemented in Haskell and includes the ability to write definitions in Haskell, instead of just OpenSCAD, and is part of an 'almost stack' of tools including ExplicitCAD (for a GUI), and HSlice (for an STL slicer).

JSCAD

JSCAD (formally know as OpenJSCAD) provides a programmer’s approach to develop 3D models. In particular, this functionality is tuned towards creating precise models for 3D printing.

JSCAD provides the ability to:

JSCAD is available as a:

JSCAD allows anyone to create 3D (or 2D) designs by combining simple shapes. And any shape can be rotated, moved, scaled, etc. Complex shapes can be saved as parts, which can used later. And the final design can be exported into various standard formats, i.e. STL, DXF, SVG, etc.

libfive

Libfive is a software library and set of tools for solid modelling, especially suited for parametric and procedural design. Lisp based language, (so (you (((((can expect ) lots of parentheses))))).

manifold

Manifold is a fast and robust mesh library with support for CSG, SDF, and other miscellaneous mesh operations. It is currently used by OpenSCAD as an experimental backend with huge speedup. It is not uncommon to see >100x speedup over the old backend of OpenSCAD.

Manifold provides a C++ API as well as C, Python and JavaScript (typescript) bindings. Users can use its JavaScript binding with the online editor, and the result can be exported in either gltf and 3mf formats (3mf is an alternative to stl that preserves manifoldness).

pythonOCC

Python-based, Also uses OpenCascade.

RapCAD

Another project inspired by OpenSCAD. The author considers key differences to be procedural vs functional programming language style, (i.e variables can be modified) and the use of arbitrary precision arithmetic throughout (meaning there are no unexpected double/float rounding errors). There is a handy feature matrix between RapCAD, OpenSCAD and ImplicitCad.

replicad

A library to build browser based 3D models with code. Exposes an API inspired by CadQuery, written to run in the browser. Replicad is a javascript wrapper on top of opencascade.js

scad-clj

OpenSCAD DSL in Clojure. Functions generally mirror OpenSCAD, with a couple of notable exceptions.

scad-hs

Same author as scad-cji, he likes functional programming languages clearly.

sdfx

Go-based Code-CAD package that uses a signed distance functions (SDFs) kernel. Is capable of doing fillets and chamfering. The repo includes a standard-library.

Note that @soypat has a rewrite that might be worth checking out.

sdf-csg

Generate meshes from signed distance functions and constructive solid geometry operations. This library is heavily based upon Inigo Quilez's 3D SDFs article.

SolidPython

Python-based library that wraps OpenSCAD, i.e. it outputs OpenSCAD code.

Tovero

Tovero is a binding of Libfive to Common Lisp, including a standalone REPL-based viewer. Tovero can be integrated with Clive, a Common Lisp scene graph and 3D GUI, to build more complex modelling applications.

Node editors / other

Not quiet Code-Cad, but they do embody much of the same thought process.

BlocksCAD

Looks to be unmaintained.

Dynamo

Dynamo is, quite literally, what you make it. Working with Dynamo may include using the application, either in connection with other Autodesk software or not, engaging a Visual Programming process, or participating in a broad community of users and contributors. Works with FreeCad

MakeCode

MakeCode's block editor supplies many great deal of helpers that make it perfect for making functional 3d prints, for example, there are functions that help stack and layout parts, as well as fillet utils (called styled edges). It also has a fast hull function (called wrap shapes). MakeCode is sponsored by BuildBee.

Sverchok

Add-on for blender. Sverchok is a powerful parametric tool for architects, allowing geometry to be programmed visually with nodes.