Working with Macros

Предыдущая страницаВ началоСледующая страница

Macro in T-FLEX CAD is a program written in one of the programming languages ​​using the Open API TFLEX CAD functions. Using macros, you can automate the execution of various actions with T-FLEX CAD documents, reducing the number of actions. performed by the user to a minimum.

The macro is executed as one command, i.e. once the macro is run, the entire set of actions inside it (calculations, work with T-FLEX CAD objects, output of results, etc.) will be performed.

For a detailed description of the API functions, see the Open API help. Help can be called in the Help drop-down menu in the upper right corner of T-FLEX CAD.

Macros can be used to work both with a 2D drawing and with elements of a 3D model. Let's give one more example. In the process of creating assembly three-dimensional models, when connecting parts, the user has to create grooves and holes in the attachment points and insert fragments of fasteners with certain parameters. You can reduce the number of user actions by writing a special macro, when you run it, the user will only need to select the LCS. And to create holes in the part, select the required set of fasteners with certain parameters and insert it into the assembly will be a macro. In this case, a large number of actions that the user had to perform manually is replaced by two: running a macro and selecting an LCS.

These are just a few examples of where macros can be used.

Macros are created and stored inside T-FLEX CAD *.grb files. From a programming point of view, the *.grb file in which macros are created is a Project. Each Project can contain an unlimited number of macros.

To display the macros available for execution and actually launch these macros for execution, a special service window Macros is used. In order for a macro to be available for use and displayed in the Macros window, a document with it must be open in T-FLEX CAD.

Modules, forms, links, projects of macros can be copied. If the target project contains a module with the same name as the inserted one, a new name is generated for the latter by adding a number in parentheses. Attempts to insert forms and links with already taken names are ignored.

Storing a macro inside a specific *.grb file does not mean that this macro can only be used in this document. Any macro from the Projects currently open in T-FLEX CAD can be run for execution (regardless of which document is active in the T-FLEX CAD working window).

You can make macros of any Project available for execution without opening the Project file in the T-FLEX CAD window. To do this, just place the Project file in a special folder “… T-FLEX Parametric CAD/Program/Macros/”. Macros from files in this folder are always available.

By default, the folder “…T-FLEX Parametric CAD/Program/Macros/” contains projects with standard macros included in the delivery. The user can create his own library of macros by simply placing the *.grb files with macros in the “/Program/Macros/” directory.