Projecting a grid of points unto a model and displaying collision output
Not a scripted solution, but you can achieve a similar effect using a particle system. 



Create an emitter plane and a particle system. This will have all the particles emitted at frame start = end = 1.000 and a lifetime long enough for the collision. 

Set the emission to grid and assign a velocity in the correct direction in the Emitter object box. Leave all the other options to their defaults (Newtonian physics with all the forces = 0) and in Field weights remove the effect of Gravity by setting gravity to 0.

Last, you would like to render the particles as lines. Select Line under Render, set Tail to zero and Head to some value between 0 and 1. Use a high trail count and set Length as long as your particles lifetime. Also, tick Length in frames.

Now, make sure that all the objects that you want to detect have a Collision property (with default values).

(Now you can also add another plane - as a "sensor" - behind the emitter and make it collide with the particles that are coming back, killing them. Then you can render the dead particles as dots on the sensor)