Files
OrcaSlicer/scripts/CAD
Tommaso BianchiandClaude Opus 5 648b930e75 gesture rungs for the six new constraint buttons, and the DistanceX/Y bug they found
Port of snaporca 2951e3c60b; parity holds (17 identical, DesignPanel.cpp still exactly 32
divergent lines, so the hunk landed on the right side of the DropDown divergence).

The sketch-constraint epic added six toolbar buttons and covered all six with kernel
tests. Not one of them was ever clicked. The gesture ladder only pressed 'perpendicular'
and 'equal' -- and CON_BTN, which locates buttons by index, was silently wrong for every
entry past index 5 for the whole epic. The untested half of the toolbar was exactly the
broken half (snaporca-rqsy).

Four rungs now drive them: D4 Equal on two circles (must mean equal RADIUS, not the
equal-length no-op the epic fixed), D5 Collinear on two oblique lines, D6 a horizontal
distance, D7 symmetric about the implicit vertical axis. Full ladder 118/118 on snaporca;
this fork's rig has not been rebuilt against the change yet, so here it is reviewed,
parity-checked and NOT exercised.

D6 found a shipped defect. apply_entity_constraint enumerated {P0,p0},{P1,p1} for BOTH
entities regardless of type, but a Point's p1 is unused and reads (0,0), as does a
Circle's. The closest-pair search then picked those two phantom origins, distance 0: the
field opened pre-filled 0.00 and the solver dropped the constraint, because ptOf(Point,P1)
resolves to no handle. Nothing errored -- the dimension simply did nothing. ends_of() now
enumerates only the roles an entity actually exposes, and the pair with no point at all is
refused with a message instead of a silent no-op.

Five kernel tests, a 7/7 ladder, a review and a fork port all passed over this, because
every one of them exercises the kernel, where the geometry was always right.

Two rig faults fixed in the same pass, both of which produce a green-looking session that
tests nothing: start-headless-gui.sh never exported SNAPORCA_MCP or SNAPORCA_KEYTRACE, so
a freshly launched rig comes up healthy and every ladder dies on "Connection refused"; and
it never dismissed the "Restore" dialog a killed session leaves behind, which grabs every
synthetic click afterwards.

The value field also takes no keyboard focus from the WM -- typed digits go to the canvas
and Return commits the pre-filled number (typed 40, got 54.94). focus_field() finds it as
its own top-level window and clicks it first. The no-op tolerance is now 5e-3, the field's
own two-decimal display resolution, not 1e-6.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MrMzTpAf78U4NG2M8jfvHY
2026-08-31 10:40:38 +02:00
..

Design-tab scripts

Everything here supports the parametric Design tab (src/libslic3r/CAD/, src/slic3r/GUI/CAD/). Nothing here is needed to build or run OrcaSlicer — these are the development and verification tools for that one feature.

The verb in the name is the role:

build-… produce a binary
start-… bring something up and leave it running
run-… run a suite and report pass/fail
check-… one specific assertion, usually driving a live app

Verification

Script What it proves Needs
run-kernel-tests.sh The CAD kernel builds and the Catch2 [CadDocument] tags pass — every case builds a document, recomputes it and asserts on real geometry. Exit 0 is the verification contract. Docker only. No display.
run-all-checks.sh Every check below, in one command. The gate before pushing a Design-tab change. Docker + the GUI container
check-sketch-engine.py A ladder of 2D sketches of increasing complexity, judged on loop count, closure and void attribution rather than on area. Kernel only
check-sketch-engine-corpus.py The same ladder graded against a systematic sample of real drawings instead of shapes we chose. Kernel + corpus
check-gui-sketching.py The same profiles drawn the way a person draws them — synthetic mouse gestures and typed values. Headless GUI
check-gui-context-menu.py That right-click is the pivot of the design gesture, and adapts to what was clicked. Headless GUI
check-mcp-sketch.py The sketch layer driven over the MCP socket, asserting what decides whether a profile is buildable. Headless GUI + SNAPORCA_MCP

run-kernel-tests.sh is the only one CI can run. The rest need a live application with an OpenGL canvas and synthetic input, which hosted runners do not have. The kernel suite itself is already in CI by an ordinary route: the cases are registered in tests/libslic3r/CMakeLists.txt under if (SLIC3R_CAD), so they are part of libslic3r_tests and run under ctest on every platform like any other unit test. This script exists for the local loop, where it is a two-minute round trip instead of a full application build.

Build and run

Script Purpose
build-gui.sh Build the GUI binary in a throwaway container, writing into the build-cache volume the long-lived GUI container reads.
build-gui-incremental.sh Incremental build against the deps-baked image, for a fast edit/compile loop.
start-headless-gui.sh Bring the app up on a headless X display (Xvfb + a window manager), ready to drive or attach to over VNC.

Two constraints that are not obvious and have each cost a session:

  • Never build inside the GUI container. Its baked source tree silently reconfigures the shared build directory and this fork's targets vanish.
  • A window manager is required. Without one, windows are never focused, and an unfocused GTK app ignores synthetic keys — which looks exactly like a code bug.

docs/rig_build_traps.md documents these and three more, with symptoms and exact recovery commands. Read it before debugging a configure or link failure one of these scripts reports.