I have just started using ghpython as there are some things that I could not solve in grasshopper itself. The issue that I have been trying to solve for these past 2 days in python is to sort surfaces into separate lists based on their z coordinate. All the surfaces are planar. So basically what I want is that all surfaces with plane z=0 is one list, all surfaces with plane z=5 the second list…
Also, welcome to the forum If this is about GHPython you ought change the category to either Grasshopper Developer or Scripting. And make sure to go through some tips that’ll help you getter answers.
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: