Skip to main content
aiagentsgrasshopperarchitecturezoning

How much can you build on a plot? I worked it out with an AI agent in Grasshopper

Out of curiosity I checked how to work out the capacity of a plot with an AI agent and Grasshopper. AI reads the zoning plan and gives a quote for every number, Grasshopper computes geometry and sunlight, and I compare the result with the estate that actually stands on the plot. On the method, three scenarios and what regulations do not explain.

Published: November 06, 2026
Three solver scenarios on plot 4/37 in Kraków. The colour of the ground shows hours of direct sun on the equinox, computed in Ladybug Tools. The lines on the roofs divide the buildings into flats.

The first question about any plot is always the same: how much can you build on it.

The answer is called a site capacity study. An architect does it: reads the local zoning plan, writes down the indicators, checks the shape of the plot and its surroundings, adds up the areas and compares layout options. An investor bases the decision to buy the land on that number.

The trouble is that the answer sits in three places at once. In the text of the plan resolution, which runs to 37 pages for my test plot. On the plan drawing, because only the drawing shows the building lines. And in the technical conditions regulation, which says how far apart buildings must stand for the flats to get daylight.

People have been doing these studies for a long time. I was simply curious how it could be done with an AI agent and Grasshopper, so I tinkered a bit. This post describes what came out of it: the method, one real plot in Kraków, three layout scenarios and a comparison with the estate that actually stands on that plot.

Why

I did not want AI to "design an estate". A language model is weak at arithmetic and can give you a parameter that the plan never sets. In a capacity study one such number is enough to make the whole result worthless.

Three things made me curious:

  1. Can the work be split so that AI does what it is good at, reading a long legal text, while ordinary code that can be checked does the counting?
  2. Will the result of such a tool agree with what was actually built on the plot?
  3. What in the built estate follows from regulations, and what from the decisions of the designer and the investor?

I made the same assumption in the post about a harness that reads a building model: every number has a source you can open and check.

How: AI reads, code computes, a human approves

The tool has one trust boundary. It is a file with the plan parameters, which I called the ruleset.

  • The AI agent reads the resolution and writes every parameter into the file together with a quote, the paragraph and the page number. What the plan does not set stays empty, with a note saying why.
  • Grasshopper does not read the PDF. It gets the ruleset and computes geometry from it.
  • AI computes no area at all.
  • A human checks the ruleset field by field before the tool treats it as verified.

Two parameters from the ruleset. The quote, the paragraph and the page stand next to every value.

The code was written by a coding agent, Claude Code. It is plain Python modules with tests. I set the rules and asked questions the way an architect does, and left the implementation to the agent. The agent connected to the open Rhino on its own, assembled the Grasshopper definition from code, solved it and took the screenshots.

That makes the definition boring, which is the point. Three components call Python modules, and panels show the result with a paragraph and a page next to every number.

The Grasshopper definition. Inputs on the left, three components in the middle, results with references to the plan on the right.

The test plot

I chose plot 4/37 in Kraków, in the "Bulwary Wisły" plan, in the multi-family housing zone MW.1. It covers 8,671 m² and it is built on: seven four-storey buildings with 53 flats have stood there since 2016. According to the developer's figures they have a footprint of 2,050 m² and 5,600 m² of usable floor area of flats (PUM, the Polish measure of sellable flat area).

The choice was deliberate. On a built plot I can compare the tool's result with something that went through design, permitting and construction.

Plot 4/37 with its surroundings within 100 m. The darker part lies in zone MW.1, the lighter part in the park.

The code fetches the data from public services: the plot boundary from the national cadastral lookup service, the plan zones from the city's spatial information system, the terrain from the national elevation model, and the neighbouring buildings from 3D building models.

Step 1: what the plan allows

For this zone the plan sets three things that decide the result: a building footprint of at most 30% of the area, a height of up to 13.5 m and at least 55% of biologically active area. It sets no floor area ratio.

The plot lies in two zones: 79.7% in MW.1, the rest in the park. The indicators are counted only from the part in MW.1, that is from 6,914 m². 30% of that is 2,074 m² of footprint.

The zones of the “Bulwary Wisły” plan around the plot. Building is allowed in MW.1, and the part of the plot in ZP.6 is a park.

The result from the plan alone: 2,074 m² of footprint, four storeys and between 5,737 and 6,177 m² of PUM, depending on how much of the floor plate goes to walls and circulation. What was built: 2,050 m² and 5,600 m².

Step 2: daylight

The plan says how much may be built. Whether people can live in those buildings is decided by the technical conditions regulation. The model applies three rules:

  • § 13: in front of a window, within a 60° angle, an obstruction must not stand closer than its height above the window sill,
  • § 60: a flat must have a room with at least 3 hours of sunlight on the equinox days, between 7:00 and 17:00,
  • § 271: at least 8 m between buildings for fire safety.

