CadQuery parametric parts for the Elegoo Centauri Carbon - describe/model/review loop with CQ-editor previews
  • Python 89%
  • Shell 11%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
minnix 11ea78ea60 Thin the compost_adapter band to 2 mm, keep the boss at 5 mm
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.
2026-10-12 18:57:14 -05:00
parts Thin the compost_adapter band to 2 mm, keep the boss at 5 mm 2026-10-12 18:57:14 -05:00
scripts CadQuery part workflow + compost_adapter prototype 2026-10-11 20:11:49 -05:00
.gitignore Ignore the Forgejo API token dropped in the repo root 2026-10-11 20:16:33 -05:00
cq CadQuery part workflow + compost_adapter prototype 2026-10-11 20:11:49 -05:00
README.md CadQuery part workflow + compost_adapter prototype 2026-10-11 20:11:49 -05:00
requirements.txt CadQuery part workflow + compost_adapter prototype 2026-10-11 20:11:49 -05:00

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

  1. Describe the change.
  2. The part file is edited; CQ-editor hot-reloads it (see below) — no restart, no click.
  3. 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.
  4. Nothing is exported until the shape is approved. ./cq build writes 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.0 declares Requires-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's python3.13 package.
  • cadquery 2.8.0 has no Model class. Use cq.Workplane / cq.CQ and cq.Assembly. The exporter takes STL, 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 use QT_QPA_PLATFORM=offscreen. Avoid forcing llvmpipe/software GL — it makes the viewport unusable on this hardware.
  • Preview rendering uses VTK 9.6.2 offscreen. Two gotchas already handled: vtkFeatureEdges emits point scalars that override actor colour (needs ScalarVisibilityOff()), and ResetCamera() fits the bounding sphere, which leaves flat parts tiny in a square tile (replaced with a projected-corner fit_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