# Getting started
pycodecad needs a graphics card with OpenGL 3.3; see Limitations for the platforms. Once installed, check that the command works:
pycodecad --version
# A first part
Open a window on a file. If the file does not exist, pycodecad creates it from a small example:
pycodecad part.py
A part can also be several files in one folder (gear.py imports teeth.py): open the folder
with pycodecad gear/ and switch between its files in the window. See
The window.
A part is a plain Python script that builds shapes with build123d and passes them to show():
from build123d import Axis, Box, Cylinder, fillet
from pycodecad import show
plate = Box(40, 30, 8) - Cylinder(5, 8)
plate = fillet(plate.edges().filter_by(Axis.Z), radius=3)
show(plate, name="plate", color="#F4B02A")
Units are millimetres and Z points up. Only what you pass to show() is in the scene: see
Scripts.
# Run and save
The script runs once when the window opens. After that, nothing happens by itself:
- Edit the code.
- Press Run (Ctrl+R or F5) to see the result.
- Press Save (Ctrl+S) when you like it.
If the script fails, the window shows the error with its line, and the last good part stays on screen. More in The window.
# Export
In the window, Export writes the part next to the script (part.stl, part.3mf...). From a
terminal:
pycodecad export part.py part.stl
pycodecad export part.py part.3mf --profile bambu # 3MF for Bambu Studio, with names and colors
Formats: STL, 3MF, STEP, GLB and BREP. See Command line.
# Without pycodecad
python part.py also runs the script: show(), clear() and frame() then do nothing and expose() uses
the defaults. See Scripts.
# Next
- Try the examples:
pycodecad examplescopies them to./pycodecad-examples(once) and opens the folder: loose parts inparts.py, composed ingearbox.pyand shown inassembly.py, turning ingears_turning.py. - Make a part to measure with Parameters.
- Let an assistant work on it: Working with an AI assistant.