Wiki source code of Как создать пользовательский макрос?
Last modified by writer on 2023/02/20 15:02
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{success title="**Attention!**"}} | ||
2 | Before you begin, make sure that the option "Create and edit macros" is active. | ||
3 | {{/success}} | ||
4 | |||
5 | To create a custom macro and add it to the program using the "[[Macros Manager>>doc:Руководство пользователя.Описание M-кодов.Управление макросами и фоновыми операциями.WebHome]]" window you can use two methods: | ||
6 | |||
7 | 1. Adding a macro file. | ||
8 | 1. Creating an empty macro and modifying it further. | ||
9 | |||
10 | 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>>doc:Руководство пользователя.Описание M-кодов.Примеры макросов.Макросы для омического датчика.WebHome]]). 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>>doc:Руководство пользователя.Описание M-кодов.Описание функций макроязыка.WebHome]]" 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. | ||
11 | |||
12 | [[image:Adding macro from file.png||alt="Adding a new macro" data-xwiki-image-style-alignment="center" height="500" width="680"]] | ||
13 | |||
14 | (% class="imagetext" style="color: gray; text-align: center;" %) | ||
15 | Adding a new macro | ||
16 | |||
17 | To **create** a macro from the program, click the "Create" button, which is located above the list of macros. | ||
18 | |||
19 | [[image:Create macro.png||alt="Creating a new macro" data-xwiki-image-style-alignment="center" height="500" width="680"]] | ||
20 | |||
21 | (% class="imagetext" style="color: gray; text-align: center;" %) | ||
22 | Creating a new macro | ||
23 | |||
24 | Next enter the name of the new macro in the window that opens. | ||
25 | |||
26 | [[image:Enter macro name.png||alt="Macro name input window" data-xwiki-image-style-alignment="center" height="150" width="276"]] | ||
27 | |||
28 | (% class="imagetext" style="color: gray; text-align: center;" %) | ||
29 | Macro name input window | ||
30 | |||
31 | Recall that the names of user macros must be in the range (% style="color:#8d69b2" %)**M120 – M199**(%%), since the range (% style="color:#8d69b2" %)**M0 – M119**(%%) as well as (% style="color:#8d69b2" %)**M200 – M299**(%%) is allocated for standard macros used in PUMOTIX, and with the possibility of editing by the user. | ||
32 | |||
33 | 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>>doc:Руководство пользователя.Описание M-кодов.Описание функций макроязыка.WebHome]] 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(% style="color:#000000" %) "(%%)[[G-codes>>doc:Руководство пользователя.Настройка ПО.Настройка параметров G-кода.WebHome||shape="rect" style="text-decoration: none;text-align: left;"]](% style="color:#000000" %)" tab). | ||
34 | |||
35 | (% style="text-align:center" %) | ||
36 | [[image:Edit macro.png||alt="Редактирование макроса.png" data-xwiki-image-style-alignment="center" height="500" width="758"]] | ||
37 | |||
38 | >(% style="font-size:14px" %)To create custom macros, take a look at the proposed articles on the Lua language: | ||
39 | >(% style="font-size:14px" %)[[http:~~/~~/tylerneylon.com/a/learn-lua/>>url:http://tylerneylon.com/a/learn-lua/||shape="rect"]] | ||
40 | >(% style="font-size:14px" %)[[https:~~/~~/zserge.wordpress.com/2012/02/23/lua-%D0%B7%D0%B0-60-%D0%BC%D0%B8%D0%BD%D1%83%D1%82/>>url:https://zserge.wordpress.com/2012/02/23/lua-%D0%B7%D0%B0-60-%D0%BC%D0%B8%D0%BD%D1%83%D1%82/||shape="rect"]] | ||
41 | >(% style="font-size:14px" %)[[https:~~/~~/www.lua.org/manual/5.4/manual.html>>https://www.lua.org/manual/5.4/manual.html||shape="rect"]] |