Wave 467/509: Frames tests: a pick on a moved component or an instance removes the exact round and bore volumes (and 3 more)
4 commits, squashed; the originals stay reachable from tag archive/merge-main-develop. - 5fe9df533 jyviko: Known failing tests: the shell after a cut whose end touches an arc side builds on SMLib batch 7 - 8ec40d25e jyviko: Surface fair test: the energy falls strictly, the face moves, and the edges are read after the fair - 697ea2ca8 jyviko: Sketch scaling test: the first dimension sets l1 to 40 and scales both joined rectangles about the origin - e60cde8dc jyviko: Frames tests: a pick on a moved component or an instance removes the exact round and bore volumes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DtL5M41G8Nua7HvuFPZkmJ
This commit is contained in:
@@ -1617,8 +1617,17 @@ fn the_first_dimension_scales_shapes_joined_by_a_constraint() {
|
||||
run(&mut s, "sketch.rectangle.two_point", json!({"p0": [0, 0], "p1": [20, 10]}));
|
||||
run(&mut s, "sketch.rectangle.two_point", json!({"p0": [30, 10], "p1": [45, 20]}));
|
||||
run(&mut s, "sketch.constraint.coincident", json!({"a": "l1.start", "b": "l5.start"}));
|
||||
let before = sketch(&s);
|
||||
let f = 40.0 / pt(&s, "l1.end").dist(pt(&s, "l1.start"));
|
||||
let out = run(&mut s, "sketch.dimension", json!({"entities": ["l1"], "value": "40 mm", "scale_sketch": true}));
|
||||
assert!(out.get("scaled").is_some(), "{out}");
|
||||
assert!((out["scaled"].as_f64().unwrap() - f).abs() < 1e-6, "{out}");
|
||||
// l1 measures its value, and every point of both rectangles, the joined one too, scaled
|
||||
// about the origin by the same factor: the joined rectangle keeps its shape at its scaled place.
|
||||
assert!((pt(&s, "l1.end").dist(pt(&s, "l1.start")) - 40.0).abs() < 1e-6);
|
||||
let after = sketch(&s);
|
||||
for (p, q) in before.points.iter().zip(&after.points) {
|
||||
assert!(q.pos.dist(p.pos * f) < 1e-6, "{} {:?} -> {:?}", p.id, p.pos, q.pos);
|
||||
}
|
||||
}
|
||||
|
||||
/// The cursor fallback shares the held solves' frame budget; a scripted drag can finish later.
|
||||
|
||||
@@ -1976,15 +1976,16 @@ mod tests {
|
||||
let before: Vec<solidcraft_geom::Vec3> = st.body("Shell").unwrap().body.edges(0.1).unwrap().iter().flat_map(|e| e.points.clone()).collect();
|
||||
assert!(!before.is_empty());
|
||||
let area_before = area(&s, "Shell");
|
||||
// The fairing reports both energies, the second no larger than the first.
|
||||
// The fairing reports both energies. The fit is not the fairest surface on its own rim, so
|
||||
// the energy falls strictly and the face moves: its area changes.
|
||||
let reply = run(&mut s, "surface.fair", json!({"body": "Shell", "tolerance": 1.0, "iterations": 3}));
|
||||
let (energy_before, energy_after) = energies(&reply);
|
||||
let area_after = area(&s, "Shell");
|
||||
eprintln!("surface.fair: {reply}\nenergies {energy_before:e} → {energy_after:e}, area {area_before} → {area_after}");
|
||||
assert!(energy_before > 0.0 && energy_after <= energy_before, "{energy_before:e} → {energy_after:e}");
|
||||
// The face moved (the fit is not the flattest surface on its own rim), but not its edges:
|
||||
// every boundary point of the body is where it was, bit for bit.
|
||||
assert!((area_after - area_before).abs() > 0.0 || energy_after < energy_before);
|
||||
assert!(energy_before > 0.0 && energy_after < energy_before, "{energy_before:e} → {energy_after:e}");
|
||||
assert_ne!(area_after, area_before, "the fairing did not move the face");
|
||||
// The edges do not move: every boundary point of the faired body is where it was, bit for
|
||||
// bit, and the sheet is still the one face.
|
||||
let st = s.world_state().unwrap();
|
||||
let after: Vec<solidcraft_geom::Vec3> = st.body("Shell").unwrap().body.edges(0.1).unwrap().iter().flat_map(|e| e.points.clone()).collect();
|
||||
assert_eq!(after, before, "fairing must not move the face's edges");
|
||||
assert_eq!(st.body("Shell").unwrap().body.face_count(), 1);
|
||||
|
||||
@@ -72,9 +72,13 @@ fn sketches_and_planes_move_with_the_component() {
|
||||
fn world_picks_map_into_the_component() {
|
||||
let mut s = moved_part();
|
||||
let v0 = volume(&mut s);
|
||||
assert!((v0 - 6000.0).abs() < 1e-6, "{v0}"); // 30 x 20 x 10
|
||||
// The edge along X at the top front: world (65, 0, 10).
|
||||
run(&mut s, "solid.fillet", json!({"edges": [[65, 0, 10]], "radius": 2}));
|
||||
assert!(volume(&mut s) < v0 - 1.0, "the fillet cut material");
|
||||
let filleted = volume(&mut s);
|
||||
// A round of radius 2 along the 30 mm edge removes r²(1 − π/4) of section along its length.
|
||||
let round = 4.0 * (1.0 - std::f64::consts::PI / 4.0) * 30.0;
|
||||
assert!((v0 - filleted - round).abs() < 4e-7 * v0, "the fillet cut {} against {round}", v0 - filleted);
|
||||
// The modified face has no certified lineage; explicitly freeze its picked plane.
|
||||
// Its world pick still maps into the moved component exactly once.
|
||||
run(&mut s, "sketch.create", json!({"plane": {"face": [70, 10, 10],"fixed":true}, "name": "Pad"}));
|
||||
@@ -88,7 +92,10 @@ fn world_picks_map_into_the_component() {
|
||||
assert!(near(pad, Vec3::new(70.0, 10.0, 10.0)), "{pad:?}");
|
||||
let v1 = volume(&mut s);
|
||||
let h = run(&mut s, "solid.hole", json!({"position": [60, 10, 10], "diameter": 4, "depth": 5}));
|
||||
assert!(volume(&mut s) < v1 - 1.0, "the hole cut material: {h}");
|
||||
// A simple (flat-bottomed) hole: a cylinder of radius 2, 5 deep, clear of the round at y < 2.
|
||||
let bore = std::f64::consts::PI * 4.0 * 5.0;
|
||||
let v2 = volume(&mut s);
|
||||
assert!((v1 - v2 - bore).abs() < 4e-7 * v1, "the hole cut {} against {bore}: {h}", v1 - v2);
|
||||
// A box made at world (100, 0, 0) in the active (moved) component shows there.
|
||||
run(&mut s, "solid.box", json!({"length": 5, "width": 5, "height": 5, "corner": [100, 0, 0], "operation": "new"}));
|
||||
let last = s.model.state().bodies.last().map(|b| b.name.clone()).unwrap();
|
||||
@@ -108,7 +115,11 @@ fn picks_on_an_instance_map_through_its_placement() {
|
||||
// An edge of the second instance only (world y = 40).
|
||||
run(&mut s, "solid.fillet", json!({"edges": [[5, 40, 10]], "radius": 2}));
|
||||
let v1 = volume(&mut s);
|
||||
assert!(v1 < v0 - 1.0, "{v0} {v1}");
|
||||
// Two 10 mm cubes; the round of radius 2 along one 10 mm edge of the component removes
|
||||
// r²(1 − π/4)·10 from every instance, the picked one and the other.
|
||||
assert!((v0 - 2000.0).abs() < 1e-6, "{v0}");
|
||||
let round = 4.0 * (1.0 - std::f64::consts::PI / 4.0) * 10.0;
|
||||
assert!((v0 - v1 - 2.0 * round).abs() < 4e-7 * v0, "{v0} {v1}");
|
||||
}
|
||||
|
||||
/// (c) Moving a body into a moved component keeps it where it is in the world.
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
solidcraft-cli::action_matrix::action_matrix_sample 3 baseline actions fail on SMLib: 2 shells (Bad Loop Orient on issue-616-lid-ribs; status 1001 on filleted-shelled-box, shelled again open at an inner wall), 1 fillet (SmSurfOfRevolution Test #7 on oblique_cut_of_cylinder)
|
||||
solidcraft-cli::naming_corpus::corpus_designs_name_alike_every_build_and_fail_where_a_reference_is_gone oracle/83-boundary-loop-thicken does not load: step 8, SMLib thicken status 1001
|
||||
solidcraft-engine::tests::fillet_fit_taper_closes_to_a_point SMLib fillet status 1001 on the taper fit (radius 16 closing to 0)
|
||||
solidcraft-engine::tests::robustness::shell_after_a_cut_whose_end_touches_an_arc_side SMLib shell status 1001 (a heavy test: pushes and nightly only)
|
||||
solidcraft-kernel::blend::corner_tests::a_round_ending_in_an_earlier_round_matches_both_together SMLib fillet status 1001 on the round that ends in the earlier one
|
||||
solidcraft-kernel::blend::corner_tests::corner_blends_hold_at_any_scale at 0.01x the arc case's rounds remove 72.783 (scaled back) against 72.713 at 1x (9.6e-4 off, 1e-4 allowed)
|
||||
solidcraft-kernel::blend_corner::tests::issue2422_vertical_after_separate_bottom_rounds SMLib's check refuses the fillet: edge and vertex tolerance 0.97 against the body's 0.01 (#2422)
|
||||
|
||||
Reference in New Issue
Block a user