Python - Working with arrays



Hi Guys,

I’ve very recently picked up python. I’m trying to create a python code that tells me to distance from a curve to a point.

I think I have done this so far, however it only does it for each index. Forr Example:
0 to 0
1 to 1
2 to 2
When I need to it to tell me the distance for every curve to every start point. For example:
0 to 0
0 to 1
0 to 2
1 to 0
1 to 1
1 to 2

If this was a node I could just change the lacing, however as I’m doing in python it’s not that simple to me.

Python Text Link

The node set-up

Code snip it with output

Thanks for help

Divide curve to distance

like this…

import clr
from Autodesk.DesignScript.Geometry import *

curves = IN[0]
start = IN[1]
end = IN[2]

result = []
for point in start:
    t1 = []
    for geom in curves:
        t1.append(Geometry.DistanceTo(geom, point))

OUT = result


two questions from rather new users for something looking like the same… is this an assignment somehow?


Perfect, thanks for the help! Nah, working on a script at work. No relation I’m afraid :slight_smile:

Python - Dividing line on point of intersection

allright then… It would not be good style if I helped someone doing their homework :slight_smile:


im not doing learning by my self. im discovering dynamo