Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

Wave 465/509: Naming: a blend's seams split its edge's name at the | between its two faces (and 3 more)

jyviko67013acc2816
diff --git a/crates/doc/src/naming.rs b/crates/doc/src/naming.rs
index 96a59e0e24..a4b61e3894 100644
--- a/crates/doc/src/naming.rs
+++ b/crates/doc/src/naming.rs
@@ -340,11 +340,7 @@ pub fn blend_seams(b: &ModelBody) -> Vec<BlendSeam> {
all(j).into_iter().any(|name| {
let (core, instance) = split_instance(name);
let face = crate::piece_names::strip_qualifiers(core);
- edges.iter().any(|(edge, at)| {
- at == instance
- && (edge.strip_prefix(face.as_str()).is_some_and(|r| r.starts_with('|'))
- || edge.strip_suffix(face.as_str()).is_some_and(|r| r.ends_with('|')))
- })
+ edges.iter().any(|(edge, at)| at == instance && edge_sides(edge).is_some_and(|(a, b)| a == face || b == face))
})
};
let mut out = Vec::new();
@@ -363,6 +359,44 @@ pub fn blend_seams(b: &ModelBody) -> Vec<BlendSeam> {
out
}
+/// The two faces an edge name `<face A>|<face B>` joins. A blend face's own name holds the edge it
+/// replaced (`F<feature>:blend:<face>|<face>`), so a side's name can hold `|` too: the split is the
+/// one `|` outside every blend face's edge (`F1:+y` and `F3:blend:F1:+z|F2:side` for
+/// `F1:+y|F3:blend:F1:+z|F2:side`). `None` for a name that is not two faces.
+fn edge_sides(edge: &str) -> Option<(&str, &str)> {
+ let first = face_name_end(edge, 0)?;
+ if edge.as_bytes().get(first) != Some(&b'|') || face_name_end(edge, first + 1)? != edge.len() {
+ return None;
+ }
+ Some((edge.get(..first)?, edge.get(first + 1..)?))
+}
+
+/// Where the face name starting at byte `from` of `s` ends: at the next `|`, or for a blend face
+/// past the two faces of the edge its name holds (and theirs, for blends of blends).
+fn face_name_end(s: &str, from: usize) -> Option<usize> {
+ const MARK: &str = ":blend:";
+ // The faces still to read: a blend face's name is read as the two of its edge.
+ let (mut pending, mut at) = (1usize, from);
+ loop {
+ let rest = s.get(at..)?;
+ let bar = rest.find('|').unwrap_or(rest.len());
+ if let Some(m) = rest.get(..bar)?.find(MARK) {
+ pending += 1;
+ at += m + MARK.len();
+ continue;
+ }
+ pending -= 1;
+ at += bar;
+ if pending == 0 {
+ return Some(at);
+ }
+ if s.as_bytes().get(at) != Some(&b'|') {
+ return None;
+ }
+ at += 1;
+ }
+}
+
/// A name and the copy it names (`@F<feature>.<instance>`, a pattern's or a paste's copy of a
/// tool face; empty for the original).
fn split_instance(name: &str) -> (&str, &str) {
diff --git a/tests/kernel-cases/fillets/KNOWN_FAILING b/tests/kernel-cases/fillets/KNOWN_FAILING
index a2bba0078d..d976a4a796 100644
--- a/tests/kernel-cases/fillets/KNOWN_FAILING
+++ b/tests/kernel-cases/fillets/KNOWN_FAILING
@@ -6,14 +6,10 @@
1080-fillet-sloped-basin-0-5-mm-rim-r4-4-edges builds to the analytic volume (rel 3e-9), but the continuity check (g1 at every blend seam) takes in the mitre's creases, G0 by the mitre ruling: the case's continuity seams need the owner's word
1080-fillet-sloped-basin-1-mm-rim-r4-2-edges builds to the analytic volume (rel 6e-9), but the continuity check (g1 at every blend seam) takes in the mitre's creases, G0 by the mitre ruling: the case's continuity seams need the owner's word
1080-fillet-sloped-basin-1-mm-rim-r4-4-edges builds to the analytic volume (rel 3e-9), but the continuity check (g1 at every blend seam) takes in the mitre's creases, G0 by the mitre ruling: the case's continuity seams need the owner's word
-1207-fillet-bar-top-edge-after-boss-arc-round-r0-5 SMLib's check refuses the round: internal coincident control points in a B-spline curve (an internal pole)
+1207-fillet-bar-top-edge-after-boss-arc-round-r0-5 SMLib's check refuses the round: internal coincident control points in its end rib on the boss, which starts where the round and the boss are tangent (the boss's intersection marched there in spans down to 6e-8 mm)
2893-chamfer-distance-and-angle-past-the-wall-refused refused for another reason: SMLib SM_ERR_INVALID_INPUT, not a check saying the angle runs past the wall
2893-chamfer-two-distances-elliptical-rim SMLib status 1001: the two arcs of the rim take their chamfer offsets each at its own midpoint, where the faces' angle differs (78.5 and 101.5 deg), and their chamfers do not meet at the tangent corners (held for the owner's ruling on unequal chamfers of a varying angle)
4782-fillet-bar-edge-wider-than-both-faces SMLib status 1001: a convex round past both its faces is not yet built by subtraction
5158-fillet-round-just-past-a-10mm-face SMLib status 1001: the round passes 5e-6 under the box's top back edge, inside the body's tolerance (1e-5), and subtracting its removal region maps that edge to two of the region's faces (SmTopologyIntersector); 10.0001-10.04 open
9-fillet-corner-curvature-with-reduce-fit not supported yet: solid.fillet builds corner g2 with the exact fit only
9-fillet-corner-curvature-with-taper-fit not supported yet: solid.fillet builds corner g2 with the exact fit only
-cov-chamfer-concave-edge-through-up-down-joined-squares SMLib status 1001 on the concave chamfer's tangent chain
-cov-chamfer-outer-corner-edge-of-a-shelled-box-with-a-lip SMLib's chamfer result is not a closed solid where it ends on the lip
-cov-fillet-arc-edge-on-an-oblique-cut-of-a-bar SMLib's check refuses the round: internal coincident control points in a B-spline curve
-every-block-cylinder-crease-top-edge-after-arc-round-r1 the r1 round's contact seam with the block's side face reads 60 degrees (the cylinder wall's normal) at its end on the crease (8.660, 5, 15.284): G0 where the round is built tangent
diff --git a/tests/kernel-cases/shell/KNOWN_FAILING b/tests/kernel-cases/shell/KNOWN_FAILING
index 224e4bf005..22716291a2 100644
--- a/tests/kernel-cases/shell/KNOWN_FAILING
+++ b/tests/kernel-cases/shell/KNOWN_FAILING
@@ -7,7 +7,4 @@
545-shell-ring-cut-frame-open-at-an-outer-wall SMLib status 1001
616-shell-open-a-rib-side-face-of-a-lid SMLib status 1001
cov-shell-again-open-at-an-inner-wall-of-a-shelled-box SMLib status 1001
-cov-shell-plate-with-a-hole-through-its-arc-side SMLib status 1001 where the hole's wall meets the arc side
-cov-shell-pocket-whose-floor-falls-to-a-drain SMLib status 1001 where four faces meet at the pocket floor's corners
-cov-shell-trough-whose-floor-falls-to-a-drain SMLib status 1001 where four faces meet at a corner
cov-shell-up-down-joined-squares-open-at-a-side-wall SMLib status 1001
diff --git a/tests/kernel-cases/shell/cov-shell-pocket-whose-floor-falls-to-a-drain/expected.json b/tests/kernel-cases/shell/cov-shell-pocket-whose-floor-falls-to-a-drain/expected.json
index a2c6c676f2..1c60969ae9 100644
--- a/tests/kernel-cases/shell/cov-shell-pocket-whose-floor-falls-to-a-drain/expected.json
+++ b/tests/kernel-cases/shell/cov-shell-pocket-whose-floor-falls-to-a-drain/expected.json
@@ -2,8 +2,9 @@
"sources": [],
"what": "a slab 140 x 90 x 50 with a 30 mm pocket whose floor falls 1 deg from its edges to a central drain (four faces meet at each of the pocket floor's concave corners), shelled 3 mm open at the top",
"source": "analytic",
- "method": "The floor below z = 0 is a pyramid, apex at the centre h = 30 tan 1 deg = 0.523652 below: two triangular prisms (a triangle on XZ swept along y, one on YZ swept along x) intersected. Slab 140 x 90 x 50 less the pocket x 20..120, y 15..75 down to z = 20 and the pyramid below it: V0 = 630000 - (100 60 30 + 100 60 h/3). Shell 3 open at the top, offset faces extended to meet: the cavity is x 3..137, y 3..87 from z = 3 up to the top, except over the pocket's walls moved 3 out (x 17..123, y 12..78), where it rises only to the pocket's floor facets moved 3 down (their max, exactly over the cells where each is highest): cavity 297136.906075. V = 151815.790029",
+ "method": "The floor below z = 0 is a pyramid, apex at the centre h = 30 tan 1 deg = 0.523652 below: two triangular prisms (a triangle on XZ swept along y, one on YZ swept along x) intersected. Slab 140 x 90 x 50 less the pocket x 20..120, y 15..75 down to z = 20 and the pyramid below it: V0 = 630000 - (100 60 30 + 100 60 h/3). Shell 3 open at the top, offset faces extended to meet: the cavity is x 3..137, y 3..87 from z = 3 up to the top, except over the pocket's walls moved 3 out (x 17..123, y 12..78), where it rises only to the pocket's floor facets moved 3 down (their max, exactly over the cells where each is highest): cavity 297136.906075. The pocket's lining (its walls and floor, 3 thick, hanging from the top's rim round the pocket) stands apart from the slab's outer walls, the cavity rising between them to the open top: two lumps in the one body. V = 151815.790029",
"body_count": 1,
+ "shells": 2,
"volume_mm3": 151815.7900294403,
"tolerance": {
"rel": 1e-05