Commit Graph

2 Commits

Author SHA1 Message Date
NiJingzhe e56c17dec3 refactor: single-choke-point sketch capture in SketchScript.render
Capture previously lived per emission call site (plain profiles, sweep
paths) — the taper loft sections and countersink cones built their
SketchScripts directly and silently bypassed snapshots and constraint
recovery, which is why pulley's extrude-3 carried constraints while its
two taper blocks did not.

SketchScript.render is now the one capture point: it fires the replayer
sink (block-context stamping, snapshot collection, constraint recovery)
and appends the sink's constraint lines after the entities. Every
construction site — profiles, loft/taper sections, countersink cones,
sweep paths, and pattern seeds (whose loop-expression plane header is
supported via render(header=...)) — is captured by construction; no call
site remembers anything. emit_profile_sketch reverts to pure formatting
(sink forwarded, snapshot return removed).

Pulley now reports 5/5 sketches riveted (taper sections included) and
wheel 2 sketches (pattern seed captured; the 63-point outline still
degrades to timeout). New tests pin the invariant: the pulley taper
blocks carry section constraints, and a SketchScript sink fires exactly
once per render. Real pulley trace baked as a fixture.
2026-09-09 17:35:59 +08:00
NiJingzhe 216a7ed625 feat: CadQuery→FTC translator toolset under tools/research (cadqueryftc)
Port the runtime-tracer half of PR #30 (feat/cadquery_converter) and rewrite
its emission layer to the current Feature Tree Convention, following the
tools/research/histjson four-stage pattern (trace / translate / validate /
profile + responsibility wall: the translator only translates).

- tracer/ (instrument, fingerprint, cq_runner, worker) ported near-verbatim:
  runs under .venv-cq (Python 3.11 + cadquery 2.8); records resolved plane
  frames, serialized args, selector strings, and geometric fingerprints of
  actually-selected faces/edges plus ground-truth volume/bbox per program.
- emission rewritten for FTC: block headers with closed role vocabulary and
  no positional slugs; transcribed planar profiles authored through the
  sketch API (local coords, pooled points, three-point arcs via
  circumcenter) annotated profile=geometry; booleans in list form over a
  histjson-shaped bodies dataflow; fillet/chamfer/shell selections
  synthesized as QL predicate bands from trace fingerprints with
  take/exactly cardinality; through-cut depths derived from the trace
  bbox; zero in-source verification; literal numbers only.
- unknown ops become untranslated notes, never silent drops; static-AST
  path and exploratory scoring/edit-bench from the PR intentionally not
  ported.
- directory named cadqueryftc so it can never shadow `import cadquery`.
- fixtures are real traces captured with cadquery 2.8; 13 tests pin format
  contracts + volume reconciliation (all four reconcile at <=2.2e-12 rel
  err) with no cadquery required in CI; full test/ suite 1516 passed.
2026-09-08 15:53:51 +08:00