Fansim
September 20, 2018, 4:31pm
1
I need some help!
I have a LIST with 255 numeric elements like:
List 1:
0 - A
1 - B
2 - C
3 - C
4 - A
5 - A
6 - B
and a LIST where i have this numbers defined with 102 univocal elements like:
List 2:
0 - A
1 - B
2 - C
Now i must compare the two list for obtaining that same values have the same indexes of the second list with a result like:
List 3:
0 - 0
1 - 1
2 - 2
3 - 2
4 - 0
5 - 0
6 - 1
How can i do it with dynamo?
Hi, and Welcome to the forum can you show what you have tried so far?
Fansim
September 20, 2018, 5:50pm
4
Here there is the definition.
Enumerazione per Area_2.dyn (23.4 KB)
GregX
September 21, 2018, 3:51pm
5
Something like this?
I thought I had to play around with list levels (the little arrow next to the inputs) but it worked on the first try
1 Like
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
list1 = IN[0]
list2 = IN[1]
listOut = []
for item in list1:
for i, reference in enumerate(list2):
if item == reference:
listOut.Add(i)
break
OUT = listOut
Just use this python code!