How to sort surfaces by z coordinates in ghpython

I was just looking up some old code and was reminded of the groupby function from itertools, which is another relevant approach. Here’s an example that demonstrates how to use the same key lambda function (a normal Python function will also work) to first sort then group a list of surfaces by Z:


210618_SortSurfacesByZIntoLists_01.gh (15.2 KB)

I’ll stop now :slight_smile:

3 Likes