Tool Change

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

General tool shift macro algorithm

  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.
  2. To get the cell number of the tool to be replaced, the GetSelectedToolSlot() function is used.
  3. 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().
  4. 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.
void SetStage(number stage, bool disable_prep_move)

Setting the current stage of the tool change.

Options:

  • number stage – tool change stage number;
  • 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.
number GetStage()

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.

Return value:

  • current stage of tool change.
number GetToolSlot()

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.

Return value:

  • cell number of the current tool.
number GetSelectedToolSlot()

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.

Return value:

  • cell number of the tool to be replaced.
void SetToolSlot(number slot)

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().

Options:

  • number slot - the number of the cell of the instrument that has been replaced.
bool GetUseGeneralToolchangePosition()

Allows you to check whether the option to use the tool change position common to all tools is selected in the tool table settings.

Return value:

  • true – if the option to use a common position for all instruments is selected;
  • false – if the position for each tool is specified in the tool table.
number GetGeneralToolchangePosition(number axisId)

Options:

  • number axisId – axis number, an integer from 0 to 8.

One of the constants defined in the Axis list can be passed as this parameter.

Return value:

  • machine coordinate of the overall tool change position on the specified axis.
number GetCurrentToolToolchangePosition(number axisId)

Options:

  • number axisId – axis number, an integer from 0 to 8.

One of the constants defined in the Axis list can be passed as this parameter.

Return value:

  • the machine coordinate of the tool change position for the current tool along the specified axis.
number GetSelectedToolToolchangePosition(number axisId)

Options:

  • number axisId – axis number, an integer from 0 to 8.

One of the constants defined in the Axis list can be passed as this parameter.

Return value:

  • the machine coordinate of the tool change position for the selected tool along the specified axis.
void SwapToolSlots(number slot)

Allows to implement a tool change algorithm using a manipulator that exchanges two tools located, respectively, in the spindle and in the cell.

Information
Example:

SwapToolSlots(GetSelectedToolSlot()) - to swap the current tool with the selected. In this case the corresponding rows in the tool table will be swapped.
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.

Options:

  • number slot – the slot number of the specified tool.
number GetToolNumber(number slot)

Returns the tool number corresponding to the specified cell.

Options:

  • number slot – the slot number of the specified tool.

Return value:

  • tool number corresponding to the specified cell.