Thank you, this is exactly what I was looking for.
Just a question, why the direction of the grid can be changed ? Do the grid of points have a starting point on the surface ?
I have made that option so you can orient grid to LocalCoordinateSystem according to BoundingBox of surface. So, yes, the grid has a starting point at origin of SurfaceBoundingBox. Dont confuse it with origin of surface.
If that is not needed you can avoid all of that, edit definition a bit a leave it as it is, everything oriented to World-XY-Coordinate-System.
Mind in that case, that you will always have to tune grid ponts count/distance dependable on distance of your surface from the XY-origin. That is why i used BBox approach. Only some minor fine-tuning is needed then.