# Re-Order Lists Structure To The Original List Order

Hi everyone,

I have an original 4 groups of surfaces, and each group has been divided into two sets(The first two levels from the bottom as the first set, and the upper levels as the second set) each set of surfaces has been divided according to specific patterns and sizes.

After dividing the two sets, I need to merge them again into one list to perform extra operations on them. But due to dividing each set of surfaces separately using different patterns, the merged two sets’ list order for each group has ended up different from the original order, which is structured as follows: Starts with the first level, 4 edges, then next it moves to the upper level…etc.
Original Order:
{0;0}
{0;1}
{0;2}
{0;3}
{0;4}
{1;0}
{1;1}

When grafted:
{0;0;0}
{0;0;1}
{0;0;2}
{0;0;3}
{0;1;0}
{0;1;1}

The resulting merged list follows a different pattern like the following: First set, first-level edge, next level belongs to the same edge, next side…etc. Then it moves to the second set, repeating the same sequence.

Merged Order:
{0;0;0;0}
{0;0;0;1}
{0;0;1;0}
{0;0;1;1}
{0;0;2;0}
{0;0;2;1}
{0;0;3;0}
{0;0;3;1}
{0;1;0;0}
{0;1;0;1}
{0;1;1;0}
{0;1;1;1}

I am looking for a way to rearrange the final merged list for all groups to align with the original order: starting with the first level, followed by the four edges, then progressing to the upper levels, and so on.

I’m curious if anyone has a solution for this. I did attempt to solve it using the path mapper and unflatten components, but I couldn’t quite achieve the desired outcome.

I hope I have clarified the problem and is not that complicated.
Please refer to the attached GH file to find the related lists.

Thank you in advance for any assistance.
RE-ORDER LIST.gh (246.7 KB)

@HS_Kim Hi Kim, I’m wondering if you have any idea or suggestion to solve this issue?
Thank you very much in advance!

had problems with elefront so i created a comparable data structure my self maybe this helps you
also i am curious about a more elegant way to solve this

RE-ORDER LIST.gh (248.0 KB)

1 Like

Your first set of surfaces have been trimmed to produce the second set so they share the same uv coordinates. This can be used to match them back to the original surfaces.

I think this gives the result you’re after.

About half the code is just for visualization.

RE-ORDER LIST_kr.gh (251.3 KB)

-Kevin

2 Likes

@Pejo I greatly appreciate you sharing this solution with me; it’s indeed effective when it comes to merging different lists and re-structuring their paths into a unified sequence. However, what Kevin has provided aligns perfectly with what I’m seeking, the ability to re-structure the paths in accordance with the original surfaces’ order.

2 Likes

@kevin Thank you so much for sharing this solution; it’s exactly what I’m looking for, to reorganize the surfaces in alignment with their original sequence.

1 Like