Skip to main content

I cannot for the life of me in the retarded ZEMAX figure out how to do this.  I have 6 CONFIGURATIONS.

 

I want to set THIC on surface to beVariable in configs 1,2,3,and 6. FIXED in 4 and 5.

FORM THE MANUAL:

Syntax:
SETVAR surf, code, status, object
or
SETVAR config, M, status, operand

 So I would use the second version of SETVAR because the “M” says it is for multiple configurations.

So where is the surface number in the command?

Where is the “T” entered for thickness

 

 

Thanks.

 

 

 

@Harvey.Spencer

 

The solve is put on a Multi-Configuration operand (and not a surface), there is no need to specify the surface number and there is also no need to use the status T. The only thing you have to do is tell OpticStudio which operand number is your THIC operand and whether the specific configuration should be variable or not (1 or 0 respectively). If your THIC operand is on row 3, you can write a ZPL like so (assuming you have 6 configurations in total, otherwise replace NCON() by 6):

FIXED = 0
VARIABLE = 1

number_of_configurations = NCON()

target_mc_operand = 3

FOR configuration, 1, number_of_configurations, 1
IF ((configuration == 4) | (configuration == 5))
SETVAR configuration, M, FIXED, target_mc_operand
ELSE
SETVAR configuration, M, VARIABLE, target_mc_operand
ENDIF
NEXT

The | stands for logical OR. I am looping through the configuration numbers from 1 to 6 (included) and if the configuration number is 4 OR 5, I set it to FIXED. Otherwise it is VARIABLE.

In my dummy example, this is the Multi-Configuration Editor after running this macro:

If you want to change the Surface that THIC refers to, it is a different problem that you need to address with another ZPL KEYWORD: SETMCOPERAND. To change THIC to surface 2 you would type:

new_surface_number = 2
SETMCOPERAND target_mc_operand, 0, new_surface_number, 1

The resulting Multi-Configuration Editor becomes like so:

Let me know if this is clear.

Take care,

 

David


Thank you so much!  Its a lot of code to do this, I feel there should be a simpler method, but this is the way Zemax is configured.


Reply