Data Management - Moving Multiple Curves onto Surface at Different Depths

Hello Forum,

I have a file with a bunch of outlines of building footprints, as well as one uneven surface which represents topography. My goal is to create a box for each building bounded by the minimum distance and the maximum distance you would have to move the curve in the z direction in order for it to touch the surface.

I have created a file which will create the box I want for each curve separately. The problem is that when I set multiple curves as inputs, the file creates a box bounded by the same z depth for all of the curves, rather than changing the z depth based on each individual curve.

Is there a way I can rewrite the grasshopper script to get different outputs for each curve?

Thank you.

Project%20Box|690x400

Project to Surface - Forum Post.3dm (6.6 MB)

drape modified3.gh (7.5 KB) Project to Surface - Forum Post.3dm (6.6 MB)

drape modified3_RE.gh (421.6 KB)

Thank you for sending this. It works great.