The enclosed file and python script demonstrates the problem. Join_Error.py (1.8 KB) join_error.3dm (46.0 KB)
The file contains a single brep and a curve that lies on the brep.
The script explodes the brep into two subobjects (brep0 and brep1) and then splits one of them using the red curve. This creates two objects (split0 and split1)
Split1 is then joined to Brep1 and at that point the bug can be seen.
Load the file and run the script to see.
In this version the script it produces the result directly without forcing the user to acknowledge each step. Also, in this version the join tolerance is set to model_tolerance*0.001 (extremely tight).
The geometry supplied is the same surfaces as before but this version surfaces are not joined. The edges between the surfaces are well within model tolerance but above the join tolerance of the script. When you run the script nothing is joined and only the unjoined Brep is returned. That is what is supposed to happen.
Now if you undo the previous result and join the two surfaces and run the script again it will work as before. It will explode the joined breps into two and one of the breps will be split and one of the splits will be joined. This time the join will work, but the edges of the split surface are still FUBAR.
Here’s a little more info that may help in figuring out what is happening.
I tried the scripts in Rhino6 and Rhino5. Rhino6 behaves the same as Rhino8.
In Rhino5 everything works correctly the surface joins without turning the edges inside-out. So it seems this bug was introduced in Rhino6.
Also, I should mention that in the actual code where I do this, both of the original BrepFaces (brep0 and brep1) are split and then the Brep.Join is used on one side of the splitting curve to join the faces that have edges of the same length. I only stumbled on this bug by accident when one of the faces fails to split.
In other words, the bug only happens when the edges of the two breps being joined are different lengths.
When the edges being joined are different lengths the join never messes up the edges of the Brep being joined its always the otherBrep that gets its edges garbled, but that only happens sometimes.