CodeCAD is a lightweight, code-first parametric CAD tool. You write Lua scripts, CodeCAD builds solids using the robust OpenCascade kernel (OCCT) — with live preview, reusable parts, and a workflow that feels as natural as editing code in your favorite editor.
Please find more information on our documentation site https://www.codecad.xyz.
- ⚡ Live: code in your editor, geometry updates instantly in an integrated viewer
- 🧩 Composable: split designs into parts and reuse them
- 📐 Parametric: adjust dimensions by changing a single parameter
- 🛠 For makers: designed with 3D printing and woodworking in mind
- 🌱 Open: built on C++17, Lua, and OpenCascade
Most GUI-based CAD tools are powerful, but:
- 🌀 Steep learning curves
- 💸 Expensive licenses
- 🔒 Hard to automate, version, and share
With CodeCAD you:
- Model in pure code (with Lua)
- Get live preview in the integrated viewer
- Keep your models small, diff-able, and version-controlled in Git
- Parametrically adapt designs, do not start all over, if you want to change a small parameter
👉 If you love code, the command line, and reproducible workflows — CodeCAD is for you.
Pure C++ layer on top of OCCT: custom types (Shapes, TriMesh, Ops), Extrude/Revolve, Booleans, Fillet/Chamfer, Section, Triangulation, STL/STEP export. OCCT stays encapsulated internally. The kernel API does not expose any OCCT types.
Binds the kernel API to Lua (via sol2). Provides a stable, curated scripting API (Primitives, Transforms, Ops, higher-level parts like Threads, Rods).
Lightweight render engine (GLFW + GLM + ImGui). Accepts TriMeshes from Kernel/Lua/Service, renders them, displays status bar & dock panel.
Project tool (ccad init/parts/live/build/bom, etc.). Can execute Lua/kernels locally; shows live geometry through Pure.
Playground for new geometries/algorithms. Uses kernel and PURE for visualization.
Important
We are still in an early development stage. Please consider that the APIs are not yet stable and may change in future.
- CMake
- C++17 compiler
- OpenCascade (OCCT) installed (version 7.9.1)
git clone https://github.com/breiting/codecad
cd codecad
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j
make install# initialize new project
mkdir myproject && cd myproject
ccad init
# add a first part (the name is optional)
ccad parts add "Box"
# run live viewer
ccad liveThis opens the viewer: edit parts/box.lua in your editor and see geometry update live.
myproject/
├── project.json # project metadata (name, units, params, materials, parts…)
├── parts/ # Lua scripts for parts
│ └── box.lua # each part is self-contained
└── generated/ # generated meshes (STL, STEP…)
Parts are written in Lua, e.g.:
-- parts/box.lua
local c = box(10, 20, 5)
emit(c)Parametric nut block:
local size = param("size", 20)
local hole = param("hole", 6)
local b = box(size, size, size/2)
local cut = cylinder(hole, size)
emit(difference(b, cut))Change hole from 6 → 8 and regenerate — instantly updated.
- Lua LSP stubs in types/ for completion & diagnostics
- For Neovim: include ./types and ./lib in your Lua.workspace.library
You are welcome to contribute to this project. I am developing under MacOS and Linux. However, I cannot test with Windows. So volunteers are welcome to support all three platforms. Any feature requests should be filed directly in Github.
