
steps=20;

xmin = View[0].MinX; xmax = View[0].MaxX;
ymin = View[0].MinY; ymax = View[0].MaxY;
zmin = View[0].MinZ; zmax = View[0].MaxZ;

Plugin(CutGrid).View = 0 ; 

// can be a bit ugly if using more than 1 series, since we don't sort
// intersecting elements accuratly.

/*
For x In {xmin:xmax:(xmax-xmin)/steps}
  Plugin(CutPlane).A = 1 ; Plugin(CutPlane).B = 0 ; Plugin(CutPlane).C = 0 ; 
  Plugin(CutPlane).D = x ; Plugin(CutPlane).Run ; 
EndFor
For y In {ymin:ymax:(ymax-ymin)/steps}
  Plugin(CutPlane).A = 0 ; Plugin(CutPlane).B = 1 ; Plugin(CutPlane).C = 0 ; 
  Plugin(CutPlane).D = y ; Plugin(CutPlane).Run ; 
EndFor
For z In {zmin:zmax:(zmax-zmin)/steps}
  Plugin(CutPlane).A = 0 ; Plugin(CutPlane).B = 0 ; Plugin(CutPlane).C = 1 ; 
  Plugin(CutPlane).D = z ; Plugin(CutPlane).Run ; 
EndFor
*/

// ok to merge all three... But the way vis5d does it: only display
// on of the three, depending on the view point!

/*
For x In {xmin:xmax:(xmax-xmin)/steps}
  Plugin(CutGrid).X0 = x ; Plugin(CutGrid).Y0 = ymin ; Plugin(CutGrid).Z0 = zmin ; 
  Plugin(CutGrid).X1 = x ; Plugin(CutGrid).Y1 = ymax ; Plugin(CutGrid).Z1 = zmin ; 
  Plugin(CutGrid).X2 = x ; Plugin(CutGrid).Y2 = ymin ; Plugin(CutGrid).Z2 = zmax ; 
  Plugin(CutGrid).Run ; 
EndFor
For y In {ymin:ymax:(ymax-ymin)/steps}
  Plugin(CutGrid).X0 = xmin ; Plugin(CutGrid).Y0 = y ; Plugin(CutGrid).Z0 = zmin ; 
  Plugin(CutGrid).X1 = xmax ; Plugin(CutGrid).Y1 = y ; Plugin(CutGrid).Z1 = zmin ; 
  Plugin(CutGrid).X2 = xmin ; Plugin(CutGrid).Y2 = y ; Plugin(CutGrid).Z2 = zmax ; 
  Plugin(CutGrid).Run ; 
EndFor
*/
For z In {zmin:zmax:(zmax-zmin)/steps}
  Plugin(CutGrid).X0 = xmin ; Plugin(CutGrid).Y0 = ymin ; Plugin(CutGrid).Z0 = z ; 
  Plugin(CutGrid).X1 = xmax ; Plugin(CutGrid).Y1 = ymin ; Plugin(CutGrid).Z1 = z ; 
  Plugin(CutGrid).X2 = xmin ; Plugin(CutGrid).Y2 = ymax ; Plugin(CutGrid).Z2 = z ; 
  Plugin(CutGrid).Run ; 
EndFor

Delete View[0];
Delete Empty Views;
Combine Views;

View[0].DrawLines=0;
View[0].ColormapAlphaPower=2;
