Last modified by writer on 2023/09/08 18:38

Show last authors
1 ==== General tool shift macro algorithm ====
2
3 1. At the beginning of the macro, the **GetToolSlot()** function returns the cell number of the previous tool, which must be returned to the cell.
4 1. To get the cell number of the tool to be replaced, the **GetSelectedToolSlot()** function is used.
5 1. Changing the number of the current instrument is made directly from the macro by the** SetToolSlot()** function after the actual replacement. After the previous tool is placed in the cell, you must call the **SetToolSlot(0)** function. After a new tool is taken, the **SetToolSlot(slot)** function is called, where** slot = GetSelectedToolSlot()**.
6 1. If the execution of the tool change macro needs to be divided into two parts with a stop between them, the **GetStage** and **SetStage** functions are used.
7
8 ===== void SetStage(number stage, bool disable_prep_move) =====
9
10 Setting the current stage of the tool change.
11
12 Options:
13
14 * number stage – tool change stage number;
15 * bool disable_prep_move – a boolean that determines whether preparatory movement will be performed when the macro continues to run after clicking the Start button. True - do not perform preparatory move, false - perform. As a rule, if true is passed, the macro logic in the second stage of the tool change should provide a return to the point from where the G-Code execution will continue.
16
17 ===== number GetStage() =====
18
19 Getting the current stage of the tool change. Returns the value that was previously set by the **SetStage** function. If the **SetStage** function has not been called before, the value 0 is returned. When any other line of the G-code is executed, the function also starts returning the value 0.
20
21 Return value:
22
23 * current stage of tool change.
24
25 ===== number GetToolSlot() =====
26
27 Getting the cell number of the current tool, which must be returned to the cell. If there is no tool in the spindle, the value 0 is returned.
28
29 Return value:
30
31 * cell number of the current tool.
32
33 ===== number GetSelectedToolSlot() =====
34
35 Getting the cell number of the tool to be replaced. If you do not need to take a new tool after returning the previous tool, the value 0 is returned.
36
37 Return value:
38
39 * cell number of the tool to be replaced.
40
41 ===== void SetToolSlot(number slot) =====
42
43 Change the cell number of the current tool. It is made at the time of the actual replacement of the tool. After the previous tool is placed in the cell, you must call the **SetToolSlot(0)** function. After a new tool is taken, the **SetToolSlot(slot)** function is called, where **slot** is the cell number of the selected tool obtained by calling **GetSelectedToolSlot()**.
44
45 Options:
46
47 * number slot - the number of the cell of the instrument that has been replaced.
48
49 ===== bool GetUseGeneralToolchangePosition() =====
50
51 Allows you to check whether the option to use the tool change position common to all tools is selected in the tool table settings.
52
53 Return value:
54
55 * true – if the option to use a common position for all instruments is selected;
56 * false – if the position for each tool is specified in the tool table.
57
58 ===== number GetGeneralToolchangePosition(number axisId) =====
59
60 Options:
61
62 * number axisId – axis number, an integer from 0 to 8.
63
64 One of the constants defined in the Axis list can be passed as this parameter.
65
66 Return value:
67
68 * machine coordinate of the overall tool change position on the specified axis.
69
70 ===== number GetCurrentToolToolchangePosition(number axisId) =====
71
72 Options:
73
74 * number axisId – axis number, an integer from 0 to 8.
75
76 One of the constants defined in the Axis list can be passed as this parameter.
77
78 Return value:
79
80 * the machine coordinate of the tool change position for the current tool along the specified axis.
81
82 ===== number GetSelectedToolToolchangePosition(number axisId) =====
83
84 Options:
85
86 * number axisId – axis number, an integer from 0 to 8.
87
88 One of the constants defined in the Axis list can be passed as this parameter.
89
90 Return value:
91
92 * the machine coordinate of the tool change position for the selected tool along the specified axis.
93
94 ===== void SwapToolSlots(number slot) =====
95
96 Allows to implement a tool change algorithm using a manipulator that exchanges two tools located, respectively, in the spindle and in the cell.
97
98 {{info icon="false" title="**Example:**"}}
99 **SwapToolSlots(GetSelectedToolSlot())** - to swap the current tool with the selected. In this case the corresponding rows in the tool table will be swapped.
100 If there is no tool in the spindle (**GetToolSlot()** == 0), the selected instrument will be taken. If the instrument returns to its place, i.e. **SwapToolSlots(0)** command is executed, the tool will be placed in its slot. In the last two cases, no changes are made to the instrument table.
101 {{/info}}
102
103 Options:
104
105 * number slot – the slot number of the specified tool.
106
107 ===== **number GetToolNumber(number slot)** =====
108
109 Returns the tool number corresponding to the specified cell.
110
111 Options:
112
113 * number slot – the slot number of the specified tool.
114
115 Return value:
116
117 * tool number corresponding to the specified cell.