diff --git a/crates/engine/src/cmd/hatch.rs b/crates/engine/src/cmd/hatch.rs index 5a77e9346..5e2a0fa7a 100644 --- a/crates/engine/src/cmd/hatch.rs +++ b/crates/engine/src/cmd/hatch.rs @@ -113,7 +113,8 @@ fn closed_loop(d: &Drawing, e: &Entity) -> Option> { } /// Open curves that can make up an island together (a square drawn as four LINEs, two ARCs -/// forming a circle). Closed objects are islands on their own (see `closed_loop`). +/// forming a circle, the inner lines of multiline walls around a room). Closed objects are +/// islands on their own (see `closed_loop`). fn island_curve(d: &Drawing, e: &Entity) -> bool { matches!( e.kind, @@ -123,6 +124,7 @@ fn island_curve(d: &Drawing, e: &Entity) -> bool { | EntityKind::LwPolyline(_) | EntityKind::Polyline3d(_) | EntityKind::Spline(_) + | EntityKind::MLine(_) ) && closed_loop(d, e).is_none() } diff --git a/crates/engine/tests/it/hatch_options.rs b/crates/engine/tests/it/hatch_options.rs index d309df165..a26d1bd58 100644 --- a/crates/engine/tests/it/hatch_options.rs +++ b/crates/engine/tests/it/hatch_options.rs @@ -249,3 +249,13 @@ fn hatchedit_refuses_unknown_patterns_and_region_boundaries() { // Region boundaries need REGION objects; the hatch is left as it was. assert!(s.execute("hatchedit", &json!({ "handles": [h], "recreate": "region" })).is_err()); } + +#[test] +fn multiline_wall_hatch_keeps_the_room_as_an_island() { + // A closed multiline wall: picking inside the wall hatches the band between its outer and + // inner lines; the room the inner lines enclose is an island, not filled. + let mut s = Session::new(); + s.execute("mline", &json!({ "points": [[0, 0], [10, 0], [10, 10], [0, 10]], "closed": true, "scale": 1, "justification": "zero" })).unwrap(); + let h = handle(&s.execute("hatch", &json!({ "points": [[0, 5]], "pattern": "SOLID" })).unwrap()); + assert_eq!(hatch(&s, &h).loops.len(), 2, "outer face + the room as an island"); +}