hot key for fixed z move

Post anything you want to discuss with others about the software.

hot key for fixed z move

Postby jimpointoh » Tue Feb 08, 2022 2:03 am

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
jimpointoh
 
Posts: 2
Joined: Sun Jun 06, 2021 10:30 am

Re: hot key for fixed z move

Postby ger21 » Tue Feb 08, 2022 3:50 am

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.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: hot key for fixed z move

Postby jimpointoh » Tue Feb 08, 2022 6:00 pm

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!!
jimpointoh
 
Posts: 2
Joined: Sun Jun 06, 2021 10:30 am

Re: hot key for fixed z move

Postby ger21 » Tue Feb 08, 2022 8:48 pm

I'll get it when I get home in a few hours.
VB or C#.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: hot key for fixed z move

Postby ger21 » Wed Feb 09, 2022 12:56 am

Code: Select all
double currentZ = AS3.Getfielddouble(228);
double newZ = currentZ - 0.125;
exec.Code("G0 Z" + newZ);
while(exec.IsMoving()){}
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: hot key for fixed z move

Postby fixebr » Wed Feb 09, 2022 3:32 am

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.
My English is bad, so you're reading machine translation results. Alas.
User avatar
fixebr
 
Posts: 40
Joined: Thu Dec 30, 2021 8:30 pm
Location: Russia, Moscow

Re: hot key for fixed z move

Postby ger21 » Wed Feb 09, 2022 11:52 am

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.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am


Return to General discussion about the UCCNC software

Who is online

Users browsing this forum: No registered users and 13 guests