Creating a contour model with building-footprints -How do you do this?

Hi everyone,

I was preparing a Terrain model with some building footprints these days.This should be an frequent task, so I imagine a lots of you did this also.
Since it cost me more time than I thought it would to develop this, and I think probably I am overseeing the easiest and most obvious way I would like to ask you how you do this tasks normally or how you would solve it.
So that’s the input, a Brep for the Terrain and some curves as building footprints:


My workflow is the following:

  1. Contouring the brep
  2. Make a mesh out of the contour
  3. Project the contourCurves on the XY Plane
  4. Project the Footprints
  5. Split the Footprints with the contours
  6. Make A midpoint on each fragment of the splitted Footprints
  7. Shoot a ray from the midpoints through the Mesh from the contour curves
  8. collecting the last mesh that got shot gives me the path to which contour the footprint splitter belongs.

For later nesting it is important that the footprint splitter match the contour tree exactly(a path with 2 dimensions),like in the picture below:


I hope I could explain it.

Thanks for every input!

Here the file with my attempt:20210426_TerrainLaserCut.gh (507.1 KB)
Also: I posted it in the GH category since I don’t want to limit it to a scripted solution.