Machsupport Forum

G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: jdm033056 on October 12, 2020, 11:51:21 PM

Title: Noob G Code question
Post by: jdm033056 on October 12, 2020, 11:51:21 PM
So I am brand new to CNC and after a 2.5 year battle over receiving a machine that was being built for me and then receiving an incomplete pile of pieces I have my machine together and moving. I have no experience with G Code but love to learn new things. Tonight I tested movement with code for the first time. I wrote a simple code to start in the middle of a square, move out, move around and back to the center just moving air. Here is the code

%        (1)
G01
F50
Y-2
X2       (5)
Y4
X-4
Y-4
X2
Y2       (10)
%

The machine ran blocks 3-8 exactly as it should but it moved block 9. 4 inches and block 10. 4 inches. So it didn't end up back at center but rather at the back right corner. I ran it many times with the same result. Running Mach 3 with motors calibrated and tuned. Do I have a setting wrong in Mach, or am I not understanding the code or what? I know this seems ridiculously simple to most, but a guys gotta start somewhere. Even at 64. :) Thanks for your help
Title: Re: Noob G Code question
Post by: Tweakie.CNC on October 13, 2020, 02:05:53 AM
Hi,

Your Gcode ran just fine here so it is not that which is causing the problem.

I know it sounds basic but perhaps check the mechanicals of your machine for tightness or binding of an axis or even slippage of a coupling, looseness of a grub screw, etc.

Tweakie.
Title: Re: Noob G Code question
Post by: TPS on October 13, 2020, 03:40:30 AM
Hello,

your code will only work, if you are in incremental mode (G91), not if you are in absolute (G90)
Title: Re: Noob G Code question
Post by: Tweakie.CNC on October 13, 2020, 03:56:04 AM
Excellent.  :D

TPS has solved the mystery.

Tweakie.
Title: Re: Noob G Code question
Post by: jdm033056 on October 13, 2020, 10:07:28 AM
Hello,

your code will only work, if you are in incremental mode (G91), not if you are in absolute (G90)

Thanks to you both, to prove that I am a noob :) where do I check and change that? I've seen it but don't remember where. Also is one better for common usage.
Title: Re: Noob G Code question
Post by: TPS on October 13, 2020, 03:01:13 PM
hello jdm033056 ,

the best Thing is to add it to your code.
 for example:
Code: [Select]

%        (1)
G91 (it is allways good to put a Header line in G-Code not only G91 or G90 some other basic's would be good)

G01
F50
Y-2
X2       (5)
Y4
X-4
Y-4
X2
Y2       (10)
%
Title: Re: Noob G Code question
Post by: jdm033056 on October 13, 2020, 04:40:08 PM
Thank you. TPS