Hello Guest it is July 19, 2025, 08:58:40 AM

Author Topic: Lua set Jog% with a button  (Read 24004 times)

0 Members and 1 Guest are viewing this topic.

Offline Rimmel

*
  •  284 284
Re: Lua set Jog% with a button
« Reply #10 on: July 03, 2024, 05:20:25 PM »
I know nothing about the Shuttle Pro other than it exists.
Is there a Plugin for it?
Can you use the buttons as an input into Mach4?
If you can then you can do something like part 1 of my earlier examples.
You can't in Mach4. But you could in Mach3...

Offline Bill_O

*
  •  601 601
Re: Lua set Jog% with a button
« Reply #11 on: July 03, 2024, 05:24:18 PM »
I have found nothing you could do in Mach3 that you can not do in Mach4.
It is different and you have to do it a different way.

So it does have a plugin?
If it does have a plugin does it show inputs in the plugin?

Offline Rimmel

*
  •  284 284
Re: Lua set Jog% with a button
« Reply #12 on: July 04, 2024, 07:01:31 AM »
The Plugin doesn't show inputs as such. You start the plugin and press a key and choose a predeterminded function.

In the Reg settings it also only shows GCode entries, no key-presses are registered.

https://www.youtube.com/watch?v=lQmi6Q_iOAU

I don't even use the wheels on the Shuttle Pro, I only really need a pendant keyboard with 5 or 6 buttons on it. That I can program to accept Lua functions.

Offline Bill_O

*
  •  601 601
Re: Lua set Jog% with a button
« Reply #13 on: July 08, 2024, 08:57:01 AM »
Make an m code that does what you want.
Then assign the key to do that m code.

Offline Rimmel

*
  •  284 284
Re: Lua set Jog% with a button
« Reply #14 on: July 08, 2024, 09:07:26 AM »
Make an m code that does what you want.
Then assign the key to do that m code.
Hi Bill - already tried that, it doesn't work. The code won't even work in the MDI.

I think is it because the code is based on the screen thread e.g.  "scr.SetProperty('sliderJogRate', 'Value', tostring(JogNow))"

Usually modern OS programming languages do not allow direct interaction between the GUI and the underlying core programming. You have to use some form of delegate.

It works on a screen button because that is also on the GUI thread.

I've been looking for a way to set the parameter in the core Mach4 programming - something like "mc.mcSetJogPercent".

Can't find much at present though. I have looked through the Mach4 Scripting Manual.pdf - but can't find a list of actually variables and their definitions for Mach4.

Offline Bill_O

*
  •  601 601
Re: Lua set Jog% with a button
« Reply #15 on: July 08, 2024, 09:44:31 AM »
Try this in your m code.
Quote
#define VAL_SLOW_JOG_RATE      2032

mc.mcCntlSetParameter(2032, 10)

Offline Rimmel

*
  •  284 284
Re: Lua set Jog% with a button
« Reply #16 on: July 08, 2024, 10:23:04 AM »
Try this in your m code.
Quote
#define VAL_SLOW_JOG_RATE      2032

mc.mcCntlSetParameter(2032, 10)
Will do - thanks

I'll report back.

Offline Rimmel

*
  •  284 284
Re: Lua set Jog% with a button
« Reply #17 on: July 08, 2024, 11:28:34 AM »
Try this in your m code.
Quote
#define VAL_SLOW_JOG_RATE      2032

mc.mcCntlSetParameter(2032, 10)
Will do - thanks

I'll report back.

Hi - tried it. The macro compiles OK, but no effect of jogging rate when run in the MDI. I can't see the setting affected any other part of the system.

thanks again

Offline Bill_O

*
  •  601 601
Re: Lua set Jog% with a button
« Reply #18 on: July 08, 2024, 11:34:47 AM »
I am sure there is a way to do this i just do not know how.
Hopefully some of the smart people can help.
Re: Lua set Jog% with a button
« Reply #19 on: July 09, 2024, 02:55:14 PM »
I saw in the Mach4 Youtube video you posted earlier that there is an option to assign 'Jog Rate Set to X%"  to a button on the ShuttlePro and it gives a few options of Jog percentage. Will this not work for you?