Home     Contact     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science     RSS     Terms of services     Privacy policy  
   
 Home     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science   

Author Topic: CNC machines - G-Codes and M-codes in a glance - Drawing an arc using G2 and G3  (Read 4409 times)

0 Members and 1 Guest are viewing this topic.

stamatis

  • Guest
A CNC (as you may already know) is drawing NOT only lines. Actually, it draws lines and arcs. With a combination of these two thing, it create marvels, drawings and complicated mechanical shapes.
And here is how it draws the arcs. There are two ways to draw a line, one is by declaring the start, end position the radius and the direction of movement, and the other is to declare the start, end position and the centre of this arc.
First of all, the arc command. Actually, it is commands rather than command. There are two arc commands, G2 and G3. They do exactly the same job and get exactly the same parameters. The difference is that, G2 will draw an arc by rotating the head clock wise (usually looking the machine from up to down) and G3 will make an arc by moving the machine counter-clock wise.

An example. Suppose that the machine is located to position 300,20 and executes the following command:

G2 X300 Y180 R200

An arc will be drawn like in the attached picture P2.jpg. The machine moved to position 300,180 NOT straight, but moved on an arc that has radius 200mm. The motion of the machine is Clock Wise because of the G2. If the command was not G2 but G3, then the result would be like the attached file P3.jpg.

This motion, and every motion of the machine that needs to move more than one axis simultaneously is called "an interpolation".

The other way on declaring arc motion is to declare the centre of the arc. This is done by the parameters I and J. I is the relative distance of the centre point from the start of the arc on the X axis and J is the relative distance of the centre point from the start of the arc on the Y axis. It is not necessary that I and J are relative to the start of the arc. If absolute positioning system is selected, then I and J are measured from the zero point rather than the start of the arc. Because is easier to work with relative measurements, almost all machines are configured with relative measurements but this is not a standard.
An example with I and J is shown in p4.jpg. The machine was stopped to 300,10 and asked to do the following command:

G2 X300 Y80 I45 J50

And here is the trick. What will happen if you give the same coordinates but you choose G3 instead of G2? Nothing strange will happen. It will draw an arc from start point to X=300 Y=80, with the same centre as before but the machine will follow a Counter-clock wise movement. The result will be like the attached file p5.jpg.

With first look, you see a drawback of the first method compared to the second. It is not obvious how to make the big part of the arc with the first method. You are partially right. Using the first method, the machine by default will make always the small part of the arc. If you wish to make the big part of the arc, you should give the arc with a negative sign. For example

G2 X300 Y180 R-200

Would make an arc like the one in the file p6.jpg.
NOTE: I have seen different controllers that may accept this function in different ways. The minus sign is the most common.
« Last Edit: August 23, 2008, 01:31:01 AM by stamatis »