DX-CAD › Python CAD
Models you can read
Python CAD: every 3D model is also a short script
Model in the window with the mouse, or write the part as Python. Either way the model is a readable script you can change, re-run, diff and keep under version control.

Why script your CAD
Change a number, rebuild
Sizes live at the top of the script. Change one and the part rebuilds, holes, patterns, flanges and all.
Variants without copies
One script makes a whole family of parts. Keep it in Git, review changes as diffs, and know exactly what changed between revisions.
Automate the repetitive
Generate the same bracket in twenty sizes, or a product range from a spreadsheet, from the command line, with no window open.
Runs without a window
dxcad run builds a model from the command line, so scripts fit into build servers, batch jobs and your own tools.
What you get
A real CAD kernel
DX-CAD is built on the OpenCASCADE kernel: sketches, extrudes, revolves, booleans, fillets, patterns, assemblies with mates, sheet metal and drawings.
pip install dxcad
DX-CAD installs from PyPI for Python 3.12, as well as from the Windows installer and the macOS and Linux builds.
An open-source SDK
Write add-ons with the Apache-licensed SDK: new commands, kinds of part and drawing tools. See how to build and publish a plugin.
Exchange with any CAD
STEP import and export with assembly structure, names and colours; DXF, STL and 3MF out.
A whole part in 25 lines
A mounting bracket with a row of holes, from DX-CAD's own examples. Every name is already in scope; change a number and run it again.
LENGTH = 80.0
DEPTH = 30.0
HEIGHT = 46.0
THICKNESS = 6.0
HOLES = 4
HOLE_DIAMETER = 5.0
INSET = 10.0
section = (
Sketch(Plane.YZ)
.move_to((0, 0))
.line_to((DEPTH, 0))
.line_to((DEPTH, HEIGHT))
.line_to((DEPTH - THICKNESS, HEIGHT))
.line_to((DEPTH - THICKNESS, THICKNESS))
.line_to((0, THICKNESS))
.close()
)
body = section.extrude(LENGTH)
pitch = (LENGTH - 2 * INSET) / (HOLES - 1)
drill = make_cylinder(HOLE_DIAMETER / 2, THICKNESS, origin=(INSET, (DEPTH - THICKNESS) / 2, 0))
drills = linear_pattern(drill, (pitch, 0, 0), HOLES)
part("bracket", cut_all(body, drills), color="steel")
Questions
Do I have to write Python to use DX-CAD?
No. Everything can be done in the window with the mouse. The script is there when you want it.
Which Python?
Python 3.12. The Windows installer, the macOS app and the Linux AppImage carry their own, so you need no Python of your own unless you install from PyPI.
How do I run a script without the window?
From the command line: dxcad run model.py --output part.dxcprt builds it, and dxcad flat unfolds a sheet part from it.
Is DX-CAD open source?
DX-CAD itself is free for 30 days and then licensed; its SDK, for add-ons, is open source under the Apache License 2.0.
Read more: The model language · Tutorial: your first part · The command line