# Equally dividing a 'module' list with given areas

Hi forum! After hitting my head a bunch of times with this, I’m asking a help to u guys.

So. I got this list of modules that I want to divide them with a given area. For example: I want to divide this 100 polylines (the modules) into 4 groups of areas: 1000m2, 1500m2, 1250m2 and 500 (just a example, not sure if them add up exactly 4250m2)

That means: the sum of 10 modules results in 1000m2, the sum of another 15 modules results 1500m2… so on

[again, not quite accurate the modules size and the division… just explaning the goal]

I’m trying to use galapagos to do this and find the exactly order of the indexes to split the list with ‘partition list’ component. But, I’m not sure if this is the best method…

And another problem is that sometimes the partition creates more than 4 branches (the 4 groups of the sumed areas that i want).

maybe with a bit of python and some loops it the best way to check after n iterations the code met the required area and then split the list and go to the another area goal?

attachments:

Mcneel_forum.3dm (98.0 KB)
Mcneel_forum…gh (19.9 KB)

Hope you guys can help me with this one, I’ll be glad!

Thank you!

Just spotted that one.

It’s rather very easy (at least via code [that’s the bad news for you]):

1. First you need to Order your Polylines (via their centers in fact) according their projected X/Y values for a given coordinate system (i.e. a Plane in R language). Like:

So … disable the 2nd C# and try to get the gist of what the 1st does.Spot the 2 order options (X/Y or Y/X). Play with the rot variable as well.

1. Then is a very simple variation of a Linear Pack problem according some SumAreas List . Like:

The attached does all the above (the 1st C# was already on hand for some other purpose. The 2nd was a 5 minutes job).

Points_OrderByProjectionInPlaneXYAxis.gh (138.4 KB)

1 Like