Orient multiple polylines at once

Hi! I need help regarding orienting the geometry on the bottom right to be oriented on the edges of the generated layout

including a GH file would make helping attempts so much easier…

by the way, let’s name:

A shapes = all your destination shapes, which Iassume are all identical
B shape = the one you want to overlap to each of A

first take one A shape (call it A’ ) and overlap it to your B shape to create perfect positioning (like you have on bottom right corner)

then calculate the area of that A’ shape → in particular find its area centroid

at this point you can orient shape B using as Source the area centroid of A’ and as Destination the various area centroids of the A shapes