Hello Guest it is April 20, 2024, 12:36:26 PM

Author Topic: reset x&y to zero in gcode  (Read 1227 times)

0 Members and 1 Guest are viewing this topic.

reset x&y to zero in gcode
« on: March 25, 2023, 12:04:57 PM »
In Mach3, can the x&y axis be reset to zero in the gcode program?
I am trying to run a program multiple times without having to reset to zero manually.

Offline Tweakie.CNC

*
  • *
  •  9,198 9,198
  • Super Kitty
    • View Profile
Re: reset x&y to zero in gcode
« Reply #1 on: March 26, 2023, 01:18:03 AM »
Do you want the machine to actually return the axis to the zero position or do you want to just reset the axis DRO's to zero ?

Tweakie.
PEACE
Re: reset x&y to zero in gcode
« Reply #2 on: March 26, 2023, 08:27:56 AM »
At the end of my code I have a line that sets x&y to my start point for the next part then I manually reset the dro to zero and press start. I would like to have that step automatic so I could walk away and the machine would keep cutting parts. I am cutting small parts out of wood with a laser.

Offline Tweakie.CNC

*
  • *
  •  9,198 9,198
  • Super Kitty
    • View Profile
Re: reset x&y to zero in gcode
« Reply #3 on: March 27, 2023, 06:13:02 AM »
Like everything in Mach there is more than one way of doing this. One way would be to create a macro which will essentially press the on-screen buttons you require when it is called within your Gcode file.

Just as an example the macro could contain the commands…

DoOEMbutton(1008)  'press ZERO X button
DoOEMbutton(1009)  'press ZERO Y button
DoOEMbutton(1000)  'press CYCLE START button

Call the macro M1111.m1s and save it in your Mach3 / Macros / Mach3Mill  folder (or whatever profile you are using folder) then when you add M1111 to any of your Gcode files it will execute the macro.

You may need to elaborate on this macro and there is much documentation available on VB scripting language and DRO buttons, etc. available on the NFS website here; https://www.machsupport.com/

Just to get you started I have attached a copy of the above macro in a .zip file.

Tweakie.
PEACE
Re: reset x&y to zero in gcode
« Reply #4 on: March 27, 2023, 12:27:37 PM »
Thanks. That worked just like I wanted it to.  Now I have to learn more about macros and figure out what numbers correspond to what screen buttons so I can
write my own macros.

Offline Tweakie.CNC

*
  • *
  •  9,198 9,198
  • Super Kitty
    • View Profile
Re: reset x&y to zero in gcode
« Reply #5 on: March 28, 2023, 01:59:13 AM »
I am pleased it worked for you.

This is perhaps the best document to start learning about creating macro's for Mach3 ;

http://www.machsupport.com/wp-content/uploads/2013/02/Mach3_V3.x_Macro_Prog_Ref.pdf


Tweakie.

« Last Edit: March 28, 2023, 02:01:14 AM by Tweakie.CNC »
PEACE