Dynamical motor to axis assignment

Last modified by writer on 2023/11/28 18:42

Attention!

Make sure that the "Dynamical motor to axis assignment" option is active before starting work.

Attention!

For this option to work, you must also purchase the options "Create and edit macros" or "Auto Tool Change".

This feature allows to disable and enable every motor assigned to specified axis (or several axes). Consider situation when we need to control the machine with two heads, each of them is moved by own Z axis motor. In such a case it is possible to modify M6 macro so previous tool was returned to SafeZ on toolchange and then active motors switching performed.

In SwitchMotors(0, 1) function first parameter is index (from zero) of motor which should be disabled. Second parameter is index of motor which should be enabled. So on this command's execution active motor is switched from first to second as they follow in Settings → Motors menu.

M6 macro example
function m6()
if (Is_THC_Mode() or Is_Oxy_Mode()) then
 return
end

local toolSlot = GetSelectedToolSlot()
local previousToolSlot = GetToolSlot()

 ExecuteMDI("G53 G0 Z0")

if (toolSlot == 2) then
  SwitchMotors(0,1)
else
  SwitchMotors(1,0)
end

local delta = 200  -- distance between two heads

if (toolSlot == 2 and toolSlot ~= previousToolSlot) then
 local CurrX = AxisGetPos(Axis.X)
 local CurrY = AxisGetPos(Axis.Y)
 local NewY = CurrY - delta
  ExecuteMDI("G55")
  ExecuteMDI("G10L20P0 X"..str(CurrX).." Y"..str(NewY))
  ExecuteMDI("G90 G0 Y"..str(CurrY))
elseif (previousToolSlot == 2 and toolSlot ~= previousToolSlot) then
 local CurrX = AxisGetPos(Axis.X)
 local CurrY = AxisGetPos(Axis.Y)
 local NewY = CurrY + delta
  ExecuteMDI("G54")
  ExecuteMDI("G10L20P0 X"..str(CurrX).." Y"..str(NewY))
  ExecuteMDI("G90 G0 Y"..str(CurrY))
end

 SetToolSlot(toolSlot)
end

Download M6 macro example

When work with second tool is finished we can switch to using first head by M6T1 command which calls SwitchMotors(1,0) function. Machine position on Z axis will be automatically restored to value it had when first motor was active.

To control disabling/enabling every motor separately MotorDisable and MotorEnable functions can be used which accept one parameter - motor index.

To make full use of this option:

  1. Purchase and activate option, apply license in PUMOTIX (How Do I Apply a Licence?).
  2. Setup multiple motors on one axis (more about motor setup). The function can be applied to any number of axes.DoubleAxisSettings.png
  3. Modify or write a new macro.
  4. Use a macro to switch between motors. You can use the line for entering the G-code, a button on the macro panel or a specialized interface button to do this.
  5. Monitor the system status in the Diagnostics tab where you can see all the motors you have configured.2020-12-04 11_53_05-PUMOTIX.png

     

Also a button will become available to turn on all configured motors on the diagnostics tab when the option is active.

2020-12-04 11_54_44-PUMOTIX.png

Button "Set active motors all"