Sort and array geometry by multiple parameters

Hello,

I’m attempting to sort and array data into a 2D matrix. Essentially I have a set of rooms that I would like to organize by two categories within a grid. I’m using the “Arrange” component from FabTools to arrange the geometry , however I’m having difficulty preserving the relationship between the data and its desired location.
In short, I am attempting to replicate something similar to the LMNts script that once upon a time could be downloaded from their page (see image).

Thanks in advance

So first of all, it will be easy if you have your groups in different branches {A;B}
-> {Shared; Admin} or {Library; Public} and so on. Or more manually, for example if you dispatched or culled them somehow. As this is done, you can move them easily on a grid on the target coordinate.
But if you upload your file, it will be more easily to help you :slight_smile:

The issue I’m having is that after having the groups in two different branches, I’m unable to then arrange them within the corresponding grid cell. I’ve managed to get them to sort for one of the branches, but want to do a two dimensional sort. I managed to retrieve a version of the LMNts script, but it does a single sort. See attached files.

TEST.zip (7.5 KB)
graphic program.gh (84.0 KB)

Well … I can provide some hints on that (In fact I have something that does that but it’s done using solely C#).

Assume that you have a collection of spaces (shown all equal for clarity and also shown in a random state of (user controlled) density):

Assume that you have 2 goups (or more) of classifications applied for each space. These can being viewed as rows/columns in a matrix like the image of yours.

Assume that you assign to each space a row and a column meaning that a given space belongs to a x class from the classes in the rows and also belongs to a y class in the columns. Then you can create a classification ttree where the first item is the N of row and the second the N of column. As a matrix this has as follows (where each matrix item represends how many spaces have this row and that column assigned):

Asume that you find the max item in the matrix and then calculate a “container” as square as possible. Assume that you create these “containers’” as a collection of empty “pockets”.Then the only thing remaining is to populate the pockets :

See another combo with different matrix size:

1 Like

Not as close to your first picture, because it the grid is always the same, neither depending on amount or size of the single rooms. So it’s for every “Group the same” But hey, it’s something :see_no_evil:

from left to right, from top to bottom - not much to adjust, but can easily changed

graphicprogramm1

graphic_programm_re.gh (31.1 KB)