Files
superGeometry 272aee1888 History: a breakpoint (roll back without deleting) and Merge
- A step's menu: Insert Breakpoint After - the later steps are off and
  greyed under a bar, the model as it was there. New steps go in at the
  breakpoint (before the ones it switched off). Remove on the bar (or in
  the menu) switches them all on again.
- Merge History…: every step becomes the bodies as they are now (each kept
  exactly, with its id, so names, colours, materials and folders stay).
  Keep the sketches and keep the variables are ticked by default. Undo
  takes it back.
- The dialog can show tick boxes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 09:58:01 +02:00

19 lines
1.0 KiB
TypeScript

// The History's breakpoint: the steps after it are off until it's removed.
// Run: npx tsx tests/breakpoint.test.ts
import type { Feature } from "../src/doc/types";
import { after, block, check, circle, done, extrude, near, sketch, volume, XY } from "./kit";
const hole = sketch("h", XY(10), [circle("c", 10, 10, 3)]);
const cut = extrude("C", hole, -10, "cut");
const all: Feature[] = [...block("B", 20, 20, 10), hole, cut];
{
const on = await after(all, "B");
check("without a breakpoint the hole is cut", !on.err && near(volume(on.body), 4000 - Math.PI * 9 * 10, 0.05), { err: on.err, v: volume(on.body) });
const back = await after(all.map((f) => (f.id === "C" || f.id === "h" ? { ...f, rolledBack: true } : f)), "B");
check("after the breakpoint the cut is off", !back.err && near(volume(back.body), 4000, 1e-3), { err: back.err, v: volume(back.body) });
check("and its sketch is not drawn", !back.r.sketchBoundaries?.h || !back.r.sketchBoundaries.h.length, Object.keys(back.r.sketchBoundaries ?? {}));
}
done();