# 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, 2023 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, 2023 at 8:26
• @retr0: you are right, my solution wasn't right Nov 20, 2023 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}$$