Cylindrical systems are only a little more complex, because these systems are focal in one plane and afocal in the other plane. From the zip archive, open the file cylindrical_lens.zmx:

A cylindrical lens

This shows a cylindrical lens, which has a flat rear surface, and a toroidal front surface. This lens is intended to produce a line focus, with the smallest spatial extent in y and the smallest angular divergence in x. This is easy to do.

Again, open the merit function editor and the default merit function tool. Set this as follows:

Set up the merit function for the minimum spot measured in the y-direction.

This will build a merit function that will minimize the y-spot size. Scroll to the end of the merit function, and note that ZEMAX has entered 42 lines of operands. Then use the default merit function tool again:

Now minimize the angular deviation in x

This build the operands to control the angular spread of the beam in x. The reason we start at line 43 is that we want to keep the spot-in-y operands: so, this merit function will require the smallest spatial extent in y, and the smallest angular extent in x: a line focus. The optimization variables are the y-radius, x-radius and back focal distance. Optimize, and ZEMAX again quickly produces the best system.

Note that this technique can be extended using the IMSF operand. IMSF allows the image surface to be re-defined on the fly in the merit function. Therefore, if a system is focal on surface 10, but afocal on surface 6, it can be easily modelled by building an Angular Radius merit function, with IMSF=6 immediately before it in the merit function, and then adding an RMS Spot merit function with IMSF=10 immediately before that.

Note also that the multi-configuration operand AFOC allows the afocal mode to be zoomed between configurations. The ZPL keywords GETSYSTEMDATA and SETSYSTEMPROPERTY allow control of the Afocal Image Space switch from within a ZPL macro.