Organize Data Tree by Panels

Hey folks, I wonder if someone could help me out with this task. I’d like to group items in branches following some kind of parametric order


In the image above it shows that the points are contained inside a rectangle (that is just there for visualization). I know that each rectangle has a row of 12 points and a column of 24 points, but as you can see, my data is structred in a way that the list slides through the horizontal line of points, and then skips to the next line above. So my goal was to pack all those points that are contained in these 12x24 grids inside a one branch for every grid

It’s not very clear what it is you want to do. How many panels? What is the exact pattern? Provide an example file, please.

Sure, I’ll explain a bit better, thanks for the reply also.

I’d like to group the points like so:

Each branch containing the points (or in this case circles) that are inside the panels boudary in order to create each panel individually

In the example file you’ll see these points are ordered first in the horizontal, then skipping to the line above, as I mentioned. The amount of panels is parametrized by the amount of isotrims of a surface in the beginning of the script

Mapped Facade.gh (21.7 KB)

The number of panels is variable. Is the number of points in the panels aswell, or always 12 x 24?

Either way, here it is:


Organize Data Tree by Panels.gh (19.9 KB)

fully variable by number of points in a row or column of a panel, and the number of panels in a row or column.

This is a tortured beginner’s attempt. I am sure there are more experienced people on this forum that could do better. However, I have heard that re-establishing data structure from a flattened data tree is never easy, which is why you should never flatten data if you don’t have to. If the number of elements in the rows and columns were static this would be much easier to approach with the Path Mapper. But while the Path Mapper can do expressions, it won’t accept variables. Hence the mess above.

here, where your points are generated initially, they are organized like:
{panel_number ; column_number} (point_number)

for instance if I retrieve the points in {panel zero; column zero} we get these:

so this also tells us that columns of points are sorted left to right in a given panel, and points in each column are sorted top to bottom

what you want to do is to first flip matrix but just inside each panel (maintaining the first branching) then trim tree in such a way to delete the division by rows

after flip matrix, points are organized by horizontal rows instead of columns (here is the Path Mapper Bible Path Mapper Help - Grasshopper )

trim tree removes the outmost branch, so points now are not branched into rows anymore but just by panel (in particular, points go left to right from the top row, then move to the next lower row)

[edit] forgot to attach the file!
Mapped Facade_Re.gh (27.7 KB)

1 Like

Cheer Volker and inno, I appreciate the reply and the help. Inno’s solution seems to work better for my existent script and goal.

I’m trying to solve this for after the points were distributed in the way the final script shows, first the entire bottom most row skipping to the next one above and so on, that is because I intend to use image sampler fo turn these points into circles of different radius

And the image sampler gives the colour information in that fashion

How can I adapt your solution to this situation?

Edit:

Using parition list with the size of 12 I get a structure similar to the initial one, but in the horizontal instead of vertical

And the branches are ordered in each panel with intervals of 40, but from here I wouldn’t know how to continue

:roll_eyes: If only I had had the plugin to be able to see all original data structure… The generalization was so much work.

@duckythatlikesturtle

You basically have everything you need right in front of you. The script I gave you takes the data structure of the image sampler and puts it into panel heirarchy. One of the two groups “Panels by Column, then Row” or “Panels by Column” will match the changes inno made to the data structure of your “Surface Domain Chord Distance” component so that they are compatible to each other. Or inno has a more direct solution, which I’m sure he has.

1 Like

Can you output and internalize the data from the “Surface Domain Chord Distance” in a geo container so I can see what’s happening?

Sure thing, I grouped with a red color so you can find it easily
Mapped Facade - Geometry Container.gh (1.0 MB)

well… if you are using the standard Image Sampler, that component will just output data with the very same tree-structure you fed its input with

if that is the case, I would not bother in matching a particular color data structure by changing the way points are organized, but I would just map the points to the original whole area like the following (Domain [0, 1] on the reparametrized Surface) and get the color output with matching data structure (or use brightness output as a function of circle diameter)

Mapped Facade_Re_Obama_Eyes.gh (255.7 KB)

1 Like

That worked out almost perfectly, thanks. The only problem is that something with the remapping numbers is messing up the image, you have any idea what it could be?
Mapped Facade_Re_Obama_Eyes.gh (250.4 KB)

Uploading: image.png…

you need to flatten the input of Bound component, because you want to find the overall Brightness range, not the range of each single different panel

didn’t upload a file because it’s just a right click → Flatten on the Bounds Numbers input

1 Like

yep, that did it, appreciate the help

1 Like