Table of Contents
In the following sections, we will create a macro module based on the applicator we have built in the Open Inventor example chapter, adding fields and scripting for dynamic control of length and diameter of the applicator.
If you have not followed our tutorial, please open the
Our first global macro needs an internal network. We will use the Applicator module group as this network.
For a start, open a new network tab (File → New or a keyboard shortcut) and copy and paste the applicator modules (Edit → Copy, Edit → Paste or the respective keyboard shortcuts) to the new network.
You can select the Applicator group with a double-click on its title bar and just copy the group.
Clean the automatic instance names of the modules — as they will be used for a new macro, there is no need to have names like “SoTranslation2”. Remove all numbers and write all module instance names starting with capital letters (if you want to) by right-clicking the module and selecting Edit Instance Name from the context menu.
In our example, this is the resulting network:
When the module names are cleaned up, save the network at some convenient location. On creating the global macro, this network will have to be referenced and is copied to its final destination on finishing the creation of the global macro.
Open the File → Project Wizard and choose Macro Module.
Enter the properties for your new module.
The name as entered above is displayed, for example
ApplicatorMacro. You can edit the name
here. The module name has to be unique within the MeVisLab module
database (including the SDK module database). Therefore, you may
need to change the module name slightly in case of a
Enter your name or initials. The author entry is mandatory and will be used in module searches.
Enter a short description for the module. The comment entry is mandatory.
The optional keywords should be the terms other users might search for, e.g., “applicator” in this case.
The optional See Also entries should list other, related modules that might be of interest for a user.
Enter the genre. Genre entries are mandatory; they define the place of the module in the Modules menu and the Module Browser. For suggestions, check out similar modules in the database.
The macro module wizard offers to choose from a tree of available genres:
The genres are not carved in stone but developed over time, so there might be more than one fitting choice for your module. You may even want to add a new genre in
Add reference to example network:
Each module should be completed by an example network to
explain its function and usage in an exemplary application. Check
to create an empty example network
ExampleModuleName.mlab which may be edited
User defined modules are grouped in projects. Enter a new
project name here: “ApplicatorMacro”. The module will
be installed in the
Project Path in the
Select a Target Package from the list, for this example “Example/General” as created in Section 8.2, “Creating a User Package for Your Project”.
Only existing Target Packages can be selected; if you want to use a new one, you have to create it before creating the module.
On this tab, browse to the previously saved network and set it as the Network File Name.
You might leave the option to add Python scripting unchecked as we will add the scripting file later on manually in this tutorial.
Now that the macro module and its necessary files are created,
the file browser (depending on your system) will open and display the
folders and files. In our example, we have a package group
“Example” with the package “General” and in
the folder Modules/Macros the new
ApplicatorMacro with the files
.def: module definition file, for
registering the module(s) to the MeVisLab module database.
.mlab: network file which includes the
modules and their settings.
.script: MDL script file for the panel
and from which Python code may get called.
On the workspace, the previously visible network is now displayed as one macro module.
To display the internal network on a second tab, right-click the module and select Show Internal Network from the context menu. Alternatively, you can hold Shift and double-click the macro module.
© 2021 MeVis Medical Solutions AG