# How to sort a wavey surface split surface by u or v values?

Hello,

I am new to grasshopper and am having some trouble sorting a wavey surface spit into parts.

Usually I would sort using x, y, or z values. But because the surface turns corners this wont work.

I thought that I may be able to sort it by the u or v values from the unsplit surface but cant seem to get this to work.

Is this even the right approach, or is there a better way? There seems to be some order, but not the one I want.

I want to be able to sort it into rows and columns as best as possible. how well this can be done would obviously depend on the pattern that the surface had been split with. (in the example attached it should be able to do this well)

Any help would be much appreciated

.
sort wavey split surfaces by U V.gh (390.8 KB)

Can anyone advise on how I should best approach this?

I have attached a simple example where I have used jitter to give me an un sorted set of surfaces to work this out with.

Hello,

The output of `IsoTrim` is already sorted by U/V.
`Partition List` could come in handy to transform that single list into a tree with one row or one column per branch.

ok, I seem to have it working by first sorting by z values, partitioning then sorting again with UV.

Is there a better way of doing this? Or is this ok?

sort wavey split surfaces by U V 02.gh (383.9 KB)

Yes I realise this.
That is why I added the jitter component to give me a set of unsorted surfaces to work this out on.
Often when I split a surface like this with a pattern of curves it results in split surfaces in what seems a random order.
This is just an example to work out the logic.
Any ideas?

Your method seems fine then.

Another idea could be to use `Sort Points` on the UV Points, but the rounding it requires to be consistent makes it as complex as your idea.

thanks for this, I am struggling to work out exactly what you have done here. But I will look closely and try and work it out.

one more quick question if you don’t mind, how do you colour the branches like this?

I’ve made a custom component, but there are equivalent clusters here :

(I hate clusters )