Updated: May 23, 2024
Current Release: V1.0.1.1
Authored By: Ethan Keeler
Downloads
Converter Download
Note: This extension is only available for the Ansys version of OpticStudio.
Beta Notice
This extension is currently in beta release. There may be unexpected bugs or errors, and we encourage you to double check any converted designs. If you have any feedback or information to share with us about your conversions, please contact us at zemax.support@ansys.com. We would also be more than happy to review the Conversion Report with you to help you understand issues with the conversion. Please feel free to share this report (and if possible, the SEQ file) so that we can better understand any failures or limitations.
Introduction
OpticStudio provides an extension for importing CODE V designs. This extension is meant to replace and improve upon the legacy ZPL macro (CodeV to OpticStudio Converter.ZPL). To import a CODE V design, it must be saved as a text-based SEQ file. By reading the CODE V commands, line-by-line, the converter can recreate the design dynamically within OpticStudio. The extension also offers an interface to directly enter the commands, one-by-one, to build or modify a design. It is important to note that not all CODE V commands and capabilities are fully supported by the converter; we are continually improving the tool, but there are some limitations, and converted designs should be validated.
Downloading and installing the extension
You can download the Converter as a ZIP folder attached to this article. To install it, first close OpticStudio. Then simply extract the files in the attached ZIP into your Documents\Zemax\ZOS-API\Extensions folder. Make sure that the executable (‘CODE V Converter.exe’) is at the top level of this folder. Once you open OpticStudio, you will see the CODE V Converter as an option on the User Extension list.
Process to convert a design
After exporting the CODE V design to a text-based SEQ file, you can access the extension on the Programming tab in OpticStudio:
After opening the extension, you will see the main GUI interface. To complete a conversion, simply navigate to the SEQ file and click Convert System. There are a few options available for the conversion:
- The extension of the conversion now has a more detailed and formatted output HTML file. If Show Summary is checked, the HTML summary will open automatically when the conversion completes.
- The Real-time Updates option will show changes in OpticStudio as the conversion executes. If this option is left unchecked, the imported system will be revealed after the conversion completes.
- Normally during a conversion, the current system in OpticStudio will be deleted, and the SEQ commands will create a new system. However, if you have created an SEQ file with commands that you want to modify the current system (without first deleting it), then Append Commands will make changes to the current system.
Once the conversion has completed, the tool will create a rich-text Conversion Report (shown below) as an HTML file output. In this report, it shows information about the conversion, as well as the errors and warnings logged during execution. At the start of the report, there is also a summary indicating metrics, including how many commands failed or the number of commands that were unrecognized.
Command line tool
If you would like to enter commands one-by-one to dynamically change the system, you can instead click the Command Line button. You will then see a command line GUI open. Here you can enter the commands and see how they affect the system. You will also see messages or errors listed in the Command History.
Appendix
Current list of supported commands
The following table shows the commands currently supported by the converter. Please note that even though the command is listed as supported, there may be command parameters or cases which are not supported. If you wish to share information with us about how a command should import or errors that you receive, please contact Zemax support at zemax.support@ansys.com.
GENERAL | |
! | Commented out line |
LEN | Data initialization for a new lens |
GO | Update system |
RDM | Radius mode instead of curvature |
SYSTEM EXPLORER | |
WL | Required wavelength in nm |
WTW | Wavelength weight |
REF | Reference wavelength number |
TITLE, TIT | Lens system title |
INI | Designer initials |
EPD | Entrance pupil diameter |
FNO | F/no of image space cone |
NAO | Numerical aperture in object space |
DIM | Override Dimensions |
DDM | Default dimensions I-inch, C-cm, M-mm |
XIM | Field: X Paraxial Image Height |
YIM | Field: Y Paraxial Image Height |
XAN | X Angle (degree) in object space |
YAN | Y Angle (degrees) in object space |
XOB | Field: X Object Height |
YOB | Field: Y Object Height |
XRI | Field: X Real Image Height |
YRI | Field: Y Real Image Height |
WTF | Field weight |
VLX | Fraction entrance pupil radius clipped off -X |
VLY | Fraction entrance pupil radius clipped off -Y |
VUX | Fraction entrance pupil radius clipped off +X |
VUY | Fraction entrance pupil radius clipped off +Y |
LENS DATA EDITOR | |
S | Increment surface pointer |
SO | Object plane surface definition |
SI | Image plane surface definition |
STO | Designate surf as a stop surface |
INS | Surface Insertion (surface-specific format) |
THI | Thickness insertion (surface-specific format) |
RDY | Radius insertion (surface-specific format) |
CUM | Mirror substrate backside curvature indicator |
THM | Thickness of the mirror substrate |
SPH | Spherical surface type |
SPS |
Set surface type to special shapes QBF – Q-Type Asphere QCN – Q-Type Asphere ZFR – Fringe Zernike |
SCO | Special Surface Operand |
GLA | Glass insertion (surface-specific format) |
GL1 | Glass description, surface 1 |
GL2 | Glass description, surface 2 |
RMD | Reflective/ Refractive mode command |
CIR | Setting up aperture semi-diameter |
ADX | Aperture decenter in X direction |
ADY | Aperture decenter in Y direction |
REX | Half-width of the rectangular aperture, X direction |
REY | Half-width of the rectangular aperture, Y direction |
SLB | Attach a label to a surface (in ZOS: Comment Column) |
PIM | Solve for paraxial image distance |
CCY | Surface curvature control (rotational symmetry) |
THC | Thickness coupling group control |
ADC | X axis tilt coupling group control |
BDC | Y axis tilt coupling group control |
CDC | Z axis tilt coupling group control |
XDC | X decenter coupling group control |
YDC | Y decenter coupling group control |
CYL | Toroidal Surface |
XTO | X Toroid Surface |
YTO | Y Toroid Surface |
ASP | Even Asphere Surface |
A | 4th order coefficient |
B | 6th order coefficient |
C | 8th order coefficient |
D | 10th order coefficient |
E | 12th order coefficient |
F | 14th order coefficient |
G | 16th order coefficient |
H | 18th order coefficient |
J | 20th order coefficient |
CON | Conic surface type (typically followed by "K" operand) |
K | Value of the conic constant (typically after operand "CON") |
GRO | Grating order |
GRS | Grating spacing |
GRT | Grating surface type |
DIF | Specifies a diffractive surface type (2-word command) |
HOE | Holographic Surface |
HV1 | Type of 1st construction point |
HV2 | Type of 2nd construction point |
HOR | Holographic diffraction order |
HWL | Construction wavelength (hologram) |
HX1 | X-coordinate of the 1st construction point |
HX2 | X-coordinate of the 2nd construction point |
HY1 | Y-coordinate of the 1st construction point |
HY2 | Y-coordinate of the 2nd construction point |
HZ1 | Z-coordinate of the 1st construction point |
HZ2 | Z-coordinate of the 2nd construction point |
HCT | Polynomial or hologram information |
HCO | Aspheric phase |
HCC | Hologram variable control |
DIF | First part of 2-word operands (example DIF GRT) |
RET | Solve to coordinate return: Orientation, XYZ |
GLB | Global coordinate data reference |
ADE | Tilt about X axis |
BDE | Tilt about Y axis |
CDE | Tilt about Z axis |
XDE | X decenter |
YDE | Y decenter of axis |
ZDE | Z decenter of axis |
BEN | Decenter and bend for mirrors |
DAR | Decenter and return operand |
LIBRARIES | |
PRV | Start of a Private Glass Catalog |
PWL | Wavelengths in Private Glass Catalog |
END | End of description of the Custom Glass Catalog |
HAR | Hartmann dispersion formula |
LAU | Laurent dispersion formula |
GML | Glass Manufacturers Laurent dispersion formula |
GMS | Glass Manufacturers Sellmeier dispersion formula |
SLM | Sellmeier dispersion formula |
CAU | Cauchy dispersion formula |
MULTI-CONFIGURATION EDITOR | |
ZOO | Zoom position |
TIT | Title (per configuration) |
EPD | Entrance pupil diameter |
FNO | F/# System Aperture value |
CIR | Circular Aperture |
ADE | Tilt about X axis |
BDE | Tilt about Y axis |
CDE | Tilt about Z axis |
XDE | X-decenter |
YDE | Y-decenter |
ZDE | Z-Shift |
THI | Thickness |
CUY | Curvature of surface |
WL | Wavelength (no support for config specific) |
REF | Primary wavelength number |
WTW | Wavelength weight |
WTF | Field weight |
XAN | X Angle (degree) in object space |
XIM | Field: X Paraxial Image Height |
XOB | Field: X Object Height |
XRI | Field: X Real Image Height |
YAN | Y Angle (degree) in object space |
YIM | Field: Y Paraxial Image Height |
YOB | Field: Y Object Height |
YRI | Field: Y Real Image Height |
GLA | Glass |
GL1 | Glass description, surface 1 |
GL2 | Glass description, surface 2 |
RMD | Reflective/ Refractive mode command |
VLX | Fraction entrance pupil radius clipped off -X |
VLY | Fraction entrance pupil radius clipped off -Y |
VUX | Fraction entrance pupil radius clipped off +X |
VUY | Fraction entrance pupil radius clipped off +Y |
Comments
Please sign in to leave a comment.