Compiling and Running Macros

Previous pageReturn to chapter overviewNext page

Compiling project

To start compilation, use the following option:

clip7712        <Ctrl><F7>        Compile        

Project compilation is a required action before executing the macro. When compiling, the system analyzes the macro code and finds errors. Compilation errors occur when the system fails to interpret the input text. Those errors could be due to incorrect syntax of an instruction or due to specifying an incorrect method or property.

 

«Output» window

The «Output» window is located at the bottom of the macro editor. It serves for displaying messages about the current state of the project. Errors and warnings resulting from project compilation are displayed in this window.

clip7713

An error message displayed in this window contains information about the error location in the code window (line and column number) and the error number.

To jump to an error location in the code window, you can either double-click clip7714clip7715 or call the option «Go To Error» from the context menu accessible by right clicking clip7716.

The error type and information about the error can be found in the Microsoft Developer Network (MSDN) application development guide by the code displayed within the error message in the «Output» window.

clip7717

Upon a successful project compilation, the macro will be added into T-FLEX CAD «Macros» window and can be executed thereafter.

 

Running macros

There are several ways of launching a macro for execution.

First of all, a macro can be run directly from the macro editor by the command:

Keyboard

Textual Menu

Icon

<F5>

«Run Default Method»

clip7718

 

Since a module can contain multiple macros (procedures), you need to tell the system which procedure to run. To do this, you need to select the default method (macro) in the command «Project Properties».

If the method was not specified initially, the «Choose Macro» dialog appears, letting you to select the method to be run by default. In this dialog, you can select any desired method from the list provided for the current project, or click the button [Set Manually] and type in the method manually in the coming up «Set Macro» dialog: defining the namespace, the class and the name of the procedure to be run.

clip7719        clip7720

The selected method will be launched. If the module's code was modified before launching the method, then, upon activating the command «Run default method», the system will prompt you for recompiling the project.

As it was mentioned earlier, a macro can be launched for execution from the T-FLEX CAD «Macros» window as well by double-clicking clip7721clip7722 the selected macro.

Additionally, a macro can be launched by clicking clip7723 a «Button» control created by the «Controls» command in the T-FLEX CAD document. That particular control can be added the «Run macro» action. For more details on the steps of creating a button control, refer to the chapter «Control elements. Creating custom dialogs».  The figure below depicts the result of running the macro that creates a construction circle and a text string wrapped on the circle. The code of this macro was shown above as part of the module's code window description.        

clip7724        

clip7725