Your first part in ten minutes
From installing DX-CAD to a bracket with four holes, exported as a STEP file. The bracket is one of the examples that ships with DX-CAD: a short script with its numbers at the top.
1. Install DX-CAD
Windows: an installer, or a portable zip that needs no Python; both carry dxcad.exe, the command line.
macOS (Apple silicon) and Linux (x64) builds.
Or, with Python:
pip install dxcad
dxcad doctor tells you the install works, ending with SMOKE OK, and dxcad doctor --report gives everything a bug report needs.
Free for 30 days from first start, then a licence. Opening, viewing and exporting stay free. Download DX-CAD.
2. Get the bracket
Copy the example out, then open it in the window:
dxcad examples bracket
dxcad gui bracket.py
The window shows the model in a pane on the right, and the part it builds on the left.
3. Read the numbers
The model is a script, bracket.py, and these are its numbers, at the top of the file:
LENGTH = 80.0
DEPTH = 30.0
HEIGHT = 46.0
THICKNESS = 6.0
HOLES = 4
HOLE_DIAMETER = 5.0
INSET = 10.0
The bracket is an L in section, drawn once and extruded along its length. Every other size follows from these names.
4. Run it
In the window, choose Model > Run Script, or press F5. The same model builds from the command line into a project, and one more command says in words what was built:
dxcad run bracket.py --output bracket.dxcprt
dxcad describe bracket.dxcprt
It is one valid solid, 80 x 30 x 46, with a volume of 33128.761: the L's area times its length, less four holes.
5. Four holes from one line
The script makes one drill, a cylinder through the base, and repeats it in a row. The holes are spaced from the length, so they move when the length does:
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")
Counting them, the part has four holes, each of diameter 5 and depth 6, with centres at x = 10, 30, 50 and 70, y = 12.
6. Change a number
Change LENGTH = 80.0 to LENGTH = 100.0 in the pane and run it again with F5. The bracket is now 100 x 30 x 46 with a volume of 41528.761, and the four holes are at x = 10, 36.667, 63.333 and 90. That is the whole of DX-CAD's parametric model: change a number and run it again.
7. Export it as STEP
Choose File > Export Parts..., pick STEP as the file type and give it a name. It writes the picked parts, or every part when none is picked, to one file; the command line writes them the same way with dxcad export.
Save the project, with its model, with File > Save.
Where next
- See the bracket as it ships: the bracket example, with its whole script.
- Every other example, a script each: the gallery.
- What each release brought: release notes.