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.