CAD as Code
Parametric Modeling and Engineering with Python

A textbook on building CAD models as Python programs. It covers modeling techniques, the geometric and topological foundations underneath them, and the workflow around a model: version control, tests, assemblies, data exchange, meshing, finite element simulation and parameter optimization. Twelve chapters with exercises, 121 pages; it assumes basic Python and no prior CAD experience. It grew out of my course on programming CAx systems and serves as companion reading for it.
Get the book
The book is published open access by HM Munich University of Applied Sciences through the HM library.
- PDF download: doi.org/10.60948/OPUS-1358
- Sources: github.com/DavidMStraub/cad-as-code-book
The text and figures are licensed under CC BY 4.0, the code examples under the MIT License, so you can use them freely in your own work. If you find an error or have a suggestion, please open an issue.
Citation
David M. Straub, CAD as Code: Parametric Modeling and Engineering with Python. HM Munich University of Applied Sciences, 2026. DOI: 10.60948/OPUS-1358
Contents
Part I – Parts from Code
- The Case for CAD as Code
- First Parts
- Profiles into Solids
- Designing with Parameters
Part II – Under the Hood
- Anatomy of a Solid
- The Mathematics of Shape
- Freeform Modeling
Part III – Engineering as Software
- Models You Can Trust
- Assemblies and Release Pipelines
- From Solids to Meshes
- Simulation
- Searching the Design Space