Smallest perpendicular distance between 2 breps

I made the changes I described above in the green group (below), which no longer uses IVRay:

In this case, the “terrain” was already a brep, not a mesh. Project works only with breps, not meshes, so if your terrain is a mesh you’ll have to convert it to a brep (polysurface), like this: