I’m working on a script that would turn a branching tree structure into a bundle of tubes. The first thing I do is analyze the network to find out how many tubes are at each node (assuming a branch continues from the base all the way to the top).

After this, I have a little python code that creates a polygon with fixed edge lengths that would be the diameter of the tube. The midpoints of these polygons edges would be the new location of the tube centers.

Finally, I have a python script that runs through each route and replaces its original node with one of the points from the polygon. This makes it so I have perfectly packed tubes at the nodes.

The problem is the ordering of how the points on the polygon are picked. I essentially want to find a way to pick points on the polygon in an order that avoids tubes intersecting with each other.

I tried a method that used a rough closest point search from the previous node to the current node. That seems like a step in the right direction but creates other messier problems at the same time.

Anyways, most of what I’m doing is in the python nodes. File is attached. If anyone has any ideas on how this could happen logically that would be great.

Wire_Bundling_WIP.gh (20.1 KB)