Hello Guest it is December 11, 2019, 09:41:54 PM

Author Topic: Lua: ? How to set a DRO that has a "DRO Code" ?  (Read 1764 times)

0 Members and 1 Guest are viewing this topic.

Offline Bodini

*
  •  216 216
    • View Profile
Lua: ? How to set a DRO that has a "DRO Code" ?
« on: May 09, 2014, 10:23:08 AM »
I am trying to set a DRO that has a "DRO Code" from the drop down in its Properties... such as "xdro1" on the default screen. (In Mach3/VB this would be like a "SETOEMDRO" if I remember correctly.)

Used the code "scr.SetProperty('xdro1', 'Value', tostring("999"))" and it works for a millisecond (you can see it flash by in the DRO).  But then the Value goes back to what it was before the DRO was set.

I notice that when the "DRO Code" is cleared, this doesn't happen.  Obviously there is another part of the process that I am unaware of.  Please advise!

Also just noticed that it works when the screen is being edited.  So, I'd guess this is some sort of PLC script issue or something like that.
« Last Edit: May 09, 2014, 10:37:58 AM by Bodini »
Re: Lua: ? How to set a DRO that has a "DRO Code" ?
« Reply #1 on: May 09, 2014, 11:15:05 AM »
Not sure of this, but did you check out Poppa's list ?

http://www.machsupport.com/forum/index.php/topic,27141.0.html

mc.mcAxisSetPos(number mInst, number axis, number val)

Just guessing till help comes along,
Russ

Offline Bodini

*
  •  216 216
    • View Profile
Re: Lua: ? How to set a DRO that has a "DRO Code" ?
« Reply #2 on: May 09, 2014, 01:00:28 PM »
OK thanks.  I did see that list but did not realize the application as related to my question.  Yep, that works.

Offline smurph

*
  • *
  •  1,161 1,161
  • "That there... that's an RV."
    • View Profile
Re: Lua: ? How to set a DRO that has a "DRO Code" ?
« Reply #3 on: May 09, 2014, 02:49:30 PM »
Russ is correct.  If you have a DRO that has a code assigned, it can only be updated with a mc.mc* API call and not using scr.SetProperty().  This is because that DRO is getting updated every screen refresh from the code assigned to it.  So you have to modify what is driving the DRO instead.  Take the Zero X button.  It is actually calling mcAsixSetPos() behind the scenes to modify the X axis DRO.