Basic Grasshopper I cant figure out relating to curve division

I am attempting to do some simple quantities for the number of rolls of wallpaper I will need for a given space. I know the width and length of the rolls (600.4mm x 8540mm) and have a series of lines or polylines relating to the lengths of walls which will be wallpapered - assuming for now that the wallpaper is full height throughout (2350mm). I am trying to divide the wall lengths horizontally into segments of 600.4mm and then gain a total linear meterage (no. of segments x 2350mm). So far pretty simple.

My issue is with the remainders or parts of walls that are smaller than the width of the roll and are not included in the divide length (or divide distance) components. I effectively would like to add these smaller parts up (eg. if I have 3 segments of 200mm this would equate to roughly one roll width). But with the divide length, these are not included in the calculation! Even just ending up with a list of lengths of either full segments (600.4) and then the smaller segments could work and I could then do mathematical operations to roughly figure out the rest. This is about as far as I can get, even after trying to find similar threads:


Hope this is clear but can anyone help? Thanks for your time.

I gone and went overkill, maybe… :rofl:

The thing about packing the remainder parts is a 1D Bin packing problem - Wikipedia .
I did find some c# from the web and edited it to suit the case.
Sadly i lost the source… :worried: (i had like 50 tabs open and then closed everything without thinking)

Any panel at full size is just a number (the index).
Any panel with a cut will have a letter, even if only one fragment is used, index+letter.


portions.gh (32.1 KB)

1 Like

This is truly incredible, thank you so much. It works perfectly of course.

Did you make this from scratch or did you already have a similar definition which you altered?

Looking forward to going through it and learning some new things!

Thanks again, really appreciate it.

The most complex part is the bin packing algorythm, which is not mine… i just edited it a bit.
Then the tree managing to give it the proper name/tag is a bit messy…
From scratch… but apart from the c#, the rest is quite simple.