Hello Guest it is April 19, 2024, 06:19:12 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - simpson36

131
Attached is a short vid of an LED being manipulated by a DRO. The code to accomplish this is also provided here for anyone to use.

There is a bug in the LED wherein the LED will hide, but will not unhide. I have reported this in the bug thread and when it gets fixed, I can continue with the idea of having LED's appear and indicate the status of various operating conditions via size, color, location or other parameters.

The videos are intended as 'proof of concept' and not what an actual practical screen might look like. I do have in mind to have an LED similar to that shown in the vid to pop up and indicate an 'overspeed' or 'overpower' condition at a spindle. The video shows cycling thru all colors, but most likely in practice only green yellow and red might be used for the application described.

So we have covered both kinds of image buttons and LEDs and how to retrieve and set the parameters of all. That should get people started down the road to 'Purdy' Screens. I have deadlines coming up so this will be it for me for a while, but I'll stay subscribed and answer questions if I can. As is typical of this forum, there are lots of reads and very little participation. Please don't be afraid to post questions, or whatever you are working on. There is no such thing as a stupid question, so don't even worry about that.

I mentioned earlier in the thread that using exponents as color numbers could be an advantage and that is shown in the calculations in the code fragment.


Code: [Select]
-- Lua Code fragment for calculating LED color from dro Values
-- Mach4 Screen
-- © 2015 www.theCUBEstudio.com
-- NOTE: dro is named 'droRPM'
--       the dro gets its values from a slider that is not shown in the code


  local CurrentRPMstring = scr.GetProperty('droRPM','Value'); -- grab the value in the RPM dro NOTE: is is a string
  local CurrentRPM = tonumber(CurrentRPMstring);              -- convert to number
  -- convert slider value into an integer between 0 and 7 to use as color number
  -- NOTE: color 'numbers' are exponents
  -- dro values come from slider. Slider values are 0 to 2000 so for max of 7, divisor will be 2000/7 = 285
  -- only the integer part of the number is required so find that using math.modf

  local colorCalcVar = math.modf(CurrentRPM/285);

--***********************************  -- debugging stuff leave commented out *************************************

--wx.wxMessageBox (CurrentRPMstring)
--wx.wxMessageBox (tostring(CurrentRPM))
--wx.wxMessageBox  (tostring(colorCalcVar))

--  mc.mcRegSetValue(RPMcmdRegHandle,RPMSliderValue); -- this sends data to modbus for use by the InTurn™ Controller
                                                      -- datat can be sent anywhere desired by adding the appropriate code here
--****************************************************************************************************************
  
   if (CurrentRPM == 0)then   -- if spindle is stopped, turn off LED
    scr.SetProperty('ledBarRPM','Hidden','1');
   else                       -- if Spindle is moving, turn on LED and set calculated color
    scr.SetProperty('ledBarRPM','Hidden','0');  
    scr.SetProperty('ledBarRPM','Color',tostring(2^colorCalcVar))    -- note calculated color 'number' is the exponent
   end

132
Steve you never saw that Wizard released with those pictures did ya ?? 

You posted pictures with the old photos in it and you also posted pictures of your widget with the new photos in it, but to answer your question; No, I never saw it 'released' at all.

Terry,
A good sniper does not reveal his position before taking the shot.

It is your prerogative to choose ugly for your screens, your widgets, or your comments. It is my prerogative to react or ignore. I shall choose the latter from here on.

133
Mach4 General Discussion / Re: Mach 4 Bug Reports
« on: March 14, 2015, 03:34:35 PM »

LED on Mach screen hide when 'hidden' is set to 1, but do not display when 'hidden' is set back to zero

134
Update:

I was able to get out of the bad PLC script loop, so no longer need an answer on that.

135
The thing to remember with machine tools IS the operator HAS to maintain focus on the job.

Well, that explains why so little ergonomic research goes into heads-up displays and control systems for fighter aircraft.  ::)


THE more GAMEBOY like you make the screen the harder it is for the OP to concentrate on  his job.



You should have said so before all those millions were spent on those 'GAMEBOY like' HMI control systems.   :)


This is just my experience YOUR mileage may vary.


My mileage varies a lot from CNC machine tools. HAAS and Fanuc may or may not be 'state-of-the-art' for CNC machine tools, but that is not representative of true 'state- of- the- art' in HMI. Nobody dies if a CNC operator pushes the wrong button at the wrong time.

