How checking self intersecting open breps

Is there a way to check whether an open brep is self intersecting. My breps usually contain 3-8 flat breps joined together.
Here is an example of five 5 breps:
self.3dm (133.3 KB)

2 of them is self intersecting.

The most obvious approach would be to explode the brep and intersect all faces with each other. This will give you intersections along the face edges as well, so you’d get either 8, 9, or 10 intersection curves based on your current geometry. By subtracting the number of faces (always 8 in your case) you can work out whether there are additional intersections going on. This approach however sounds a bit unreliable to me, as there is no guaranteed intersection along the edges where two faces meet, since after exploding those faces may end up further apart than the intersection tolerance.

A post-process step would be to remove all intersection curves that are coincident with face edges. This is quite a lot harder to achieve.

Another possible approach would be to use meshes, but there is no MeshSelf intersection algorithm in RhinoCommon either…

I think both BrepSelf and MeshSelf intersectors ought to be available in Rhino/Grasshopper, but at the moment they are not.

I attached a Grasshopper C# script which performs the naive intersections mentioned in the first paragraph. It works on your example geometry, but don’t trust it to work in every case.

selfintersectingbreps.gh (20.9 KB)

Thank you David,
I havent tested it thoroughly but is much more reliable what I have used before. :slight_smile: