Creating Custom Automation in Valor NPI Using Scripting Languages

custom scripting for Valor NPI
Computer user automating DFM using Python or Perl

Over the years, automation has evolved from the C-Shell, to Perl and now Python as the wizardry world has recently slithered into Valor NPI. We use automation to take on tasks that are overly complex to simply repetitive. With a little experience creating automation for Valor NPI is incredibly rewarding. Whether the development requirement is an hour long, a few days or even weeks, the basic understanding is exactly the same.

Test drive Valor NPI for 30 days>>

The first step is to choose the language to use. The most modern language supported and delivered with Valor NPI is Python. If Perl is your language of choice then an additional module needs to be acquired through Active State. When all else fails there is the legacy C-Shell that is also included with Valor NPI. The C-Shell lacks many basic capabilities found in modern languages and should be avoided except for the most basic automation. While it is not possible to transfer the required background to begin development it is possible to give some insight on how automation goes from a thought to generating results.

The language is important because the way variables and data structures are supported and the methods used to control the program flow are different. The truth of the matter is, each language has an approach and for the type of automation required for Valor NPI either Python or Perl are certainly sufficient. I suggest staying away from the C-Shell for most automation tasks because it is fundamentally old and the language lacks definite variable declarations, data structures and even basic mathematical capabilities which are critical.

Linking the language to Valor NPI

Once a language has been chosen, the next step is to connect the language to Valor NPI. Most interaction with Valor NPI is done through the use of line mode commands. Line mode commands perform everything – opening the Graphic Editor, displaying a layer, adding a line, etc. Almost every step taken in Valor NPI results in a generation of a unique COM command instructing Valor NPI to perform some action. Automation takes these COM commands, connects them using variables and controls the flow through the use of the selected language.

There are times that information contained in the ODB++D product model which Valor NPI acts upon is required to control the automation flow or as part of a COM command. Valor NPI provides the INFO command as a means to collect this information into data structures that is then used by the language of choice. This makes the automation task very powerful and adaptive since ODB++D product models are virtually never identical.

To create custom interfaces, for example to retrieve a response from a user, an additional module is required for both Python and Perl referred to as Tk. Information obtained through the Tk generated interface become variables that then add a greater deal of flexibility to the automation by flow control and COM commands.

Creating automations – the sky is the limit

So let’s connect the dots with a basic automation need to draw a 1 inch grid on a layer that is 10 inches square. Using flow control you would employ mathematical loops to divide the 10 inches vertical and horizontal dimension in 1 inch intervals using the COM command to create multiple line segments 10 inches long. The next challenge may be to keep creating a 10 by 10 grid but the size of the layer is defined by the ODB++D product model. Here the INFO command can be used to obtain the size of the layer. That introduces two variables for the X and Y dimension that is then used to divide utilizing the previous logic only with a variable grid dimension.

Finally, perhaps the number of grids to divide the variable layer size into is the next challenge. Now using Tk the automation first inquires with the user through a custom interface, that then drive two other variables into the automation, number in X and number in Y. I have found that when a programmer can tackle this task successful then the sky is the limit when it comes to creating automation for use by Valor NPI.

Hello world.

Leave a Reply