3-6. Dealing with macros

3-6-1. Creating a macro
3-6-2. Opening a macro
3-6-3. Decompacting a macro
3-6-4. Creating a custom intermediate control panel for a macro
3-6-5. Finding and replacing identical macros

 

A macro is a group of modules gathered together to form a new single module. Creating macros from modules that go together allows to simplify the program and make it clearer. Front panels and intermediate control panels can be created to facilitate the use of the created macros.

3-6-1. Creating a macro

In a diagram, if you wish to gather several functions into a box called a macro, you must start by creating a simple box, or fence. This is done by clicking the left button of the mouse and sliding the cursor to enclose the functions you wish to gather (the box is created when the mouse button is released).

Then you must select this new box by clicking on its border and apply the Create a macro command from the Tools menu (or use the Alt+M shorcut). A small new macro box is generated instead of the selected box and a name is given by default "Macro n". You are automatically entered into the Edit mode to change the name according to your needs.

You may of course open the created macro by double-clicking on it, add or remove pins, change its content, or create a front or intermediate control panel. A macro can be created from a simple box or from another macro. Any macro behaves like any other box : it can be moved, deleted, duplicated or resized exactly the same way.

3-6-2. Opening a macro

A double-click on the macro box with the left button of the mouse shows a new window enclosing the macro selected initially. Each macro in this window can in turn be opened. Any constituent of the macro may still be modified, provided it has not been previously locked up.

If an error is detected when compiling the graph, the Alt+I shortcut may be used to open the successively selected boxes until the erroneous module is shown.

3-6-3. Decompacting a macro

If you want the whole content of a macro to explicitly appear in your program, just click the macro to select it and use the Decompact a macro command in the Tools menu. The macro is then expanded and all its constituents appear. Make sure there is enough free space around the macro before decompacting it, otherwise the neighboring modules will be moved.

3-6-4. Creating a custom intermediate control panel for a macro

Once a coherent set of modules has been gathered into a macro, one may want to create a control panel in which all the necessary parameters appear and can be altered. This can be done very simply :

 

If you want to access the content of the macro, just double-click again on the intermediate control panel to open the mother window.

3-6-5. Finding and replacing identical macros

The List… command, in the Tools menu, with Identical macros checked can be used to show all macros identical to the previously selected reference macro.

The "View/x" macro appears in green as it is identical to the "View/t" macro. The "Macro containing the View module" macro appears in blue as it contains the "View" module. The latter can then be localized by double-clicking as many times as necessary on the macro and its blue framed sub-macros, until the "View" module appears.