Skip to main content

Hey Zemax Team,

I have another suggestion for a feature that would make ZPL even more useful: A Settings dialog box.

I’m writing a macro that traces rays, so it has something like:

    hx = .5

    hy = 0

    Px = 0

    Py = .5

    primary = PWAV()

This is fine except when you want to change the ray traced easily. I have to edit the file, save and rerun, or use the INPUT keyword which only accepts one variable at a time. It would be ideal if ZPL supported a generalized Settings dialog like so:

 

The ZPLSettings dialog would include drop-downs for wavelength, field and surface, and have say 10 data input variables and 5 check boxes. The user could ideally set all these to draw/not draw individually, and could define the labels used. It would be far more flexible than just using INPUTs

  • Mark

Hey Mark,

I 100% agree with this.  When the CodeV to OpticStudio Converter was ported from a compiled DDE to ZPL, Zemax added the BROWSE dialog box; this was a trivial add since it was just a slight variation on the INPUT box but extending ZPL to include an form would be amazing.

Although it might not look pretty, I would use the following logic:

  • Create 2 new keywords FORM and ENDFORM;
    • These would act like PLOT and PLOT GO where all the intermediate commands have to be between these 2 keywords
    • A form would only have an OK and Cancel buttons; these would be added automatically by the ZPL
      • The form will be modal
      • OK will continue the ZPL execution with the user inputs as variables
      • Cancel will stop the ZPL execution (same as calling END in the script)
    • If the programmer does not use the ENDFORM keyword, then an error will be thrown in the ZPL PreProcessor
    • A form will only have 2 columns, the left column for the control label and the right column for the control itself (the FFT MTF example above would become twice the height and half the width)
  • Only have LabelCheckbox, Combobox, and Textbox with labels
    • Label
      • No control associated with this
      • ex: LABEL “This is an example label”
    • Checkbox
      • Variable will be treated as an integer (no $)
      • Initial value can will be either 0  or non-zero   
      • If 0 then the checkbox is unchecked by default; if any other number then the checkbox is checked by default
      • ex: CHECKBOX “Use Polarization”, pol, 0
    • Combobox
      • Variable will be treated as an integer (no $)
      • Each new drop-down option will be separated by a comma (very similar to the functionality of the $GETSTRINGC() String Keyword)
      • Return values will be the index of the Combobox
      • ex: COMBOBOX "Type", type, "Modulation, Real, Imaginary, Phase, Square Wave"
        • Return would be 0 for “Modulation”...and 4 for “Square Wave”
    • Textbox (used for both numerical values and string values like filenames)
      • Variable will be treated as a string (need $)
      •  Programmer can use SVAL to convert the string to a double value if needed
      • ex: TEXTBOX "Maximum Frequency", maximum_frequency$, "0"

To recreate the FFT MTF settings box, the following code would work:

And the form would look like:

This preserves all the current rules for ZPL and the Pre Processor.  Only 6 new keywords will be needed so the implementation would be straightforward.


Indeed so! For next release, @Tom Pickering ?

😀


Reply