Grid sag surface

I added a grid sag surface in a non-sequential system. Apparently, its material can only be mirror. Can I use glasses as its material? How? Many thanks! 

10 replies

Userlevel 4
Badge +2

Hello Haining,

You are right, only MIRROR material can be added to a non-sequential Grid Sag Surface object. This is because it is a surface, so its volume is zero.

If you would like to model a solid volume, please use the Grid Sag Lens or the Grid Sag Lens 2 objects instead. The Grid Sag Lens is a solid volume object with a Standard surface front face and a Grid Sag surface rear face; while the Grid Sag Lens 2 is a solid volume object that supports two Grid Sag surfaces for the front and rear faces. You may find more information about the Grid Sag Lens objects in the Help System under The Setup Tab > Editors Group (Setup Tab) > Non-sequential Component Editor > Non-sequential Geometry Objects > Grid Sag Lens (2) tabs.

For the Grid Sag Lens objects, you can add glass materials if you wish.

I hope this helps!

Let us know if you have any further questions!

Thanks Csilla! That's really helpful! 

I try to add a grid sag surface to a non sequential mirror surface and I get an error message 'No valid object files found'.

The relavante file is save in 'Zemax / Objects / Grid files'.

What sould I do?

Userlevel 4
Badge +2

Hi Daniel, 

Thanks for your question.

I’m sorry to see that you’re experiencing this error message. The ‘No Valid Object Files Found’ normally occurs when there is incorrect path specified. Can you please double-check the path in the Project Preferences as there might be a mismatch there:

In the Project Preferences of OpticStudio, can you try using the Browse button (the 3 dots) to re-navigate to the correct folder?

Please let us know how this goes or if there are any additional questions.



I get a “No valid object files found” message when I try to load grid sag lens into a non-sequential setup and I have the paths as specified in your picture. 

Userlevel 5
Badge +2

Hi @Paul.Harrison , and everyone,


The same happened to me when I tried setting up a Grid Sag Lens. When I checked my folder Documents\Zemax\Objects\Grid Files it didn’t contain a *.GRD file, which are used by Grid Sag Lens.

I wonder if there shouldn’t be a template file with a *.GRD extension in that folder from the default installation, what do you think @Csilla Timar-Fulep?

If you create a *.GRD file, and put it in that folder, the error should be gone, and you should be prompted with your newly created file.

The *.GRD format is described in the Help File under The Setup Tab > Editors Group (Setup Tab) > Lens Data Editor > Sequential Surfaces (lens data editor) > Grid Sag.

Let me know if that makes sense.

Take care,




Works now! Thanks

Userlevel 4
Badge +2

Hi @David.Nguyen and All,

Thanks for your comments here.

I have checked and unfortunately there is no*.GRD file included in the default installation files. I have raised this internally to add one to the upcoming future releases.

In the meantime, as David suggested, you may create your own *.GRD files based on the Random_Grid_Minus.DAT or Cross_Grid_10x10.DAT sample files included in the \Documents\Zemax\Objects\Grid Files folder.

The proper file format is as follows:

nx ny delx dely unitflag xdec ydec 
z dz/dx dz/dy d2z/dxdy nodata

The first line in the file contains seven values, which define the (integer) number of points in the x and y directions, the (floating point) increment in the x and y directions (positive values are assumed, only the absolute values of delx and dely are taken into account), an (integer) flag indicating the units of the data: 0 for mm, 1 for cm, 2 for in, and 3 for meters, and the (floating point) decenter of the grid points relative to the base surface in x and y. Any required scaling to the current lens units will be performed. Note that sag and cross derivative values have dimensions, and are therefore scaled, but first derivative values are dimensionless, and are not scaled.

The remaining nx*ny lines of the file contain four (floating point) numbers and (optionally) one integer each. The four floating point values are the sag, the x derivative of the sag, the y derivative of the sag, and the cross derivative d/dxdy. The optional fifth data entry is an integer flag that indicates if the data is invalid. Valid measured data should either have a zero or blank space for the nodata flag. Points for which the data is not valid should have a nodata value of unity.

If the nodata value is unity, the whole line of entries will be replaced with zeros and only the base portion of the sag will be used for calculations. If any entry in the grid sag table is not a number, the entry is replaced with zero.

The first data line in the file corresponds to the upper left corner of the surface, that is, the corner defined by -x and +y limits. Each point that follows is read across the face of the surface from left to right. After nx points, the nx+1 point is read in as the first value in row 2, and so on until nx*ny points have been read in. The file must be in ASCII and end in the extension .DAT  for sequential surfaces and .GRD for files used by NSC objects.

Finally, let me draw your attention to this knowledgebase article which discusses how to write grid files programmatically:

How to write a Grid Sag DAT file programmatically – Knowledgebase (



Userlevel 5
Badge +2

Thank you @Csilla Timar-Fulep !

Have a nice weekend,