For two parallel rows of four storeys this gives concrete distances: 11.2 m from obstruction and 13.9 m from sunlight when the façade faces due south.

The tool checks this room by room. It divides the façade of a flat into rooms about 3 m wide and puts a point in the middle of each, at the window sill of every storey. From each point it checks the obstruction and casts a ray to the sun every 5 minutes.

PUM is counted flat by flat. A flat of up to 52 m² has two rooms, a larger one three. It enters the result when its façade holds at least as many unobstructed rooms as the flat has rooms, and one of them gets 3 hours of sun. I call the PUM of such flats compliant PUM. Step 3 describes how the model knows where the flats are.

The dots are sun positions at full hours on the equinox. The lines are rays from one ground-floor window, every 15 minutes. The grid on the buildings marks flats and storeys, and the colour shows hours of sun.

Step 3: flats, staircases and corridors

To count daylight flat by flat, the model has to know where the flats are. So for every building it draws a schematic of one storey: staircases with a lift, corridors and the outlines of flats. It does not draw rooms.

I set three assumptions myself:

  • Flats have between 40 and 80 m².
  • Every staircase has a lift.
  • A single-aspect flat has 40 m² and is about 7 m deep.

The staircase and its lift form a core. On a façade it takes 4.85 m of width and is 5.92 m deep.

The model knows three plans:

  • Plan 1: three or four flats per staircase. The building is 13 m deep. The core stands on a façade, one or two single-aspect flats face it, and a through flat lies on either side. One staircase serves up to 22.1 m of building with three flats and up to 26.5 m with four.
  • Plan 2: a core in the middle and four corner flats. It suits buildings 13 m deep and between 17.4 and 35.4 m long.
  • Plan 3: the corridor block. The building is 16.5 m deep, with a corridor down the middle, single-aspect flats on both sides and through flats at the ends. A flat door may be at most 20 m from the staircase (§ 256), so one staircase is enough for a building of up to 48 m, and a longer one gets two.

The three plans to one scale. A dark block is a staircase with a lift, and a dot is a room on the façade.

The model draws every plan that fits the building, with the staircase on one side and on the other. It keeps the one in which the most PUM meets the rules. In a tie the plan with fewer staircases wins, and after that the one with more flats.

The model does not measure flat areas from the plan. The PUM of a storey is still a fixed share of its area, 0.70 for the stair-access block and 0.68 for the corridor block, split between the flats in proportion to their outlines.

One of the layouts described below. Dark blue flats have windows on two sides, light blue ones on one side, and a dark block is a staircase with a lift. In five buildings the core stands on a façade, in three in the middle.

Step 4: searching the layouts

On this plot the 30% footprint cap binds, not the space. The area where buildings may stand has 5,635 m², and only 2,074 m² may be built on. So hundreds of layouts give the same PUM. A second criterion was needed and I chose sunlight: among layouts with the same compliant PUM, the one whose flats get the most hours of sun on average wins.

The solver draws layouts from a few variables: building type, direction and spacing of rows, building length, gaps. It scores each one and refines the best. One run is about 2,300 layouts. The result repeats exactly, because the random draw always starts from the same number.

The most important rule was about me, not the code. I knew the layout that stands on the plot, so it would have been easy to pick variables that let the solver "discover" it. That is why I wrote the search rules down before the solver ran for the first time: where the bounds of the variables come from, what the criterion is and how I would measure likeness to the built layout. Every later change has its reason recorded, along with the result before the change.

Step 5: checking

How do I know the code computes correctly? From three sources.

The first is tests. There are 142 of them. The reference values were computed by hand, I approved them, and the agent cannot edit them.

The second is the built estate, which I compare the result with.

The third is another tool. My model computes the hours of sun with its own code. To check that it does so correctly, I repeated the calculation in Ladybug Tools, a well-known Grasshopper plug-in, on the same points and the same building volumes. The mean difference is between 1.7 and 3.2 minutes per point, the largest 20 minutes. The cause is known: Ladybug takes 21 March as a calendar day and accounts for atmospheric refraction, while my model assumes an ideal equinox. The model gives slightly less sun, so it errs on the safe side.

The check in Ladybug Tools. The component on the right gets the same points and the same volumes as my model.

Results

I ran three scenarios and set them against the estate that stands there, scored by the same rules.

The built estate and three scenarios in the model seen from above. Dark blue flats have windows on two sides, light blue ones on one side, and the dark boxes are staircases with a lift.

  • Scenario 1, plan and regulations only: 3 buildings, 7 staircases, 100 flats, 5,686 m² of compliant PUM, 8.1 h of sun per flat.
  • Scenario 2, buildings up to 22 m: 8 buildings, 8 staircases, 116 flats, 5,682 m², 6.4 h.
  • Scenario 3, buildings along the edge: 8 buildings, 8 staircases, 108 flats, 5,623 m², 7.0 h.
  • Built estate: 7 buildings, 7 staircases, 56 flats, 5,508 m², 7.9 h.

Every flat counts in every layout.

In the first scenario the solver knows only the zoning plan and the technical conditions. Its job is to fit as much PUM as possible and, at equal PUM, to give the flats as much sun as possible. It placed three long buildings in two rows, 19.8 m apart. The compliant PUM came out 1.5% above the 5,600 m² given by the developer.

In the second I added one assumption of my own: a building has one staircase, so it is at most 22 m long. The solver set eight blocks in a grid. The PUM is almost the same, but there is clearly less sun, because the buildings stand close together.

The layout of the second scenario meets the regulations and is poor as urban design. So in the third I added a composition rule: every building stands at the edge of the buildable area, parallel to its side, and the middle of the plot stays open. The result is eight buildings of 19.8 m around a courtyard.

The model draws the built estate as it stands: one staircase and two flats per floor. That gives 56 flats, and the developer reports 53. They are roughly twice as large as the flats in the scenarios, and every flat reports the hours of its best room. That is why I do not set the 7.9 h directly against the hours of the scenarios.

The corridor block did not win in any scenario. In scenario 1 the best layout of corridor blocks has 5,165 m² of compliant PUM, 9% less than the layout with staircases. Scenario 1 has blocks of 79, 59 and 21 m with three, three and one staircase, seven in total. Scenarios 2 and 3 have eight buildings each with one staircase, so eight. Here the long blocks save one staircase with a lift.

In the long blocks of scenario 1 the north façade does not get 3 hours of sun. A single-aspect flat with windows on that side would not meet § 60. The model puts the staircases there and the single-aspect flats on the south side, so no flat drops out.

Scenario 1 from the north-west. The staircases stand on the side that does not get 3 hours of sun, and the single-aspect flats on the opposite one.

Hours of direct sun on the equinox, computed in Ladybug Tools on a 1 m grid. Blue means less than 3 hours. The lines on the buildings mark flats and storeys.

The sun maps show where the differences come from. Blue is less than 3 hours, below the requirement. The lighter the colour, the more sun. In scenario 1 the south façades are bright along their whole length, and the shade falls on the strip between the rows. In scenario 2 the gaps between the blocks are dark, and so are the walls that face them.

Conclusions

Regulations explain how much was built. The model hit the PUM given by the developer within 1.5% and spaced the rows similarly: 19.8 m in the model, more than 17 m across most of the real estate. The built estate, scored by the same rules, has 5,508 m², 1.6% less than the developer's figure, and every one of its flats counts.

Regulations do not explain the form. Regulations, PUM and sunlight favour long blocks, and seven small buildings stand on the plot. That is a product decision: views, flat sizes, the character of the estate. The plot holds 53 large flats, 106 m² on average. In the scenarios I assumed flats of 40 to 80 m², and there are between 100 and 116 of them. Only when I gave the solver two assumptions from outside the regulations, small buildings and a composition along the edge, did I get the same type of development as in reality: eight buildings of 257 m² against seven of 293 m². The placement itself is different.

A well-chosen plan evens out the layouts. Three very different layouts have almost the same compliant PUM. The difference is 63 m², or 1.1%, and every flat counts in each of them. A plan can be fitted to the points of the compass: the staircase goes to the side without sun and the single-aspect flats to the sunny one. The layouts differ in other things: the number of flats, the number of staircases and the hours of sun, from 6.4 to 8.1 h per flat.

Composition has a price that can be counted. Against scenario 2 it costs 59 m² of PUM, or 1.0%, and gives more than half an hour more sun per flat.

AI built the tool, but it is not the source of the numbers. The agent wrote the code and the tests and drove Rhino. No number in the result comes from a language model. The plan values carry a quote, and the rest is geometry and arithmetic that can be repeated.

What it does not do

A real project has more conditions than I checked here. The model does not place the playground that the technical conditions require for more than 20 flats, at least 10 m from windows and roads. It does not draw the car park either, and it does not count the effect of the new buildings on neighbours' windows, balconies or trees. The result is an estimate, not a legal opinion.

It is also a test on one plot, and a retrospective one: the plan and the design were made around the same time, so the agreement of the numbers says the plan matches the design, not that the forecast is accurate.

What next

I tinkered out of curiosity, and for now I am stopping at one plot. I will compute the next one blind: first the tool's result, then the comparison with what was built. I also want to give the solver more freedom: buildings rotated one by one and trimmed to the building lines.