Skip to main content

Hello



I frequently use standard lenses in NSC modeling such as for imaging a light source onto a detector, fiber etc. Prior to optimizing them the lenses would be roughly 'created' in situ i.e. in the NSC Lens Editor. As an old school optical designer I need a feeling for magnification of the optical system I am setting up. It would help in determining the magnification if I knew the individual (paraxial) EFLs of the lenses in my setup.



Any quick way?



Thank you,



Dusan

Hi Dusan,



Not sure if this helps, but take it from a new schoold optical designer :D



What about a macro solve?





# This is a macro solve to set on the Y Position of a Null Object

# Lens position identified by the X Position in the same Null Object

lens = NPOS(1, SOSO(1), 1)

# This is the refractive index at wavenumber 1

n_lens = NPRO(1, lens, 200, 1)

# These are the radii

R_1 = NPAR(1, lens, 1)

R_2 = NPAR(1, lens, 6)

# This is the thickness of the lens

thick = NPAR(1, lens, 5)

# Lensmaker's equation

focal_length = (n_lens - 1) * (1 / R_1 - 1 / R_2 + (n_lens - 1) * thick / (n_lens * R_1 * R_1))

focal_length = 1 / focal_length

# Solve return

SOLVERETURN focal_length


Put a Null Object after your lenses, and use the X Position as the lens object number you desire the focal length for. Put a Macro Solve on the Y Position, and it'll return the focal length as per the Lensmaker's equation.



See my example attached to this post.



Let me know if its helpful.



Take care,



David


Sorry, I'm having issues with the forum. Hopefully the file gets attached now.


Hi David



Thank you, this is an excellent idea and it works well.



Is there an easy way of selecting the macro from the list or it has to be typed in?



Also, please, be so kind as to explain the meaning of SOSO(1) in the 1st equation and meanings of NPRO and 200 in 'n_lens' equation.



Best regards, Dusan


Hi Dusan,



 



From what I know, I think it has to be typed in.



Of course, SOSO(1) returns the number of the calling Object where the SOLVE is. For example, if your Null Object 17 has the solve, it'll return the number 17. There are two ways of using this numeric function, the other one is SOSO(0), and it returns the surface number in sequential systems.



NPRO is used to retrieve properties of objects in NSC, the number 200 is the code for the refractive index, and the last number 1 is the wavenumber. The syntax is:

















NPRO(surf, object, code, face)





If you need more help about the ZPL, have a look at what's been discussed in this post.



Let me know if this is clear.



Do you want to elaborate on why you'd use something like that in your application? I'm being curious here.



Take care,



 



David



 


Hi David



Thank you. One has to learn quite some codes for writing a macro...



The application: I am experimenting with aspheric lenses instead of a e.g. CPC to image a LED on a small detector with the best possible efficiency: LED --> asphere (collimator) --> focusing lens --> detector. As you know LED is a finite object and apart from collecting as large as possible radiance angle one has to image it (I think) properly on the detector. So, if the focusing lens is given one has to approx. know the focal length of the aspheric lens in order to adjust the magnification...



Best regards, Dusan


Hi Dusan,



Thanks for sharing those insights.



There's an entry cost to the ZPL macros, but once you get use to it, it can really speed things up.



Take care,



David


Nice macro David!



Dusan, to get quick access to a macro, you can add it to the Toolbar:





(1) select the seq or NSC toolbar



(2) in the search bar, enter ZPL to show only macros



(3) drag the selected macro to the toolbar



and you now have one-click access to it.



- Mark



 



 


Hello Mark



Thank you for this suggestion. I managed to drag the macro to the toolbar but that was about all.



I go to the desired cell, select ZPL Macro for Solve Type, click in the empty cell of Macro and afterwards on the macro itself in the toolbar. A Zemax Error appears...



Please, advise.



Thanks, Dusan


Sorry Dusan, the toolbar is only for running macros, not filling in the editor dialogs. I misunderstood your request.


Apologies for a very basic question as I am new to Zemax.



How do I replace a standard lens with a cylindrical lens in a non-sequential model?



Our esisting model uses a standard lens to model a spherical mirror and I would like to make it a cylindircal mirror.


Hello



Try to replace 'standard lens' with 'toroidal surface'. Read Manual for correct input of parameters. Use MIRROR for material.



Regards, Dusan


Thank you Dusan, that worked well and I managedf to add a reflective cylindircal surface at one end.



My input mirror had a hole (which was achieved with the standard lend and a cylinder volume and a bolean CAD to subtract the cylinder from the lens and create a hole.



THis does not seem to work with a toroidal surface. Is there a way round to this?



Regards



Giuseppe


Hi Giuseppe



I am not a top expert on Boolean optics but it may work with volumes only. I would try to replace toroidal surface with a toroidal lens, leave MIRROR for material and then use Boolean approach to create a hole.



Regards, Dusan


Thank you Dusan,



that worked well



Regards



Giuseppe


Hi Giuseppe,



I think this can also be solved in a simpler but elegant way by using 'nested objects'. Place two identical toroidal surfaces after each other with zero distance between them. First surface should have MIRROR as material and 2nd surface air (empty cell). The 2nd toroidal surface should have semi-diameter equal to the semi-diameter of the hole you want to have in the mirror. Done.



Let me know it it works.



Dusan


Reply