feat: feature replies list the bodies the feature created (#525)

Fixes #374. Feature replies gain created_bodies: the bodies the new feature made, apart from the ones it changed or that were already there. Documented in the execute tool description and docs/mcp.md.
This commit is contained in:
Jonas Wrede authored and GitHub committed 2026-10-13 02:39:19 -04:00
1 parent c1cd4cf194
commit 9283d2b5bb
5 files changed
+23 -6

No files matched your search

+15 -1
View File
@@ -2839,7 +2839,6 @@ fn a_profile_added_later_is_named_after_body_name() {
/// The reply names the bodies the feature created, apart from the ones already there (#374).
#[test]
#[ignore = "fails until #374 is fixed"]
fn extrude_reply_lists_the_bodies_it_created() {
let mut s = Session::default();
run(&mut s, "solid.box", json!({"length": 5, "width": 5, "height": 5, "corner": [0, 50, 0], "operation": "new_body", "body_name": "Base"}));
@@ -2938,3 +2937,18 @@ fn tapered_extrude_of_a_profile_mixing_lines_and_an_arc() {
let expect = a0 * h + p * t * h * h / 2.0 + k * t * t * h.powi(3) / 3.0;
assert!(rel(volume(&mut s), expect) < 1e-3, "{} vs {expect}", volume(&mut s));
}
/// A feature that joins into a body creates none, and its reply says so; a primitive's reply
/// names the body it made (#374).
#[test]
fn feature_replies_list_only_the_bodies_they_created() {
let mut s = Session::default();
let r = run(&mut s, "solid.box", json!({"length": 10, "width": 10, "height": 10, "body_name": "Base"}));
assert_eq!(r["created_bodies"], json!(["Base"]), "{r}");
run(&mut s, "sketch.create", json!({"plane": "XY", "name": "Boss"}));
run(&mut s, "sketch.circle.center", json!({"center": [5, 5], "radius": 2}));
run(&mut s, "sketch.finish", json!({}));
let r = run(&mut s, "solid.extrude", json!({"sketch": "Boss", "distance": "15", "operation": "join"}));
assert_eq!(r["created_bodies"], json!([]), "{r}");
assert_eq!(r["bodies"], json!(["Base"]), "{r}");
}