Hello Guest it is March 29, 2024, 09:12:27 AM

Author Topic: Gcode to re-zero Z axis  (Read 12336 times)

0 Members and 1 Guest are viewing this topic.

Gcode to re-zero Z axis
« on: October 18, 2007, 09:55:04 AM »
I've got Mach3 running pretty well right now.  I just set up a floating torch head, and have a few code questions.  I can get the G28.1 command to reference the home switch, no problems there.  But, after the reference command, the Z axis DRO doesn't reset to zero. 

What I would like to have happen is the G28.1 command be run to reference the home switch, the Z axis offset be reported, and then the new Z height it referenced become zero. 

My thought is that this way every time the torch head references the switch it re-zeros for the code to run based on the height/thickness of the metal at that location.  By re-referencing before every cut I am hoping to avoid the torch dragging on the metal or trying to fire too far above the metal. 

I am currently using LazyCAM for my .dxf to Gcode conversions, and I'm not sure of any way to get it done in LazyCAM.  Any help would be greatly appreciated.
« Last Edit: October 18, 2007, 09:57:43 AM by dnorton77 »

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Gcode to re-zero Z axis
« Reply #1 on: October 18, 2007, 10:05:42 AM »
The easy way in my opion would be to Drop a Dro on your main page
and call it Metal thickness, put its number as 1100 in screen designer.

Then put this macro in your macro folder for your machine.
have your post processor, (or hand edit in) this macro after your G28.1
note in homing/limits set your z to auto zero after homing.

so your posted G code would look like this:

G90 G17
G28.1
M700
(the rest of code here)

Here is the Macro:

'M700.m1s  'metal thickness offset macro

z=GetUserDro(1100)     'get the value of your metal thickness from the dro.
Code "G0 Z" & z        'This moves to the new Z position that you put in the dro.
While IsMoving
WEnd

'Scott
« Last Edit: October 18, 2007, 10:08:54 AM by poppabear »
fun times
Re: Gcode to re-zero Z axis
« Reply #2 on: October 18, 2007, 10:49:04 AM »
Scott,

Thanks for your input.  Sorry to bug you, but I'm not really sure how to add a new DRO to my main screen.

Also, I'm not too sure how to make a macro.  Sorry, but I'm really not much of a programmer.

Any chance you could help me out with these issues?

Thanks

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Gcode to re-zero Z axis
« Reply #3 on: October 18, 2007, 11:02:03 AM »
I posted the macro on my last post, here it is again, copy it, then open up mach3, then click operator, then VB scripter, then paste it into the window, click file, save as, then name it M700, make sure it is saving to the directory that has your machines profile in the macro folder for that profile.

What screen are you using now?

Download a copy of Screen 3, install it, open it, goto file open, navigate to the screen set your using, open it, the little tool bar, click on DRO, you can click on the dro and rezise it, place it on your screen, double clidk it then, and tick the button that says OEM number, put in the box 1100.

If not, post what your screen is and I will do it for you.

scott
fun times

vmax549

*
Re: Gcode to re-zero Z axis
« Reply #4 on: October 18, 2007, 02:27:21 PM »
Scott you might want to be carefull with userdro's in the range that may be used by wizards we have had some interesting confict show up between mach and wizards sharing the same dro#s.

I moved all my userdros to the end of the number range far away from the normal wizards range.

Just a thought, (;-) TP

vmax549

*
Re: Gcode to re-zero Z axis
« Reply #5 on: October 18, 2007, 02:58:22 PM »
HUM have you tried setting up the G28 reference position in config to Zero??? Or am I missing something to do with a plasma head (;-) TP

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Gcode to re-zero Z axis
« Reply #6 on: October 18, 2007, 03:17:00 PM »
vmax549,

   I usually do, but my replies where for instructional purposes for dnorton77

scott
fun times
Re: Gcode to re-zero Z axis
« Reply #7 on: October 19, 2007, 10:25:21 AM »
Thanks for the help. I appreciate it.