21
Mach4 General Discussion / Re: Macro will not jog mill
« on: November 24, 2023, 03:16:56 PM »
Hi,
Add this function to the screen load script
Add this to clicked script or left up script of a button
Add this function to the screen load script
Code: [Select]
function TestButton()
--Move axis 1/2 bit diameter in X+ and Y+
--Set current position as X and Y zero in work coordinates
local inst = mc.mcGetInstance()
--Get bit diameter and set jog distance
local strBitDiam = scr.GetProperty("JogToValue", "Value")
local AxisJog = tonumber(strBitDiam) / 2
-- Jog controller 0 in the X and Y axes;
mc.mcJogIncStart(inst, 2, 1)
coroutine.yield() --Wait for idle state
mc.mcJogIncStart(inst, 0, AxisJog)
mc.mcJogIncStart(inst, 1, AxisJog)
coroutine.yield() --Wait for idle state
-- Set local coordinates to zero for the X and Y axes
mc.mcAxisSetPos(inst, 0, 0)
mc.mcAxisSetPos(inst, 1, 0)
end
Add this to clicked script or left up script of a button
Code: [Select]
wait = coroutine.create(TestButton)