Matching indices between Lists and Sublists

Hey everyone! I know, another flare getting shot into the sky asking for help with list management - my apologies inadvance, but I am really struggling with the logic of this one. Screenshot function in Dynamo 2.16 seems to be busted (unless I’m missing something) so I’ll do my best to explain in text what I have and what I’m trying to do.

I have 5 primary lists of points. Each of these lists has 5 sublists. Each sublist represents a unique arc of points. So, each primary list has a collection of 5 sublists representing points along different arcs.

I have 5 primary lists because for each arc, those points have been mirrored/translated in order to form a collection of points around each arc. Now I want to be able to group the same index from each sublist in each primary list to get to a collection of 5 points that I can create a polyline from. I’m hoping the sample image below helps illustrate the ask. TIA.

Hello, you can export your image via the menu bar (export cf. image sorry for the non-English language)

About your problem
1/ List Flatten
2/ List chop of 5
3/ Transpose
4/ Polycurve Bypoints

cordially
christian.stan

Hi @amurrayCD ,

Use List.Combine using List.Join as combinator, just make sure you have 5 inputs on the Combine node and on the List.Join node aswel.

@christian.stan Thank you for the suggestion! The export image button in the top-right was getting me nowhere. Attached is the proof of concept I have working if I focus on grabbing just a single index each time.

I attempted the flatten/chop/transpose but am not getting the right groupings of 5 points by the end.

Using List.Combine with Join as the combinator from my original list of lists? Using those as the inputs I still get 5 lists of 475 points each.

I’ll try to dig tomorrow afternoon, sorry
edit
maybe like this… M @amurrayCD

cordially
christian.stan

1 Like

Thank you for the suggestion. I’m really trying here so sorry if I’m just missing something really simple, but my data structure is not following what you’re showing. Between my List.Chop and List.Transpose (even matching levels) does not seem to be working the same way.

try:
test.dyn (32.6 KB)

update:
added case with using alphashapes from Crumple package. The permutations won’t be fast for large data sets.

1 Like

Thank you for the test script. I think where our approaches differ is at your Geometry.Translate node. In my case, the original points that are being translated are not yet in the groups that need to be connected by a polycurve. So in your example, if you were to take your points and translate them UP instead of around in a square to begin with, that is the original list I’m dealing with. In your list structure I think that would look something like {0[0], 1[0], 2[0], 3[0], etc.}.

Below is a proof of concept that I was able to get working on a single arc of points. My issue is obviously trying to figure out how to either loop this node structure through every index of points or be able to solve the original list structure to simply provide the groups of 5 points in the appropriate list structure for all arcs.


So, prepare sample Dynamo file (like i did) with points and initial lists levels. We’ll try to help.

Ok the lightbulb finally went off! I revisted @Daan 's suggestion using List.Combine, but originally it was not providing the right data structure. However, instead of using List.Join as the combinator, I swapped that out for List.Create, in order to get the levels I needed to work with. Using that List.Combine I could go from 5 lists of 95 points each to 5 lists of 5 sublists each with 95 points. Seeing this structure I immediately knew I could now perform a List.Transpose at Level 3 to get 5 lists of 95 sublists of 5 points each!

Only hurdle left is figuring out why I can’t plug that into my polycurve node :sweat_smile:

Ok, and polycurve issue has been resolved. Thank you all so much for pitching in on this. Below is the section of the graph that works for me now!

1 Like