SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.
Wave 501/509: Kernel rig: a case's continuity can ask for an order per seam (seams: [{order, edges, exact}]) (and 3 more)
jyviko3a5b38355c48
diff --git a/apps/solidcraft-cli/src/kernel_cases.rs b/apps/solidcraft-cli/src/kernel_cases.rsindex 07dcc4673f..4f566dff5b 100644--- a/apps/solidcraft-cli/src/kernel_cases.rs+++ b/apps/solidcraft-cli/src/kernel_cases.rs@@ -198,6 +198,28 @@ fn continuity_seams(b: &solidcraft_engine::doc::ModelBody, edges: &Value) -> Res}}+/// The orders a case's `continuity` asks for: `{order, edges, exact}` for its `edges` seams, or+/// `seams: [{order, edges, exact}, ...]`, each read the same way, for seams that reach different+/// orders (`edges` points picking each). Nothing where it asks for no order (the curvature-jump+/// form, or none); an `order` that is not g0…g4 is an error.+fn continuity_wants(cont: &Value) -> Vec<Result<(&Value, solidcraft_engine::kernel::Continuity, bool), String>> {+ fn one(w: &Value) -> Option<Result<(&Value, solidcraft_engine::kernel::Continuity, bool), String>> {+ let order = w.get("order").filter(|o| !o.is_null())?;+ let exact = w["exact"].as_bool().unwrap_or(false);+ Some(+ order+ .as_str()+ .and_then(solidcraft_engine::kernel::Continuity::parse)+ .map(|o| (&w["edges"], o, exact))+ .ok_or_else(|| format!("continuity `order` {order} is not g0…g4")),+ )+ }+ match cont.get("seams").and_then(Value::as_array) {+ Some(seams) => seams.iter().map(|w| one(w).unwrap_or_else(|| Err("a continuity seam with no `order`".to_owned()))).collect(),+ None => one(cont).into_iter().collect(),+ }+}+/// The `continuity: {order, edges}` check of `b`: its `edges` seams measured as Continuity/// Analysis (`inspect.continuity`) measures them, at its default stations and tolerances, and the/// lowest order among them with the seam that has it (the worst: of those, the one whose first@@ -794,22 +816,22 @@ fn check_case(dir: &str, dumps: Option<&std::path::Path>, validation: solidcraft);}// The order every blend seam reaches, as Continuity Analysis measures it.- if let Some(order) = want["continuity"].get("order").filter(|o| !o.is_null()) {- let edges = &want["continuity"]["edges"];- let exact = want["continuity"]["exact"].as_bool().unwrap_or(false);- let which = if edges.is_array() { "picked" } else { edges.as_str().unwrap_or("blend") };- let need = format!("{} {} at every {which} seam", if exact { "exactly" } else { ">=" }, order.as_str().unwrap_or("?"));- match order.as_str().and_then(solidcraft_engine::kernel::Continuity::parse) {- Some(o) => match continuity_order(b, o, edges, exact) {- Ok((got, ok)) => c.push("continuity_order", got, json!(need), ok),- Err(e) => c.push("continuity_order", json!(format!("{}: {e}", b.name)), json!(need), false),- },- None => c.push("continuity_order", json!(format!("continuity `order` {order} is not g0…g4")), json!("an order"), false),+ for wanted in continuity_wants(&want["continuity"]) {+ match wanted {+ Ok((edges, o, exact)) => {+ let which = if edges.is_array() { "picked" } else { edges.as_str().unwrap_or("blend") };+ let need = format!("{} {} at every {which} seam", if exact { "exactly" } else { ">=" }, o.as_str());+ match continuity_order(b, o, edges, exact) {+ Ok((got, ok)) => c.push("continuity_order", got, json!(need), ok),+ Err(e) => c.push("continuity_order", json!(format!("{}: {e}", b.name)), json!(need), false),+ }+ }+ Err(e) => c.push("continuity_order", json!(e), json!("an order"), false),}}// Curvature continuity across the seams round a point: the worst jump clear of the// seams' turns must be within the case's bound.- if let Some(cont) = want.get("continuity").filter(|c| !c.is_null() && c.get("order").is_none()) {+ if let Some(cont) = want.get("continuity").filter(|c| !c.is_null() && c.get("order").is_none() && c.get("seams").is_none()) {let (near, within, clear, bound) =(v3(&cont["near"]), cont["within_mm"].as_f64(), cont["clear_mm"].as_f64(), cont["curvature_jump_per_mm"].as_f64());match (near, within, clear, bound) {@@ -1196,6 +1218,28 @@ mod tests {let _ = std::fs::remove_dir_all(&root);}+ /// `continuity` asks for one order at every seam it picks, or per seam (`seams`), each entry+ /// read as the one-order form; the curvature-jump form asks for none.+ #[test]+ fn continuity_asks_for_one_order_or_one_per_seam() {+ use solidcraft_engine::kernel::Continuity;+ let read = |c: Value| {+ continuity_wants(&c).into_iter().map(|w| w.map(|(e, o, x)| (e.clone(), o, x))).collect::<Vec<Result<(Value, Continuity, bool), String>>>()+ };+ let g2 = Continuity::parse("g2").unwrap();+ let g3 = Continuity::parse("g3").unwrap();+ assert_eq!(read(json!({"order": "g2", "exact": true})), vec![Ok((Value::Null, g2, true))]);+ let (p, q) = (json!([[30.0, 31.3, 10.0]]), json!([[30.0, 29.4, 12.7]]));+ assert_eq!(+ read(json!({"seams": [{"order": "g2", "exact": true, "edges": p}, {"order": "g3", "edges": q}]})),+ vec![Ok((p.clone(), g2, true)), Ok((q, g3, false))]+ );+ assert!(read(json!({"near": [0.0, 0.0, 0.0], "within_mm": 1.0})).is_empty());+ assert!(read(Value::Null).is_empty());+ assert!(read(json!({"order": "g9"}))[0].is_err());+ assert!(read(json!({"seams": [{"edges": p}]}))[0].is_err(), "a seam must say its order");+ }+/// The flat pattern is graded on the last `sheet.flat_pattern` result: its size, its outline's/// area less the cut-outs', and its bend lines matched either way round, one for one.#[test]diff --git a/tests/KNOWN_FAILING_TESTS b/tests/KNOWN_FAILING_TESTSindex 2aa1a04978..e9003bc989 100644--- a/tests/KNOWN_FAILING_TESTS+++ b/tests/KNOWN_FAILING_TESTS@@ -8,9 +8,10 @@# for junit and junit-gpu-1..4), run `cargo xtask known-failing --junit <dir>`, then drop each# FIXED line and add each REGRESSION line with its cause, from the test's failure message.# Baseline: develop 38fd4a4f6 (CI run 41157648345, x86_64 Linux), after the SMLib eaa998a pin.-solidcraft-cli::action_matrix::action_matrix_sample 3 baseline actions fail on SMLib: 2 shells (Bad Loop Orient on issue-616-lid-ribs; status 1001 on filleted-shelled-box, shelled again open at an inner wall), 1 fillet (SmSurfOfRevolution Test #7 on oblique_cut_of_cylinder)+solidcraft-cli::action_matrix::action_matrix_sample 2 baseline actions fail on SMLib: 2 shells (Bad Loop Orient on issue-616-lid-ribs; status 1001 on filleted-shelled-box, shelled again open at an inner wall)solidcraft-cli::naming_corpus::corpus_designs_name_alike_every_build_and_fail_where_a_reference_is_gone oracle/83-boundary-loop-thicken does not load: step 8, SMLib thicken status 1001solidcraft-engine::tests::fillet_fit_taper_closes_to_a_point SMLib fillet status 1001 on the taper fit (radius 16 closing to 0)+solidcraft-engine::tests::shell_tangent_chain_that_opens_every_face_explains_how_to_keep_walls SMLib shell status 1034 on a box with all 12 edges rounded (Ball corners since 5e8c9c1), opened at one face (tangency-labs/smlib#102)solidcraft-kernel::blend::corner_tests::a_round_ending_in_an_earlier_round_matches_both_together SMLib fillet status 1001 on the round that ends in the earlier onesolidcraft-kernel::blend::corner_tests::corner_blends_hold_at_any_scale at 0.01x a picked edge runs on tangentially into an unblended edge and SMLib's result is not a closed solid (the smooth-vertex End, tangency-labs/smlib#81)solidcraft-kernel::blend_corner::tests::issue2422_vertical_after_separate_bottom_rounds SMLib's check refuses the fillet: edge and vertex tolerance 0.97 against the body's 0.01 (#2422)diff --git a/tests/kernel-cases/fillets/cov-fillet-section-curvature-boss-root-r2/expected.json b/tests/kernel-cases/fillets/cov-fillet-section-curvature-boss-root-r2/expected.jsonindex 576a1ddb8c..06733808ab 100644--- a/tests/kernel-cases/fillets/cov-fillet-section-curvature-boss-root-r2/expected.json+++ b/tests/kernel-cases/fillets/cov-fillet-section-curvature-boss-root-r2/expected.json@@ -12,5 +12,5 @@"tolerance": {"rel": 1e-07},- "timeout_s": 600+ "timeout_s": 1800}