Additional Tools for Customizing and Organizing Projects
In this section, you will learn how to:
- Use scripts to streamline tasks in EMPro
- Define your own universal parameters
- Store object definitions externally to reuse them in multiple projects
- Organize objects in your EMPro project for more convenient access
EMPro provides several tools to facilitate the creation and organization of projects.
- Parameterization is a powerful tool that makes it easy to define variables and functions in one convenient workspace window, which can be referenced anywhere within the EMPro interface. Additionally, Parameterization can be used in conjunction with scripting to sweep through a series of parameters (i.e., multiple antenna lengths) to run a calculation at every swept point. In EMPro, parameters are defined in the Parameters workspace window.
- The Scripting workspace window makes it convenient to write scripts to accomplish tasks that are specific to an EMPro project. It provides users with the ability to create fully-customizable functionality within the EMPro interface that is specific to their own tasks. Scripting may be useful for quickly performing repetitive tasks, referencing external files, employing a series of modeling operations at once, or virtually any task that is tedious with the standard EMPro tools.
- Libraries provide useful means of storing definitions and any types of objects created within an EMPro project. They are saved in the Libraries workspace window as files that are not attached to a specific project so that they can be referenced again and again. They are very useful for creating new projects that reuse definitions and objects from past projects. Rather than having to rebuild a project from scratch, pertinent libraries can be imported so that time is not wasted redefining similar objects and properties.
- EMPro also provides various features that help in grouping and organizing definitions and objects. The Groups branch of the Project Tree functions to store shortcut groups, which are groups of objects that are added and organized by the user. Similarly, Assemblies are user-defined groups of geometric objects that are added to the Parts branch of the Project Tree. They are convenient, especially for projects that contain a large number of parts, so that objects in the tree remain organized and easy to access.
Parameters Workspace Window
The Parameters workspace window enables you to define parameters that can be used in other places in the project to parameterize their project. A parameter can be referenced in any dialog box in EMPro. It can have a simple numeric value or a mathematical expression, and can reference other parameters.
The Parameters workspace window can be accessed at any time by right-clicking in the tabbed workspace or selecting the window in the View menu of the Application Menu Bar.
The Parameters workspace window
The Parameters workspace window contains four fields: Name, Formula, Value and Description. Note that a value named 'timestep' is already present upon opening this window.
A new parameter is added by clicking the button above the table of parameters. A new line with default values will be added to the list of parameters. These values can edited by double-clicking on any value. The |Tab| key will scroll through the columns of the table and the |Escape| key will cancel any changes that have been made to a parameter entry.
The Formula column is where a user will input a mathematical formula or a simple numeric value that will define the value of a given parameter. This formula can reference other parameters that have already been defined.
The Value column is a read-only column that displays the evaluated value of the parameter. If an invalid formula is entered, an error message will appear within this field with a description of the invalidity. Simply hold the mouse over the error message to view this description.
Similarly, a parameter is deleted by selecting the unwanted parameter and clicking the button above the table. If a parameter is deleted that is referenced within another parameter's definition, an error message will appear since the parameter that is referenced is no longer defined.
Each parameter is referenced by its assigned name defined in the Name column of this window. For instance, a parameter named "length" can be referenced at any time by typing "length" into any dialog box within EMPro, and it will assume this defined value.
A sweep over a parameter may be set up in the Simulations workspace window. For more information, refer to Simulations Workspace Window.
Scripting Workspace Window
The Scripting workspace window enables you to create, edit, manage, and execute user-defined scripts, which are capable of gathering and reporting information from the EMPro project or making changes to the project. Scripts are blocks of Python scripts that use EMPro as module. They are typically used to automate repetitive or tedious tasks (that could otherwise be done through the EMPro GUI) with greater speed and precision.
The Scripting workspace window
Parameters that have been defined in the active parameter list of the Parameters workspace window may be referenced within any script. A consequence of this ability is that changing a parameter in the parameter list may change the behavior of user-defined functions.
There are a dozen of example scripts included. You can launch the demo by using the menu item Help > Scripting Demo.
Demo Scripting Window
EMPro Scripting Language
All scripts in EMPro are written in the Python scripting language.
For more information on Python, visit the Python Software Foundation homepage at http://www.python.org or use the Help functionality within EMPro.
New Python Script
Select this icon to bring up a New Python Script tab where a new Script can be defined. The script is not executed until the Execute Python icon is pressed.
Select this icon to commit a change to a script after an edit.
Select this icon to "revert" or abandon an edit. Any changes that have been made in the editor will be lost, and the editor will revert back to the script that was stored in the EMPro project or application.
Clear Output Window
Select this icon to clear the text in the output window where error messages and script output are written.
Search and Replace
Select this icon to search for text within scripts. By selecting the Replace With check-box, text can be located and replaced with the desired text.
Select this icon to execute a macro from one of the user-defined scripts.
Libraries Workspace Window
The Libraries workspace window enables you to create libraries or collections of objects grouped by category so that they can be easily referenced during a project and can be accessed in subsequent projects. This makes it very easy to access commonly used objects and definitions so that they do not have to be recreated during every project.
The Libraries workspace window
Creating a New Library
To create a new library directory or subdirectory, click on the button above the Libraries space in the workspace window. Specify the name of the location to store the new library file.
Accessing Existing Libraries
To access an existing library, click on the button, navigate to the appropriate directory, and select the desired library to load into the project.
Adding Objects and/or Definitions to a Library
To add objects of definitions to a library, simply drag the desired object from the Project Tree into lower workspace entitled Object/Notes. The object will be placed in a library grouping that corresponds to its original position in the Project Tree. For example, a Material dragged from the Project Tree will be placed in the Materials folder of the Library. Additionally, filters can be applied to library objects to control the visibility of each group. They are controlled in the Filters section of the Libraries workspace window.