Hello Guest it is March 28, 2024, 05:02:47 PM

Author Topic: User Label  (Read 16403 times)

0 Members and 1 Guest are viewing this topic.

User Label
« on: October 27, 2011, 09:19:44 AM »
Guys...Is there any way to make a user label persistent?  If I set it's value then close and reopen Mach, the user label is blank.   Thanks

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: User Label
« Reply #1 on: October 27, 2011, 11:50:20 AM »
Create a macro to fill it in and put the macro in your initialization string?? Not ideal, and maybe won't even work correctly.
Gerry

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

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: User Label
« Reply #2 on: October 27, 2011, 12:19:52 PM »
Create a macro to fill it in and put the macro in your initialization string?? Not ideal, and maybe won't even work correctly.

That probably won't work.  No way to know what to fill it with as the user can change the label any time.  I could write it to a text file, then open the text file to populate the label. 

How do I use the initialization string?  Is that something that fires when Mach opens?

Offline Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: User Label
« Reply #3 on: October 28, 2011, 03:37:44 AM »
You could hard code it into the Macropump
Without engineers the world stops

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: User Label
« Reply #4 on: October 28, 2011, 12:07:47 PM »
The init string runs anytime Mach3 resets such as startup and reset.

You create a Mcode (example M1099) then put in what CB code is required AND include that Mcode in the init string.

Mach will then apply what was in the code to mach if/when it resets.

I take it the lable info is NOT numeric and you cannot use a dro?

(;-) TP

Re: User Label
« Reply #5 on: October 30, 2011, 09:12:58 PM »
The init string runs anytime Mach3 resets such as startup and reset.

You create a Mcode (example M1099) then put in what CB code is required AND include that Mcode in the init string.

Mach will then apply what was in the code to mach if/when it resets.

I take it the lable info is NOT numeric and you cannot use a dro?

(;-) TP



Yes...It is non numeric...unfortunately.

Offline zealous

*
  •  489 489
  • HI!
    • View Profile
    • Artsoft Solutions
Re: User Label
« Reply #6 on: November 02, 2011, 07:55:51 PM »
Scott posted this awhile ago but the search function in Mach's forum is broken
Just change the location of "UserLabel.AGD" to store the Userlabels when you close Mach3, maybe make a Save button.
I dont rember if Mach3 has a Mcode that gets fired off when you shut it down, but if there is one you can put this script in there to store the userlabels.

Code: [Select]
UserLabels = 1
Open "C:\\Program Files\\AGD\\UserLabel.AGD" For Output As #6
For z = 1 To 250
LabelState = GetUserLabel(UserLabels)
Print  #6, LabelState
UserLabels = (UserLabels + 1)
Next z
Close #6
Code("SAVE_XML")


Put this in a Macro to load the stored labels:

Code: [Select]
Dim fich3 As String
fich3="C:\Program Files\AGD\UserLabel.AGD"
If Dir(fich3)<>""  Then
Call Dir("null")
UserLabels = 1
Open "C:\Program Files\AGD\UserLabel.AGD"  For Input As #5
Do While Not EOF(5)
Line Input #5, FileData
SetUserLabel(UserLabels, FileData)
UserLabels = UserLabels + 1
Loop
Close #5
Else
Call Dir("null")
MsgBox("no file to load:" & fich3)
End If

otherwise you'll have to request that Mach3 stores user/Labels in the XML.
Re: User Label
« Reply #7 on: November 09, 2014, 11:49:26 AM »
Hi, everybody, I try to add label to my screen and will need to change the label dynamically , I learned from mach3 v3 programmer's manual, I should be able to do it in vb script( setuserlabel(number,"text"), but the problem is, in screen4,when I add the label to the screen, I do not get a label number and I can not give it a number either, can anyboby give me a hint? Thank you very much for your help!
Re: User Label
« Reply #8 on: March 13, 2016, 02:06:03 PM »
Old post, but I learned the answer, maybe will help someone out....
When you create your label, the text should be "UserLabel" + some integer from 1 to 255...for example "UserLabel50"
Now your code and Mach3 have access to read and write, just like a DRO...

To write to it, simply call SetUserLabel(50, "some such text"), read it if someone entered into it, use GetUserLabel...

Leslie

Offline zealous

*
  •  489 489
  • HI!
    • View Profile
    • Artsoft Solutions
Re: User Label
« Reply #9 on: March 13, 2016, 07:16:07 PM »
you don't need to get the label value, if you put the text box var as _root.USERLABEL********* and you can use 0 - 3000.

also here are some more labels

VB Label:            Flash Label

"COSYS"            _root.Cosys
"TOOLDESC"         _root.ToolDesc
"UNITREVMIN"      _root.UnitRev
"UserLabel#"         _root.USERLABEL#
"Error"            _root.StatusLine
"RADDIA"         _root.RadDia
"Mode"            _root.Mode
"Profile"            _root.Profile
"File"            _root.FileName