Hello Guest it is April 16, 2024, 03:27:35 AM

Author Topic: Activate "Set Home Z" from G-Code possible?  (Read 4291 times)

0 Members and 1 Guest are viewing this topic.

Activate "Set Home Z" from G-Code possible?
« on: September 07, 2015, 07:47:18 AM »
I have an opto probe on the Z axis of my lathe which works great for accurately setting up a part but I'd like to automate its operation.

At the moment, I have it set up to move to the correct location but have to manually click the button on each part (standard lathe screenset at the moment)  Is there a way to activate the button from a G-code command?
Milton from Tennessee ya'll.

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Activate "Set Home Z" from G-Code possible?
« Reply #1 on: September 08, 2015, 01:42:45 PM »
You can do it via a custom M code.

Just open notepad, put the VB you want in then save as M101.m1s and save to your macro folder of the profile you are using.
When you call m101 from G Code it will do whatever is in the macro.
Custom macro numbering is 101 upwards.
Hood
Re: Activate "Set Home Z" from G-Code possible?
« Reply #2 on: September 09, 2015, 08:31:40 AM »
Thanks, that makes sense.  As far as the VB code, where can I find what's "behind" the button ie: what code runs when I click it?  I tried Operator/Edit Button Script but the Set Home Z button isn't flashing/editable.  (Or am I barking up the wrong tree as Pappy used to say.)
Milton from Tennessee ya'll.

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Activate "Set Home Z" from G-Code possible?
« Reply #3 on: September 09, 2015, 08:37:06 AM »
Looking in the OEM code list it seems to be 212, so VB would be
DoOemButton(212)


Hood

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Activate "Set Home Z" from G-Code possible?
« Reply #4 on: September 09, 2015, 08:37:56 AM »
Oops sorry Z you said, I gave you X, 213 is Z.

Hood
Re: Activate "Set Home Z" from G-Code possible?
« Reply #5 on: September 09, 2015, 09:16:50 AM »
Goody, goody....can't wait to try it when I get home tonight! ;D
Milton from Tennessee ya'll.
Re: Activate "Set Home Z" from G-Code possible?
« Reply #6 on: September 10, 2015, 08:23:44 AM »
Well piffle, it didn't work like I planned. :'(

Instead of moving the Z towards the work at the 5% speed I have setup in the Home config screen it takes off at max jog speed.  I couldn't risk destroying the probe so I gave up for last night.  Is there a way to add some code to the macro to set the jog speed to 5%?
Milton from Tennessee ya'll.

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: Activate "Set Home Z" from G-Code possible?
« Reply #7 on: September 11, 2015, 04:10:02 AM »
Hi,

SetOEMDro(3,5) will set the slow jog speed to 5%,
but i am not sure the DoOemButton(213) will
use this speed.
Thomas

here:

http://www.machsupport.com/forum/index.php/topic,30658.msg212858.html#msg212858

i have posted a list with button's, led's and dro's.
« Last Edit: September 11, 2015, 04:18:18 AM by TPS »
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Activate "Set Home Z" from G-Code possible?
« Reply #8 on: September 11, 2015, 04:53:43 PM »
Thanks, been busy all day & haven't tried it yet.  I'll try it later & see what happens.
Milton from Tennessee ya'll.

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Activate "Set Home Z" from G-Code possible?
« Reply #9 on: September 11, 2015, 05:11:35 PM »
I am not really familiar with the standard lathe screenset so I don't really know what the button in question is meant to do.
If you simply want to home the Z in the normal manner, as you would with a mill, and as I do with my own lathes, then try
DoOemButton(1024)

That should home the Z in the normal manner, ie move at the set homing speed %, trip the switch and back off until switch is closed again.
Hood