Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: N4NV on February 05, 2009, 05:09:26 PM
-
I am very close to getting my converted Hardinge CHNC lathe doing everything it would do when it left the factory 26 years ago. My latest endeavor is to control the collet closer with M10, M11 and a screen button(s). I think I can figure out the macro for the M codes, one to open the collet and the other to close. It looks like I just place them in the Machturn directory and mach will execute them when it sees them in the g-code file. Now for putting a button on the screen. When I look at existing buttons like the one for the spindle, I see that one click turns the spindle on and another click turn it off. Is this done with the "use hotkey function"? If so, how can I make a single button that will open the collet with one click and close it with another click? I was thinking I might need two buttons, and in the section for G-code function put M10 in one button and M11 in another. If someone could point me in the right direction I would appreciate it.
Thanks
Vince
-
Ideally you should nothave User M Codes that are under 100, so if at all possible then rename your macros M110 and M111 or something like that.
Ok so for your single button what you can do is something like this
If GetUserLED(1000) Then
Code ("M110")
Else
Code("M111")
End If
Now in your M110 macro you will need to set the user LED inactive and in M111 set it active.
Hood
-
OK, I worked on putting in a button with screen 4. As I read elsewhere, you can not add the VB script to the button in screen 4, but you have to do it in Mach. After adding my button and saving the screen, I opened MachTurn and when I pressed the button, got a couple of errors, then the VB editor opened. When I add my code to this window, where is it saved? Is it now part of the screen set? I am doing my development on my desktop and will need to transfer everything to my machine when done.
Vince
-
Yes its now part of the screenset as you suspect.
Hood