Grouping the list

#1

Hi, everyone

Is there a way to create the list shown below on a standard node or Python script?

We also upload frustrated Python scripts.

Thank you

Home_01.dyn (2.4 KB)

0 Likes

#2

It might be worth going through more than just that solution.

0 Likes

#3

PauLtus san

I saw the thread you introduced.

However, the goal is to create a combination rather than sorting the list.

Therefore, as shown in the figure shown above, I would like to tell you how to generate a list like the one on the right from the given list.

0 Likes

#4

Yes, but with Design Script …

``````a;
b = [Imperative]
{
c = List.Count(a);
d = {};
e = 0;
while (e < c)
{
f = 0;
g = 0;
while (g < c)
{
d[e][0] = a[e];
if (List.LastItem(d[e][f]) == List.FirstItem(a[g+1]))
{
f = f + 1;
d[e][f] = a[g+1];
g = -1;
}
else
{
g = g + 1;
}
}
e = e + 1;
}
return = d;
};``````
3 Likes

#5

Vikram Subbaiah san

Design script worked as expected.
This script can check the route of piping etc.

Thank you very much for helping me.

1 Like

#6

Sorry for misunderstanding your question then.
I’m glad that @Vikram_Subbaiah was able to solve it (consider giving him a like ).

3 Likes

#7

To do so, the script might have to be altered to check equality for objects.
Also, it might work with open loops, but might fail with closed loops.

You might also find the Grouping Curves script I’ve posted here helpful.

2 Likes

#8

PauLtus san

The sort that I taught was also very helpful!

1 Like

#9

Vikram Subbaiah san

GroupCurves design script is also great!
I will use it by all means.

thank you everybody.

1 Like