JoinBreps edge gaps

I’m having some trouble emulating the _Join command with Rhino Common. I have 3 surfaces, that intersect on common edge curves and I want to join them to make a uniform brep. If I use the Rhino GUI and click on Join in the surface block, select the 3 surfaces, things work fine. The new brep is smooth and connected along the edges.

However, when I try to replicate this functionality with the SDK, I still get gaps between the surface edges after the joinBreps command succeeds. I’ve attached a few graphics below to illustrate what I’m seeing.

breps = [rs.coercebrep(id, True) for id in surfaceIds]
joinedbreps = rg.Brep.JoinBreps(breps, 0.01)
for brep in breps: _guid = sc.doc.Objects.AddBrep(brep)
rs.DeleteObjects(surfaceIds)

Any help is appreciated!

Original Surfaces

Original Surfaces Rendered

Join command from Rhino GUI

Scripted JoinBreps command from rhinocommon

Scripted JoinBreps command from rhinocommon, rendered

JoinBreps may give you partially joined result where naked edges still remain. If you’re making a solid (are you?) I suppose you could test if any naked edges remain, and if not, use a looser tolerance when joining.

I am trying to make a solid. I played around with the tolerance parameter a bit and didn’t see any difference. The thickness of the layers is about 2mm, and I tried varying the tolerance from 0.01mm to 5mm and got the same result shown above. Am I using the correct strategy to try to create a solid?

How would I test for naked edges and what can I do about them?
What is the Rhino Join command doing behind the scenes?

Just to follow up in case anyone runs into the same problem, I solved the problem by replacing the thin edge surface generation with Brep.CreateFromSweep instead of a Brep.CreateFromLoft. Then I was able to adjust the tolerance in JoinBreps until the NakedEdges stopped showing up. (which required an order of magnitude increase from the default ModelAbsoluteTolerance). I also played around with Breps.JoinNakedEdges, but ended up not needed it.

Can you post your geometry?