Machsupport Forum
Mach Discussion => Mach Screens => Topic started by: Giuno85 on February 28, 2025, 04:26:25 AM
-
Hi everyone, is it possible to create a label on the computer screen and populate it with the description of the tool in use?
-
not directly you can make a workarround via macropump macro
code for Userlabel 123 would be:
SetUserLabel(123, GetToolDesc(GetDRO(24)))
!not tested
-
thanks for the reply.
How do I apply this variable to the label in mach screen? I see that it is not possible to put functions in labels
-
you have to make a userlabel in your screen, for example Userlabel123
and the code needs to be in macropump.m1s macro. make sure macropump is enabled in general config.
-
this way?
because i tried but it doesn't work...
-
yes this way.
for a quick test open Menu:
Operator -> VB Script Editor
then copy and paste this code into Editor
SetUserLabel(123, GetToolDesc(GetDRO(24)))
and use the green start button to run it
-
I tried to do as you say but the label doesn't change it stays like this
Am I doing something wrong?
-
not sure, but i think it needs to be UserLabel123 insteed of Userlabel123
made a quick test here and it works
-
but are you using machscreen?
I tried to insert the text but it doesn't work for me, it takes the instruction as text
-
i am using MachScreen
https://kd-dietz.com/pages/eng/machscreen/description.html#
-
made a quick test, it is for sure UserLabel needs to have a capital letter -> L
-
Hi TPS, now it works, I was wrong, I copied and pasted on the line in machscreen the wording UserLabel123. And doing so it did not take it as a command. Rewriting it with the keyboard now it works.
Thanks a lot for the help.
I wanted to ask you since you suggested adding it to Macropump, since it cycles continuously, is there a risk of going to weigh down the system?
-
i do not think that this one line of code in macropump will slow down anything.
-
thank you so much for your help.
Do you know if there is a way to block the manual insertion of the tool number on the panel? I would like the DRO tool of the mach3 panel not to be able to be changed manually...
Should I open another post or can we talk about it here?
-
just put a image button transp. (without image) over the to of the tool DRO.
then select the image button again and the shown list will come up.
normaly the image button is the last in the list,
now click (left mousebutton) and hold mousebutton then move (with mouse)
the image button line up to be before the line with the DRO entry.
now it will be "in front" of the tool DRO and it can not be changed manualy.
-
It works great, except that every time I open machscreen a window opens telling me that the image file is not found... is this correct? to set the transparent button when it makes me select the file inside the Mach3 folder since I can't leave everything blank I put .jpg... is this correct?
The prompt window is quite annoying :-)
And how do I make the button not execute any command when pressed?
-
that is how i configured my "test" button
-
ok this is to prevent the button from executing any commands...
because I was about to ask you how to make it not execute any command
-
I can't write None in the Path box... when I click it it sends me to search for the image file to insert
-
if you insert a fresh one, there should be none as default
-
when I insert it new it tells me that before inserting the button I have to point to the image file by opening the search window...
-
after insetring a "fresh" one just type 34 to standard code then select Standard Code -> Run basic script adjust position and size by mouse , done.
-
in the MachScreen Properties input mask under Control, i select Image button transp, then i use
the Add button and click into the screen to place it, i get nothing asked
-
you are right, I was wrong because I inserted a normal image button and not a transparent image button. Thanks a lot for the help
-
I share the code to make the write label command run only once in macropump
If GetUserLabel(123) = "" Then
' Leggi il numero utensile corrente
Dim currentToolNumber As Integer
currentToolNumber = GetDRO(24)
' Esegui il comando
SetUserLabel(123, GetToolDesc(currentToolNumber))
' Aggiorna la variabile con il nuovo numero utensile
lastToolNumber = currentToolNumber
End If
-
I share the code to make the write label command run only once in macropump
If GetUserLabel(123) = "" Then
' Leggi il numero utensile corrente
Dim currentToolNumber As Integer
currentToolNumber = GetDRO(24)
' Esegui il comando
SetUserLabel(123, GetToolDesc(currentToolNumber))
' Aggiorna la variabile con il nuovo numero utensile
lastToolNumber = currentToolNumber
End If
but now it will not be updated if you change for example from tool1 to tool2?
-
and also the code that must always be inserted in macropump which both writes the label only once and changes the text of the label when the tool number changes when changing from the panel
' CODICE PRECEDENTE
' Definisci una variabile per memorizzare l'ultimo numero utensile (usa DRO 2005 come variabile persistente)
Dim lastToolNumber As Integer
lastToolNumber = GetoemDRO(1225) ' Leggi il valore persistente da DRO 1225
' Definisci una variabile per memorizzare il numero utensile corrente
Dim currentToolNumber As Integer
' Controllo del numero utensile all'inizio (solo se GetUserLabel(123) è vuoto)
If GetUserLabel(123) = "" Then
' Leggi il numero utensile corrente
currentToolNumber = GetDRO(24)
' Esegui il comando
SetUserLabel(123, GetToolDesc(currentToolNumber))
' Aggiorna la variabile persistente con il nuovo numero utensile
SetDRO(1225, currentToolNumber)
lastToolNumber = currentToolNumber
End If
' Controllo se il numero utensile è cambiato (solo se necessario)
currentToolNumber = GetDRO(24) ' Leggi il valore corrente
If currentToolNumber <> lastToolNumber Then
' Esegui il comando solo se il numero utensile è cambiato
SetUserLabel(123, GetToolDesc(currentToolNumber))
' Aggiorna la variabile persistente con il nuovo numero utensile
lastToolNumber = currentToolNumber
End If
' RESTO DEL CODICE
-
yes exactly I will use the first one because in my case the tool number cannot be changed from the panel using the transparent image button, but can only be changed from the M6 tool changer.
obviously I have the label update done in the m6Start script
-
anyway I also shared the code to be able to change the label by manually changing the number from the panel