# Remove a section of a curve and add it to the next one

Hi everyone,
I want to divide a curve based on length and if there is any section which its length is less than 300 millimetre, add it to the next section to it…

So if your divided segments end up with lengths (300, 300, 300, 300, 186.3), you want to merge the last two so you get (300, 300, 300, 486.3)?

Yes, it’s always line, but the length of the total line in different levels is varies and I want to use this algorithm for all levels facade work points_L40.gh (36.4 KB)

do you have a preferential direction from which a given line should be processed?
for instance, for a line which is 1000 units long, divided in segments of 300 units, you can have it divided from start (a), from end (b), or from -for instance- a random point (c1 + c2 divided from middle point)?

a) 300, 300, 300, 100 -> 300, 300, 400
b) 100, 300, 300, 300 -> 400, 300, 300
c1) 50, 300, 300, 300, 50 -> 350, 300, 350
c2) 200, 300, 300, 200 -> 500, 500

Not sure this is what you want.