Hi everyone,
I am new here and trying to write a macro for a simple setup that I have. I have a beam at source with specific NA and goes through few optics and get focused on a surface with floating aperture. My inputs are relative position of source/object respect to image in X and Y and output is efficiency at “Geometric Image Analysis”. How can I write such a Macro?
How to write a Macro to scan in XY and get efficiency
Best answer by David.Nguyen
Efficiency from Geometric Image Analysis in ZPL
I’ll start with the efficiency of Gemetric Image Analysis. For that, I’d recommend using the IMAE Merit Function operand. From the Help File of this operand:

Then, assuming you have an IMAE operand in your Merit Function (it could also be added automatically with ZPL):

Retrieving this value in ZPL can simply be done with:
OPER(1, 10)
This ZPL command returns the Value column (identified by the number 10) at row 1 (change this value to whichever row your IMAE operand is). This is a dummy example with the Merit Function above:

XY alignment
For the XY alignment, there are many ways to go about it. But if I understood what you are trying to achieve correctly, it might be easiest to use the Field definition. In your file, under the Setup..System Explorer..Fields..Settings change Type to Object Height. Then, still in the System Explorer, tick the Aperture..Telecentric Object Space:

That way, by change the Field Y coordinate you can laterally move the incoming pencil of rays. This is an example with 3 Fields:

But instead of having 3 Fields, you can just keep one, and use ZPL change the Field Y Coordinate like so:
SYSP 103, 1, 0.02
UPDATE ALL
This changes the Y coordinate (identified by number 103) of Field 1 to the value 0.02mm.
Putting everything together
Lastly, you can scan the field through a FOR loop, and at every field value, you can retrieve the efficiency.
field_start = 0.00
field_end = 0.04
number_of_field_points = 10
field_step = ( field_end - field_start ) / number_of_field_points
FOR ii, 0, number_of_field_points, 1
field_value = field_start + ii * field_step
SYSP 103, 1, field_value
UPDATE ALL
PRINT OPER(1, 10)
NEXT
This is the result with your file:

Instead of printing, you could also do a plot, but I let you check that for yourself as the post is already quite long.
I hope this helps and take care,
David
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.