Hello Friend
I wan to calculate distance 0 index list from other 0 index and 1 index list from other 1 index list. I dont need and want distance 0 index list from 1 index list. How can I do that? (Better say that how only find distance two corresponding element)
Hi @f.saeedian i guees you have better luck if you get rid of these sublist in list.chop…
Hi Mr @sovitek Its better I say how can I only act on corrospedning element. 0 by 0 and 1 by 1
1 Like
yeah try play around with list level and lacing…maybe…but still think itd better without sublist
as Sovitek said, lots of playing around with levels and lacing, but for a larger data a simple python code is much easier. (Thanks to this problem I had a chance to dive a bit more into how list levels and lacing generates different outputs)
# Initialize the output list
distances = []
# Loop through corresponding sublists in both lists
for sublist1, sublist2 in zip(IN[0], IN[1]):
# Calculate distances between all points in the sublists
sublist_distances = [[p1.DistanceTo(p2) for p2 in sublist2] for p1 in sublist1]
distances.append(sublist_distances)
# Output the distances
OUT = distances
Not all combinations of list structures are valid for a given node, even with list levels or lacing. In fact, most combinations with more than one degree difference from the node’s intended list structure become non-trivial.
Look into replication guides for DesignScript. They can offer a lot more control in those situations.
1 Like