Well … I have a C# that does(*) that kind of stuff (working on a single BrepFace [i.e. a Surface + trim info]) but is 100% code and thus more or less useless to you. Bored to death (I don’t like waffles) I never added some other Methods required in order to work with collections of BrepFaces l(that’s not very simple, mind)
But if nobody else can point to some doable solution (must be, search the old GH Forum) maybe I’ll post the def here.
(*) That said …er … occasionally some boolean ops fail without any apparent reason (maybe a Rhino bug, maybe Karma maybe both - who cares?).
In real life and for some cases (NOT the one that you posted) you’ll need torsion free segments/beams (for obvious reasons) and one potential solution for that is post processing the solution via Kangaroo2 (also done solely via code).