# Thread: Learning exercise (for me)

1. ## Learning exercise (for me)

Is it possible to look at this picture and determine what the gcode would be? How would it be written? Thanks for helping me learn.pic

2. Assuming XY 0 on top left.

Code:
```G90 G0 X-.125 Y-2.125
G1 Z-.3 F50.
X8.875
G0 Z1.```
?

3. It would be

G0 Z5 (to clear the stock)
G0 X9.875 Y0.125 (to move from start (0,0) to the desired x,y spot)
G1 F6 Z-0.3 (plunging move at 6IPM)
G1 F24 Y8.875 (cut along y at 24IPM)
G0 Z5 (clearing again)
G0 X0 Y0 (back home)

Hope this helps!

4. Lol, beat me, and more concise too!

5. Originally Posted by kong
Lol, beat me, and more concise too!

6. Hey chuncky, If you want to practice your codes and see them simulated you can download this free program http://www.cncsimulator.com/

Here is a sample of what you will see. You can simple type the code in the blue box on the side and then see how it will run.

7. G90 G0 X-.125 Y-2.125
G1 Z-.3 F50.
X8.875
G0 Z1.
Matt

Kaboom! Yipee! Breakthrough for me! Now I'm getting somewhere. Thanks to all of you who did the code!

8. Ummm... I know that the answers in the above posts would have confused the daylights out of me when I was first becoming acquainted with g-code.

The two codes are not the same because they started from different origins (0,0)
Also there is confusion because the graph looks as though X is North-South and Y is East West which is the reverse of standard CAD practice.

Notice that Rekd assumed that 0,0 was the UPPER left hand corner, and X was East-West.

Kong on the other hand worked under the assumption that 0,0 was at the lower left hand corner and X and Y were switched with Y being East-West.

For just starting out it would probably be best to think in the standard Cartesian plane since this is the default setting for popular CAD programs.

9. Originally Posted by ynneb
Hey chuncky, If you want to practice your codes and see them simulated you can download this free program http://www.cncsimulator.com/
Flashcut is another one to use for practise. It also converts .dxf to g-code. Get it here.

Chris

10. ## So glad you responded because......

.... that's what I always thought. (X being horizontal on the screen with Y being vertical). But then-- when I got the CNC bug I read "somewhere" that it was the other way around. I either read it wrong or it was a typing mistake. Thanks for speaking up.

"I know that the answers in the above posts would have confused the daylights out of me when I was first becoming acquainted with g-code.
The two codes are not the same because they started from different origins (0,0) Also there is confusion because the graph looks as though X is North-South and Y is East West which is the reverse of standard CAD practice."

11. AutoEditNC is a simulator created by an educator. No expiry or strings on this one. Discriminator
is commercial ware but the demo allows saving and does not expire.

12. Originally Posted by Chunky
.... that's what I always thought. (X being horizontal on the screen with Y being vertical). But then-- when I got the CNC bug I read "somewhere" that it was the other way around. I either read it wrong or it was a typing mistake. Thanks for speaking up.
You can actually set your machine up any way you like, but, as was already mentioned, most CAD programs have the X axis running horizontally and the Y axis vertical, with the origin (0,0) at the lower left.

I didn't see anyone mention it so I'll chime in here. The G90 sets the machine to move in absolute coordinates. So if you have G0 X2 Y2, the machine will move to X=2 Y=2. Absolute coordinates are the most common. But, you can also use G91, which is incremental coordinates. If you use G91, then G0 X2 Y2 will move the machine 2 units in X and 2 units in Y from it's previous position. This can get confusing when trying to read the code, because you have to read through all the code to see where you are. by using G90, you can read any line and know exactly where you are.

ALso, noone mentioned the difference between G0 and G1. G0 is a rapid, or positioning move, which occurs at the machines maximum speed. You usually use G0 to lift up the tool, and move it into position for upcoming cutting moves. G1 moves are usually cutting moves, and move at a feedrate specified by an F word. G1 X2 Y2 F10 will move at 10 inches per minute. (If your machine is set up in inches. You can set it for any type of unit you like)

Kong did a pretty good job explaining, just thought I'd add a little too it.

Page 1 of 2 12 Last