Iterative test for collisions in pipes until zero

Hi All,
Collision test sample.gh (8.0 KB)

I have what I think is a relatively simple query.
Basically, I have a faceted structure with many struts connecting at nodes, in different quantities. What I’m trying to achieve are zero collisions in the strut geometry (pipe) by incrementally pulling the end points back from both ends of the strut curve (independently, as the amount needed to pull back may be different on either end of the curve) … I’m including a sample scripts with a simplified geometry to test / explain

Collision test sample edited v0.gh (18.4 KB)
Here shows two methods.
With the second one, you can control the actual distances.

Quan,
Thanks so much for your reply. I unfortunately wasn’t so clear, apologies… I need a way to offset or shrink the ends of each curve individually / by different lengths … in the final the struts with be many different lengths… and I need them each to be the longest possible without having a collision…