Wave 397/509: Tests: convex blends past a cliff are cut from the part, as the owner decided (and 3 more)
4 commits, squashed; the originals stay reachable from tag archive/merge-main-develop. - 44b779364 jyviko: Tests: a point path's sweep has a wall along each line; coplanar walls join at a corner - d945cf53a jyviko: Fillet and chamfer: a refusal as too large names the largest size that fits - 8bcd81244 jyviko: Tests: a blend refused as too large is SMLib's NO_ROOM, in its own words - deaf8e679 jyviko: Tests: convex blends past a cliff are cut from the part, as the owner decided Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DtL5M41G8Nua7HvuFPZkmJ
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
//! #1080: a fillet or chamfer too large for the geometry beside its edge is refused, naming the
|
||||
//! largest size that fits, and one that fits still builds.
|
||||
//! #1080: a fillet or chamfer running past the faces beside its edge into an opening is built
|
||||
//! as if the faces went on and cut by the opening (the blend-overflow decision, 237f0ae74), so it
|
||||
//! never bridges it; one that stops short builds as it always did.
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
@@ -21,15 +22,14 @@ fn chamfer_error(s: &Session) -> Option<String> {
|
||||
|
||||
/// The report's design: a 20 mm cube with a 10 mm square opening into each of three faces,
|
||||
/// then a 9 mm chamfer on the top edge over one side opening. The openings are 5 mm from the
|
||||
/// edge, so the chamfer would cut through their rims. It is refused, naming 5 mm, and the part
|
||||
/// is left as it was.
|
||||
/// edge, so the chamfer runs over their rims: it is cut by them. Of its section, the triangle
|
||||
/// y + (20 − z) <= 9 (area 40.5, along 20: 810), the two openings crossing it hold 80 each
|
||||
/// (the rig's fillets/1080-chamfer-runs-into-openings-refused): 4000 − (810 − 160) = 3350.
|
||||
#[test]
|
||||
fn chamfer_through_the_openings_is_refused() {
|
||||
fn chamfer_through_the_openings_is_cut_by_them() {
|
||||
let mut s = open_fixture();
|
||||
let err = chamfer_error(&s).expect("the 9 mm chamfer cuts through two openings: it must be refused");
|
||||
assert!(err.contains("runs past the faces beside the edge"), "{err}");
|
||||
assert!(err.contains("the largest size that fits is 5 mm"), "{err}");
|
||||
assert!((volume(&mut s) - 4000.0).abs() < 1e-6, "the part stays as it was without the chamfer");
|
||||
assert_eq!(chamfer_error(&s), None);
|
||||
assert!((volume(&mut s) - 3350.0).abs() < 1e-6, "{}", volume(&mut s));
|
||||
}
|
||||
|
||||
/// Sizes that stop short of the openings build, and take away exactly the chamfer's triangle
|
||||
@@ -44,3 +44,17 @@ fn chamfer_that_fits_still_builds() {
|
||||
assert!((volume(&mut s) - want).abs() < 1e-6, "{d} mm: {} (want {want})", volume(&mut s));
|
||||
}
|
||||
}
|
||||
|
||||
/// A rib 4 mm wide: blends of its two top edges meet in its top's middle at 2 mm and past that
|
||||
/// would cross each other. Refused as too large, naming the largest size that fits.
|
||||
#[test]
|
||||
fn blends_crossing_each_other_are_refused_naming_the_largest_that_fits() {
|
||||
let mut s = Session::default();
|
||||
run(&mut s, "solid.box", json!({"length": 40, "width": 4, "height": 20}));
|
||||
let edges = json!([[20, 0, 20], [20, 4, 20]]);
|
||||
let e = s.execute("solid.chamfer", &json!({"edges": edges, "distance": 3})).unwrap_err().to_string();
|
||||
assert!(e.contains("the largest distance that fits is 2 mm"), "{e}");
|
||||
let e = s.execute("solid.fillet", &json!({"edges": edges, "radius": 3})).unwrap_err().to_string();
|
||||
assert!(e.contains("the largest radius that fits is 2 mm"), "{e}");
|
||||
assert!((volume(&mut s) - 3200.0).abs() < 1e-6, "the part stays as it was");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user