import bpy from mathutils import Vector C = bpy.context footprints = [o for o in bpy.data.objects if "Plane" in o.name and o.type == "MESH"] terr = bpy.data.objects["Topography"] for footprint in footprints: zrange = Vector((0,0,1000)) start = footprint.location - zrange end = footprint.location + zrange hit_loc, hit_normal, hit_face = terr.ray_cast(start,end) footprint.location = hit_loc