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)


#2

I think this will help you as well:


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


#3

PauLtus san

Thank you for your reply.
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.

The thread you taught was very helpful. Thank you very much.


#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;
};

#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.


#6

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


#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.


#8

PauLtus san

Thank you for your kind reply.
The sort that I taught was also very helpful!


#9

Vikram Subbaiah san

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

thank you everybody.