Anyone using CODE V from beginners to seasoned experts recognize the benefits of creating your own custom analyses and plots. Whether you need to generate a custom definition of distortion, plot your own unique aberration components, or just loop through your fields to check aperture clearances. Using K2 Extensions’ editor / debugger simplifies the task in significantly less time than it takes to learn how to use it. Read more in our blog Writing Macros for Optical Systems Design: Exciting New Developments for CODE V Users.
Take Command of Your Optical Design With K2 Extensions' Editor / Debugger
K2 EXTENSIONS POWERED BY CODE V OPTICAL DESIGN SOFTWARE
K2 Extensions offers a new editor with debugging capabilities to help the user with these tasks. There are three main areas where users benefit:
Editor
Code highlighting, code folding, and syntax help
Debugger
Execute code line by line, set breakpoints, and watch variables
Project Environment
Easily save/load any set of macros, lens files, or presentations to manage your projects
Editor

The biggest benefit is syntax help to avoid opening the reference manual. As code is typed, any CODE V function or command will list all required parameters with a simple keypress (CTRL+SPACE).

Not only functions, but any CODE V macro inputs will show up in a pop-up window. This includes your own user-defined macros as well and does not require any custom modifications. This syntax help is available in both the script editor and the command line directly.
Auto-completion of variables is very helpful to avoid typos. And the ability to collapse blocks of text like for loops and if statements, makes it much easier to read and navigate complicated code.


Additional features you can expect from K2 Extensions’ new CODE V editor:
-
-
- Bookmarks
- Search results with wildcards and regular expression syntax
- Dark or light color themes
- Standard docking window layouts
-
Debugger
While the syntax help is a great time saver when writing a CODE V macro, the ability to step through the macro line by line is a huge benefit when trying to get the logic correct. Gone are the days of adding RTN and WRI statements to exit the macro and print data to the window. Now users can set breakpoints at any point to pause execution, look at the values for any variables or arrays, and continue stepping through the code and watch the variables to verify the logic is correct.
When stopping at a breakpoint, users can add custom logical expressions known as ‘conditional breakpoints’. For example, only pause execution if some variable, or lens parameter, reaches a user entered target (^i > 9 – or – thi s1 > 1.5).
To make it easier, there’s a special command to show full array contents in a grid format.


You can also use any CODE V command during debugging to view the lens, run any analysis or print lens information.

Project Environment

Not only does this new editor make macro writing more efficient, it also provides a convenient interface to manage the many files typically needed for a design project. The file management tree is very much like Windows Explorer with the ability to add/remove any desired file, organize into groups, and run with a click.
Keep a collection of .seq files that you need for your design in one folder, and use another for a history of lens changes. To load or run any .seq file on your lens, just double-click.
These changes can be documented in a Word document to keep design notes handy, or a Powerpoint presentation for colleagues. Double-click to open at any time.
Any project environment can be loaded at any time, and it also restores the directory when it was last saved. This allows users to conveniently switch between projects for different customers, since multi-tasking is required for any optical designer.