Hello Guest it is December 06, 2019, 01:59:43 PM

Author Topic: DRO Code differences  (Read 9959 times)

0 Members and 1 Guest are viewing this topic.

DRO Code differences
« on: April 24, 2014, 09:28:06 PM »
What is the difference between "X Position" DRO and "X Multiple Position" DRO ?

Thanks,
Russ

Offline smurph

*
  • *
  •  1,153 1,153
  • "That there... that's an RV."
    • View Profile
Re: DRO Code differences
« Reply #1 on: April 25, 2014, 12:06:39 AM »
The X position is the user coordinates only.  It will not toggle between machine, user, and distance to go like X Multi Pos will.

Steve
Re: DRO Code differences
« Reply #2 on: April 27, 2014, 12:58:36 PM »
How do you pass a calculated value back to a screen DRO and "in real time"

Button and Image graphics are found where must be embedded? Some of them are corrupt. (not all there)
And there is no provisions to select images in folders using the Properties Images drop down list.

Offline smurph

*
  • *
  •  1,153 1,153
  • "That there... that's an RV."
    • View Profile
Re: DRO Code differences
« Reply #3 on: April 27, 2014, 01:26:44 PM »
All GUI objects can be accessed by their name in the LUA script environment.  This can be done as a result of an event (button press, etc...) or part of the PLC script.  The PLC script take the place of macro pumps and brains.

When in the screen editor, Screen->Manage Images.  This is where you add images to your screen set.  Then those images will appear in the Images drop down list.

Steve
Re: DRO Code differences
« Reply #4 on: April 27, 2014, 02:06:06 PM »
Thanks, but are there any examples of a PLC script and how to pass data? My dro named "droXY" must be passed a correctly formatted string or float. Just not sure what the proper way to do it is. Not much reference to it in the Docs folder.

Screen Manage Images: I see it now thanks



« Last Edit: April 27, 2014, 02:09:51 PM by Ya-Nvr-No »

Offline smurph

*
  • *
  •  1,153 1,153
  • "That there... that's an RV."
    • View Profile
Re: DRO Code differences
« Reply #5 on: April 27, 2014, 02:25:15 PM »
A lot of those images were from my computer which had a HD crash.  I just imported all of them and didn't look at each one.  So it is basically a corrupt image that was imported into the screen set.

I guess I don't understand your other issues.  You simply add images to the screen set via "Manage Images".  Then, you create a bitmap button and choose the image that you imported in the Image property drop down list.  LUA has nothing to do with it.  

The LUA comment was on how to update a DRO with a calculated value.  There is a screen objects API that is used.  I do not have it documented yet.  But you can see some of it in action just by looking at the scripts behind some of the buttons and the PLC script.  It is how we make the enable button blink, etc...

Steve
Re: DRO Code differences
« Reply #6 on: April 27, 2014, 03:14:54 PM »
Once you mentioned the location of the "screen managed images" and I found it, I understood, not sure what you are confused about.

I'm just not having luck finding out how to pass my computed value to the DRO I created.

local Xval = mc.mcAxisGetPos(0,0);
local Yval = mc.mcAxisGetPos(0,1);
local XYval =math.deg(math.atan(Xval/Yval));

droXY = XYval

Thanks

Offline smurph

*
  • *
  •  1,153 1,153
  • "That there... that's an RV."
    • View Profile
Re: DRO Code differences
« Reply #7 on: April 27, 2014, 03:35:40 PM »
number SetProperty(string ctrlName, string propName, string newValue)

The function is int the "scr" table.

scr.SetProperty('droXy', 'Value', tostring(XYval));

All parameters are strings.  So you have to convert the XYVal into a string with tostring().  Now, this does not control the format of the DRO.  That is done with the Format property that should already be set.

Any property of any control can be set this way.  The property names for the controls are what are used in the properties grid in the editor.  There is no documentation that lists the properties of each control yet.  Just look at them in the properties grid and use what you want.

As I said, look to the PLC script as an example of this function where we make the Enable button blink.

Hint:  Where there is SetProperty(), there is also a GetProperty() making it possible to read the properties of any control.

Steve
« Last Edit: April 27, 2014, 03:40:19 PM by smurph »
Re: DRO Code differences
« Reply #8 on: April 27, 2014, 04:30:45 PM »
Cool, works now, Thanks

Big help...

Looking forward to that documentation. Because looking on the net shows something different to me.

// Set up a value that may be used by a lexer for some optional feature.
void SetProperty(const wxString& key, const wxString& value);

having the property names and not knowing what to pass makes it a head scratchier.

Thanks again
Re: DRO Code differences
« Reply #9 on: April 27, 2014, 08:04:03 PM »
Thought others might like to see how easy it is done. :)
just add this to the PLC script at the end and the new DRO's get updated when any of the XYZ axis update.
It took me awhile to find where it was. So I circled it for you.
Little tedious to add the screen data but so much easier than macropump or adding a plugin
Thanks Steve & Brian
Did find that I tried to hide a button I created and it does not hide properly, don't need it any more, just used it to develop the script.
So that might be a bug.
I got all this done, and find that G68 does not work? :'(

The more we learn the better the life. :D
Code: [Select]
   local Xval = mc.mcAxisGetPos(0,0);
    local Yval = mc.mcAxisGetPos(0,1);
    local Zval = mc.mcAxisGetPos(0,2);
    
    local XYval = math.deg(math.atan(Xval/Yval));
    local XZval = math.deg(math.atan(Xval/Zval));
    local YZval = math.deg(math.atan(Yval/Zval));
    local XYvalhyp = math.sqrt(math.pow(Xval,2)+math.pow(Yval,2));
    local XZvalhyp = math.sqrt(math.pow(Xval,2)+math.pow(Zval,2));
    local YZvalhyp = math.sqrt(math.pow(Yval,2)+math.pow(Zval,2));
    
    scr.SetProperty('droXY', 'Value', tostring(XYval));
    scr.SetProperty('droXZ', 'Value', tostring(XZval));
    scr.SetProperty('droYZ', 'Value', tostring(YZval));
    scr.SetProperty('droXYhyp', 'Value', tostring(XYvalhyp));
    scr.SetProperty('droXZhyp', 'Value', tostring(XZvalhyp));
    scr.SetProperty('droYZhyp', 'Value', tostring(YZvalhyp));
« Last Edit: April 27, 2014, 08:22:41 PM by Ya-Nvr-No »