Sorting Grasshopper Lists Using Desired Percentages

Hello,

I have a bit of a complex Grasshopper problem I’d like some input/advice on.

I am working on an urban design tool, and a component of that tool involves the organizing of parcels into built vs. unbuilt. I already have polygons that serve as the parcel boundaries that will be the input for this piece (currently using a Voronoi model, as the shape of the boundaries is not the focus at this point).

The basic structure of the script begins with the creation of the parcel boundaries, and these are put into some order based on z-value related to the topography surface as well as distance from the previous boundary in the list…from this sequencing, boundaries are grouped together to form “blocks”. I have all of this and then some worked out, but here is where the tricky part comes:

I need to set the script up so, beginning with the parcels that make up the FIRST “block” group, it searches and sends a certain percentage (this should be a variable that can be determined/adjust based on user needs, so a number slider is preferred) of that group’s overall area to a new list that represents parcels to remain unbuilt. For example, if I have a group of parcels that equal 1000 square meters, and I want an area equal to at least 10% of that to remain unbuilt, the script will begin searching with the boundary with the lowest z-value within that group’s list and will stop once it has reached a sum of individual boundary areas that is at least 100 square meters (it can be greater than the desired percentage, but the idea is that it stops as soon as it has passed that threshold, and the chosen boundaries should be adjacent to each other).

From there, it should be able to move through the sequence of “block” groups and recalculate based on the accrued area weighed against desired open space percentage. For example, if I began with the 1000 square meter group from above and parsed out two parcels with a combined area of 150 square meters, I have exceeded my goal for that section; however, if I the next group of parcels is also 1000 square meters, bringing the total area to 2000 square meters, 150 square meters is not satisfactory, and the script will have to search from this next group as well in order to bring the total unbuilt percentage up to 10%, in this case, it would take an additional 50 square meters. On the other hand, let’s say the second group is much smaller, at only 500 square meters…our total is now 1500 square meters, which means the 150 square meters found in the first search satisfies the 10% desired, and the script can move on to the next group without parsing more boundaries out this time around.

I hope I am making sense; as you may be aware by now, I have a clear idea of WHAT I need this script to be able to do, but I am unsure of the HOW, given my limited scripting knowledge/experience.

I have attached the Grasshopper file as well as a Rhino model on which it can be used.

Thanks!

Rhino.3dm (439.9 KB)
Grasshopper.gh (24.5 KB)

Very interesting. I really want to do this, unfortunately I don’t got time today.

  1. How you want to define the starting area? Just list one random parcel of your block or should there be some critera like highest slope, smallest area etc.

  2. Your talking about sequence so I think for example about Anemone, listing parcels and change to the next block/group when reaching the goal.

  3. In my opinion a simple optimization process would be the most effective way. Let Oktopus search for n amount of parcels to reach your overall goal of 10%, but also that every block is nearly 10% unbuild.
    And also that all parcels in one block need to be next to each other.

Is an optimization ok, where it search simultaneously or you want your sequence as described?

@tim.stark
Thanks for your response.

The sequencing is fundamental to the logic of the script. The blocks are formed in sequence, and the idea for searching for unbuilt parcels is that it would start with the first block, with the parcel with the lowest z-value, and continue out from there if necessary.

And then just to clarify my thought process and goal, by the end the overall site, or sum of all block groups, would have an unbuilt percentage of roughly n, rather than each individual block group having that percentage unbuilt.

Does that make sense?

Hope you like it. Requires Anemone. Feel free to edit, so it fits your needs.

The Problem in this script is, that it starts in every block with the lowest pacel. So if it’s a big one, it still will take it and it always takes atleast one parcel. So in the end I got over the 10%. But nothing unsolvable. For the area calc I used the planar curves not the projected ones.

Sequence_search_area.gh (42.9 KB)

Thanks, this looks like something I may be able to use as a base.

I’ll take a closer look at it and see if my local scripting expert and I can come up with a modification that gets it where I need it.

perhaps an alternative approach, from a land developers point of view, would be to identify drainages, extract the medial axis of the drainages, do a variable offset of the medial axis, and then play with the offset amount until the area of the drainage plus offset = 10% of plot. So, rather than identifying which plots have the lowest elevation, start the other way, identify the lowest elevations, then determine plots from there. Just a thought

Ok, found an error and solved the Problem, with listing atleast one parcel per block.

Sequence_search_area_1.gh (38.4 KB)

But I would consider what @markz wrote.