Sorting a List of Curves into Chunks

problem_curve chunks.gh (17.5 KB)

Morning all. I have a list of curves whose lengths generally follow a wave-like pattern. I want to eliminate curves which pass above a controllable threshold and then take the remaining curves and separate them into branches of consecutive curves. I have included a python script which does the job, but I am really curious about how to achieve it using nodes. I have included my feeble attempt but I really cannot seem to wrap my head around how to make use of series and shift list to identify breaks..

I appreciate anyone who takes their time to review this.

Edit: intended goal summarized in the screenshot although with smaller than instead of larger than for some reason:

Hi, here is the old trick with Group Points, but you will have to deal with the gaps. It can be done with a little bit of fine-tuning.

problem_curve chunks_RE.gh (19.5 KB)

thank you very much!

I didn’t really understand if you want to filter longer or shorter than given amount, so you can use that relay thing as a switch for that:

problem_curve chunks_inno.gh (28.2 KB)

Bucketing via falling / rising edge detection:


curve bucketing VR 1.gh (19.7 KB)

Comparing index numbers + partition list:


problem_curve chunksEW.gh (27.7 KB)

Interesting… I don’t understand it. It’s like a falling edge dectector on the indices list? It leaves gaps:

@Volker_Rakow
loft from curve 0 to 5 (example ) + loft from 6 to 10 will give gap from 5 to 6.
Now I do not understand what you mean with “falling edge detector” here. What kind of output would you expect there?

I see. Nevermind. You are targetting just the smaller than than case, not dispatching into the two cases.

You have a list of indices and you are identifiying their grouping by the last item (falling edge) in each group:

You could have done this by finding the first item (rising edge) in each group aswell.


@Eef_Weenink Probably the quickest way to find the rising edges of the indice groupings is to take the Relative Difference, subtract one thereof, and cast to bool:

From here the falling edge can be found by shifting the rising value list by the default vale of 1:

or you could reverse the original indices list, use Relative Diferences, add 1, cast to bool, and re-reverse (essentially use the rising edge technique on a reversed indices list):

To get the rising and falling edges of the groupings you just XOR the rising and falling edge lists, however it is you got them, together:

This is useful if the means by which you are splitting the indices list into branches is by Sub List, instead of Partition List, which requires domains:

Member Index for boolean “True” value indices, Dispatch, Construct Domain.

Single strips and cull strips with lenght above threshold

Nice! That doesn’t really sort the lines, but goes directly to the solution. You can rely on Brep Join to merge adjacent faces. Did you know curves cast to numbers retrieve the curve length?:


@Fabio_Franchetti It’s actually not that hard to go from your solution and work backwards to a list of sorted lines which you can then use to make a “properly” lofted surfaces through all the lines:

It’s surprisingly succinct in terms of the number of components used (I don’t know how these solutions compare in terms of speed) and is particularly useful if you are looking for individual panel heights that exceed a threshold value, because such a solution will include edge lengths smaller than the threshold value.

I know that if you input a data type into a different one there are some implicit operations but I missed this case, thank you!

Very much appreciated. Both your and @Fabio_Franchetti 's solution is elegant and easy to understand. Thanks.

I introduced the edge detection because I didn’t like that you have to set a threshold distance for Point Groups. However the Point Groups method is still the shortest method, and you can amend it to not have to set a threshold distance:

Instead of comparing the distance between the centerpoints of lines with Point Groups, we create a new set of points with X values dependent on the line indices. Because the indices to a group increase by one each time, we can use a constant distance of one to detect lines that belong together.

It is very strange, but in order to “asynchronously” partion the points into branches in a way that reflects the desired data structure for the lines, you have have to reverse the point list for Point Groups

:person_shrugging:

A bug? I don’t know how this effects branched data, i.e. if Point Groups works through branches in reversed order aswell.


@Owen_L Point Groups is my preferred method, but I included in the file below all three main methods described in this thread:

Sorting a List of Curves into Chunks VR1.gh (35.1 KB)