I’m trying to move/copy elements upwards until they reach a total given area. As they are building volumes I would like to have random numbers of floors for each building with even distance between floors. So far I have try this but now I’m stucked on how I should continue.
Can anyone guide me in the right direction?

for each of the buildings create a random number, for instance between 1 and 10 (for the number of floors), then use that number to create a series for the height offset of the floors, and use these vectors to move the starting floor in the positive Z direction. You can easily calculate the sum of the areas of these surfaces once this is done and use that to evaluate.

Thanks for the answer Devin. If I understand your answer you are adjusting the number of floors to try to match the area needed but What I need is to change the total square meters and generate different number of floors configurations respecting this given area.

Ok, in this case, you will need to take the total area as input, then divide it by the area of one floor to determine how many floors you need. Then you could also have as input the length or width of one floor, then use the total area and a random number of floors and then you can make the number of floors randomized. Here’s what that would look like:

Thanks a lot Devin! This solution gives the written total area by building (in your example 11292 per building, so a total of 101628 counting the 9 buildings). I will continue to modify it to find a total (11292) for all of the buildings