From 86390de541f80c46655a051d75cdfce70b1905d7 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 22:42:10 -0400 Subject: [PATCH] Wave 394/509: Exploded views are shown only: the design's placements and Capture Position leave them out (and 2 more) 3 commits, squashed; the originals stay reachable from tag archive/merge-main-develop. - ffb1e650d jyviko: Isocurve Analysis: count curves each way, evenly spaced across the face - 177eb207f jyviko: Exploded views are shown only: the design's placements and Capture Position leave them out - 8d72cfa59 jyviko: SMLib export: a face's outer area reads only its own loop's edges Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DtL5M41G8Nua7HvuFPZkmJ --- crates/doc/src/eval.rs | 6 +- crates/engine/src/cmd/component.rs | 14 +- crates/engine/src/cmd/component_clone.rs | 2 +- crates/engine/src/cmd/component_extract.rs | 2 +- crates/engine/src/cmd/component_placing.rs | 2 +- crates/engine/src/cmd/component_properties.rs | 10 +- crates/engine/src/cmd/component_reparent.rs | 10 +- crates/engine/src/cmd/component_transfer.rs | 12 +- crates/engine/src/cmd/features.rs | 6 +- crates/engine/src/cmd/file.rs | 6 +- crates/engine/src/cmd/motion.rs | 3 + crates/engine/src/cmd/motion_tests.rs | 12 ++ crates/engine/src/lib.rs | 8 ++ crates/engine/src/occurrences.rs | 43 +++++- crates/kernel/src/iso.rs | 110 ++++------------ crates/smlib/src/export.rs | 40 ++++-- crates/smlib/src/export/tests.rs | 89 +++++++++++++ tests/kernel-cases/assemblies/PATHS | 3 + .../expected.json | 8 +- .../expected.json | 6 +- .../expected.json | 91 +++++++++++++ .../recipe.json | 123 ++++++++++++++++++ .../expected.json | 102 +++++++++++++++ .../recipe.json | 27 ++++ 24 files changed, 591 insertions(+), 144 deletions(-) create mode 100644 tests/kernel-cases/assemblies/cov-explode-show-keeps-the-placements/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-explode-show-keeps-the-placements/recipe.json create mode 100644 tests/kernel-cases/inspect/cov-isocurve-40-by-30-face-count-3/expected.json create mode 100644 tests/kernel-cases/inspect/cov-isocurve-40-by-30-face-count-3/recipe.json diff --git a/crates/doc/src/eval.rs b/crates/doc/src/eval.rs index 289dab12a..efcd233ab 100644 --- a/crates/doc/src/eval.rs +++ b/crates/doc/src/eval.rs @@ -347,9 +347,9 @@ impl ModelBody { self.mesh.get().cloned() } - /// The isoparametric curves of face `face` for Isocurve Analysis: spaced by `count` on the - /// face's surface (so faces on one surface share them), exact and cut to its trims - /// ([`kernel::iso_grid`]), their points at the chord + /// The isoparametric curves of face `face` for Isocurve Analysis: `count` each way, evenly + /// spaced across the face (faces on one surface spaced together, so they share them), exact + /// and cut to its trims ([`kernel::iso_grid`]), their points at the chord /// tolerance of the viewport's display quality. Worked out once per face, count and display /// quality, and shared by every clone of this body (timeline snapshots, world states). A mesh /// body has no surfaces, so none. diff --git a/crates/engine/src/cmd/component.rs b/crates/engine/src/cmd/component.rs index a99d000a5..5bb82ddf4 100644 --- a/crates/engine/src/cmd/component.rs +++ b/crates/engine/src/cmd/component.rs @@ -430,8 +430,8 @@ pub(super) fn copy_occurrence(s: &mut Session, p: &Value) -> Result { let m = if bool_(p, "in_place") == Some(true) { placing::in_place(s, &occurrence_path(s, p, src.id, cmd)?, parent, placing::parent_path(p, cmd)?.as_deref(), t, cmd)? } else { - let base = s.pending_moves.get(&src.id).unwrap_or(&src.transform); - solidcraft_doc::mat_mul(&translation(t), base) + let base = s.uncaptured_moves().get(&src.id).copied().unwrap_or(src.transform); + solidcraft_doc::mat_mul(&translation(t), &base) }; if !valid_position(&m) { return Err(bad(cmd, "copy transform exceeds supported numeric range")); @@ -469,7 +469,7 @@ fn paste_new(s: &mut Session, p: &Value) -> Result { let transform = match occ.as_ref().filter(|_| bool_(p, "in_place") == Some(true)) { Some(o) => placing::in_place(s, &occurrence_path(s, p, o.id, cmd)?, parent, placing::parent_path(p, cmd)?.as_deref(), t, cmd)?, None => { - let base = occ.as_ref().map(|o| s.pending_moves.get(&o.id).copied().unwrap_or(o.transform)).unwrap_or(solidcraft_doc::IDENTITY); + let base = occ.as_ref().map(|o| s.uncaptured_moves().get(&o.id).copied().unwrap_or(o.transform)).unwrap_or(solidcraft_doc::IDENTITY); solidcraft_doc::mat_mul(&translation(t), &base) } }; @@ -560,7 +560,7 @@ fn move_occurrence(s: &mut Session, p: &Value) -> Result { } let path = if p.get("path").is_some() || space == "world" { Some(occurrence_path(s, p, id, cmd)?) } else { None }; let delta = if space == "world" { - let placement = s.occurrence_placement(path.as_deref().unwrap_or(&[]))?; + let placement = s.occurrence_placement_with(path.as_deref().unwrap_or(&[]), &s.uncaptured_moves())?; let inverse = solidcraft_doc::mat_inverse(&placement.parent_world).ok_or_else(|| bad(cmd, "parent frame is singular"))?; solidcraft_doc::mat_mul(&solidcraft_doc::mat_mul(&inverse, &delta), &placement.parent_world) } else { @@ -579,7 +579,7 @@ fn move_occurrence(s: &mut Session, p: &Value) -> Result { } base } else { - s.pending_moves.get(&id).copied().unwrap_or(o.transform) + s.uncaptured_moves().get(&id).copied().unwrap_or(o.transform) }; let next = solidcraft_doc::mat_mul(&delta, &cur); if !valid_position(&next) { @@ -611,7 +611,9 @@ fn ground(s: &mut Session, p: &Value) -> Result { } fn capture(s: &mut Session, _p: &Value) -> Result { - let moves = std::mem::take(&mut s.pending_moves); + // The exploded view is shown, never captured: it stays shown, the design keeps its placements. + let moves = s.uncaptured_moves().into_owned(); + s.pending_moves.retain(|id, _| !moves.contains_key(id)); let n = moves.len(); for (id, m) in moves { if let Some(o) = s.doc_mut().occurrences.iter_mut().find(|o| o.id == id) { diff --git a/crates/engine/src/cmd/component_clone.rs b/crates/engine/src/cmd/component_clone.rs index 1d2e1e839..5e0b9e5dc 100644 --- a/crates/engine/src/cmd/component_clone.rs +++ b/crates/engine/src/cmd/component_clone.rs @@ -277,7 +277,7 @@ pub(super) fn paste( for old in source.occurrences.iter().filter(|o| selected.contains(&o.parent)) { let child = *components.get(&old.component).ok_or_else(|| bad(CMD, "missing child definition"))?; let owner = *components.get(&old.parent).ok_or_else(|| bad(CMD, "missing parent definition"))?; - let pose = s.pending_moves.get(&old.id).copied().unwrap_or(old.transform); + let pose = s.uncaptured_moves().get(&old.id).copied().unwrap_or(old.transform); if !super::component::valid_position(&pose) { return Err(bad(CMD, "invalid internal pending occurrence transform")); } diff --git a/crates/engine/src/cmd/component_extract.rs b/crates/engine/src/cmd/component_extract.rs index fab3b78bd..ea72a2bd3 100644 --- a/crates/engine/src/cmd/component_extract.rs +++ b/crates/engine/src/cmd/component_extract.rs @@ -228,7 +228,7 @@ fn scope(s: &Session, comp: u64, cmd: &str) -> Result { if source.marker.is_some_and(|m| m < source.features.len()) { return Err(bad(cmd, "move the timeline marker to the end first")); } - if !s.pending_moves.is_empty() { + if !s.uncaptured_moves().is_empty() { return Err(bad(cmd, "capture or revert the moved components first")); } let subtree: BTreeSet = source.components.iter().filter(|c| source.component_within(c.id, comp)).map(|c| c.id).collect(); diff --git a/crates/engine/src/cmd/component_placing.rs b/crates/engine/src/cmd/component_placing.rs index 60b0628ec..01aeb03a2 100644 --- a/crates/engine/src/cmd/component_placing.rs +++ b/crates/engine/src/cmd/component_placing.rs @@ -21,7 +21,7 @@ pub(super) fn parent_path(p: &Value, cmd: &str) -> Result>> { /// is in the world, then moved by `translate` (in the world). The parent is placed by /// [`placement_of`]: in its other instances the copy sits in the same place within them. pub(super) fn in_place(s: &Session, path: &[u64], parent: u64, parent_path: Option<&[u64]>, translate: Vec3, cmd: &str) -> Result { - let doc = s.placed_document(); + let doc = s.design_document(); let component = path.last().and_then(|id| doc.occurrences.iter().find(|o| o.id == *id)).map(|o| o.component).ok_or_else(|| bad(cmd, "no placement"))?; let world = doc.path_transform(component, path).ok_or_else(|| bad(cmd, "that placement is gone"))?; diff --git a/crates/engine/src/cmd/component_properties.rs b/crates/engine/src/cmd/component_properties.rs index dd8033474..c1a654951 100644 --- a/crates/engine/src/cmd/component_properties.rs +++ b/crates/engine/src/cmd/component_properties.rs @@ -15,13 +15,7 @@ fn descendants(p: &Value, cmd: &str) -> Result { } fn placed_doc(s: &Session) -> Document { - let mut doc = (*s.doc).clone(); - for occurrence in &mut doc.occurrences { - if let Some(transform) = s.pending_moves.get(&occurrence.id) { - occurrence.transform = *transform; - } - } - doc + s.design_document().into_owned() } /// A property total must cover the entire assembly. The display traversal intentionally @@ -97,7 +91,7 @@ fn properties(s: &Session, doc: &Document, selected: &[u64], descendants: bool, let selected_placements = if selected.is_empty() { if descendants { placements(doc, cmd)? } else { vec![(0, Vec::new(), solidcraft_doc::IDENTITY)] } } else { - let placement = s.occurrence_placement(selected).map_err(|e| bad(cmd, e.to_string()))?; + let placement = s.occurrence_placement_with(selected, &s.uncaptured_moves()).map_err(|e| bad(cmd, e.to_string()))?; let mut out = vec![(placement.component, selected.to_vec(), placement.world)]; let mut stack = if descendants { out.clone() } else { Vec::new() }; while let Some((component, path, transform)) = stack.pop() { diff --git a/crates/engine/src/cmd/component_reparent.rs b/crates/engine/src/cmd/component_reparent.rs index 3e1e23525..c5000ab3b 100644 --- a/crates/engine/src/cmd/component_reparent.rs +++ b/crates/engine/src/cmd/component_reparent.rs @@ -35,7 +35,7 @@ pub(super) fn reparent(s: &mut Session, p: &Value) -> Result { // From the placement named (`path`), into the parent's placement named (`parent_path`). let moved = occurrence_path(s, p, id, cmd)?; let to_given = parent_path(p, cmd)?; - let doc = s.placed_document(); + let doc = s.design_document(); let (from_path, from_frame) = placement_of(s, &doc, o.parent, moved.split_last().map(|(_, up)| up), "path", cmd)?; let (to_path, to_frame) = placement_of(s, &doc, to, to_given.as_deref(), "parent_path", cmd)?; let local = doc.occurrences.iter().find(|x| x.id == id).map(|x| x.transform).unwrap_or(o.transform); @@ -52,10 +52,12 @@ pub(super) fn reparent(s: &mut Session, p: &Value) -> Result { let mut scratch = s.scratch(); // Pending moves along both parents and of the placement itself are kept: its new transform // was worked out from them. + // The exploded view is shown only: an ancestor it moves keeps its placement, and stays shown. + let uncaptured = s.uncaptured_moves().into_owned(); for ancestor in from_path.iter().chain(&to_path) { - if let Some(pending) = scratch.pending_moves.remove(ancestor) - && let Some(x) = scratch.doc_mut().occurrences.iter_mut().find(|x| x.id == *ancestor) - { + let Some(pending) = uncaptured.get(ancestor).copied() else { continue }; + scratch.pending_moves.remove(ancestor); + if let Some(x) = scratch.doc_mut().occurrences.iter_mut().find(|x| x.id == *ancestor) { x.transform = pending; } } diff --git a/crates/engine/src/cmd/component_transfer.rs b/crates/engine/src/cmd/component_transfer.rs index ffb66c9fb..6e893d875 100644 --- a/crates/engine/src/cmd/component_transfer.rs +++ b/crates/engine/src/cmd/component_transfer.rs @@ -6,7 +6,7 @@ use std::collections::{BTreeMap, BTreeSet}; type UniqueFrames = BTreeMap, Mat)>>; fn unique_frames(s: &Session, cmd: &str) -> Result { - let doc = s.placed_document(); + let doc = s.design_document(); let mut children = BTreeMap::>::new(); for occurrence in &doc.occurrences { children.entry(occurrence.parent).or_default().push(occurrence); @@ -54,7 +54,7 @@ fn transfer(s: &mut Session, name: &str, to: u64, frames: &UniqueFrames, cmd: &s let state = s.model.state(); let body = state.body(name).ok_or_else(|| bad(cmd, "body is missing"))?; let from = s.doc.model_body_component(body); - let doc = s.placed_document(); + let doc = s.design_document(); let unique = |component| { frames.get(&component).and_then(Option::as_ref).ok_or_else(|| { bad(cmd, "body transfer requires one source and destination placement; shared instances cannot preserve a unique world pose") @@ -78,7 +78,9 @@ fn transfer(s: &mut Session, name: &str, to: u64, frames: &UniqueFrames, cmd: &s } let inherited = (!s.doc.appearances.bodies.contains_key(name)).then(|| s.doc.appearances.components.get(&from).cloned()).flatten(); let paths: BTreeSet = source.0.iter().chain(&destination.0).copied().collect(); - let captures: Vec<_> = paths.into_iter().filter_map(|id| s.pending_moves.get(&id).map(|transform| (id, *transform))).collect(); + let uncaptured = s.uncaptured_moves(); + let captures: Vec<_> = paths.into_iter().filter_map(|id| uncaptured.get(&id).map(|transform| (id, *transform))).collect(); + drop(uncaptured); if captures.iter().any(|(_, transform)| !solidcraft_doc::valid_transfer_matrix(transform)) { return Err(bad(cmd, "pending transfer position is not a supported rigid transform")); } @@ -164,13 +166,13 @@ fn move_at_boundary(s: &mut Session, p: &Value, allow_boundary: bool) -> Result< // component placed more than once gets the bodies in every instance, placed by that one. let given = path_param(p, "component_path", cmd)?; if given.is_some() || frames.get(&to).is_some_and(Option::is_none) { - let placed = super::placing::placement_of(&scratch, &scratch.placed_document(), to, given.as_deref(), "component_path", cmd)?; + let placed = super::placing::placement_of(&scratch, &scratch.design_document(), to, given.as_deref(), "component_path", cmd)?; frames.insert(to, Some(placed)); } // The bodies move from the placement named (`from_path`: one of several where their component // is placed), as that placement shows them. if let Some(path) = path_param(p, "from_path", cmd)? { - let placed = scratch.placed_document(); + let placed = scratch.design_document(); let component = path .last() .and_then(|id| placed.occurrences.iter().find(|o| o.id == *id)) diff --git a/crates/engine/src/cmd/features.rs b/crates/engine/src/cmd/features.rs index 398cc0455..79008ecc5 100644 --- a/crates/engine/src/cmd/features.rs +++ b/crates/engine/src/cmd/features.rs @@ -2091,9 +2091,13 @@ fn placed_bodies(s: &Session, names: Vec, cmd: &str) -> Result<(Vec Result { // their links. let st = s.model.state(); let mut held = Vec::new(); - let doc = if s.pending_moves.is_empty() { + // The exploded view is shown only: the links are where the design places them. + let moves = s.uncaptured_moves(); + let doc = if moves.is_empty() { std::borrow::Cow::Borrowed(&*s.doc) } else { let placed = solidcraft_doc::joints::solve(&s.doc, &st).world; let mut doc = (*s.doc).clone(); for o in &mut doc.occurrences { - match s.pending_moves.get(&o.id) { + match moves.get(&o.id) { Some(_) if placed.contains_key(&o.id) => held.push(o.name.clone()), Some(t) => o.transform = *t, None => {} diff --git a/crates/engine/src/cmd/motion.rs b/crates/engine/src/cmd/motion.rs index 0800dd11d..69955852c 100644 --- a/crates/engine/src/cmd/motion.rs +++ b/crates/engine/src/cmd/motion.rs @@ -1061,6 +1061,7 @@ fn explode_show(s: &mut Session, p: &Value) -> Result { let cmd = "explode.show"; if p.get("view").is_none_or(|v| v.is_null() || v.as_str().is_some_and(|x| x.eq_ignore_ascii_case("none"))) { s.pending_moves.clear(); + s.exploded.clear(); s.revision += 1; return Ok(json!({"view": null})); } @@ -1070,6 +1071,8 @@ fn explode_show(s: &mut Session, p: &Value) -> Result { if !moves.values().all(solidcraft_doc::is_placement) { return Err(bad(cmd, format!("exploded view `{}` moves an occurrence out of range", v.name))); } + // Shown only: `exploded` marks these as the view's, so the design's placements leave them out. + s.exploded.clone_from(&moves); s.pending_moves = moves; s.revision += 1; Ok(json!({"view": v.id, "name": v.name})) diff --git a/crates/engine/src/cmd/motion_tests.rs b/crates/engine/src/cmd/motion_tests.rs index 371ff6d4b..63543f62d 100644 --- a/crates/engine/src/cmd/motion_tests.rs +++ b/crates/engine/src/cmd/motion_tests.rs @@ -652,6 +652,18 @@ fn exploded_views_show_without_changing_the_design() { assert!((bb(&mut s, &names[0]) + 10.0).abs() < 1e-6, "{names:?}"); assert!((bb(&mut s, &names[1]) - 30.0).abs() < 1e-6); assert_eq!(s.doc.occurrences, before, "shown only"); + // The design's placements are not the view's: the properties report where the design + // places B, and Capture Position has nothing of the view's to keep (it stays shown). + let b_id = occ(&s, "B"); + let centre = + |s: &mut Session| run(s, "occurrence.properties", json!({"occurrence": b_id}))["total"]["center_of_mass"][0].as_f64().unwrap_or(f64::NAN); + run(&mut s, "explode.show", json!({"view": null})); + let placed = centre(&mut s); + run(&mut s, "explode.show", json!({"view": "Apart"})); + assert!((centre(&mut s) - placed).abs() < 1e-9, "{} shown, {placed} placed", centre(&mut s)); + assert_eq!(run(&mut s, "component.capture_position", json!({}))["captured"], 0); + assert_eq!(s.doc.occurrences, before, "the exploded view is never captured"); + assert!((bb(&mut s, &names[1]) - 30.0).abs() < 1e-6, "still shown"); run(&mut s, "explode.show", json!({"view": null})); assert!(bb(&mut s, &names[0]).abs() < 1e-6); run(&mut s, "explode.create", json!({"name": "Hand", "moves": [{"occurrence": "B", "translate": [0, 0, 50]}]})); diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index 7b93a7426..1460203f6 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -400,6 +400,11 @@ pub struct Session { pub active_occurrence_path: Option>, /// Occurrence moves not captured yet (Capture Position keeps them, a recompute drops them). pub pending_moves: std::collections::BTreeMap, + /// The placements the exploded view (`explode.show`) put in `pending_moves` to be shown: + /// display only. An entry of `pending_moves` still equal to its one here is the exploded view's, + /// not a move of the design's, so the placements the design reports and Capture Position + /// keeps leave it out ([`Session::uncaptured_moves`]). + pub exploded: std::collections::BTreeMap, world_cache: std::sync::Mutex>, /// The design the joints were last solved for, as the solve left it, and the model it read /// (see [`Session::solve_joints`]). @@ -611,6 +616,7 @@ impl Session { active_component: 0, active_occurrence_path: None, pending_moves: Default::default(), + exploded: Default::default(), world_cache: Default::default(), joints_settled: None, occurrence_visibility_cache: Default::default(), @@ -1420,6 +1426,7 @@ impl Session { active_component: self.active_component, active_occurrence_path: self.active_occurrence_path.clone(), pending_moves: self.pending_moves.clone(), + exploded: self.exploded.clone(), world_cache: std::sync::Mutex::new(self.world_cache.lock().ok().and_then(|cache| cache.clone())), joints_settled: self.joints_settled.clone(), occurrence_visibility_cache: Default::default(), @@ -1609,6 +1616,7 @@ impl Session { self.active_component = computed.active_component; self.active_occurrence_path = computed.active_occurrence_path; self.pending_moves = computed.pending_moves; + self.exploded = computed.exploded; // Joints the computation hid (an import's rigid group) stay hidden. for j in computed.visibility.hidden_joints { if !self.visibility.hidden_joints.contains(&j) { diff --git a/crates/engine/src/occurrences.rs b/crates/engine/src/occurrences.rs index a07b4a305..9094b75c8 100644 --- a/crates/engine/src/occurrences.rs +++ b/crates/engine/src/occurrences.rs @@ -139,8 +139,44 @@ impl Session { } std::borrow::Cow::Owned(doc) } - /// Resolve only the supplied path, never an exponentially expanded assembly. + /// The occurrence moves of the design not captured yet: `pending_moves` without the + /// placements the exploded view shows ([`Session::exploded`]), which are display only. An + /// entry the exploded view put there and nothing has moved since is left out; one moved since + /// (dragged, played) is a move like any other. + pub fn uncaptured_moves(&self) -> std::borrow::Cow<'_, std::collections::BTreeMap> { + if !self.pending_moves.iter().any(|(id, m)| self.exploded.get(id) == Some(m)) { + return std::borrow::Cow::Borrowed(&self.pending_moves); + } + std::borrow::Cow::Owned(self.pending_moves.iter().filter(|(id, m)| self.exploded.get(id) != Some(*m)).map(|(id, m)| (*id, *m)).collect()) + } + + /// The document with the design's own uncaptured moves applied ([`Session::uncaptured_moves`]): + /// [`Session::placed_document`] without the exploded view, for what reports the design's + /// placements or works a new placement out from them. + pub fn design_document(&self) -> std::borrow::Cow<'_, solidcraft_doc::Document> { + let moves = self.uncaptured_moves(); + if moves.is_empty() { + return std::borrow::Cow::Borrowed(&self.doc); + } + let mut doc = (*self.doc).clone(); + for o in &mut doc.occurrences { + if let Some(transform) = moves.get(&o.id) { + o.transform = *transform; + } + } + std::borrow::Cow::Owned(doc) + } + + /// Resolve only the supplied path, never an exponentially expanded assembly: placed where + /// it is shown (uncaptured moves and the exploded view included). pub fn occurrence_placement(&self, path: &[u64]) -> Result { + self.occurrence_placement_with(path, &self.pending_moves) + } + + /// [`Session::occurrence_placement`] with the occurrences moved by `moves` instead of + /// `pending_moves` (the design's own, [`Session::uncaptured_moves`], for what reports the + /// design's placements). + pub fn occurrence_placement_with(&self, path: &[u64], moves: &std::collections::BTreeMap) -> Result { if path.is_empty() || path.len() > 64 { return Err(invalid("occurrence path must contain 1..64 ids")); } @@ -162,7 +198,7 @@ impl Session { return Err(invalid("occurrence path has a missing component")); } parent_world = world; - world = mat_mul(&world, self.pending_moves.get(id).unwrap_or(&o.transform)); + world = mat_mul(&world, moves.get(id).unwrap_or(&o.transform)); if world.iter().flatten().any(|x| !x.is_finite()) { return Err(invalid("occurrence path has a non-finite transform")); } @@ -183,7 +219,7 @@ impl Session { path: path.to_vec(), name: leaf.name.clone(), world, - local: self.pending_moves.get(&leaf.id).copied().unwrap_or(leaf.transform), + local: moves.get(&leaf.id).copied().unwrap_or(leaf.transform), parent_world, grounded: leaf.grounded, bodies, @@ -497,6 +533,7 @@ impl Session { pub(crate) fn prune_occurrence_state(&mut self) { self.pending_moves.retain(|id, _| self.doc.occurrences.iter().any(|o| o.id == *id)); + self.exploded.retain(|id, _| self.doc.occurrences.iter().any(|o| o.id == *id)); if self.active_component != 0 && !self.doc.components.iter().any(|c| c.id == self.active_component) { self.active_component = 0; self.active_occurrence_path = None; diff --git a/crates/kernel/src/iso.rs b/crates/kernel/src/iso.rs index 391ed144b..1e6e7cbd0 100644 --- a/crates/kernel/src/iso.rs +++ b/crates/kernel/src/iso.rs @@ -191,14 +191,14 @@ pub fn iso_curves(body: &Body, face: usize, at: Vec3, along_u: bool) -> Result Result> { if !(1..=MAX_ISO_COUNT).contains(&count) { return Err(KernelError::Invalid(format!("iso curves: 1…{MAX_ISO_COUNT} each way"))); @@ -207,28 +207,15 @@ pub fn iso_grid(body: &Body, face: usize, count: usize, chord: f64) -> Result lo) { continue; } - let Some((start, step)) = iso_ladder(trims.surface, &trims.eval, !along_u, count, spacing) else { continue }; - // Rungs on the extent's sides are its boundary, not curves across it. - let eps = step * 1e-6; - let first = ((lo + eps - start) / step).ceil(); - let last = ((hi - eps - start) / step).floor(); - if !(first.is_finite() && last.is_finite()) { - continue; - } - // The ladder is spaced so that a face holds at most about `count + 1` rungs; the cap - // only guards a surface whose parameters run far faster than the body's size. - let rungs = (last - first + 1.0).clamp(0.0, (4 * MAX_ISO_COUNT) as f64) as usize; - for k in 0..rungs { - let fixed = start + (first + k as f64) * step; + for k in 1..=count { + let fixed = lo + (hi - lo) * k as f64 / (count + 1) as f64; for (curve, interval) in trims.clip(along_u, fixed)? { let segs = curve_path(&curve, interval)?; let mut points: Vec = segs.first().map(crate::PathSeg::start).into_iter().collect(); @@ -242,72 +229,19 @@ pub fn iso_grid(body: &Body, face: usize, count: usize, chord: f64) -> Result Option<(f64, f64)> { - use solidcraft_geom::brep::Surface; - let d = if held_u { 0 } else { 1 }; - if let Some((a, b)) = eval.domain().range.get(d).copied().flatten().filter(|(a, b)| b > a) { - return Some((a, (b - a) / (count + 1) as f64)); - } - let v = |q: [f64; 3]| Vec3::new(q[0], q[1], q[2]); - // The parameter as (P - origin) · g, P a point of the surface. - let (origin, g) = match surface { - Surface::Plane { origin, u_axis, v_axis } => (v(*origin), plane_gradient(v(*u_axis), v(*v_axis), held_u)?), - Surface::PlaneThrough { origin, u_point, v_point } => { - let o = v(*origin); - (o, plane_gradient(v(*u_point) - o, v(*v_point) - o, held_u)?) +/// The extent in (u, v) of face `face` together with every other face of `body` on the same +/// surface record (the same surface and parameters, so one (u, v) for all of them): the box round +/// all their extents ([`FaceTrims::extent`]). +fn shared_extent(body: &Body, face: usize, trims: &FaceTrims) -> Result<[[f64; 2]; 2]> { + let mut b = trims.extent(); + for (i, other) in body.record().faces.iter().enumerate() { + if i == face || other.parameters() != trims.surface { + continue; } - // Along the axis: P = origin + z * v + (radial part, at right angles to z). - Surface::Cylinder { frame, .. } | Surface::Cone { frame, .. } if !held_u => { - let z = v(frame.x_axis).cross(v(frame.y_axis)); - let zz = z.dot(z); - if !(zz > 1e-300) { - return None; - } - (v(frame.origin), z * (1.0 / zz)) - } - _ => return None, - }; - let len = g.len(); - if !(len.is_finite() && len > 0.0) { - return None; + let [[a0, a1], [c0, c1]] = FaceTrims::new(body, i)?.extent(); + b = [[b[0][0].min(a0), b[0][1].max(a1)], [b[1][0].min(c0), b[1][1].max(c1)]]; } - // The parameter of the world plane P · g/|g| = k * spacing is k * spacing * |g| - origin · g. - Some((-origin.dot(g), spacing * len)) -} - -/// The gradient of a plane's u (`held_u`) or v in the world: the dual of its axes in their plane. -fn plane_gradient(du: Vec3, dv: Vec3, held_u: bool) -> Option { - let n = du.cross(dv); - let nn = n.dot(n); - if !(nn > 1e-300) { - return None; - } - Some(if held_u { dv.cross(n) } else { n.cross(du) } * (1.0 / nn)) -} - -/// `x` rounded down to 1, 2 or 5 times a power of ten (None unless it is positive and finite). -fn round_spacing(x: f64) -> Option { - if !(x.is_finite() && x > 0.0) { - return None; - } - let p = 10f64.powf(x.log10().floor()); - let m = x / p; - Some( - p * if m >= 5.0 { - 5.0 - } else if m >= 2.0 { - 2.0 - } else { - 1.0 - }, - ) + Ok(b) } /// A pcurve's parameters and points at [`ISO_SAMPLES`] per knot span, in its direction. diff --git a/crates/smlib/src/export.rs b/crates/smlib/src/export.rs index 70df616f9..7a1b3fee3 100644 --- a/crates/smlib/src/export.rs +++ b/crates/smlib/src/export.rs @@ -1259,6 +1259,10 @@ fn canonical(parts: Parts, n_vertices: usize, flat: View, tolerances: &Tolerance uses, }); } + let record_geometry = |e: u32| { + let edge = edge_records.get(e as usize)?; + Some(EdgeGeometry { curve: edge.nurbs.as_ref().unwrap_or(&edge.curve), interval: edge.interval, tolerance: edge.tolerance }) + }; let mut face_records = Vec::with_capacity(face_order.len()); for (fi, &f) in face_order.iter().enumerate() { let face = faces.get(f as usize).ok_or_else(|| invalid("face"))?; @@ -1271,7 +1275,7 @@ fn canonical(parts: Parts, n_vertices: usize, flat: View, tolerances: &Tolerance }) .collect::>()?; let mut curves = - pcurves(face.nurbs.as_ref().unwrap_or(&face.surface), face.domain, &renumbered, &face.given, &edge_records, tolerance)?.into_iter(); + pcurves(face.nurbs.as_ref().unwrap_or(&face.surface), face.domain, &renumbered, &face.given, record_geometry, tolerance)?.into_iter(); let mut loops = Vec::with_capacity(renumbered.len()); for (li, l) in renumbered.iter().enumerate() { loops.push(match l { @@ -1532,15 +1536,23 @@ fn split_touching(faces: &mut [Face], edges: &mut Vec, edge_source: &mut V Ok(()) } +/// What the pcurve routine needs of one edge: the curve its parameter is on, its interval and its +/// tolerance. +struct EdgeGeometry<'a> { + curve: &'a b::Curve, + interval: [f64; 2], + tolerance: f64, +} + /// A face's pcurves, edge loop by edge loop: SMLib's own UV trims where `given` (loop by loop as /// `loops`) has them, the plain-record routine on the face's records for the rest; each loop moved -/// by whole periods into the face's domain. -fn pcurves( +/// by whole periods into the face's domain. `edge` looks up an edge of `loops` by its index. +fn pcurves<'a>( surface: &b::Surface, domain: [[f64; 2]; 2], loops: &[Loop], - given: &[Vec>], - edges: &[b::Edge], + given: &'a [Vec>], + edge: impl Fn(u32) -> Option>, tolerance: f64, ) -> Res>> { if given.len() != loops.len() { @@ -1554,13 +1566,13 @@ fn pcurves( } let mut loop_uses = Vec::with_capacity(l.len()); for (&(e, forward), given) in l.iter().zip(g) { - let edge = edges.get(e as usize).ok_or_else(|| invalid("edge"))?; + let geometry = edge(e).ok_or_else(|| invalid("edge"))?; loop_uses.push(b::pcurve::EdgeUse { edge: e, - curve: edge.nurbs.as_ref().unwrap_or(&edge.curve), - interval: edge.interval, + curve: geometry.curve, + interval: geometry.interval, forward, - tolerance: edge.tolerance, + tolerance: geometry.tolerance, given: given.as_ref(), }); } @@ -1575,12 +1587,12 @@ fn pcurves( /// (positive: counter-clockwise, the record's convention); 0 where it has no edge loop. fn outer_area(face: &Face, edges: &[Edge], tolerance: f64) -> Res { let Some(Loop::Edges(outer)) = face.loops.first() else { return Ok(0.0) }; - let records: Vec = edges - .iter() - .map(|e| b::Edge { nurbs: e.nurbs.clone(), curve: e.curve.clone(), interval: e.interval, vertices: e.vertices, tolerance, uses: Vec::new() }) - .collect(); + let geometry = |e: u32| { + let edge = edges.get(e as usize)?; + Some(EdgeGeometry { curve: edge.nurbs.as_ref().unwrap_or(&edge.curve), interval: edge.interval, tolerance }) + }; let given = face.given.first().map(std::slice::from_ref).unwrap_or(&[]); - let curves = pcurves(face.nurbs.as_ref().unwrap_or(&face.surface), face.domain, &[Loop::Edges(outer.clone())], given, &records, tolerance)?; + let curves = pcurves(face.nurbs.as_ref().unwrap_or(&face.surface), face.domain, &[Loop::Edges(outer.clone())], given, geometry, tolerance)?; let mut pts: Vec<[f64; 2]> = Vec::new(); for (pc, &(e, forward)) in curves.first().map(Vec::as_slice).unwrap_or(&[]).iter().zip(outer) { let edge = edges.get(e as usize).ok_or_else(|| invalid("edge"))?; diff --git a/crates/smlib/src/export/tests.rs b/crates/smlib/src/export/tests.rs index daff933d4..da02114ba 100644 --- a/crates/smlib/src/export/tests.rs +++ b/crates/smlib/src/export/tests.rs @@ -281,6 +281,95 @@ mod native_tests { assert!(native(&shifted(1e-3)).map(|(r, _)| r.validate()).map_or(true, |v| v.is_err()), "a real overshoot is not moved"); } + /// [`outer_area`] as it was: every edge of the body copied into a record for each face. + #[allow(clippy::unwrap_used)] // test reference + fn outer_area_copying_every_edge(face: &Face, edges: &[Edge], tolerance: f64) -> Res { + let Some(Loop::Edges(outer)) = face.loops.first() else { return Ok(0.0) }; + let records: Vec = edges + .iter() + .map(|e| b::Edge { + nurbs: e.nurbs.clone(), + curve: e.curve.clone(), + interval: e.interval, + vertices: e.vertices, + tolerance, + uses: Vec::new(), + }) + .collect(); + let lookup = |e: u32| { + let edge = records.get(e as usize)?; + Some(EdgeGeometry { curve: edge.nurbs.as_ref().unwrap_or(&edge.curve), interval: edge.interval, tolerance: edge.tolerance }) + }; + let given = face.given.first().map(std::slice::from_ref).unwrap_or(&[]); + let curves = pcurves(face.nurbs.as_ref().unwrap_or(&face.surface), face.domain, &[Loop::Edges(outer.clone())], given, lookup, tolerance)?; + let mut pts: Vec<[f64; 2]> = Vec::new(); + for (pc, &(e, forward)) in curves.first().map(Vec::as_slice).unwrap_or(&[]).iter().zip(outer) { + let [a, z] = edges.get(e as usize).unwrap().interval; + let mut run: Vec<[f64; 2]> = (0..=32).filter_map(|i| point2(pc, a + (z - a) * f64::from(i) / 32.0)).collect(); + if !forward { + run.reverse(); + } + pts.extend(run); + } + let n = pts.len(); + Ok(0.5 * (0..n).map(|k| (pts[k], pts[(k + 1) % n])).map(|(p, q)| p[0] * q[1] - q[0] * p[1]).sum::()) + } + + /// A face's outer area reads only its own loop's edges, and is bit for bit what copying every + /// edge of the body gave: the export's face turns, and so its records and numbering, are + /// unchanged. Each body's record faces are counter-clockwise by convention, so positive. + #[test] + fn a_faces_outer_area_reads_only_its_own_loop_and_is_unchanged() { + let block = Brep::make_box([0.0; 3], [31.0, 29.0, 10.0]).unwrap(); + let hole = Brep::make_cylinder([12.0, 14.5, -1.0], 5.0, 12.0).unwrap(); + let rounded = Brep::make_box([0.0; 3], [60.0, 40.0, 20.0]).unwrap().fillet(&[[60.0, 40.0, 10.0]], 0.1, 5.0).unwrap(); + let mut bodies: Vec<(&str, Brep)> = primitives().into_iter().map(|(name, b, _)| (name, b)).collect(); + bodies.push(("box minus cylinder", block.boolean(&hole, crate::BooleanOp::Subtract).unwrap().unwrap())); + bodies.push(("rounded box", rounded)); + for (name, body) in bodies { + let record = body.to_native().unwrap_or_else(|e| panic!("{name}: {e}")); + let edges: Vec = record + .edges + .iter() + .map(|e| Edge { + curve: e.curve.clone(), + nurbs: e.nurbs.clone(), + interval: e.interval, + vertices: e.vertices, + reversed: false, + trim_map: None, + }) + .collect(); + for (f, rf) in record.faces.iter().enumerate() { + // Without SMLib's trims (the pcurve routine) and with the record's pcurves as them. + for with_given in [false, true] { + let loops: Vec = rf + .loops + .iter() + .map(|l| match l { + b::Loop::Edges { edges } => Loop::Edges(edges.iter().map(|u| (u.edge, u.forward)).collect()), + b::Loop::Vertex { vertex } => Loop::Vertex(*vertex), + }) + .collect(); + let given = rf + .loops + .iter() + .map(|l| match l { + b::Loop::Edges { edges } => edges.iter().map(|u| with_given.then(|| u.pcurve.clone())).collect(), + b::Loop::Vertex { .. } => Vec::new(), + }) + .collect(); + let records = loops.iter().map(|_| Vec::new()).collect(); + let face = Face { nurbs: rf.nurbs.clone(), surface: rf.surface.clone(), domain: rf.domain, agrees: true, loops, records, given }; + let now = outer_area(&face, &edges, record.tolerance).unwrap_or_else(|e| panic!("{name}: face {f}: {e}")); + let before = outer_area_copying_every_edge(&face, &edges, record.tolerance).unwrap(); + assert_eq!(now.to_bits(), before.to_bits(), "{name}: face {f}, trims given {with_given}: {now} != {before}"); + assert!(now > 0.0, "{name}: face {f}, trims given {with_given}: area {now}"); + } + } + } + } + #[test] fn hostile_arrays_are_errors_never_panics() { let good = Brep::make_box([0.0; 3], [1.0, 2.0, 3.0]).unwrap().arrays().unwrap(); diff --git a/tests/kernel-cases/assemblies/PATHS b/tests/kernel-cases/assemblies/PATHS index c4d4c73b5..45bba6bf7 100644 --- a/tests/kernel-cases/assemblies/PATHS +++ b/tests/kernel-cases/assemblies/PATHS @@ -18,9 +18,12 @@ crates/engine/src/cmd/component_clone_assembly.rs crates/engine/src/cmd/component_drag.rs crates/engine/src/cmd/component_extract.rs crates/engine/src/cmd/component_link.rs +crates/engine/src/cmd/component_placing.rs crates/engine/src/cmd/component_properties.rs crates/engine/src/cmd/component_reparent.rs crates/engine/src/cmd/component_transfer.rs +# Where occurrences are placed, shown and reported (the exploded view is shown only). +crates/engine/src/occurrences.rs # Interference and clearance between placed bodies. crates/engine/src/cmd/clearance.rs crates/engine/src/cmd/interference.rs diff --git a/tests/kernel-cases/assemblies/cov-explode-create-automatic-scale-2/expected.json b/tests/kernel-cases/assemblies/cov-explode-create-automatic-scale-2/expected.json index 21464fb60..9779216e3 100644 --- a/tests/kernel-cases/assemblies/cov-explode-create-automatic-scale-2/expected.json +++ b/tests/kernel-cases/assemblies/cov-explode-create-automatic-scale-2/expected.json @@ -2,7 +2,7 @@ "sources": [], "what": "an automatic exploded view of scale 2", "source": "analytic", - "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); each occurrence moves scale \u00d7 (its centre - the mean of the centres): centres (0,0,-5) and (20,0,5), mean (10,0,0): Base by (-20,0,-10), Arm by (20,0,10); shown, Arm at (40,0,15)", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); each occurrence moves scale \u00d7 (its centre - the mean of the centres): centres (0,0,-5) and (20,0,5), mean (10,0,0): Base by (-20,0,-10), Arm by (20,0,10); shown only (the design keeps its placements), so occurrence.properties reports Arm where the design places it: centre (20,0,5)", "body_count": 2, "volume_mm3": 8000.0, "results": [ @@ -32,12 +32,12 @@ "json": { "total": { "center_of_mass": [ - 40.0, + 20.0, 0.0, - 15.0 + 5.0 ] } } } ] -} +} \ No newline at end of file diff --git a/tests/kernel-cases/assemblies/cov-explode-create-explicit-move/expected.json b/tests/kernel-cases/assemblies/cov-explode-create-explicit-move/expected.json index 63cb1244d..9192aa3e4 100644 --- a/tests/kernel-cases/assemblies/cov-explode-create-explicit-move/expected.json +++ b/tests/kernel-cases/assemblies/cov-explode-create-explicit-move/expected.json @@ -2,7 +2,7 @@ "sources": [], "what": "an exploded view moving the arm 30 mm up, shown", "source": "analytic", - "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); explode.show places Arm by (0,0,30): centre (20,0,35)", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); the view moves Arm by (0,0,30). explode.show is shown only (the design keeps its placements), so occurrence.properties reports Arm where the design places it: centre (20,0,5)", "body_count": 2, "volume_mm3": 8000.0, "results": [ @@ -27,10 +27,10 @@ "center_of_mass": [ 20.0, 0.0, - 35.0 + 5.0 ] } } } ] -} +} \ No newline at end of file diff --git a/tests/kernel-cases/assemblies/cov-explode-show-keeps-the-placements/expected.json b/tests/kernel-cases/assemblies/cov-explode-show-keeps-the-placements/expected.json new file mode 100644 index 000000000..e57cdf8a4 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-explode-show-keeps-the-placements/expected.json @@ -0,0 +1,91 @@ +{ + "sources": [], + "what": "an exploded view shown, then the arm's properties and Capture Position: the design keeps its placements", + "source": "analytic", + "method": "Arm: box 40x10x10 from (0,-5,0), centre (20,0,5), volume 4000. explode.show is shown only (the design keeps its placements), so occurrence.properties reports the arm where the design places it before the view is shown (step 8), while it is shown (step 11) and after Capture Position (step 12, which has no move of the design's to keep: 0 captured) and the assembled view (step 14): centre (20,0,5), box (0,-5,0)..(40,5,10)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 8, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ], + "bbox": { + "min": [ + 0.0, + -5.0, + 0.0 + ], + "max": [ + 40.0, + 5.0, + 10.0 + ] + }, + "volume_mm3": 4000.0 + } + } + }, + { + "step": 11, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ], + "bbox": { + "min": [ + 0.0, + -5.0, + 0.0 + ], + "max": [ + 40.0, + 5.0, + 10.0 + ] + }, + "volume_mm3": 4000.0 + } + } + }, + { + "step": 12, + "json": { + "captured": 0 + } + }, + { + "step": 14, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ], + "bbox": { + "min": [ + 0.0, + -5.0, + 0.0 + ], + "max": [ + 40.0, + 5.0, + 10.0 + ] + }, + "volume_mm3": 4000.0 + } + } + } + ] +} \ No newline at end of file diff --git a/tests/kernel-cases/assemblies/cov-explode-show-keeps-the-placements/recipe.json b/tests/kernel-cases/assemblies/cov-explode-show-keeps-the-placements/recipe.json new file mode 100644 index 000000000..1288e1895 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-explode-show-keeps-the-placements/recipe.json @@ -0,0 +1,123 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + }, + { + "command": "explode.create", + "params": { + "name": "Up", + "moves": [ + { + "occurrence": "Arm:1", + "translate": [ + 0, + 0, + 30 + ] + } + ] + } + }, + { + "command": "explode.show", + "params": { + "view": "Up" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + }, + { + "command": "component.capture_position", + "params": {} + }, + { + "command": "explode.show", + "params": {} + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} \ No newline at end of file diff --git a/tests/kernel-cases/inspect/cov-isocurve-40-by-30-face-count-3/expected.json b/tests/kernel-cases/inspect/cov-isocurve-40-by-30-face-count-3/expected.json new file mode 100644 index 000000000..61b4efb79 --- /dev/null +++ b/tests/kernel-cases/inspect/cov-isocurve-40-by-30-face-count-3/expected.json @@ -0,0 +1,102 @@ +{ + "sources": [], + "what": "three isocurves each way across a 40 x 30 face", + "source": "analytic", + "method": "box 40 x 30 x 10 with a corner at the origin: its top is the plane z = 10, x 0..40 and y 0..30. count 3 curves each way, evenly spaced across it (the command's contract), divide each side into 4: x = 10, 20, 30 (each from y 0 to 30) and y = 7.5, 15, 22.5 (each from x 0 to 40), every curve the straight line across the face. In the order the reply lists them (along the surface's first parameter first, as its parameters run), to 1e-9 mm", + "results": [ + { + "step": 2, + "pointer": "/faces/0/count", + "json": 3 + }, + { + "step": 2, + "pointer": "/faces/0/u_curves", + "json": 3 + }, + { + "step": 2, + "pointer": "/faces/0/v_curves", + "json": 3 + }, + { + "step": 2, + "pointer": "/curves", + "json": [ + [ + [ + 30.0, + 0.0, + 10.0 + ], + [ + 30.0, + 30.0, + 10.0 + ] + ], + [ + [ + 20.0, + 0.0, + 10.0 + ], + [ + 20.0, + 30.0, + 10.0 + ] + ], + [ + [ + 10.0, + 0.0, + 10.0 + ], + [ + 10.0, + 30.0, + 10.0 + ] + ], + [ + [ + 40.0, + 7.5, + 10.0 + ], + [ + 0.0, + 7.5, + 10.0 + ] + ], + [ + [ + 40.0, + 15.0, + 10.0 + ], + [ + 0.0, + 15.0, + 10.0 + ] + ], + [ + [ + 40.0, + 22.5, + 10.0 + ], + [ + 0.0, + 22.5, + 10.0 + ] + ] + ], + "abs_mm": 1e-09 + } + ] +} \ No newline at end of file diff --git a/tests/kernel-cases/inspect/cov-isocurve-40-by-30-face-count-3/recipe.json b/tests/kernel-cases/inspect/cov-isocurve-40-by-30-face-count-3/recipe.json new file mode 100644 index 000000000..4aa2e1133 --- /dev/null +++ b/tests/kernel-cases/inspect/cov-isocurve-40-by-30-face-count-3/recipe.json @@ -0,0 +1,27 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Slab", + "operation": "new" + } + }, + { + "command": "inspect.isocurve", + "params": { + "faces": [ + [ + 20, + 15, + 10 + ] + ], + "count": 3 + } + } + ] +} \ No newline at end of file