Dictionary with sublists

Hello guys,
I’m struggling with dictionaries and need some help.

Basically I’ve got:
-list of curves endpoints pairs in order
-curves
-curves endpoints
Both curves endpoints and curves are in the same order. Both from Clockwork Element Location node

So I create dictonary:

def create_Dictionary(keys, values):
return { keys[i] : values[i] for i in range(len(keys)) }

But I can’t find values :smiley:

I’m trying to find curves for each point to get the same order of curves as in my list of ordered points.

So the first idea was to use Dictionary from Springs nodes:
keys = curves
values = curves endpoints
search values = my list of points in order (the same points as in value input, but different order)

Unfortunately it doesn’t work, tried pretty much everything with list combine, map etc.
Output look like, without any empty/null indexes (same points):
0
0 some line
0 some line
1
0 some line
0 some line
2
etc…

What am I doing wrong ? :smiley:

I think this is caused because the point values are doubles (or floats) and thus inaccurate. This makes them useless as lookup keys. You could try rounding the values to a certain precision for the keys/values or you could convert the points to string and then use those as lookup keys/values.

Yeah,
already tried that too, but apparently it’s sth else:
forum.dyn (7.9 KB)

hi @Tomasz_Puchala ,
try this :

Thanks, but still doesn’t work

switch keys and values. The key is your string, the value is the curve.

switched, played with lacing, but still not what I need
forum.dyn (19.9 KB)

My bad I might not understand what you’re trying to do :smile:
I thought you wanted to retrieve curves based on their endpoints using a list of ordered endpoint.

:smiley:
Maybe I don’t need dictionary for this. Basically I need to find curve that one endpoint belongs to. Curves are not joined. Dictionary was the first thing that came to my mind.

then maybe this ? :slight_smile:

Still not, I need sublists
image
the same list as attached, but instead of points I need curves.

Nailed it :smiley: Thanks guys for help!