Files
superGeometry 857f632c95 iPad findings: wheels kept on screen in a column beside History, clean thread ends, line tool ends on any closed shape, Auto by direction, quick actions on a picked face/edge/point
- Wheels: the tool wheel is always kept on screen; a tap on its middle folds it (never gone). First places on tablets and computers: one column left of History, below the view cube (tools, Options, Settings), far enough apart not to overlap when open. New places key, so old dragged spots don't hide it.
- Browser dark-mode add-ons washed the wheels out (they lighten dark fills): darkreader-lock tells them the page is already dark.
- Threads: the groove's stopped ends left a thin ring of the face and a flat stub at the end, and a flat triangle where groove pieces met. Free ends now get a 45 degree chamfer to the root; the pieces are fused into one groove.
- Line tool: a line that ends on an existing point and closes a shape (drawn in pieces, after an arc, carried on after a stop) puts the line tool down, as closing on its own first point did.
- Auto, by the way it goes (new extrudes, byDirection): on its own, + is a new body, - cuts what it runs into; on a face, out adds, in cuts. Older extrudes keep the old rule. The choice is "Operation"; the Options wheel names it by what it does (Cut, Add, New body).
- Quick actions: the two most likely next tools as round buttons beside a picked face, edge or point (clear of its arrow and of the wheels).
- Welcome text: a free MakerWorld Boost or a follow.
- valve test: threaded pairs' overlap confirmed by point sampling (the kernel's intersect said 34 and 83 mm3 where no point is in both).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 12:35:21 +02:00

46 lines
3.2 KiB
TypeScript

// Run: npx tsx tests/autodirection.test.ts - Auto by the way it goes (new
// extrudes): a shape drawn on its own (on a plane, not on a face) going + is a
// new body, whatever it runs into; going - it cuts what it runs into (a new
// body when it runs into nothing). On a face: out adds, in cuts. And extrudes
// saved before (no byDirection) still cut what they run into either way, so
// old projects come out as they were.
import type { Shape3D } from "replicad";
import { after, block, bodies, check, done, extrude, near, rect, sketch, XY } from "./kit";
import { measureVolume } from "../src/kernel/ocFree";
import type { Feature } from "../src/doc/types";
const vol = (s: Shape3D) => Math.abs(measureVolume(s));
const box = block("Box", 40, 40, 20); // 32000
const slot = sketch("Slot", XY(10), [rect("s", 10, 10, 30, 30)]); // in the box's middle height
const sum = () => [...bodies().values()].reduce((v, s) => v + vol(s as Shape3D), 0);
{
const { errors } = await after([...box, slot, extrude("Up", slot, 30, "auto", { byDirection: true })]);
// A new body 20x20x30 standing in the box, the box as it was.
check("going +, drawn on its own: a new body, the box untouched", !errors.length && bodies().size === 2 && near(vol(bodies().get("Box") as Shape3D), 32000, 1e-6) && near(vol(bodies().get("Up") as Shape3D), 12000, 1e-6), [errors, bodies().size, sum()]);
}
{
const { errors } = await after([...box, slot, extrude("Down", slot, -30, "auto", { byDirection: true })]);
// Down from z 10 through the floor: a 20x20x10 pocket out of the box, no new body.
check("going -, drawn on its own: a cut of what it runs into", !errors.length && bodies().size === 1 && near(vol(bodies().get("Box") as Shape3D), 32000 - 4000, 1e-6), [errors, bodies().size, sum()]);
}
{
const air = sketch("Air", XY(50), [rect("a", 10, 10, 30, 30)]);
const { errors } = await after([...box, air, extrude("Below", air, -10, "auto", { byDirection: true })]);
check("going -, running into nothing: a new body", !errors.length && bodies().size === 2 && near(vol(bodies().get("Below") as Shape3D), 4000, 1e-6), [errors, bodies().size]);
}
{
// Saved before: the same + extrude cut through the box (and made no body).
const { errors } = await after([...box, slot, extrude("Old", slot, 30, "auto")]);
check("an extrude saved before: cuts as it did", !errors.length && bodies().size === 1 && near(vol(bodies().get("Box") as Shape3D), 32000 - 4000, 1e-6), [errors, bodies().size, sum()]);
}
{
// On the box's top face: out adds, in cuts (target: the box).
const top = { ...sketch("Top", XY(20), [rect("t", 10, 10, 30, 30)]), attachedTo: { body: "Box", normal: [0, 0, 1] } } as Feature;
let r = await after([...box, top, extrude("Boss", top, 5, "auto", { byDirection: true, target: "Box" })]);
check("on a face, out: added to it", !r.errors.length && bodies().size === 1 && near(vol(bodies().get("Box") as Shape3D), 32000 + 2000, 1e-6), [r.errors, bodies().size, sum()]);
r = await after([...box, top, extrude("Pocket", top, -5, "auto", { byDirection: true, target: "Box" })]);
check("on a face, in: cut from it", !r.errors.length && bodies().size === 1 && near(vol(bodies().get("Box") as Shape3D), 32000 - 2000, 1e-6), [r.errors, bodies().size, sum()]);
}
done();