Closest point from long list to a point in a shorter list

Hmm, without seeing the internal of the custom node (perhaps there is an issue with reading the correct index within) I can only offer another option.
Give this a try :wink:

# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# Inputs
short_list = IN[0]
long_list = IN[1]

# Output list
result = []

# Loop check for each point in the short list
for s in short_list:	
	# List for distances
	dist = []
	for l in long_list:
		# Distance to point s
		d = Geometry.DistanceTo(s,l)
		dist.append(d)
	# Lowest distance in list		
	min_d = min(dist)
	# Index of lowest distance in list
	min_ind = dist.index(min_d)
	# Get the closest point from the long_list
	closest_p = long_list[min_ind]
	# Add the point to the results, as it is the closest to the point from the short list
	result.append(closest_p)

# Output the results
OUT = result
3 Likes