Hello Guest it is May 10, 2021, 02:48:26 PM

Author Topic: Mach4 screen GRAPHICS -- makin' it Purdy  (Read 28705 times)

0 Members and 1 Guest are viewing this topic.

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: Mach4 screen GRAPHICS -- makin' it Purdy
« Reply #50 on: March 14, 2015, 03:09:36 PM »
Update:

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

Offline BR549

*
  •  6,952 6,952
    • View Profile
Re: Mach4 screen GRAPHICS -- makin' it Purdy
« Reply #51 on: March 14, 2015, 04:24:03 PM »
Steve you never saw that Wizard released with those pictures did ya ??  That was more about stroking ego's than anything else and it seemed to work.

(;-) TP

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: Mach4 screen GRAPHICS -- makin' it Purdy
« Reply #52 on: March 15, 2015, 07:22:09 AM »
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.

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: Mach4 screen GRAPHICS -- makin' it Purdy
« Reply #53 on: March 15, 2015, 07:40:04 AM »
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
« Last Edit: March 15, 2015, 07:58:44 AM by simpson36 »

Offline RICH

*
  • *
  •  7,419 7,419
    • View Profile
Re: Mach4 screen GRAPHICS -- makin' it Purdy
« Reply #54 on: March 15, 2015, 11:25:38 AM »
Quote
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.

A good rule to follow during discussion is to question for understanding if intent of a comment
 was not understood. One should  consider the comment if it is additive to what is being discussed
or just keep in mind the point made. Comment nor reply need not be defensive but would just clarify intent.

Continue exploring the new interface and by all means post the how to do it...... :)

RICH

Offline BR549

*
  •  6,952 6,952
    • View Profile
Re: Mach4 screen GRAPHICS -- makin' it Purdy
« Reply #55 on: March 15, 2015, 01:36:22 PM »
Steve that sounds like a great idea ..... We can agree to ignore each other.

Just a thought, (;-) TP
« Last Edit: March 15, 2015, 01:38:09 PM by ger21 »

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: Mach4 screen GRAPHICS -- makin' it Purdy
« Reply #56 on: March 15, 2015, 01:53:38 PM »
you got a bit missing from you code condition or if one then the other

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: Mach4 screen GRAPHICS -- makin' it Purdy
« Reply #57 on: March 16, 2015, 07:57:14 AM »
you got a bit missing from you code condition or if one then the other

The code I have posted here are not complete programs that are intended to be 'run', so there would be are a lot of bits missing. They are 'fragments' to show one method to accomplish a specific task. You will need to lift all or part of the example and insert into your own program. Change the screen item names and variable names to whatever you have used.

ex: in the code fragment, the dro is named 'droRPM'. That is a name that the programmer makes up and it has no special meaning to Lua or Mach, but it is a good programming practice to name things intuitively so that the code 'read' in a more comprehendible way.

That being said, if you can be specific about what you are trying to do, I might be able to help you.

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: Mach4 screen GRAPHICS -- makin' it Purdy
« Reply #58 on: March 16, 2015, 08:53:56 AM »
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.

It just occurred to me that the LED 'state' can be any of the eight colors, so if you monitored 'Color' instead of 'Value' you could track 8 conditions.

So there actually is an advantage to using the LED type.  As far as the ugly factor on round LEDs, I would not let that stop me from using them because I think the Ugly will go away once they fix the anti-aliasing. I can't imagine any modern graphics handler that does not support this feature. I would speculate that it is available, but just turned off. Anti aliasing is compute intensive so it is often defaulted to OFF (for low end graphics cards).


Offline ger21

*
  • *
  •  6,292 6,292
    • View Profile
    • The CNC Woodworker
Re: Mach4 screen GRAPHICS -- makin' it Purdy
« Reply #59 on: March 16, 2015, 09:41:19 AM »
But if the goal is "Makin it Purdy", then we can do much better than the built in LED's.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html