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:
@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?
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:
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):
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:
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 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
A bug? I don’t know how this effects branched data, i.e. if Point Groups works through branches in reversed order aswell.
@Owen_LPoint Groups is my preferred method, but I included in the file below all three main methods described in this thread: