Difficulty modeling different types of buildings from SHP

Hi all,

I’m trying to model a large section of a city from a ShapeFile following this excellent tutorial. It directs you to import the SHP file and the DBF table (through Excel), then create boundaries on the SHP curves so as to treat inner openings (courtyards) as part of the building. This should, in theory, ensure that the number of buildings is the same as the number of features.

In this image, buildings with courtyards (highlighted buildings 1 and 3 from left to right) or interpenetrating volumes (building 4) come out fine. The courtyards are identified as such and the overlapping volumes are identified as such.

Problem is when I have overlapping volumes that don’t interpenetrate (building 2).

The inner volume is interpreted as a courtyard.

I wouldn’t mind that since I’m modelling about 40k buildings, and the problematic ones are few (about 200) and far between. Problem is, when that happens, my list of heights shifts and the heights of buildings after the first error are all wrong. For the case above I have 6 volumes but I get 9 curves that are translated into 5 boundaries (and not 6, because the 2 volumes on building 2 get interpreted as one volume with a courtyard).

I’m trying to think of a solution that doesn’t involve a lot of manual cleaning up of the shapefile.

Any tips?

Thanks in advance!

I am quite sure there is something on this forum or elsewhere. Some links I found if it could help to explore a bit more !

Hello Laurent!

Thanks for your reply!

I have visited the links you sent (and many more) but I have not yet found one that touches the specific subject I mentioned (how to tell grasshopper when multiple polygons are overlapping and when they’re actually courtyards - or a way to deal with that in a large scale project).


Ok, post some geometry in a file, so we have not to recreate or worse badly recreate it.
I am sure people on the forum could help. But I am sure there was a discussion to find very fast if a polygon is inside or ouside a set of polygons. I can’t find it.
@lemieszek Here it is

are those two associated? if so why not use the region intersection component?

Hi my friends,

I think I have not expressed myself well in the original post.

When I import the curves from a SHP file, I get several isolated curves that are not associated with each other. See the first screenshot? I get 9 curves.

When I import the list of heights I get 6 values because, as you see again in the first screenshot, I have 6 independent building volumes (2nd and 4th buildings from left to right have 2 overlapping volumes).

When I do a boundary on the original curves, the buildings with inner courtyards (1st and 3rd from left to right) are interpreted correctly and each becomes 1 boundary (associated with one height - it extrudes correctly). The 4th building is also interpreted correctly because the volumes interpenetrate each other, so the inner volume isn’t mistakenly taken as an inner courtyard. But this does happen on the 2nd building. So I get a list of 5 boundaries and 6 heights and then they don’t extrude correctly.

I would need a way of telling grasshopper that building 2 does not have a courtyard, but 2 overlapping volumes - and that buildings 1 and 3 do have courtyards, not overlapping volumes.

One way I’ve thought of is to export different shapefiles for volumes that are inside other volumes, and keep inner courtyards in the original shapefile on which I would apply a boundary. Then I extrude the boundaries independently from the second shapefile…

Anyway, thanks for the replies!

Hello @lemieszek, by any chance you or anyone here managed to resolve this? I have also been trying to extrude 3D buildings based on polygons in shp files, following the same tutorial. But am having problems as the polygons overlap (and also the courtyard issue you mentioned). So any solution/help on this will be greatly appreciated. I’m work with a city with around 25,000 buildings, so manually cleaning the polygons is not preferred. Thanks!

Hi there,
I face exactly the same problem but I would like to extrude a whole city, so I can’t realy isolate the buildings with internal courtyard. The problem I face is that the number of curves of the shapefile are more than the number of heights, coming from the same shapefile. I understand that it has to do with the way the Import Shapefile (TT toolbox) reads the .shp file. If someone has an idea, please let me know.
Thank you!