Skip to main content

CAD-as-Code, in a box

A turnkey workspace for parametric CAD as software. Reopen this repo in any Dev Containers-capable editor or cloud workspace — VS Code, Cursor, GitHub Codespaces, and many other clients — and you get a complete modeling environment: IDE, live 3D viewer, automated tests, export tooling, and a CI/CD pipeline already wired together.

Define geometry with build123d, preview it in the OCP CAD Viewer, validate it with pytest and quality checks, then export STEP, STL, GLB, and release assets from the same source. Python in cad/ is the source of truth; generated files are outputs, not files you hand-manage.

If you are new to software-style workflows, that is the point of the template: the non-CAD pieces are all here and configured so your CAD work is repeatable, inspectable, and automated so that you can focus on design and modeling. If a term is unfamiliar, start with the glossary and follow the linked guide from there.


Dev environment with build123d code, OCP CAD Viewer, and a parametric sphere The default workspace: source code, live model preview, and agent assistance sharing the same containerized CAD environment.


Section cut through the demo sphere assembly in OCP CAD Viewer A section cut through the demo sphere assembly, showing the kind of interior geometry the OCP CAD Viewer can inspect while you iterate.


What's in the box​

LayerWhat you get
IDEDev container (.devcontainer/) for VS Code, Cursor, Codespaces, and more; dependencies and docs site start with the workspace
Modelingbuild123d parts and assemblies under cad/
VisualizationOCP CAD Viewer plus the ocp-vscode bridge for show_object
Qualityruff linting, mypy type checks, and vulture dead-code detection
Commandsjust command runner for development, export, and CI/CD pipeline tasks
CI/CD pipelineDagger plus GitHub Actions for repeatable checks and releases
AgentsOptional AI assistance from tools such as Cursor, Claude, and GitHub Copilot
MCPAgent tools in the dev container: build123d-mcp and ocp-viewer-mcp
PublishMakerRepo decorators and mr CLI for artifact discovery and export

Stack architecture​

The source of truth is always Python model code in cad/. Editors and AI tools work around that source, while commands, quality checks, export tools, and the CI/CD pipeline all regenerate results from it. That keeps changes reviewable: the model code changes first, and artifacts follow from repeatable automation.

Stack​

ToolRole
build123dParametric CAD-as-Code on Open CASCADE
OCP CAD ViewerLive 3D visualization in VS Code-based IDEs
ocp-vscodePython bridge for show_object
uvDependency and virtualenv management
justCommand runner for development, export, and CI/CD pipeline tasks
pytestGeometry and export tests
ruff / mypy / vultureLinting, type checking, and dead-code detection
DaggerPortable CI/CD pipeline from local runs to GitHub Actions
build123d-mcpMCP interface for sandboxed geometry execution by agents
ocp-viewer-mcpMCP interface for viewer screenshots and visual feedback
MakerRepo@artifact, @customizable, and @cached decorators
makerrepo-cliArtifact discovery, export, and viewer integration

New repo from the template?​

If you used Use this template:

  1. Follow Create and initialize your repository: Use this template, edit template.repo.toml, then run just init.
  2. Complete Set up GitHub for Actions, Pages, branch protection, and merge settings.
  3. Read Releases before publishing generated assets.

Details: Replace the template identity.

Explore the docs​

AreaStart here
Getting startedQuick start · Create and initialize · GitHub setup · Releases · Project layout · IDEs and workspaces
ModelingConventions · Parts and assemblies · Testing strategy · External libraries
Toolsjust · uv and quality · MakerRepo · MCP servers · CAD tooling
WorkflowsDaily development · Export and formats · CI/CD pipeline and Dagger · Releases
Reference and helpGlossary · Troubleshooting · Open CASCADE · For agents

Roadmap​

  • Additional parts and real assemblies: constraints, patterns, and reusable project structure.
  • build123d part libraries and PartCAD integration.
  • Bills of materials from assemblies.
  • Manufacturing export profiles that let one model target different processes: printer-specific margins for Bambu or Prusa workflows, tighter CNC machining clearances, and reusable shop defaults for generated release artifacts.
  • Topology optimization demos, for example dl4to4ocp.

Repository​

Coffee2Bits/CAD-as-Code-Template