diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index dd10facc..b06eb3aa 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -252,6 +252,28 @@ fn join_of_two_overlapping_rings_is_not_refused() { assert!(rel(got, want) < 1e-3, "{got} vs {want}"); } +/// A disc with a lobe on its rim, patterned six times about its centre: every copy shares the +/// whole disc with the target, and joining them was refused as too much contact work (#1029). +#[test] +fn join_of_a_lobed_disc_pattern_is_not_refused() { + let mut s = Session::default(); + run(&mut s, "sketch.create", json!({"plane": "XY"})); + run(&mut s, "sketch.circle.center", json!({"center": [0, 0], "diameter": 15})); + run(&mut s, "sketch.circle.center", json!({"center": [0, 7.5], "diameter": 5})); + run(&mut s, "sketch.finish", json!({})); + run(&mut s, "solid.extrude", json!({"distance": 10, "profiles": "all", "operation": "new", "body_name": "Disc"})); + run(&mut s, "solid.pattern.circular", json!({"bodies": ["Disc"], "axis": "Z", "count": 6})); + let tools: Vec = s.model.state().bodies.iter().map(|b| b.name.clone()).filter(|n| n != "Disc").collect(); + assert_eq!(tools.len(), 5); + run(&mut s, "solid.combine", json!({"target": "Disc", "tools": tools, "operation": "join"})); + assert_eq!(s.model.state().bodies.len(), 1); + // The disc plus six lobes, each less the part inside the disc; neighbouring lobes stay apart. + let (disc, lobe) = (7.5, 2.5); + let want = (PI * disc * disc + 6.0 * (PI * lobe * lobe - disc_overlap(disc, lobe, disc))) * 10.0; + let got = volume(&mut s); + assert!(rel(got, want) < 1e-3, "{got} vs {want}"); +} + mod boolean_diagnostics; mod component_frames; mod large_step_import;