Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started 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?
-
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
-
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.)
-
Looking in the OEM code list it seems to be 212, so VB would be
DoOemButton(212)
Hood
-
Oops sorry Z you said, I gave you X, 213 is Z.
Hood
-
Goody, goody....can't wait to try it when I get home tonight! ;D
-
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%?
-
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.
-
Thanks, been busy all day & haven't tried it yet. I'll try it later & see what happens.
-
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
-
That sounds like it'll work; I'll try it tomorrow. I'm knackered & ready for dinner & a movie (to sleep to.)
-
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
-
Good you got it working as you want :)
Hood