LightTools Enewsletter

May 2016

Not Writing Macros Yet? You Could Be Missing Out on a Lot!

LightTools® provides several different types of Application Program Interfaces (APIs) for a variety of tasks such as writing macros, creating user-defined optimization components, materials, and optical properties. The core macro interface is most commonly used to write macros to automate tasks. Macros provide various advantages, including:

  • The ability to do what you do interactively, but many times faster
  • Easy methods to handle large data sets
  • Integrate LightTools results with additional features from other programs to generate the final results and presentations

The LightTools JumpStart Library now has functions to easily manipulate optical properties

The LightTools JumpStart library provides added functionality such as use of a wild card (*) capability to manipulate multiple data items at once. It also provides a large number of functions for various tasks. The latest addition to the JumpStart library includes functions to manipulate Optical Properties. Examples of JumpStart functions can be found in the following location in your LightTools installation folder:

C:\Program Files\Optical Research Associates\LightTools 8.4.0\JumpStart Macros\Sample Code\

Use the JSSampleCode.xls to test the sample code.

You will often find that it is more convenient (and sometimes necessary) to use a combination of core macro functions and JumpStart library functions in order to write your macro more efficiently. The following example shows how to generate a wavelength-dependent diffuse reflective surface (i.e., color) using the Angle of Incidence scatter model.

The spectral reflectance of the diffuse surface and the corresponding color are shown below:

Spectral Reflectance

For the optical property, we can use only the diffuse component, and set all the specular components to zero as shown in the picture below.

Optical Properties

After setting the common settings for the diffuse-only scattering property, you can insert the wavelength and reflectance percent. First, update the wavelength data.

Wavelength Data
Wavelength Code

After setting the wavelengths, you can see that LightTools has copied our original scatter settings for the wavelength 550 nm to all the new wavelengths. This means we can simply update the two columns, Percent Absorb and Percent Propagate, without having to define any additional data. While JumpStart functions can accommodate this task, we can use a few core macro functions to accomplish the task given the simplicity. We need to select the wavelength in the combo box and set the absorbed percent and propagated percent.

Absorbed percent and propagated percent
Absorbed percent and propagated percent code

The following picture shows the projected view of the simulated surface in LightTools (Spatial Luminance, Color Chart):

Spatial Luminance, Color Chart

The LightTools COM API can interact with many programs, such as MATLAB

Besides EXCEL/VBA, there are many other programs that can be used for macro writing (COM clients). Some common programs are MATLAB, C#, Python, etc. For MATLAB, you can use the latest JumpStart functions and LightTools API in .NET format, using the .NET capabilities in MATLAB. The following is a simple example that shows how to initiate the .NET interface within MATLAB.

.NET interface within MATLAB

For more details and examples, please refer to the API Reference Guide, Appendix D, accessible in the Help > Document Library menu.

If you have any other questions, please email us at

LightTools User Group Meetings 2016

Current users of LightTools are invited to this one-day meeting, which will be presented in two U.S. cities. Learn about the latest developments in LightTools, listen to technical talks, and network with other LightTools users. LightTools User Group Meetings are currently planned for Sunnyvale, CA on September 13, and Marlborough, MA on September 20.

The following agenda is tentative (there may be minor changes in content).

  • LightTools 8.4 New Features and Future Plans
  • Case Studies for LIDAR and Heads-Up Display Applications
  • Effective Usage Of LightTools 2016
  • Advanced Design Module Demonstrations
  • …and more!
LightTools User Group Meeting

Registration will be taken closer to the event date. For more information, please contact email us at or call us at (626) 795-9101. We hope to see you there!