Hello Guest it is April 17, 2021, 11:41:05 AM

Author Topic: Noob G Code question  (Read 268 times)

0 Members and 1 Guest are viewing this topic.

Noob G Code question
« 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
Holding on to bitterness is like drinking poison and expecting the other person to die....

Offline Tweakie.CNC

*
  • *
  •  8,696 8,696
  • Super Kitty
    • View Profile
    • Tweakie.CNC
Re: Noob G Code question
« Reply #1 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.
KEEP SAFE !

Offline TPS

*
  •  2,110 2,110
    • View Profile
Re: Noob G Code question
« Reply #2 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)
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline Tweakie.CNC

*
  • *
  •  8,696 8,696
  • Super Kitty
    • View Profile
    • Tweakie.CNC
Re: Noob G Code question
« Reply #3 on: October 13, 2020, 03:56:04 AM »
Excellent.  :D

TPS has solved the mystery.

Tweakie.
KEEP SAFE !
Re: Noob G Code question
« Reply #4 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.
« Last Edit: October 13, 2020, 10:17:51 AM by jdm033056 »
Holding on to bitterness is like drinking poison and expecting the other person to die....

Offline TPS

*
  •  2,110 2,110
    • View Profile
Re: Noob G Code question
« Reply #5 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)
%
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Noob G Code question
« Reply #6 on: October 13, 2020, 04:40:08 PM »
Thank you. TPS
Holding on to bitterness is like drinking poison and expecting the other person to die....