- A new cut was clipped against the panel with every one of its cut-outs, so each hole of a perforation cost the square of all the holes before it and the second cut of 500 ran out of the flat budget. A tool is now clipped against only the cut-outs whose boxes meet its own (the same result). - The planar booleans' point-in-loop test now skips loops whose box is clear of the point, before the costly on-the-loop test; with a thousand holes that test was most of the time. The 1000-hole panel now takes about 15 s instead of failing. Co-authored-by: jonaswre <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
5 files changed
+3654
-1
No files matched your search
@@ -3570,3 +3570,36 @@ fn every_flat_face_of_a_sheet_takes_an_attached_sketch() {
|
||||
let f = flat(&mut t);
|
||||
assert_eq!(f["cutouts"].as_array().map(Vec::len), Some(1), "{f}");
|
||||
}
|
||||
|
||||
/// #732: a perforated panel. A 400 x 470 x 0.8 sheet with Ø1 holes on a 1.5 mm 60° staggered grid (DIN 24041
|
||||
/// Rv 1.0-1.5), cut in two sketches of 500 holes; 0.8.0 refuses the second cut ("sheet metal flat geometry exceeds
|
||||
/// the bounded processing budget"). A real mesh panel needs ~94 000 such holes; 1000 is the first step.
|
||||
#[test]
|
||||
fn perforated_sheet_takes_a_thousand_round_holes() {
|
||||
let mut s = Session::default();
|
||||
outline_blank(&mut s, json!([[0, 0], [400, 0], [400, 470], [0, 470]]));
|
||||
let flat = volume(&mut s);
|
||||
let (p, dy) = (1.5_f64, 1.5_f64 * 3f64.sqrt() / 2.0);
|
||||
let mut holes = Vec::new();
|
||||
'grid: for r in 0..(450.0 / dy) as usize {
|
||||
for k in 0..(380.0 / p) as usize {
|
||||
let x = 10.0 + k as f64 * p + if r % 2 == 1 { p / 2.0 } else { 0.0 };
|
||||
holes.push([x, 10.0 + r as f64 * dy]);
|
||||
if holes.len() == 1000 {
|
||||
break 'grid;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (g, chunk) in holes.chunks(500).enumerate() {
|
||||
let name = format!("Perforation {g}");
|
||||
run(&mut s, "sketch.create", json!({"plane": {"origin": [0, 0, 2], "x_dir": [1, 0, 0], "y_dir": [0, 1, 0]}, "name": name}));
|
||||
for c in chunk {
|
||||
run(&mut s, "sketch.circle.center", json!({"center": c, "radius": 0.5}));
|
||||
}
|
||||
run(&mut s, "sketch.finish", json!({}));
|
||||
run(&mut s, "solid.extrude", json!({"sketch": name, "distance": "4", "direction": "negative", "operation": "cut"}));
|
||||
}
|
||||
let removed = flat - volume(&mut s);
|
||||
let expected = 1000.0 * std::f64::consts::PI * 0.5 * 0.5 * 0.8;
|
||||
assert!((removed - expected).abs() / expected < 0.05, "removed {removed:.1} mm³, 1000 holes are {expected:.1} mm³");
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user