Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: mcardoso on April 20, 2019, 07:25:04 PM
-
Another question for everyone. I have written a serial script that is able to monitor the spindle load of my machine in real time. I'd like to add a bar graph in the spindle area which follows the value of the load, preferably colored green for 0-100%, yellow for 100-150%, and red for 150%-250%.
The bar chart display object looks perfect for what I am trying to do, but I cannot figure out a way to get to the value saved in my global register. It looks like it supports only Mach 4 internal values. Is this accurate? If so, would there be a possibility of expanding the functionality of this object in the future? Are there any workarounds to accomplish what I am trying to do? Thanks much!
-
Just wanted to follow up on this post. I am still unsure if there is a way to interface with this object (or the rotary gauge either) for non system variables. If anyone has a way to do this I would be very interested.
Also the only way I know to display the data from my global register is a DRO. If there is any other elegant solution for showing this data, please let me know!
-
Would it be possible to add a wx.wxGauge to the screen? I can programmatically set the value of this, but I have no idea if Mach 4 allows use of graphics from the wxWidgets library that are not built in.
-
Are you not able to select the Register from the properties menu for the gauge control? (see attachment)
If you have not yet created a register, with mach disabled go to Configure>Plugins>Regfile and then add a new instance register and then restart mach. This will appear within the iRegs0 menu when you go to Diagnostics>Regfile. This will also appear in the Register property dropdown for the gauge control. You will need to write a value to the register for the gauge to update.
Alternatively you can use the scr.SetProperty which is used for modifying GUI controls
e.g. scr.SetProperty('gau(1)', 'Value', '10')
Any control property can be edited using this, but it is always advisable to set values etc. using the proper methods.
You can also use wx.wxGauge, but this would required a lua panel if you want to embed it in the screen and gets a bit more confusing..
-
Very interesting....
When I open the properties for either a bar gauge or the crescent gauge, I only see the option "code". If I could get to what you are seeing then this would be perfect!
I do have the value in my regfile -> global register. Should this be in the instance section? I'm not sure I understand the difference. Either way, I have been able to read and write to the register.
Which version of Mach 4 are you using? I am at the last fully supported 3884, but I see now that the recommended download has been updated to 4162 so I will change to that.
I figured that would be the case about the wxGauge and would like to avoid LUA panels for the time being.
Thanks for your thoughts and time!
-
Upgraded from 3884 to 4162 and the options to tie the bar gauge to a register is now there! Problem solved. Thanks