Machsupport Forum

Mach Discussion => Mach Screens => Screen designer tips and tutorials => Topic started by: Bob La Londe on June 10, 2015, 07:16:49 PM

Title: Execute Code With Buttons
Post by: Bob La Londe on June 10, 2015, 07:16:49 PM
On one machine I used an MPG for a while, and on another I used an external joystick and some game console buttons.  I have to say neither was really wonderful for zeroing to a work piece.  

Recently I got my big mill that I put a touch screen on going again, and I used the [TAB] flyout jog screen.  I liked it as well as anything.  Especially with the touch screen.  I'ld like to use the jog screen, but get rid of most of the things on it.  Instead have multiple large buttons for each axis and have each button do a specific jog amount using g-code and relative positioning (G91 / G00 X.1 / G90).  The buttons would jog, .1, .01, .001 relative to their location from center.  I've been doing basically that with the current jog screen and a wiggler.  Its a lot faster than it sounds. 

Never mind if you hate the idea or love it.  Trust me if I can get it to work I will like it.  I just would like some guidance in setting up some buttons (LARGE BUTTONS) to execute snippets of code.  If that works I'ld also apply it to write a custom button for z-height setting with a touch pad.  I know the blue screen already has a z-height set function, but I want to do all new screens optimize for my use with large buttons and large icons for touchscreen. 

I imagine I can figure it out by reverse engineering some of the screensets already available, but I am hoping somebody is willing to give me a jump start on this.  

Eventually I think I'll run touchscreens on all machines.

Title: Re: Execute Code With Buttons
Post by: ger21 on June 10, 2015, 08:28:03 PM
If you want to run multiple lines of code, then put the code in a macro and call the M code from the button.
Title: Re: Execute Code With Buttons
Post by: Bob La Londe on June 10, 2015, 08:35:03 PM
That makes sense, and I've already written macros with embedded code for my tool changes so I kinda already know how to write code macros.  (absolute moves, position save etc,)



Title: Re: Execute Code With Buttons
Post by: RICH on June 11, 2015, 06:08:58 AM
Quote
I have to say neither was really wonderful for zeroing to a work piece.
 

FWIW,
I use 2 MPG's in continuous mode  and they work great as the settings are such that the faster you turn the
wheel the faster the axis moves. That way you can rapid jog close and then just touch off using the MPG.

Another option to consider is to rapid jog close to touch off point and then have a button  which will probe
to touch off at a slow feed rate and reset DRO's to zero on touch off and then do  whatever. It's quick and very accurate.

Just something you may want consider,
RICH
Title: Re: Execute Code With Buttons
Post by: Bob La Londe on June 11, 2015, 11:43:24 AM
Quote
I have to say neither was really wonderful for zeroing to a work piece.
 

FWIW,
I use 2 MPG's in continuous mode  and they work great as the settings are such that the faster you turn the
wheel the faster the axis moves. That way you can rapid jog close and then just touch off using the MPG.

Another option to consider is to rapid jog close to touch off point and then have a button  which will probe
to touch off at a slow feed rate and reset DRO's to zero on touch off and then do  whatever. It's quick and very accurate.

Just something you may want consider,
RICH

It is sort of in my plan to write touch off macro buttons also.  I still want to get close first. 

I actually found of all things the Xbox controller to be very useful, because I could use the trigger buttons to quickly change from step mode to jog mode.  I found my direct input joystick and arcade buttons to be the least useful of my external control devices.  I've got a nice VistaCNC MPG with LCD display and its ok, but atleast one of my machines acted a little flakey while using it.  I do eventually plan to change that machine from USB SS to ESS so it might perform better with less demand on the USB.  I started using the jog screen / touchscreen (also USB) on that machine and found I could position quite quickly by changing the step size, and thought, gee wouldn't it be nice if I could just touch buttons further out or closer in to the center for different step values.  Sure if I guess wrong I could break a wiggler, but it wouldn't be the first time I broke a tool. 
Title: Re: Execute Code With Buttons
Post by: BR549 on June 11, 2015, 04:48:38 PM
One thing to consider is IF you are using a touch probe you can run it in what is know as protected move mode. THat is when you are not probing  just joggin or moving around to get into position to probe and the probe strikes an object the MACHINE will STOP motion to protect the probe..

Most higher end controllers have it and we have been able to somewhat duplicate it in Mach3 .  It can save your bacon if you get in a hurry and forget which way to push the jogstick(;-) ask me how I know.

Just a thought, (;-) TP

Title: Re: Execute Code With Buttons
Post by: RICH on June 11, 2015, 07:03:32 PM
Quote
protected move mode.........we have been able to somewhat duplicate it in Mach3

How was that Terry?
Never heard of it.

RICH
Title: Re: Execute Code With Buttons
Post by: Bob La Londe on June 11, 2015, 07:55:07 PM
One thing to consider is IF you are using a touch probe you can run it in what is know as protected move mode. THat is when you are not probing  just joggin or moving around to get into position to probe and the probe strikes an object the MACHINE will STOP motion to protect the probe..

Most higher end controllers have it and we have been able to somewhat duplicate it in Mach3 .  It can save your bacon if you get in a hurry and forget which way to push the jogstick(;-) ask me how I know.

Just a thought, (;-) TP

Nah, I never broke a probe or a wiggler from going the wrong way or going to far.  ROFL.  Yeah right.  LOL. 
Title: Re: Execute Code With Buttons
Post by: BR549 on June 11, 2015, 09:23:05 PM
Here is where Scott and I were working on it. It always worked here.

http://www.machsupport.com/forum/index.php/topic,25253.0.html

(;-)TP