Hello Guest it is March 28, 2024, 09:03:18 AM

Author Topic: Mach3 Jog buttons not working when ran as script  (Read 1812 times)

0 Members and 1 Guest are viewing this topic.

Mach3 Jog buttons not working when ran as script
« on: February 08, 2020, 05:56:50 PM »
Hi Everybody,
Please bear with me as I am a Mach3 newbie and just recently started toying with the software. 
I am pretty sure this topic has been brought up before but I just couldn't find the right answer; I am trying to add a button on the screen that would simultaneously jog 2 axes. To edit the screen I am using the MachScreen Editor. It seems a simple task but when I tried it nothing works.
I've added a button and set its Function to "Execute Basic-Script". For the Execute Code I added:
DoOEMButton(307)
DoOEMButton(309)

Theoretically it should have simultaneously moved the X and Y axes in the positive direction but there is no movement at all.
It seems that the jog buttons will only execute their functions if they have the function called directly (i.e. Function: Push to jog X++) and not by employing the DoOEMButton() in a script.
I hope I made myself clear, I don't know how can I explain it better. If anybody has any suggestions your help will be highly appreciated.

Thanks in advance

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: Mach3 Jog buttons not working when ran as script
« Reply #1 on: February 09, 2020, 07:47:57 AM »
normaly DoOEMButton(307) DoOEMButton(309) should be excecuted and start the axis to jog.
make sure JogMode is on.

the Problem will be that a DoOEMButton(307) will start JogX-movement and a DoOEMButton(334) has to stop JogX.

a normal Screen button will only run the when the button is pressed and you have no controll when the button is released.

you can test your macro code in Operator -> VB Script Editor window and use the >|| button to test code line by line.
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Mach3 Jog buttons not working when ran as script
« Reply #2 on: February 09, 2020, 12:09:44 PM »
Hi TPS and thank you for your quick reply.
You are right, when I test the macro line by line in the VB editor, I have movement on the axes. For the moment I am only testing it offline on my laptop but, regardless, I can see the X and Y DROs counting.
The only problem is that when you assign a macro to the jog buttons, it is not executed when you press the screen button. Not even with the hotkeys.

With the onscreen buttons, when you press the button the axis starts moving and keeps on moving for as long you keep the button pressed and stops when you let go. Pretty normal behavior for a JOG BUTTON I think.

Cheers

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: Mach3 Jog buttons not working when ran as script
« Reply #3 on: February 09, 2020, 01:14:58 PM »
IMHO you will not be able to do a XY jog via a Screen button (i do not know a way, but maybe there is a way).
i have attached a smallĀ“brain for a XY plus jog via Trigger of input1.

-copy it to your C:\mach3\brain Folder
-use Operator -> Brain control and enable the brain
-goto Config -> ports&pins -> Input Signals -> enable Input1 ->enable emulated -> assign a hotkey

and you will see, you can jog X/Y via the assigned hotkey
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.