- Python 89%
- Shell 11%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
T drove both the flange wall and the bend radius, so it is split into BAND_T and PIPE_WALL: the band can go thin without dragging the boss with it. RI = RO - BAND_T keeps the sheet-metal model exact -- outer R=160 / inner R=158 measured off the solid. The boss keeps PIPE_WALL=5, so O53 outer / O43 bore are unchanged and the flat washer-seat tip still measures 754 mm2 = pi(26.5^2 - 21.5^2). Solid volume drops 118.6 -> 50.5 cm^3. |
||
| parts | ||
| scripts | ||
| .gitignore | ||
| cq | ||
| README.md | ||
| requirements.txt | ||
CadQuery → 3D print workflow
Parametric CAD for the Elegoo Centauri Carbon (256 × 256 × 256 mm build volume).
Describe a part → it gets modelled in CadQuery → reviewed live in CQ-editor → exported print-ready.
Layout
cq launcher (build / show / open / list)
parts/ one .py per part; each defines build()
out/ exports: <name>.step, <name>.3mf, <name>.stl, <name>-preview.png
scripts/build.py export + preview renderer
.venv/ Python 3.13 virtualenv (do not commit)
requirements.txt pinned: cadquery 2.8.0, cq-editor 0.7.0
Usage
./cq build smoke_box # exports STEP + 3MF + STL, renders 4-view preview
./cq show smoke_box # build + print the preview in-terminal
./cq open parts/foo.py # open CQ-editor (live 3D, GPU via XWayland)
./cq list # list parts
A part file is just:
import cadquery as cq
def build():
return cq.Workplane("XY").box(60, 40, 20)
# Required — see the CQ-editor note below.
result = build()
build() may return a cq.Workplane, a cq.Assembly, or any CadQuery Shape.
The result = build() line is not optional. CQ-editor only renders module-level
CadQuery objects: cq_utils.find_cq_objects() scans the module dict for
Workplane / Shape / Assembly / Sketch values. A file that merely defines
build() loads without error and shows a completely empty viewport — which looks
like the geometry broke, not like a missing line.
The review loop
- Describe the change.
- The part file is edited; CQ-editor hot-reloads it (see below) — no restart, no click.
- Review the viewport. A 4-view PNG grid (ISO/TOP/FRONT/RIGHT) is also rendered into chat so the geometry can be checked, not just the fact that the script ran.
- Nothing is exported until the shape is approved.
./cq buildwrites STEP/3MF/STL, so it is the last step, never the first.
Reloading: use File → "Automatic reload and preview". Do not press F5.
render() reads editor.get_text_with_eol() — the editor buffer, not the file on
disk — so after an external edit F5 re-renders the stale geometry and looks like the
change did nothing. "Automatic reload and preview" arms a QFileSystemWatcher;
_file_changed() reads the file into the buffer and emits triggerRerender.emit(True),
re-rendering ~50 ms after each write. With it enabled, an external edit lands in the
viewport on its own. Don't hand-edit in the CQ-editor window while a write is in flight —
the reload replaces the whole buffer.
Export formats
.3mf— feed this to OrcaSlicer. Carries units and colours..step— keep for re-measuring or re-editing the CAD later..stl— universal fallback.
Environment notes (why it looks the way it does)
- Python 3.13, not the system 3.14.
cq-editor 0.7.0declaresRequires-Python <=3.14, which in PEP 440 means<=3.14.0— so the system Python 3.14.8 is rejected outright. The venv uses Fedora'spython3.13package. cadquery2.8.0 has noModelclass. Usecq.Workplane/cq.CQandcq.Assembly. The exporter takesSTL, STEP, AMF, SVG, DXF, TJS, VRML, VTP, 3MF, BREP, BIN.- GPU rendering is preserved. CQ-editor runs on
QT_QPA_PLATFORM=xcb(XWayland) so the Intel iGPU does the work. Headless builds useQT_QPA_PLATFORM=offscreen. Avoid forcingllvmpipe/software GL — it makes the viewport unusable on this hardware. - Preview rendering uses VTK 9.6.2 offscreen. Two gotchas already handled:
vtkFeatureEdgesemits point scalars that override actor colour (needsScalarVisibilityOff()), andResetCamera()fits the bounding sphere, which leaves flat parts tiny in a square tile (replaced with a projected-cornerfit_parallel_scale).
Rebuilding the environment
sudo dnf install -y python3.13 # 3.14 is incompatible, see above
python3.13 -m venv .venv
.venv/bin/pip install -r requirements.txt