Orient object to normal of surface at polysurface edge

Hello forum,

I have a problem where I am stuck.
I want to align an instance object onto two surfaces to create a connector for metal plates that form a sculpture in the end. All touching plates have different angles, which would be a helpful script instead of creating all connectors by hand and aligning and positioning them.

I’ve already got a lot of help in this forum and hope someone can point me in the right direction again.

I have a working script where my connector object is oriented at the right positions and adaptable. The object’s plane and the surfaces are aligned, but somehow they seem a little off.
I tried to figure it out, and my guess is that there must be some error in the lists. In the one screenshot is also one object that I oriented in rhino to the normal, so the normal vector should be fine.
I saw that after the cull and the second list item, the duplicates are removed and also somehow the value goes up to 252, while there were only 16 normals and the value for the input of the first list item was 56 with an output list of 56 also. So now I am a bit confused and trying to figure out if the problem lies in my understanding of how those list and data commands work.

If there is a hint in the right direction, I would be thrilled!





orient object to normal of surface at polysurface edge.gh (263.5 KB)