Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Launch the AWR SDE from within the NI AWR Design Environment.  Your first step is to start the NI AWR Design Environment.   Save the project to a file named MyFirstScript to help follow along with this guide.    

...

This command adds a new module named Module1 under the Code Modules node in the project  The code module window will also open for editing.   You might need to maximize this window to see the full contents. Notice this command also adds the Sub Main and End Sub code.   

...

Notice as soon as you type the open parenthesis, information displays about the inputs to the function.    The The first input is the message to display in the message box.    The The second two are optional to set the type of message box and the title of the message box.  

...

The section will cover coding a script to create the same circuit as in the linear chapter of the Microwave Office getting started guide.     In general, this will work through the various steps of generating the filter.   Each step will be a function or subroutine in the Sub Main.  The guide will show you how to change the Sub Main and then just the code to implement that function or subroutine.   This organization will make showing the code changes at each step simpler.   

...

Either start a new project or select File > New Project.    Then Then save the project with the name ScriptFilter.emp.   

...

When developing scripts, it is common that the script will change your project.  It is a good idea to have code to clean up the project while you are developing code to save the work of doing manual clean up.   For this example, create a new code module.    Right Right click on the code module, select Rename 'Module1'...

...

For the autocomplete, when you type "project.", you will get a list of the available objects available under the Project object.  

...

As you continue typing, it will match and highlight the closest child object.   For example, typing "project.sch" will show as below.  

...

Notice the highlighted object.   Pressing the Tab key will complete that word. 

...

Note:  If you run the script again, it will create a new schematic with a slightly different name.   

 

The CreateScheamtic CreateSchematic code was done as a function to be able to send up an object for the schematic created.     Keeping track of the schematic reference is vital in case you create objects by name that already exist; you can reference the schematic as created this way.   

...

To make things easier,  run the CleanUp code at the start of the script.     The main subroutine should now look like below:

...