You may have noticed that MACH4 out-of-the-box has some of this 'fancy' stuff and even some context sensitive controls. Apparently they also did not get the memo where it was explained that you don't need to disable buttons so that they will not function when they SHOULD not function. It is not a big leap to go from disabled to disappeared. Functionally, these methods are the same, but one makes the screen less cluttered and uses the real estate more efficiently.

In any case, the purpose of this thread is to figure out how to make the screen pretty, not to debate whether it should be pretty or not. If ugly is your preference, you don't need to learn anything. Ugly is included for free.
    
Incidentally, from what little I saw of the wizard you are working on, it looked pretty jazzy to me. There were big photos in the middle of the screen, provided by yours truly. Which HAAS or Fanuc control was that idea copied from?  ;)

Incidentally, didn't you get a script stuck in a continuous loop? How did you get out of that?

136
I like my buttons FIRMLY attatched to an exact spot on the screen. That way I KNOW where they are when I need them.

You would need to go back in time to DOS for that.  The windowing environment had had things popping on and off the screen as needed since Xerox invented it many moons ago. That is more or less the whole point. Mach is a windows program and already has, in addition to the normal windows pull-downs, tabbed 'pages' as well as a separate set of tabbed windows within those pages.

Widgets pop on and off the screen, are resizable and can be moved anywhere, not to mention dialogue boxes for everything from alarms to user input.

If you click on a tab, a new set of 'buttons' appears. If instead, you click on a button and a new set of buttons appears, there is no operational difference, except that you have more control over placement and how much space is consumed.  All I will do is make the process more ergonomic and context sensitive.

The great thing about MACH is that you CAN have all of your buttons 'glued' to one spot if that is your preference.

137
Attached is a quick video of the 'cascading buttons' idea I described a few posts back.

Also note that the larger 'master' button setting off the cascade is not an image toggle, but just an image button. I discovered that the single 'enabled' image can be changed 'on the fly' which opens up some interesting possibilities.

There are some other goodies as well, but I have now managed to make MACH4 unusable by not commenting out a wx.messagebox in the PLC script, so not it just continuously puts the box up in a split second after dismissing it and the net effect is that I can't do anything else.  :'(

I have tried a number of things to escape this loop, but so far no joy. Anybody know how to recover from this?

138

(and you CAN edit [Lua Panel's] boarder, color etc., see wxTemplate in the tool box).


Do you know how to turn off the border on image toggle buttons?

139
Ironically, I found this with a google search and it happens to be here on the forum.

Main documentation overview can be viewed here: http://wxlua.sourceforge.net/documentation.php

1. Lua
Replacing Basic, this is the new scripting language used in UI callbacks, scripts and wizards. API documentation: http://www.lua.org/manual/5.2/

2. wxLua
This UI library was originally built on C++. It makes you able to build windows, frames, input fields, buttons and has been ported to Lua (not all of it, but most). You can either refer to wxWidget original API documentation (starting at http://docs.wxwidgets.org/2.8/) or to the sparse wxLua doc (http://wxlua.sourceforge.net/docs/wxluaref.html, please scroll down for partial API).



There are tons of docs and examples on SourceForge and after a few nights of reading, I should be up to speed.
 

140
What I meant was have the images change state based on the state of the LED's. I don't need to manipulate the LED's, just read their state and swap the images accordingly. So the image would be (or mimic)  the LED.

I'm trying to imagine the task that would be best done with this method, but to your question, yes, it is doable. There may be a number of ways to do what you want, but only one comes to mind, and I can describe that;

LEDs do not have associated scripts, but they do have an input and an output. The output has a pulldown with a bunch of choices, none of which would do what you want. I do not know if you can just type in some other option nor what those options might be if you could .

That leaves you needing to continuously monitor either the LED itself or something that the LED can output to. The only mechanism for monitoring something, to my knowledge at this point, is the screen script (I don't recall its actual name at the moment) that is accessed in screen edit mode by clicking the very topmost item in the upper left window (wxMach01).

This script runs continuously and you can add whatever code you want and it will loop indefinitely. In this script, you can look at the LED using scr.GetProperty or look at whatever the LED is outputting to, say output#7 or something like that.

When the state changes, the script will catch it and do whatever you told it to do in response, in your case swap an image. I don't know what image you want to swap, so can't help there.
[/quote]


I don't have Mach4 in fornt of me, but is there a border style option of "none"?

On some types, yes. But not on the image toggle