# GN: Index of nearest node - Ignore Self position

I'm trying to build a hanging wires.

I have a bunch of planes.
I convert faces of these planes into points and then I want to connect closest points to each other with a curve line.

The issue is, that in some cases it makes second wire where it already exists.
As far as I understand the issues is in the Index of Nearest Node and in the way i sample indexies position.
I basically need to tell geometry nodes to ignore the plane, if there is already a wire connected to this plane, but so far have no idea how to make it.

UPD:
To make my question more clear to understand, I made this. There are 4 planes, dinstance between each plane is 10 meters. Now, when I try to create cables, between these planes, I get a double wire in one place, and missing wire in another. I basically need the 4th cable go where the blue line on the screenshot is. • The first problem here is that your GN object is inside of a collection that it references. This creates a loop: the collection depends on GN which depends on the collection which depends on the GN etc. Without understanding yet your complete node structure, moving your GN object to "Lamp" collection solves the problem in the file you've provided. Nov 19 at 21:57
• Hi @Nathan! Thank you for your reply! The solution you are talking about in your comment didn't really solve my issue =( I added a little update to my post to make the problem i have more clear to understand. Nov 20 at 8:26
• @retr0: you are right, my solution wasn't right Nov 20 at 14:42

To connect a point to all other points with a maximum distance you can use the following algorithm:

Update: faster method:

1. Create a line for every point.
2. for every point, duplicate the lines created, now every point has a group of lines.
3. for every line:
1. if its index in group is less than or equal ($$\le$$) its group index:
1. delete the line.
2. else:
1. set its start point position to the point of index equal to the line's group index.
2. set its end point position to the point of index equal to the line's index in group.
3. if the line length is greater than the max distance:
1. delete it.  Older Method:

1. For every point serially:
1. Remove it from the list.
2. For all points in the list:
1. if the distance to the removed point is $$\le$$ the maximum distance:
1. Create a line between the removed point and the current point.     $$\small\text{Blender 4.0}$$

You can also define a minimum distance by adding an extra distance check: • hey! thank you for your suggestion! Unfortunately I need to keem them as planes, cuz i use these planes for some other options of my node setup (i attached only problematic part of the geo node tree to this post). Nov 20 at 14:47
• @retr0 I edited my answer, but the new method has a high performance cost. Nov 20 at 21:05
• thank you for the update! I tried it and it works, but the problem is still here. If i put 4 planes in a square there is still 1 cable missing =( gyazo.com/276bfacf0d6c2addfc4fc5be8452fa28 Nov 21 at 7:53
• maybe there is an option to use raycast node with limited ray lenght? So it connects a wire to any face which ray hits? I tried to make such setup but no success Nov 21 at 8:10
• @retr0 so what you want is to a plane to connect to all planes that are far away by a maximum of 10 meters? Nov 21 at 12:35