Move Polyline or Solid unitl reach a Surface

Hi, i’m trying to make a 3D of an area. (i’ve tried whit external source like open street map but there are not enough information in the shp file).
So i’ve the surface through patch and buildings and now i’ve to move them on the irregular surface.
i thought to use “move” and “unit z” but i don’t know how to set the distance at "minimum from the polyline to the surface on z axis)
Thank you so much

Hey Antonio,
attached a file where I projected the P-lines onto the terrain surface. I used the MeshRay componant to “project” the center pt of the Plines onto the terrain surface alon the z-axis. Maybe this helps you to start with.
Next time please upload a filewhere others can start with.

generate-buildings-on-terrain.gh (20.6 KB)