Python LGPL-3.0

pymadcad

Simple yet powerful CAD (Computer Aided Design) library, written with Python.

J

jimy-byerley

Dernière activité 18 sept. 2026
jimy-byerley/pymadcad

293

étoiles

30

forks

32

issues ouvertes

3d3d-printingcadengineersgeometryguikinematicslibrarymadcadmeshmodelingpythonqtrendering

Ce README est souvent en anglais.

madcad-logo

PyMADCAD

Mechanical design as code -- a Python CAD library for engineers who prefer scripts and automation over clicks.

PyPI tests Documentation Matrix

PyMADCAD is a script-based CAD library where the Python script is the model. Design mechanical parts with transparent, composable geometry you can version, diff, test, and automate -- no parametric black box, no opaque GUI. It outputs triangulated meshes ready for rendering, simulation, or 3D printing.

uimadcad is the graphical frontend for pymadcad -- an interactive 3D editor with multi-view scene, script editor, and quick primitive tools. Everything you can do in the GUI, you can also do in a script.

Website · Documentation · Examples · Matrix chat

differential

Install

pip install pymadcad

Optional file format support:

pip install pymadcad[stl,ply,obj]

Quick examples

Extrusion

from madcad import *

show(extrusion(ArcThrough(+Y, Z, -Y), 2*X))

extrusion

Boolean difference

from madcad import *

m1 = brick(width=vec3(2))
m2 = m1.transform(vec3(0.5, 0.3, 0.4)).transform(quat(0.7 * vec3(1, 1, 0)))

show([difference(m1, m2)])

boolean

See the examples/ folder and the guide for more.

bearing

Features

  • Surface generation -- extrusion, revolution, tube, helix, screw, saddle, and standard shapes
  • Boolean operations -- union, intersection, difference with spatial hashing
  • Kinematic system -- joints, screw theory, mechanism simulation
  • Constraint solver -- tangent, distance, angle, radius, and more
  • Bevel & blending -- chamfer, filet, and smooth transitions
  • Standard library -- ISO nuts, screws, bearings, gears
  • File I/O -- STL, PLY, OBJ import/export
  • High-quality display -- OpenGL rendering via moderngl, Qt integration

Project structure

pymadcad/
├── madcad/      # Python module
├── src/         # Rust extensions for the python module (performance-critical operations)
├── examples/    # example of mechanisms designed with madcad
├── tests/       # all unit tests for madcad
└── docs/        # docs based on mkdocs

This python module stands as a library proposing few data structures and a lot of functions to operate them. It is mostly functional and straight forward code style The rust extension of pymadcad standard as madcad.core and is based on pyo3 and built with maturin

Development

Here are recommended ways to work with this repo

  • start by cloning the repo and setting up an environment
# clone this repository from official sources
git clone https://github.com/jimy-byerley/pymadcad
cd pymadcad

# Install dependencies
uv sync
  • build and test commands
# build the Rust extension for inplace use of madcad, add --release for bechmarks
maturin develop

# Run tests
pytest
# run tests but skip visual checks
MADCAD_VISUALCHECK=false pytest

# Build and serve the docs locally
mkdocs serve
  • package build
# build pymadcad package
maturin build --release
# just build the docs website
mkdocs build

License LGPL

Copyright 2019-2026 Yves Dejonghe jimy.byerley@gmail.com

Distributed under the LGPL-v3 license.

Projets similaires

A python CAD programming library

Python3d3d-models3d-printing
Ggumyr
3,2 k étoiles289

Official source code of FreeCAD, a free and opensource multiplatform 3D parametric modeler.

C++3d3d-printingarchitecture
FFreeCAD
33,8 k étoiles6,1 k

OpenSCAD - The Programmers Solid 3D CAD Modeller

C++3d3d-graphics3d-models
Oopenscad
10,3 k étoiles1,8 k