Hello Guest it is December 13, 2024, 07:06:00 PM

Author Topic: Screen 4, Macro, M10, M11 etc.  (Read 6211 times)

0 Members and 1 Guest are viewing this topic.

Offline N4NV

*
  •  398 398
Screen 4, Macro, M10, M11 etc.
« 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

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
Re: Screen 4, Macro, M10, M11 etc.
« Reply #1 on: February 05, 2009, 06:04:12 PM »
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
« Last Edit: February 05, 2009, 08:32:44 PM by Hood »

Offline N4NV

*
  •  398 398
Re: Screen 4, Macro, M10, M11 etc.
« Reply #2 on: February 06, 2009, 11:54:32 AM »
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

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
Re: Screen 4, Macro, M10, M11 etc.
« Reply #3 on: February 06, 2009, 01:32:10 PM »
Yes its now part of the screenset as you suspect.
Hood