Hello Guest it is October 23, 2019, 06:56:45 AM

Author Topic: Execute Code With Buttons  (Read 4570 times)

0 Members and 1 Guest are viewing this topic.

Execute Code With Buttons
« 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.

« Last Edit: June 10, 2015, 07:22:13 PM by Bob La Londe »

Offline ger21

*
  • *
  •  6,288 6,288
    • View Profile
    • The CNC Woodworker
Re: Execute Code With Buttons
« Reply #1 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.
Gerry

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

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: Execute Code With Buttons
« Reply #2 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,)



Offline RICH

*
  • *
  •  7,368 7,368
    • View Profile
Re: Execute Code With Buttons
« Reply #3 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
Re: Execute Code With Buttons
« Reply #4 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. 

Offline BR549

*
  •  6,902 6,902
    • View Profile
Re: Execute Code With Buttons
« Reply #5 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

Offline RICH

*
  • *
  •  7,368 7,368
    • View Profile
Re: Execute Code With Buttons
« Reply #6 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
Re: Execute Code With Buttons
« Reply #7 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. 

Offline BR549

*
  •  6,902 6,902
    • View Profile
Re: Execute Code With Buttons
« Reply #8 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