Here you find the code to calcualte the point where a line intersects a plane.

And her you find the code for a boundary-line to grid converter.

Here you can learn why geoscience is important :-)