Grid curves are 2D lines, the possibilities for extracting a plan is practically infinite. This is why your code snippet includes the third point XYZ.BasisZ. Similarly, when accessing to get curves from the DatumPlan class, a view is required as part of the method parameters. The documentation clarifies that the curves displayed are a reflection of the original, especially in elevation or section views. I am sure you read the below snippet, but placed it here for just in case of clarity. so what I can see from all this, the sketch plan of the view that shows the grid, is supposed to be the plan of the grid or the DatumPlan
A DatumPlane represents a 3d surface with finite extents. It can be either a
rectangle with arbitrary orientation, or a cylinder whose axis is parallel to
the project z-axis. If a datum is visible in a plan or section view, it will
be displayed as one or more curves. These curves are determined by the intersection
of the datum surface with the cut plane of the view. By default, the extents
of these curves reflect the 3d extents of the datum surface. If the surface is
a plane, then the extents represent the projection of the surface onto the cut
plane. This matters, for example, when viewing a datum plane, really a 3d rectangle,
along one of its diagonals. The extents of the curve do not vary with the location
of the view, because we use the projection of the rectangle and not the actual
intersection. If the surface is a cylinder, then the extents reflect the actual
intersection of the surface with the cut plane. In addition, the curves that
represent a DatumPlane can be modified on a view specific basis. In this case,
the ends of the curve no longer reflect the 3d extents of the datum.
I would be glad to know why you are seeking the plan of a grid or a datum in general
Moustafa Khalil