Created
December 16, 2020 19:08
-
-
Save daguiam/925356dc3a30fcb4dd2d17f4224d9b79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! ZPL macro for Zemax to initialize multiconfiguration setup for arrangements of angles x and y | |
! with the help from https://osphotonics.wordpress.com/2015/05/21/zemax-programming-language-3-11-multi-configuration/ | |
FOR i, 1, 4, 1 | |
DELETEMCO 1 | |
NEXT | |
! delete all existing configurations | |
FOR i, 1, NCON(), 1 | |
DELETECONFIG 1 | |
NEXT | |
! adding oprand rows | |
FOR i, 1, 2, 1 | |
INSERTMCO 1 | |
NEXT | |
row_x = 1 | |
row_y = 2 | |
! fill oprand config 0 | |
SETMCOPERAND row_x, 0, "PRAM", 0 | |
SETMCOPERAND row_x, 0, 4, 1 | |
SETMCOPERAND row_x, 0, 3, 2 | |
SETMCOPERAND row_y, 0, "PRAM", 0 | |
SETMCOPERAND row_y, 0, 4, 1 | |
SETMCOPERAND row_y, 0, 4, 2 | |
angle_x_start = -60 | |
angle_x_stop = -30 | |
angle_x_step = 5 | |
angle_x_N = (angle_x_stop-angle_x_start)/angle_x_step | |
angle_y_start = -15 | |
angle_y_stop = 15 | |
angle_y_step = 3 | |
angle_y_N = (angle_y_stop-angle_y_start)/angle_y_step | |
total_configs = angle_x_N*angle_y_N | |
PRINT "Adding ", total_configs," configurations" | |
! insert as many configurations as we want | |
! INSERTCONFIG 1 | |
FOR angle_x, angle_x_start, angle_x_stop, angle_x_step | |
FOR angle_y, angle_y_start, angle_y_stop, angle_y_step | |
INSERTCONFIG NCON () | |
index_config = NCON() | |
SETMCOPERAND row_x, index_config, angle_x | |
SETMCOPERAND row_y, index_config, angle_y | |
PRINT "X: ", angle_x, " Y: ",angle_y | |
NEXT | |
NEXT | |
SETCONFIG 1 | |
UPDATE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment