Hi,
I want to sort planar surfaces by their orientation, and just cannot find the right method.

As example I made a grid surfaces with incrementally increasing orientations (in 2 - axis). I randomize this grid. And now I need to find a way to get back to the original configuration.

In my real case I get planar surfaces with all kinds of different orientations, and I need to align them with ever increasing values for 2 axis.

I attach both the .gh and printscreen. The left of the color image mimics the randomised input geometry, and right grid mimics my desired output (or any other configuration as long as I get transition with surfaces from low to high angle values).

Any help directing me towards the right solution is greatly appriciated Sort_Srf_by Orientation.gh (59.4 KB)

not sure if I have understood correctly: surfaces are oriented the right way but their location is wrong, so you want something like â€śwhich goes where?â€ť -already knowing that each of them will have a particular location?-

or you want to know how much each surface should rotate on both axis, in such a way its final orientation will match the correct one?

Hi Inno,
The surfaces are oriented in a certain way in a grid, but i donâ€™t care about their location.

All I want to achieve is move the planes inside the grid so that in the new position the planes are aligned by their orientation. Essentially getting the plane XY and XZ or YZ angles and remapping that along a X and Y axis. So for example at 0,0,0 the plane with the lowest orientation is located, while in the oppositie corner of the grid, the plane with the highest angle for both XY and XZ or YZ angle is placed.

Arghh â€¦ so annoying How the most complex things flow so easy out of the mind, and the most basic stuff kills the workflow.

I line with sometimes a solution is just right in front of us, all it requires is looking through a different eye â€¦ it will be much appreciated if someone has some suggestions on how to approach this seemingly super simple task â€¦ just spent a frustrating day on solving this.

@kev.r WOW! awesome and elegant solution. Life saver and exactly what I need. For context, I needed sorting working to get a simpler, more aesthetic mesh used later on in my script to make fabrication a lot simpler. Again, super thankful that you are willing to spending your time on helping me out here.

Hi Kevin, I was a bit too optimistic. When I pick another random configuration for the planes (for now randomly orientated), the script fails. Just cannot seem to get to grips to this, and understand why this actually happens, and your solution only seems work for the giving surfaces as initialised in the file. See attachment, hope you can have another look. Thanks

Hi Kevin,
Your script works like a charme. Super happy with it.

Iâ€™ve been playing with your suggestion for using the 1st and 2nd sortation to determines the visual output. I combined that in the script. Instead of manually going through each of the possible 78 combinations ( 6 x 13 sortations) I am looking for a way to display all these combinations in a grid, so I can more easily select the preferred option.
Normally that wouldnâ€™t be such a bit deal, but I get stuck because of the sorting and partition operations messing up the branches. Itâ€™s be a couple of years since I last used GH so I am a bit rusty with the tree structure operations. The method I tried is to Shift Paths by 2, one for the 1st order and the second for the 2nd sortation

Hope you can have a look and point me in the right direction.

I culled the banches that were causing the "vector is zero-length after projection onto the Plane" errors in the Angle components. This reduced the combinations from 78 to 48.

Also displaying the surfaces after going through a Flip Matrix component, so 96 combinations in total.