Points to Lines

Hi everyone,
I get a geometry (rectangle) and would like to connect the edges with each other influenced by a parameter(length). Once all edges can be connected so it will be a rectangle or the lines are not long enouhg so the result will be “indipend edges”.I hope the pictures and files can illustrate the situation better. does anybody could help? Thanks a lot

PointLinie

Point Linie.3dm (167.4 KB)

PointLine.gh (5.2 KB)

PointLine_1.gh (10.7 KB)

Check this out. The 4 corner L shapes is in the last “join” component. Is this what you were looking for?

Somehow yes. Thanks! But when they reach the other line move back again… I was thinking about that they stay and finally creat a rectangle.
I tried a new script, and now it works, but if I offset them i get a double offset in the lift corner. Does anybody know why and how to fix it?

PointLine_2.gh (8.3 KB)