Page 1 of 1
hot key for fixed z move
Posted:
Tue Feb 08, 2022 2:03 am
by jimpointoh
Is it possible to assign a hotkey so when it is pressed it would move the Z axis down a certain settable distance. We have a 6' x 24' "cnc router" we built using UCCNC to flatten large wood slabs using a 4" diameter fly cutter. I want to basically do this... Once the highest point of the wood slab is visually found, I want to run the M31 macro on a touch plate to set this point as material surface (these slabs come in twisted and cupped and have a very uneven surface so we start at the highest spot). Once this is found, I would like to hit a hotkey to move the Z axis down a set amount (typically .125"). We then use a wireless usb number pad to "jog" the spindle around until that area is flat. Hit the hotkey again to move the bit down another .125" and continue jogging x and y, rinse and repeat until the entire slab is flat. Does something like this sound feasible? Would this be considered a macro that needs to be written? Appreciate any help.
https://imgur.com/a/VQJqGU3
Re: hot key for fixed z move
Posted:
Tue Feb 08, 2022 3:50 am
by ger21
Yes, a very simple macro named M20000-M21999, and you assign the M# to the hotkey.
Basically, read the Z axis DRO, then subtract 0.125 from it, and move to that position.
Re: hot key for fixed z move
Posted:
Tue Feb 08, 2022 6:00 pm
by jimpointoh
Do you have a recommendation on where I can find some info on the syntax for writing the macro? This sounds like a good idea, and I want to persue doing this. What language does the macro need to be written in?
Thanks for the reply!!
Re: hot key for fixed z move
Posted:
Tue Feb 08, 2022 8:48 pm
by ger21
I'll get it when I get home in a few hours.
VB or C#.
Re: hot key for fixed z move
Posted:
Wed Feb 09, 2022 12:56 am
by ger21
- Code: Select all
double currentZ = AS3.Getfielddouble(228);
double newZ = currentZ - 0.125;
exec.Code("G0 Z" + newZ);
while(exec.IsMoving()){}
Re: hot key for fixed z move
Posted:
Wed Feb 09, 2022 3:32 am
by fixebr
Please let me know if the code is correct in this situation.
- Code: Select all
exec.Code("G91");
exec.Code("G0 Z-1");
exec.Code("G90");
I did this for a similar task, but I'm not sure if this is the right approach.
Re: hot key for fixed z move
Posted:
Wed Feb 09, 2022 11:52 am
by ger21
Yes, that does the same thing as the code I posted above.
You do need to add the While... Waiting after each line of code.