Hello Guest it is February 05, 2023, 06:48:04 AM

Author Topic: Gcode  (Read 555 times)

0 Members and 1 Guest are viewing this topic.

Gcode
« on: October 21, 2019, 09:59:12 PM »
I was wondering if their is a gcode command to move an axis a certain amount Without specifying the exact xyz location.  For instance suppose the Z axis has been moved from the 0.0 location by a THC and the cnc does not actually know the axis has been moved and I want to lift the z axis 50 thousandths or lower it 50 thousandths.  I think I just answered my question.  If the cnc does not know the z axis has been moved and I tell it to move to 0.050 and then back to 0.0 it should move as if it were there from the start?  Does that sound reasonable? 
Re: Gcode
« Reply #1 on: October 21, 2019, 11:13:13 PM »
Hi,
that is the difference between absolute movement and incremental movement, the two different modes are called into effect by either g90 or g91.

Usually your X-Y moves on a plasma table are absolute, so the torch will move to x1y1, x2y2, x3y3
etc in sucession. The Gcode for that would look like this:
g90 ; Absolute mode
g1 x1 y1
g1 x2 y2
g1 x3 y3

If you want to move the Z axis incrementally between moves it would look like this:
g90 ; Absolute mode
g1 x1 y1
g91 ;Incremental mode
g1 z 0.05
g90 ;Absolute mode
g1 x2 y2
g1 x3 y3

Note that what you cant do is have one axis move incrementally while the others move absolutely, Mach is in one mode or the other. You need to switch
between modes.

As a consequence it can be problematic to use both modes within a Gcode program, it so easy to lose track of which mode you are in and call
a move g1 x5 y5, expecting the machine to go to x=5, y=5 but in fact its in incremental mode and it goes 5 to the right and 5 backwards, not what
you intended at all!

Use with caution.

Craig
« Last Edit: October 21, 2019, 11:14:48 PM by joeaverage »
My wife left with my best friend...
     and I miss him!