Sort and group Breps by height

Hello wonderful people of this forum

I have a collection of panels (closed polysurfaces) which need to be sorted and grouped into rows. Because each panel is the same height per row, I thought to take the centroid and list the Z-coordinates… and then got stuck :frowning:

Specifically, I’m not sure what to do with the list, and how to use it to group each row of panel geometries.

The end goal of this project is to take these rows and apply a formula which varies the colour/material of panels in a defined pattern. If a previously posted topic is similar, please point me in that direction and I will go do my homework. For now, I am asking for help with this grouping issue.

panel_Z_group.gh (13.2 MB)

As always, your time is appreciated! Thank you!


panel_Z_group_2025Jan14a.gh (13.6 MB)

1 Like

Amazing, thank you Joseph
I found some previous posts where you explained the color cluster, very neat!

Is there a way to manipulate the color for the panels in each row based on a pattern? For example, if a row is predominately blue, I could set a “weight” of 60% blue, so the final row may look like [blue, blue, pink, green, blue]. If you could please point me in the direction of what components may be useful I’ll go do some learning :smile:

Attention.
Grouping using Z as a parameter is not a good idea.
Thirty groups seems too many to me.

There are several issues with the solution I posted. The blocks are not grouped by “wall” (6) and not sorted by row.

I don’t believe that is true? For example, this image shows a small “panel” (block?) at the top that affects the height and grouping of blocks into rows:

And all the geometry is far from the origin - why?

Great catch, this was a revit export - I’ll have to go in and manually fix the issues. I’ll do some digging to see if there’s a better solution for this

Correct. Looks like most of the problem is solved by rounding the Z value, which results in 16 groups instead of 43:


panel_Z_group_2025Jan14b.gh (13.6 MB)

Without rounding:

The problem also remains with rounding.

Ah, so… GIGO :bangbang: (garbage in, garbage out)
I was measuring the height of the boxes (DeVec, deconstruct vector) instead of the Z value of the centroids. :thinking:


panel_Z_group_2025Jan14c.gh (13.6 MB)

The problem (or geometry) looks poorly defined.

P.S. I know this is still wrong.

It is better to use the corner box and to group the Z divide by a thousand. (I don’t understand why they are so large)
panel z1.gh (13.6 MB)