Hello Guest it is March 29, 2024, 03:13:12 AM

Author Topic: coding help  (Read 1340 times)

0 Members and 1 Guest are viewing this topic.

Offline Bill_O

*
  •  563 563
    • View Profile
coding help
« on: September 28, 2018, 10:05:03 AM »
Ok i am finally back to working on the Mach4.
I am having a problem with what i thought was a simple code.
I do not want to use the sliders for speed adjustments so i made a button to increase and one to decrease the FRO.
When i click the button the DRO flicks the change then immediately back to what it started at.
Here is the code.

local val = scr.GetProperty('droCutSpeed', 'Value');
val = tonumber(val) + 10;
local maxval = 300
if (tonumber(val) >= tonumber(maxval)) then
 val = maxval;
end
scr.SetProperty('droCutSpeed', 'Value', tostring(val));

I am sure it is something simple i am missing but I have no idea what.
Thanks,
Bill
Re: coding help
« Reply #1 on: September 28, 2018, 10:10:30 AM »
Bill,
There are already buttons to adjust the FRO. 
But you can use the code in this post below, see if it works. 

http://www.machsupport.com/forum/index.php/topic,38406.0.html
Chad Byrd

Offline Bill_O

*
  •  563 563
    • View Profile
Re: coding help
« Reply #2 on: September 28, 2018, 10:50:58 AM »
I will definitely look at that code.
I have other code i will need to write so if you have any idea why mine doesnt keep the change in the dro it would be helpful to me.

Bill
Re: coding help
« Reply #3 on: September 30, 2018, 02:41:47 PM »
If you replace your scr.GetProperty and scr.SetProperty commands with the API calls mc.mcCntlGetFRO and mc.mcCntlSetFRO your code will work

Offline Bill_O

*
  •  563 563
    • View Profile
Re: coding help
« Reply #4 on: October 02, 2018, 08:47:40 AM »
Swifty,

Thanks for the assistance.

Bill