SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.
Lip: clearer guidance when the face is not a shelled rim (#10437) (#10871)
SilentWolf753a23d217953d
diff --git a/assets/locales/en.json b/assets/locales/en.jsonindex 7e20b68cae..5c5985726d 100644--- a/assets/locales/en.json+++ b/assets/locales/en.json@@ -1600,7 +1600,7 @@"help.parts.resize": "Changes the size or length of an inserted standard part and rebuilds it; its joints keep it seated. Use it when a screw turns out too long or a hole needs another size.","help.plastic.assign_rule": "Assigns a plastic rule to bodies, so their plastic features take its draft and clearance as defaults. Use it to set up a moulded part once for all its features.","help.plastic.boss": "Adds a screw boss on a face: a post with an optional hole, draft, root fillet and supporting ribs. Use it for screw points in moulded or printed housings.",- "help.plastic.lip": "Adds a lip or a matching groove along the rim of a shelled body. Use it so that two housing halves locate on each other and close tightly.",+ "help.plastic.lip": "Adds a lip or a matching groove along the rim of a shelled body (Shell a face open first, then pick the rim around that opening). Use it so that two housing halves locate on each other and close tightly.","help.plastic.manage_rules": "Creates and edits plastic rules: material, wall thickness, radii, clearance and draft. Use them to keep the features of a moulded part consistent.","help.plastic.rest": "Adds a rest on a face: a round or rectangular pad, solid or hollow, with draft. Use it as a support or standoff in a moulded housing.","help.plastic.snap_fit": "Adds a snap-fit hook on a face, with its length, thickness and catch. Use it to clip parts together without screws.",diff --git a/crates/doc/src/eval_more.rs b/crates/doc/src/eval_more.rsindex 4072380b9c..9e47d518ae 100644--- a/crates/doc/src/eval_more.rs+++ b/crates/doc/src/eval_more.rs@@ -2318,11 +2318,16 @@ pub(super) fn plastic_eval(doc: &Document, vals: &BTreeMap<String, Value>, f: &F_ => false,};let (Some(_), Some(_), false) = (outer, openings.first(), alike) else {+ // A solid box top has no opening: Shell that face first, then pick the rim+ // around the cavity (#10437).let what = match (loops.len(), openings.len()) {- (0 | 1, _) => "pick the rim face of a shelled body (a face with an inner and an outer edge)".to_string(),- (_, 0) => "pick the rim face of a shelled body: this face's inner edges are where other features stand on it, not an opening"+ (0 | 1, _) => "Lip needs the rim of a shelled body: Shell a face open first, then pick the rim around that opening (a face with an outer edge and an inner hole)".to_string(),- (_, k) => format!("pick the rim face of a shelled body (round one opening): this face has {k} openings alike in size"),+ (_, 0) => "Lip needs a rim around an opening: this face's inner edges are where other features stand on it, not a shell cavity. Shell a face open, then pick that rim"+ .to_string(),+ (_, k) => format!(+ "Lip needs one clear opening as the rim: this face has {k} openings alike in size (for example a plate of holes). Shell one cavity, or pick a rim that rings a single opening"+ ),};return Err(DocError::Invalid(what));};diff --git a/crates/engine/src/cmd/plastic.rs b/crates/engine/src/cmd/plastic.rsindex 651802584c..f2daa1667d 100644--- a/crates/engine/src/cmd/plastic.rs+++ b/crates/engine/src/cmd/plastic.rs@@ -404,7 +404,7 @@ mod tests {s.run_script(&crate::sample::script()).unwrap();let lip = json!({"body": "Plate", "face": [51.89, 45.2, 8.0], "width": "1.5 mm", "height": "3.5 mm", "side": "inside", "type": "lip"});let e = s.execute("plastic.lip", &lip).unwrap_err().to_string();- assert!(e.contains("rim face") && e.contains("2 openings alike"), "{e}");+ assert!(e.contains("one clear opening") && e.contains("2 openings alike"), "{e}");// The boss alone, no holes: its foot is not an opening either.let mut b = Session::default();run(&mut b, "solid.box", json!({"length": 80, "width": 50, "height": 8, "body_name": "Plate"}));diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rsindex f86234e981..6449b1ac6c 100644--- a/crates/engine/src/tests.rs+++ b/crates/engine/src/tests.rs@@ -3291,6 +3291,16 @@ fn unequal_chamfers_on_circular_rims() {assert!(rel(full - volume(&mut s), flipped) < 5e-3, "{} vs {flipped}", full - volume(&mut s));}+/// A solid box top is not a rim: Lip says to Shell first (#10437).+#[test]+fn lip_on_a_solid_box_says_to_shell_first() {+ let mut s = Session::default();+ run(&mut s, "solid.box", json!({"length": 40, "width": 30, "height": 10}));+ let err = s.execute("plastic.lip", &json!({"face": [20, 15, 10], "width": 1, "height": 2})).unwrap_err().to_string();+ assert!(err.contains("Shell"), "{err}");+ assert!(err.contains("rim") || err.contains("opening"), "{err}");+}+/// An enclosure built in the usual order: shell, bosses, then the lip on the rim.#[test]fn lip_after_boss() {