Random Quad panels order (Lunch box_Random quad panels)


I made random panel on the curved surface by using Random quad panels (Lunchbox).
My goal was to make the order of panel as shown below image.

In the sorting part, I refered HS_Kim’s script:

I am guessing that the data management of Partition list part is wrong but I couldn’t solve this issue.

Here is my script:
Random Quad Panel.gh (20.0 KB)

Could anyone give advise for this issue?
Thanks in advance.

i would do it like this:

  1. extract the rightmost edge
  2. for each randomised quad, find its centroid and the distance to the rightmost edge
  3. sort all panels in the list (maintain tree structure) using the distance as a key.

If it’s not clear, share your script file so i can show you.

Hi Wiley.

Oh. I forgot to upload my script.
I added my script to my initial post.
I did as your advice but I couldn’t solve it.

Random Quad Panel_re.gh (19.1 KB)

You made it too complicated. See the attached GH file.

There are a couple misconceptions about the tree structure in grasshopper after opening your script.

You don’t need to duplicate data here. if a single item and a list is put together in a cell function, the single item will be parsed every time automatically for each item in the list. same goes for tree. Because the item is a constant parameter.

just use the flatten in the script.

I almost never use the tree statistic and for a beginner I don’t recommend using it. Try to understand the tree structure instead.

Good luck scripting!
Random Quad Panel.gh (16.7 KB)

Hi Wiley,

I appreciate your help but The order of panel is not what I want.
Did I miss something?

Hi HS_Kim,

Thanks a lot.
It works very well. I will try to understand the logic of Create set and Member Index part.

I am sorry. I didn’t realize the squads are not arranged into trees according to their Z values.
Random Quad Panel.gh (20.7 KB)

Hi Wiley.

Thanks for your updating.
Yes it is working.
I am going to study your script.