Measurement Plans (MPs) is the name given to the scripting capability built into SpatialAnalyzer. MPs are similar to macros in that they can repeat a series of steps for you—but the similarities end there. MPs actually have significantly more capability—scripts make calculations, branch to different behavior based on decisions, gather user input, read and write to files, and execute custom code. In that sense, scripts share more traits with a programming language than a macro.
True programming languages such as C++ have a complex syntax, often take many years to master, and have a high learning curve. MPs are designed to share as much capability as possible with programming languages while still dramatically lowering the learning curve compared to learning a programming language.
Scripts can vary from simple utilities constructed in just a few minutes to comprehensive inspection plans that provide go/no-go automation and drive other machinery such as robots or CNC machines.
MPs are available for editing and executing on SA Ultimate or higher. They cannot be created, edited, nor executed on SA Professional.
MPs can be saved in a couple of different ways:
Embedded Scripts - are saved as part of a job file and stored in the SA Tree structure.
External Scripts - are separate and independence files of the format *.mp or *.mpxml
MPs can be imported as embedded files and embedded MPs can be exported as separate files at any time.
An embedded MP is stored within an SA job file and listed in the tree. This allows an MP to be part of a particular job file and easily accessed as part of a templated operation.
To run an embedded MP, simply double-click on the MP in the tree.
Embedded Measurement Plans have the benefits of:
Are stored as part of the SA file, therefore are easier to find and bundle with a script.
Are easier to execute and edit, since you can access them directly from the tree.
But also have the following drawbacks:
May not work if you need to create a new SA file or load an SA file as part of the script, since such actions will clear the embedded scripts from the tree.
Make version maintenance, reuse, and distribution of scripts more difficult, since you need to export the script to a separate file in order to use it with other SA files.
Important NOTE. Exits to an embedded MP must both be saved in the script and then the SA job file needs to be saved in order for the changes to persist because the version of the script is saved within the SA job file.
An MP can also be saved (or exported) as a standalone ( *.MP) file on the file system. It can then be easily transferred from machine to machine and is completely independent of any job file. To run an external file, simply drag-drop the MP into SA's graphics.
External Measurement Plans have the benefits of:
Are much better suited to script maintenance, reuse, versioning, and distribution.
Are able to work with any scripting commands—creating a new SA file or loading an existing file does not create problems.
But also have the following drawbacks:
Are stored as a separate .mp file, therefore you must navigate to the file to execute it.
When an MP is run, it does not run in the editor but opens within the MP Bar. The current status of the operation is then shown within the MP Bar:
The MP can either start automatically or wait in the MP Bar to be started. This behavior is controlled by a setting in on the Automation tab of the User Options.
The Green button starts the MP and will run it.
The Play / Pause button can be used to walk the MP through one step at a time.
Press the Done button to close the MP script. Note that the X on the MP Bar will not stop an MP operation, it will only hide the MP bar.