test: failing regression test for #544 (ignored until fixed): Blind Ø2 hole into a long D-profile bar is refused ("exact fallback … takes planar faces only") although it stays clear of the round face (#551)

Adds an ignored regression test for #544; it runs once #544 is fixed.
This commit is contained in:
Jonas Wrede authored and GitHub committed 2026-10-13 02:28:12 -04:00
1 parent 6441621b8b
commit 7a8754bef7
2 files changed
+33

No files matched your search

@@ -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));
}
@@ -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"]}}
]
}