How to Create a Custom Macro?

Last modified by writer on 2023/02/20 15:02

Attention!

Before you begin, make sure that the option "Create and edit macros" is active.

To create a custom macro and add it to the program using the "Macros Manager" window you can use two methods:

  1. Adding a macro file.
  2. Creating an empty macro and modifying it further.

To add a macro file, you need to write a macro in advance or download a ready-made file (for example, a macro for ohmic sensor). Macro code can be written in standard Notepad, Notepad ++, or in any other editor. To write code, use the functions that interact with PUMOTIX. The list of functions and their description is presented in the block of articles "Description of the functions of the macro language" and for convenience is divided into sections. Next click the "Add" button in the macro management window and select the required file in the window that opens.

Adding a new macro

Adding a new macro

To create a macro from the program, click the "Create" button, which is located above the list of macros.

Creating a new macro

Creating a new macro

Next enter the name of the new macro in the window that opens.

Macro name input window

Macro name input window

Recall that the names of user macros must be in the range M120 – M199,  since the range M0 – M119 as well as M200 – M299  is allocated for standard macros used in PUMOTIX, and with the possibility of editing by the user.

After creating the macro it will appear in the list. All that remains is to add commands to it using the fuctions of the PUMOTIX macro language and the Lua language. To write the code click the "Edit" button. An empty macro will open in a standard text editor (uses the program specified on the "G-codes" tab).

Редактирование макроса.png

To create custom macros, take a look at the proposed articles on the Lua language:
http://tylerneylon.com/a/learn-lua/
https://zserge.wordpress.com/2012/02/23/lua-%D0%B7%D0%B0-60-%D0%BC%D0%B8%D0%BD%D1%83%D1%82/
https://www.lua.org/manual/5.4/manual.html