fix: text cut into a large part stays on the exact 2D route (#1903)
Thanks @NOWN-DEV.
This commit is contained in:
1 parent
cd9db57366
commit
9a4d936b7b
4 files changed
+74
-4
No files matched your search
@@ -1251,3 +1251,29 @@ fn a_line_of_text_cut_again_deeper_is_one_exact_boolean() {
|
||||
let again = cut(&mut s, 2.0);
|
||||
assert!(rel(again, first) < 1e-3, "{first} {again}");
|
||||
}
|
||||
|
||||
/// Text cut through a large plate (2 m) is decided in 2D in one exact boolean, as it is in a
|
||||
/// small one. The 2D route's tolerances grow with the part: a font's curve that is merely near a
|
||||
/// circle was read as an arc ending a micron off the next curve, so the letter's outline did not
|
||||
/// close, and where the curves of a 3 come close the arrangement left a sliver that closed up to
|
||||
/// nothing. The cut went to the B-rep boolean instead, which took tens of seconds and moved the
|
||||
/// tool to find a result at all.
|
||||
#[test]
|
||||
fn text_cut_through_a_large_plate_is_one_exact_boolean() {
|
||||
let taken = |w: f64, h: f64, at: [f64; 2]| {
|
||||
let mut s = Session::default();
|
||||
run(&mut s, "solid.box", json!({"length":w,"width":h,"height":1.5,"corner":[0,0,0]}));
|
||||
let before = volume(&mut s);
|
||||
run(&mut s, "sketch.create", json!({"plane":"XY","offset":1.5}));
|
||||
run(&mut s, "sketch.text", json!({"text":"PART-23","at":at,"height":7}));
|
||||
run(&mut s, "sketch.finish", json!({}));
|
||||
let id = run(&mut s, "solid.extrude", json!({"distance":-2,"operation":"cut"}))["feature"].as_u64().unwrap();
|
||||
let r = s.model.result(id).unwrap();
|
||||
assert!(r.error.is_none() && r.boolean_diagnostics.events.is_empty(), "{w} x {h}: {r:?}");
|
||||
before - volume(&mut s)
|
||||
};
|
||||
let (small, large) = (taken(200.0, 120.0, [60.0, 40.0]), taken(2000.0, 1200.0, [860.0, 125.0]));
|
||||
// The letters right through the plate, their counters left as pieces of their own: the same
|
||||
// material in either plate (measured on meshes, which are coarser on the larger one).
|
||||
assert!(small > 10.0 && rel(large, small) < 5e-2, "{small} {large}");
|
||||
}
|
||||
Reference in new issue
Block a user