Hello Guest it is March 28, 2024, 07:19:27 AM

Author Topic: Jog Speed DRO  (Read 1411 times)

0 Members and 1 Guest are viewing this topic.

Offline Bill_O

*
  •  562 562
    • View Profile
Jog Speed DRO
« on: August 14, 2019, 04:57:12 PM »
I am having a little problem with the Lua on a couple of buttons I am making.
The script changes the value but does not change the actual speed.
If I type in the DRO the speed will actually change.

Bill

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Jog Speed DRO
« Reply #1 on: August 14, 2019, 06:51:35 PM »
What DRO Code is assigned to that DRO?
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!

Offline Bill_O

*
  •  562 562
    • View Profile
Re: Jog Speed DRO
« Reply #2 on: August 15, 2019, 08:15:41 AM »
Jog Rate % is the DRO Code for droJogSpeed

Offline Bill_O

*
  •  562 562
    • View Profile
Re: Jog Speed DRO
« Reply #3 on: August 15, 2019, 09:12:13 AM »
If I put in a slider and use the same code to adjust the slider it changes the slider and the dro and works.
I really do not want the slider.

Bill

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Jog Speed DRO
« Reply #4 on: August 15, 2019, 09:40:56 AM »
mc.mcJogSetRate is covered in the Mach4CoreAPI help file. That is what you will need to use. I'm pretty sure changing the value of a DRO (via script) displaying current jog rate will not change jog rates, only the DRO. Your interaction with the DRO is different than clicking in the DRO and entering a value. Therefore different events will or more accurately will not get triggered.

Two things to try.

It may work if you add script including mc.mcJogSetRate in the droJogSpeed "on update" script.

In the script you are changing the DRO value........ instead of changing DRO value set the jog rate using  mc.mcJogSetRate.
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!

Offline Bill_O

*
  •  562 562
    • View Profile
Re: Jog Speed DRO
« Reply #5 on: August 15, 2019, 10:12:20 AM »
mc.mcJogSetRate in the API is for single axis.
mc.mcJogSetRate(inst, axis, percentage)
How do I use it for all?

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Jog Speed DRO
« Reply #6 on: August 15, 2019, 01:05:01 PM »
Quote
mc.mcJogSetRate in the API is for single axis.
mc.mcJogSetRate(inst, axis, percentage)
How do I use it for all?

Simple, the same way you use a single pencil to write a lot of different things. You do it for each axis you want to set the rate for. Look at the API calls as colored pencils you are using to create a colored drawing. Some you use more than others. Some cover a lot of canvas, others are for fine details. They each do something specifically. There won't be a fine and wide for each but some do have both and others have one or the other.

One thing you might want to do though is at some point set all axes back to the same rate and it would be whatever the screen says it should be. I think the first example below is pretty much what the Jog Rate % code (function) does in the core.

Code: [Select]
local JogRate = 50

for v = 0,5 do --This will set 0-5 AKA X, Y, Z, A, B, C
mc.mcJogSetRate(inst, v, JogRate)
end

--Or

mc.mcJogSetRate(inst, 0, JogRate)
mc.mcJogSetRate(inst, 1, JogRate)
mc.mcJogSetRate(inst, 2, JogRate)

--Or if you don't want to set them by using a single variable set them independently......... even to different values if you want.

mc.mcJogSetRate(inst, 0, 50)
mc.mcJogSetRate(inst, 1, 25)
mc.mcJogSetRate(inst, 2, 100)


;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!

Offline Bill_O

*
  •  562 562
    • View Profile
Re: Jog Speed DRO
« Reply #7 on: August 19, 2019, 08:36:53 AM »
OK.
I figured I could do that but was hoping I would not need to.

Thanks,
Bill