Hi, you can see in my script that I defined the closest point from one starting point to all other points that are in the grid.
Now I want to use the Closest Point again and search for the closest point … and again the result…
How to define this searching in a for loop? I am tried it for hours
Thanks a lot for your help!
Maybe this one is better:
poolunused = sum_attractors[:]
closestattractor = 
dist = 9999999
for n in poolunused:
ee = rs.Distance(start_point, n)
if ee <= dist:
dist = rs.Distance(start_point, n)
closestattractor = n
I also noticed the adventage of this code. Regarding to scripting efficiency I would say that python also has adventages that C# does not have. But I think this belongs to the never ending prefered language discussion. Thank you again for your time, hopefully @Dancergraham can help me now?
something like this might work, (first draft, might not be right). One advantage that C# has over Python, is the incrementer i++, that can be put right in the initialization of the loop. Python, (I don’t think…), has an equivalent ability, so you have to do it “manually”.
while len(pts) > 0:
counter = 0
for pt in pts:
if counter == 0: StartPt = StartPt
else: StartPt = a[len(a)-1]
ClosestPt = Rhino.Collections.Point3dList.ClosestIndexInList(pts, StartPt)