Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: DICKEYBIRD on September 07, 2015, 07:47:18 AM

Title: Activate "Set Home Z" from G-Code possible?
Post by: DICKEYBIRD 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?
Title: Re: Activate "Set Home Z" from G-Code possible?
Post by: Hood 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
Title: Re: Activate "Set Home Z" from G-Code possible?
Post by: DICKEYBIRD 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.)
Title: Re: Activate "Set Home Z" from G-Code possible?
Post by: Hood 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
Title: Re: Activate "Set Home Z" from G-Code possible?
Post by: Hood on September 09, 2015, 08:37:56 AM
Oops sorry Z you said, I gave you X, 213 is Z.

Hood
Title: Re: Activate "Set Home Z" from G-Code possible?
Post by: DICKEYBIRD on September 09, 2015, 09:16:50 AM
Goody, goody....can't wait to try it when I get home tonight! ;D
Title: Re: Activate "Set Home Z" from G-Code possible?
Post by: DICKEYBIRD 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%?
Title: Re: Activate "Set Home Z" from G-Code possible?
Post by: TPS 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.
Title: Re: Activate "Set Home Z" from G-Code possible?
Post by: DICKEYBIRD 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.
Title: Re: Activate "Set Home Z" from G-Code possible?
Post by: Hood 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
Title: Re: Activate "Set Home Z" from G-Code possible?
Post by: DICKEYBIRD on September 11, 2015, 09:22:30 PM
That sounds like it'll work; I'll try it tomorrow.  I'm knackered & ready for dinner & a movie (to sleep to.)
Title: Re: Activate "Set Home Z" from G-Code possible?
Post by: DICKEYBIRD on September 12, 2015, 08:55:32 AM
Ahhh, life is good.  A few hours sleep, a saturday morning away from the real job, a cuppa Joe, some muffins n' jam, and Hood fixed my problem... as usual. ;D

A quick edit to put the 1024 in place of the 213 and Robert is my favorite brother, it works a treat, I'm happy as a sandboy.  That's all the British sayings I could think of off hand that fit.  Oh wait, Hood's Scottish.  Oh geez, now I've gone & dunnit.  Didn't mean to pi$$ yer off! ;)

Seriously though, thanks a ton.  That one little thing really made my day! ;D
Title: Re: Activate "Set Home Z" from G-Code possible?
Post by: Hood on September 14, 2015, 06:18:33 AM
Good you got it working  as you want :)

Hood