CODE V Designer Blog​

Writing Macros for Optical Systems Design: Exciting New Developments for CODE V Users

Picture of k2_support

k2_support

cooke triplet code v command line debugger
Table of Contents

Many CODE V Power Users eventually gravitate to writing scripts or macros to refine their projects. If you’re already writing scripts in CODE V’s Macro+, you know how useful it can be. But you also know that it can be incredibly time-consuming; you’re probably so used to the lengthy, iterative process that it’s second nature to you. 

Spend Less Time on Macros & More Time on What Matters to You!

But CODE V users can now access a new editor through K2 Extensions, and our current users are seriously excited. They’re discovering that the debugger reduces macro writing time, which frees them up to focus on what truly matters to them—finding optical design solutions—rather than spending all their time sorting through code. 

Less Time Checking Code, More Time Developing Your Lens Design. 

K2realm delivers all the features you expect from a modern editor, including two notable components that users are especially excited about: the convenient syntax help and the time-saving, interactive debugger

Syntax Help: Put Away The Reference Manual

How often do you find yourself turning, again and again, to the reference manual to track down the syntax for a command? For most power users, the answer is “too often.” How would you like to stop doing that?

With the new syntax help feature, options will populate as you begin typing commands. Any CODE V function or command will list all required parameters with a simple keypress (think Google auto-complete).

This syntax help is available in both the script editor and the command line directly. The auto-completion of variables helps avoid typos and eliminates the need to consult the reference manual constantly.

A Modern Debugger for CODE V Macros

You know this story. You’ve spent hours writing a macro, but you’re not getting the numbers you expect. Usually, this requires repeated use of WRI and RTN statements, added at various locations in the code, rerunning to print data to the window—over and over until you find the single point causing the problem. 

But for CODE V users with K2 Extensions, this protracted process is now just memory.

Stepping Through Code

Instead of modifying the code with WRI statements, rerunning the macro, and printing values, now you can step through the code line by line like any modern debugger. Watch lists allow you to look at any particular variable’s value while in debug mode. Your watch list can include variables and CODE V expressions (e.g. (thi s2) ); add or remove them with ease with no need to modify the code.

That means you can choose what variables to inspect on the fly—without stopping and rerunning and adding WRI statements! 

command window debugger for CODE V optical design software

What’s more, you 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.

Learn in Less Time Than it Would Take you to Debug Your Next Script

Thanks to its intuitive functionality, the new editor from K2realm is easy to learn. The editor/debugger has a natural feel and interface. If you’re already writing scripts in CODE V, you can learn the new debugger in less time than it would otherwise take you to debug your next project.  

Or, if you’ve been thinking about writing scripts to refine your projects, there’s never been an easier way to start. K2realm now offers one-on-one and group training, so you can learn how to use the editor / debugger and all the other time-saving features in short training sessions.

Power users know that writing scripts lets them take full advantage of the power of CODE V software. Whether you’re already writing macros or just beginning with scripts, you’ll love the modern feel and new features in this command environment, and its interactive and intuitive nature makes it quick and easy to learn.

Your Priorities are Important to Us

We want you to spend your time on what’s important to you. We offer a free trial download of our optical design software because we’re confident it will increase productivity and improve your end product. Try K2 Extensions out today.