I think I am not first one who is aking this question here, but any way…
List comparision question.dyn
I have two list containing nested lists. I need to compare first level list between enach other, but in addition each element from first list with whole second list. Expected results wrote in code block highlighted in green.
@Alien thank you, but this method doesn’t work with more 2 lists. Moreover I would like to keep list structure like this.
You could split the lists and do them separately.
So list 1 is only checked against list 1 and list 2 against list 2.
Right, it also depends of number of input lists. Unfortunately, I can’t predict this number so I need some common solution.
You can split using a count…
So count the number of lists… split into that number…
Match each against each.
Hmmm… actually my idea is far easier using a bit of Python.
Do a count… then create a range from 0 to number…
Then use the code block i but feeding in the range…
That should work.
@Vikram_Subbaiah, thanks a lot! It works perfefct.
As you propose I did a python script to handle this issue. Thank you for idea.
# Load the Python Standard and DesignScript Libraries
from Autodesk.DesignScript.Geometry import *
# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
lst_to_plus = IN
lst_to_plus_to = IN
# Place your code below this line
output_lst = 
for i in range(len(lst_to_plus)):
nested_lst_lev_1 = 
for ii in range(len(lst_to_plus[i])):
nested_lst_lev_2 = 
for item in lst_to_plus_to[i]:
nested_lst_lev_2.append(item + lst_to_plus[i][ii])
# Assign your output to the OUT variable.
OUT = output_lst