How to make clean mesh with grasshopper for getting closed curve?

I have very wide range of geo-information in mesh [terrain + building] and make them (vertical)contour in grasshopper for laser cutting. This is for communal contour model in architecture studio graduation exhibition

I had to make closed curves for laser cutting, and between [terrain] and [building] I had to move the end points to the z axis, and make polylines with them in [terrain]. But in case of [building], because of the complex mesh, it’s not possible to use one method in [terrain], but it’s only possible to fix it at the mesh stage not contour or edit curves. I tried [mesh join], [mesh union], and [mesh cap(mesh+)] but didn’t work.

The range is so wide that the grasshopper must be used to handle it.
Please give me a hand.Thank you.

  • Contains mesh information within the grasshopper algorithm. (258.4 KB) (106.0 KB)