Sort breps into separate lists according to stacked groups

I am struggling to sort stacks of breps into separate lists as shown below:

From here I would like to be able to count how many objects in each group if possible.

Thank you in advance, I really don’t know how to start on this question.
240930_grasshopper help.gh (31.3 KB)

You could create boxes around the one’s you want to group:

boxes.gh (45.6 KB)


group+sort_2024Sep30a.gh (45.7 KB)

Count in purple group:


group_sort_2024Sep30b.gh (52.2 KB)

Thank you!!

I thought it would then be simple to figure out the area of the bottom surfaces, but I was wrong. Could you also help with that?

So essentially the floor surface area sorted by building:

Crappy attempt so far:

241002_grasshopper help2.gh (90.6 KB)

Try getting the top or bottom face of each brep, calculate the area and add up for each tower. Right now it looks like you’re calculating area for the entire block rather than just its footprint / floor surface.

The floor plates all level brep node is only the bottom faces - I’m having trouble seperating those surfaces into 3 seperate lists aka: floor area per building rather than total.

Adding to my code above…


floors.gh (49.1 KB)

1 Like

I have no interest in reading, understanding and commenting on a “crappy attempt”.

In this case, area of each building’s footprint is the area of the bottom face of the bounding box:


group_sort_2024Oct2a.gh (54.0 KB)

But perhaps you meant the sum of floor areas for each building?


group_sort_2024Oct2b.gh (56.5 KB)

P.S. I found and fixed an error in version ‘b’ above. It doesn’t affect the result because top and bottom of each stacked brep has the same area but still… it’s wrong. :roll_eyes:

I hastily copied the List Item downstream from BBox and used it downstream from the Sort ‘A’ output, forgetting that the stacked breps are not bounding boxes where face sequence is predictable. So I replaced both with a G-sort cluster that sorts geometry by a Z value (“Returns brep or curve with lowest and highest average vertices point.”).


group_sort_2024Oct2c.gh (62.4 KB)

Version ‘b’ (WRONG):

Version ‘c’ (CORRECT):