hi,
looking for a way to visually represent the cumulative areas of separate geometries using a progress bar-like visualization. Think of it like transferring water from multiple cups into another cup, where each cup represents a different area, and as you transfer water from each cup, you fill up the target cup until it’s full.
In other words, calculate the total area of several individual geometries and then represent that total area as a filled shape or pattern within another geometry, like a progress bar filling up.
Hi,
If you have the overall rectangle, the empty rectangle to be filled out progressively, what you need to do is:
Get the base width of this overall rectangle
That base width will be the base width of the current progress fill rectangle.
But we know the area of that progress rectangle (from the summed areas) and we have the width (base width), so what we need to do is divide the two (area / width), to get the height of the progress rectangle.
Then we draw the progress fill rectangle in the same position
See attached script.
I am assuming we want to fill in that large irregular area right, my guess is it is still very doable.
I think the specific solution will depend of the shape. For the example you sent for instance,
I would divide it into narrow horizontal strips (using contour),
get the area of each strip,
and progressively colour the strips, as the shape areas increase
we get the area of all the shapes whose progress we want to show (measure area)
we divide the main volume (to fill up with progress), by a grid into rectangular panels
we start progressively add the sums of the panels one by one (progress sum)
as we add the sums, we check if this progressive sum is less or equal to our measure area
if the progress sum is less or equal to the measure area, we colour the the panel we just added.
once the progress sum is greater than measure area we ignore those panels
area_progress_bar trial.gh (19.1 KB)
i had a different approch but it didnt work as i wanted, i used the grasshopper code i found on the internet by someone named djordje, he showed how he can divide a surface into parts with area of a given percentage** this link : Divide surface in subsurfaces with a given percentage - Grasshopper
but i couldnt achieve the calculation to do it a surface at a time , it does all the surfaces as a collective.
img1:
img2:
i wanted to achieve that the surface starts to fill by taking the calculation of each surface as individuals but keeps on adding until it fills up the overall surface needed
The area component you are using is a custom component which I do not have. Are you able to replace it with the native grasshopper area component and reload that updated script?
yeah i see you have for some reason the old “area” component
i changed them to the one you used
let me know if this works now area_progress_bar trial.gh (17.1 KB)
I think with more time the solution can be scripted much more simpler and elegant. About the area component, I must be on a very old version of the software.
My script is not very neat, and the comments not so great either, I apologise for that. However I hope it is intelligible enough.
We want to consider the summed areas of the shapes as one value starting from 0 to a 100 percent
As we scroll through 0 to 100 with a slider, we want the areas to fill up starting with the first shape up to however much of the total it contributes, then the next shape fills and so on, filling up one by one until the last one
So, we associate each shape with its cumulative sum (as a percentage) say first shape is 0to7%, second is 7to30%, and so on, until last one which is up to a 100%
So based on the position of the slider we pick the current shape, (under which the slider falls)
And for that shape alone, we fill it from start to finish within its cumulative sum, so for example, if the second shape is 7to30% as the slider moves from 7 to 30, the shape fills from 0 to 100
But, as implemented, this only colours the current shape.
So, we have a side logic, that only does the following
checks if the current slider value is larger than or equal to the cumulative sums for each of the shapes
If it is larger it fills the shape solid, if not it does nothing.
The logic employed would be very simple to implement with coding, say python.
this is exactly what i had in mind!
thank you! its extremely helpful . very much appreciated
and thanks for the very detailed explanation , it def helps me in the future to solve similar things