Skip to content

Split Body: a mesh-converted solid with sub-micrometre sliver facets splits into an open result (fine at 10x scale) #18501

Open

Description

@Mqrius

What happened

Splitting a mesh-converted solid at a plane fails when the mesh has sliver facets a few tenths of a micrometre across, as decimated meshes often do. The converted body passes SMLib's full check (--validation each_step), so it's the split that breaks.

The script below writes a 44-triangle closed mesh (a 0.04 × 1.8 × 0.05 mm piece of a knurled knob's decimated mesh; vertex rows 0.4 to 0.6 µm apart in z):

result
mesh.convert, then solid.split_body at XZ SMLib's result is not a closed solid
the same mesh scaled 10× or 100× splits into two closed bodies

On the whole knob (2,000 triangles, edges down to 1.3 µm), the split is refused for "partially Coincident Edges" and "Bad Loop Orient" at every plane tried (XZ, YZ, XY at z −5, y 0.37). A tilted plane through its middle even reports "the tool does not split the body". Infinity Cubes' converted mesh gives the same "Bad Loop Orient" in a cut.

Expected

Two closed halves, as at 10× scale.

Steps to reproduce

python sliver.py, then solidcraft-cli run sliver.json next to it (main 96280b89a, 0.43.0, Windows):

# sliver.py: writes sliver.stl (44 triangles, a 0.04 x 1.8 x 0.05 mm piece of a decimated mesh)
import struct
V = [
    (-8.9375, 0.049745112657547, -9.122843742370605),
    (-8.9375, 0.09773678332567215, -9.120742797851562),
    (-8.9375, -0.07496185600757599, -9.122835159301758),
    (-8.9375, 0.8698979616165161, -9.078125),
    (-8.9375, -0.8951396346092224, -9.078125),
    (-8.9375, -0.12295322865247726, -9.120742797851562),
    (-8.9375, -0.7918225526809692, -9.091606140136719),
    (-8.9375, -0.04001481086015701, -9.124358177185059),
    (-8.9375, -0.02530142292380333, -9.125),
    (-8.9375, 0.00016491214046254754, -9.125),
    (-8.9375, 0.014793939888477325, -9.124366760253906),
    (-8.9375, 0.7665904760360718, -9.091606140136719),
    (-8.98046875, 0.08163239061832428, -9.078516960144043),
    (-8.98046875, 0.03221558779478073, -9.080679893493652),
    (-8.98046875, -0.04084471985697746, -9.08139419555664),
    (-8.98046875, -0.05743195489048958, -9.080671310424805),
    (-8.98046875, -0.012612542137503624, -9.082625389099121),
    (-8.98046875, 0.015624254010617733, -9.081402778625488),
    (-8.98046875, -0.10684844851493835, -9.078516960144043),
    (-8.98046875, -0.11584273725748062, -9.078125),
    (-8.98046875, 0.09062646329402924, -9.078125),
    (-8.950942993164062, -0.7929981350898743, -9.078125),
    (-8.950942993164062, 0.7677659392356873, -9.078125),
    (-8.938054084777832, -0.012612675316631794, -9.125)]
F = [(0,1,2), (3,4,5), (6,5,4), (3,5,1), (5,2,1), (2,7,0), (8,9,7), (9,10,7), (10,0,7), (1,11,3), (1,0,12), (13,12,0), (14,15,13), (16,14,17), (15,18,12), (18,19,20), (20,12,18), (12,13,15), (13,17,14), (0,10,13), (17,13,10), (21,6,4), (20,3,22), (19,3,20), (3,19,4), (21,4,19), (21,5,6), (19,5,21), (18,5,19), (18,2,5), (15,2,18), (15,7,2), (14,7,15), (16,9,23), (17,9,16), (10,9,17), (9,8,23), (23,8,16), (7,14,8), (14,16,8), (11,1,22), (12,20,1), (20,22,1), (22,3,11)]
with open("sliver.stl", "wb") as f:
    f.write(b"\0" * 80 + struct.pack("<I", len(F)))
    for t in F:
        f.write(struct.pack("<3f", 0, 0, 0) + b"".join(struct.pack("<3f", *V[i]) for i in t) + b"\0\0")
{"commands": [
 {"command": "file.insert_mesh", "params": {"path": "sliver.stl"}},
 {"command": "mesh.convert", "params": {"body": "sliver"}},
 {"command": "solid.split_body", "params": {"body": "sliver", "plane": "XZ"}}
]}
error: step 3 (solid.split_body): SMLib boolean: operation: SMLib's result is not a closed solid

0.40.0-rc.3 refuses this mesh at mesh.convert (not a constant-section prism), so I couldn't compare.

Related: #18259 (there the converted body already fails the check; here it passes, and the boolean breaks), #18211 (split time on converted meshes).

🤖 Generated with Claude Code

Activity

  1. added
    needs-triage
    on Nov 17, 2026
  2. Mqrius commented on Nov 17, 2026

    @Mqrius
    ContributorAuthor

    A second case from another decimated mesh, in a boolean this time: a tube (r 2.25 to 7.5) joined to a mesh-converted spline shaft whose faceted wall has a vertex exactly on the tube's r 7.5 cylinder. The full shaft gives "no radial edge use classifies the face's edge use"; after an STL round trip, the error below. Cropped to a 0.01 mm piece (22 triangles, mesh vertices 0.7 µm apart near the one on the cylinder), it still fails:

    error: step 7 (solid.extrude): SMLib boolean: operation: solidcore: SmApiBoolean: boolean::topology_intersector::p1::relate: relating the operands' entities failed: the edge from (-5.30330423647902, -5.303297648896365, 20.9873046875) to (-5.30330423647902, -5.303297648896365, 21.000001907348633) of the B-rep is related to the edge from (-5.30330423647902, -5.303297648896365, 20.9873046875) to (-5.303306083650462, -5.303295634142599, 20.999860051319768) and was asked for the edge from (-5.303306083650462, -5.303295634142599, 20.999860051319768) to (-5.30330423647902, -5.303297648896365, 21.000001907348633): another entity is already related to the other one
    

    So it relates the piece's edge on the cylinder to an intersection edge about 2e-6 mm from it, split once more at z 20.99986. The piece is closed and measures 1.169e-6 mm³ on its own, and the tube builds as a new body (5949.98 mm³). A plain box with the same corners joins the tube fine; so do converted prisms inscribed in r 7.5 (they convert to a true cylinder).

    python piece.py, then solidcraft-cli run piece.json (main 96280b89a):

    # piece.py: writes piece.stl (22 triangles, a 0.01 mm piece of a decimated mesh whose edge lies on r 7.5)
    import struct
    V = [
        (-5.303300857543945, -5.3033013343811035, 21.000001907348633),
        (-5.303768634796143, -5.302791118621826, 20.9873046875),
        (-5.303300857543945, -5.3033013343811035, 20.9873046875),
        (-5.306640625, -5.299656391143799, 20.9873046875),
        (-5.306640625, -5.299656391143799, 21.000001907348633),
        (-5.306640625, -5.2958984375, 20.9873046875),
        (-5.306640625, -5.2958984375, 21.000001907348633),
        (-5.2958984375, -5.2958984375, 20.9873046875),
        (-5.2958984375, -5.306640625, 20.9873046875),
        (-5.299656867980957, -5.306640625, 20.9873046875),
        (-5.299656867980957, -5.306640625, 21.000001907348633),
        (-5.2958984375, -5.306640625, 21.000001907348633),
        (-5.2958984375, -5.2958984375, 21.000001907348633)]
    F = [(0,1,2), (3,1,4), (0,4,1), (3,4,5), (6,5,4), (5,1,3), (7,1,5), (1,7,2), (8,9,7), (9,2,7), (10,9,11), (8,11,9), (8,12,11), (7,12,8), (7,6,12), (5,6,7), (11,12,10), (6,4,12), (4,0,12), (0,10,12), (10,2,9), (0,2,10)]
    with open("piece.stl", "wb") as f:
        f.write(b"\0" * 80 + struct.pack("<I", len(F)))
        for t in F:
            f.write(struct.pack("<3f", 0, 0, 0) + b"".join(struct.pack("<3f", *V[i]) for i in t) + b"\0\0")
    {"commands": [
     {"command": "file.insert_mesh", "params": {"path": "piece.stl"}},
     {"command": "mesh.convert", "params": {"body": "piece"}},
     {"command": "sketch.create", "params": {"plane": "XY", "name": "Tube"}},
     {"command": "sketch.circle.center", "params": {"center": [0, 0], "radius": 7.5}},
     {"command": "sketch.circle.center", "params": {"center": [0, 0], "radius": 2.25}},
     {"command": "sketch.finish", "params": {}},
     {"command": "solid.extrude", "params": {"sketch": "Tube", "profiles": [0], "operation": "join", "targets": ["piece"], "distance": "37 mm", "direction": "positive"}}
    ]}

    🤖 Generated with Claude Code

  3. dudedagger42 commented on Nov 17, 2026

    @dudedagger42
    Collaborator

    Triage by dudedagger42: Reproduced on 0.41.0: your sliver.py mesh converts, then solid.split_body at XZ stops with "SMLib's result is not a closed solid". rc: 1. The same mesh scaled 10x splits into a body on 0.41.0. rc.3 and 0.30.1 refuse earlier, at mesh.convert ("not a supported constant-section prism"), at both scales.
    Boundary: the 10x scale splits.
    Root cause (unknown): I did not read the split code; the failing step is kernel work (Solidcore).

  4. MarkusReichart commented on Nov 19, 2026

    @MarkusReichart
    Contributor

    Triage: the split fails because the XZ plane crosses two sliver triangles near one vertex along cut segments shorter than the kernel's zone tolerance (1e-5 mm). It depends on where the plane passes that vertex, not on the scale as such.

    Measured with solidcraft-cli run (release build of main at 78d06f4), using sliver.stl:

    • The mesh.convert tolerance makes no difference: 0.00005 to 0.5 mm all refuse at 1x and all split at 10x.
    • With the plane at {"origin": [0, c, 0], "normal": [0, 1, 0]}, c = 0, 1e-5 and 1e-4 are refused. c = 2e-4 to 0.3 and -0.001 to -0.5 (11 values) split into two closed bodies.
    • Vertex 9 is 1.65e-4 above y = 0. Triangles 6 (8, 9, 7) and 36 (9, 8, 23) meet there at 0.92° and 2.48°. Their sides stay within 1e-5 of each other out to 6.3e-4 and 2.3e-4 mm from the vertex.
    • The cut lengths in those two triangles:
    plane triangle 6 triangle 36 split
    y = 0 2.6e-6 7.2e-6 refused
    y = 1e-4 1.0e-6 2.8e-6 refused
    y = -0.001 1.9e-5 5.1e-5 2 bodies
    y = 0 at 10x 2.6e-5 7.1e-5 2 bodies
    y = 0.001 at 10x 1.0e-5 2.8e-5 2 bodies

    For c of 2e-4 and up, the plane passes above vertex 9 and the shortest cut is 1.4e-4.

    Every refused plane leaves a cut of 7.2e-6 or less, and every plane that splits leaves 1.0e-5 or more. That bracket fits ZONE_TOL_3D = 1e-5 (solidcore/crates/solidcore/src/geom/tol.rs:200).

    Read only, not run: the absolute COPLANAR = 1e-7 in crates/kernel/src/mesh_convert.rs:23 fuses triangles 19+20 and 31+32 at 1x only, which explains 24 against 26 kernel faces. The y = 0 plane crosses none of those four triangles. The fix could go in three places:

    • the boolean makes the two crossings one vertex (the capture-distance paragraph near line 489 of solidcore/docs/booleans.md shows this is a deliberate choice);
    • mesh.convert grows the vertex's tolerance;
    • mesh.convert refuses such slivers with a reason.

    Not run: the C++ reference, and 476a0e6, which adds #19498 and #19590 in the kernel.

    The second case in the thread (the piece joined to the tube) builds on 78d06f4: one closed body, 5949.98 mm³. That is right, because the piece lies at most 3.4e-7 mm outside r 7.5.

    Not claiming. We'd take it once the place for the fix is settled.

    Written with Claude Code (AI) on behalf of @MarkusReichart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions