From 7a8754bef7a4249b5bc7ddfabc9ab6076aa36054 Mon Sep 17 00:00:00 2001 From: Jonas Wrede Date: Tue, 13 Oct 2026 08:28:12 +0200 Subject: [PATCH] =?UTF-8?q?test:=20failing=20regression=20test=20for=20#54?= =?UTF-8?q?4=20(ignored=20until=20fixed):=20Blind=20=C3=982=20hole=20into?= =?UTF-8?q?=20a=20long=20D-profile=20bar=20is=20refused=20("exact=20fallba?= =?UTF-8?q?ck=20=E2=80=A6=20takes=20planar=20faces=20only")=20although=20i?= =?UTF-8?q?t=20stays=20clear=20of=20the=20round=20face=20(#551)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds an ignored regression test for #544; it runs once #544 is fixed. --- crates/engine/src/boolean_regression_tests.rs | 19 +++++++++++++++++++ .../blind_hole_in_long_d_profile.json | 14 ++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 examples/regressions/blind_hole_in_long_d_profile.json diff --git a/crates/engine/src/boolean_regression_tests.rs b/crates/engine/src/boolean_regression_tests.rs index d030f243..fabaecf9 100644 --- a/crates/engine/src/boolean_regression_tests.rs +++ b/crates/engine/src/boolean_regression_tests.rs @@ -88,3 +88,22 @@ fn struts_ending_on_a_bore_wall_join_without_a_panic() { result.unwrap(); assert_eq!(s.model.state().bodies.len(), 1); } + +/// A blind Ø2 hole into the flat back of a long D-profile bar ends 2 mm short of the round front, +/// yet the cut was refused (#544). It removes π · 1² · 10 mm³ (within 5 %: the measure tessellates +/// the small bore) and adds the bore's wall and floor to the bar's six faces. +#[test] +#[ignore = "fails until #544 is fixed"] +fn blind_hole_into_a_long_d_profile_bar_stops_short_of_the_round_front() { + let script: Value = serde_json::from_str(include_str!("../../../examples/regressions/blind_hole_in_long_d_profile.json")).unwrap(); + let steps = script.get("commands").and_then(Value::as_array).unwrap(); + let mut s = Session::default(); + s.run_script(&Value::Array(steps[..5].to_vec())).unwrap(); + let bar = volume(&s, "Slat"); + s.run_script(&Value::Array(steps[5..].to_vec())).unwrap(); + let hole = std::f64::consts::PI * 10.0; + let removed = bar - volume(&s, "Slat"); + assert!((removed - hole).abs() < 0.05 * hole, "removed {removed} vs {hole}"); + let faces = s.model.state().body("Slat").map(|b| solidcraft_kernel::measure(&b.body).unwrap().merged.faces); + assert_eq!(faces, Some(8)); +} diff --git a/examples/regressions/blind_hole_in_long_d_profile.json b/examples/regressions/blind_hole_in_long_d_profile.json new file mode 100644 index 00000000..75841b7e --- /dev/null +++ b/examples/regressions/blind_hole_in_long_d_profile.json @@ -0,0 +1,14 @@ +{ + "description": "A blind 2 mm hole drilled 10.5 mm from 0.5 mm behind the flat back of a 452 mm D-profile bar (flat back 9.2 wide at x = -7.4, half-round front R 4.6 reaching x = 4.6). The hole ends at x = 2.6, 2 mm inside the material and clear of the round face, but the cut was refused: the exact fallback takes planar faces only, and the nudged tool gave an implausible volume (#544). The same cut works on a 350 mm bar. Result: the bar less pi * 1^2 * 10 mm3.", + "commands": [ + {"command": "sketch.create", "params": {"plane": "XY", "name": "D"}}, + {"command": "sketch.line", "params": {"points": [[0, 4.6], [-7.4, 4.6], [-7.4, -4.6], [0, -4.6]], "closed": false}}, + {"command": "sketch.arc.center_point", "params": {"center": [0, 0], "start": [0, -4.6], "end": [0, 4.6]}}, + {"command": "sketch.finish", "params": {}}, + {"command": "solid.extrude", "params": {"sketch": "D", "distance": 452.0, "body_name": "Slat"}}, + {"command": "sketch.create", "params": {"plane": {"origin": [-7.9, 0, 0], "x_dir": [0, 1, 0], "y_dir": [0, 0, 1]}, "name": "H"}}, + {"command": "sketch.circle.center", "params": {"center": [0, 35.0], "radius": 1}}, + {"command": "sketch.finish", "params": {}}, + {"command": "solid.extrude", "params": {"sketch": "H", "distance": 10.5, "operation": "cut", "targets": ["Slat"]}} + ] +}