Search This Blog

Showing posts with label Circular interpolation gcode. Show all posts
Showing posts with label Circular interpolation gcode. Show all posts

Thursday, October 08, 2015

Defining a Circle in an APT programming


In an Apt programming the geometry statement for defining a CIRCLE is very easy, as said before the APT programmer as kept everything close to English words.  The statement for circle can be written as C1 =CIRCLE/P1, R. So this command creates a Circle using a point and radius defined around it. . So when u are defining a CIRCLE command you must know the exact center point and the radius around it. The CIRCLE command is mainly used to the cutting material in the Circular motions or removing the material in the holes, the output gcode will be G02 for clockwise circular interpolation and the G03 for the anticlockwise interpolation. though the gcode is simple the background apt code will defer with respect to the arc or the circle.

Examples for the CIRCLE (C1) definition in APT programming:

There are many ways of defining the CIRCLE in an APT Programming, The following figures show the different ways of defining the CIRCLE in an APT programming


Center of the circle and the radius:
The circle can be drawn by knowing the center point and the radius of the circle. P1 is the center point from the X5 and Y6 from the origin point of the coordinates and R is the radius. this is the simple circle we draw commonly. 



Aptsource Code:
C1=CIRCLE/5,6,2
          OR
C1=CIRCLE/5,6,0,2 (Where 0=Z-axis)
          OR
C1=CIRCLE/CENTER,P1,RADIUS,2







----------------------------------------------------------------------------------------------------

Center of the circle and a tangent line:
The circle can be drawn by knowing the center point and using a line passing through tangent of the circle, here the center of the circle is fixed and the line is fixed, so the circle will be created using P1 as the center and the other end is joined to the tangent line to make the circle.


Aptsource Code:
C1=CIRCLE/CENTER,P1,TANTO,L1











----------------------------------------------------------------------------------------------------


Center of the circle and a point on the circumference:
The circle can be drawn by knowing the center point P1 and using another point P2 as the distance for the radius of the circle. In any space two point is enough to draw a circle. so the aptsource code can be written as shown as below, after drawing the circle the aptsource code takes the X and Y coordinates of P1 and P2 from the origin point and prepares the code.





Aptsource Code:
C1=CIRCLE/CENTER,P1,P2












----------------------------------------------------------------------------------------------------


Circle using three points:
The circle can be drawn by using the three points in a space, P1, P2 and P3 are the points in the space, so the curve moving the points makes a circle C1. however the aptsource code says the circle is formed using three points, the gcode generates the circle with the start point given and goes clock wise or anticlockwise to form a circle giving X,Y coordinate and I,J as the radius of the curve movement.



Aptsource Code:
C1=CIRCLE/P1, P2,P3













----------------------------------------------------------------------------------------------------


The center and a tangent circle:
The below drawing shows the two possibility of drawing a circle, If you have a point P1 and a circle C1, You can draw a circle C2 using point P1 as the center and the C1 circle circumference as tangent. Same way to draw a circle C3 you can use P1 as a center and the C2 circle circumference as tangent. the aptsource code can be written as shown.



Aptsource Code:
C1=CIRCLE/CENTER,P1,
SMALL,TANTO,C2
                OR
C3=CIRCLE/CENTER,P1,
LARGE,TANTO,C2








----------------------------------------------------------------------------------------------------


Center of the circle and a tangent to another circle:
If you have a center point P1, and Circle C2 in a space, you can draw a circle with two possibilities.
Circle C1 Can be drawn using center point P1 and the tangent to lower circumference of the Circle C2 and circle C3 can be drawn using center point P1 and the Tangent to the upper circumference of the circle. the aptsource code can be written to circle C1 and C3 is as shown below.


C1=CIRCLE/CENTER,P1,
SMALL,TANTO,C2
                OR
C3=CIRCLE/CENTER,P1,
LARGE,TANTO,C2







----------------------------------------------------------------------------------------------------


Known radius and the two intersecting lines:
The circle can be drawn by known radius and the two intersecting lines in the space, there are four corner while the line intersects, by using the known radius R we can draw circle tangent to each corners, we can draw for possible circles C1, C2, C3 and C4. the apt source for this code can be written a shown below,




Aptsource Code:
C1=CIRCLE/XLARGE,L2,
YSMALL,L1,RADIUS,.75
                  OR
C2=CIRCLE/XLARGE,L2,
YLARGE,L1,RADIUS,.75
                   OR
C3=CIRCLE/XSMALL,L2,
YLARGE,L1,RADIUS,.75
                    OR
C4=CIRCLE/XSMALL,L2,
YSMALL,L1,RADIUS,.75

The modifiers XLARGE, etc., are used to indicate which of the four circles is wanted.

----------------------------------------------------------------------------------------------------


Known radius and tangent to the line with the given radius:
If we have a known radius, a point and a tangent line in a space, the circles can be drawn in two possibilities. if the given point is P1, then the circle C1 and C2 can be drawn tangent to L1 passing through P1 in two possibilities as shown in below drawing. If the given point is P2 and it lies on the line, then the circle can be drawn in two possibilities as the circle passes through the point and the tangent to the line as shown in the below diagram. the aptsource for the circles C1,C2, C3 and C4 can be written as below: 


Aptsource Code:
C1=CIRCLE/TANTO,L1,
XSMALL,P1,RADIUS,.5
              OR
C2=CIRCLE/TANTO,L1,
XLARGE,P1,RADIUS,.5

If the point lies on the line then the apt program can be written as below,

C3=CIRCLE/TANTO,L1,
YLARGE,P2,RADIUS,.5
             OR
C4=CIRCLE/TANTO,L1,
YSMALL,P2,RADIUS,.5


----------------------------------------------------------------------------------------------------
I have explained some of the examples of drawing a circles, we can draw the circle in many ways in a space. now a days we you the computer software to calculate and generate the aptsource codes, computer software make the life easy. 

Enjoy learning cnc programming and Apt programming.

Sunday, November 23, 2014

G17-G18-G19 Plane selection

G-Code G17, G18, and G19 plane selection.

Plane selection:
In a CNC programming there are 3 G-codes for plane selection during the NC programming that are used to define the two axes of either X, Y or Z. The plane selection is modal and stays in effect for all until you command another circular plane.

The 3 Plane selection G-Codes are:


G17 for XY Plane
G18 for XZ Plane
G19 for YZ Plane
When machine is powered on, the default for plane selection is G17 for the XY plane. This means that the XY plane is already selected without programming in a G17, so the G17 XY-plane will always be active when you Power On the machine.

G17 XY Plane Selection:

G17 Format:

G17 G02 X_Y_ I_ J_

G17 is the G-code used for selection of XY plane in a CNC programming. In this plane arc is parallel to XY plane and the circular motion is defined as clockwise for the operator looking down onto the XY table from above.

NOTE: In G17 Cutter Compensation can be only applied for X and Y movement but not on Z


Example G17:

O1001                                                            (G17 XY CIRCULAR PLANE)
N170 T1 M06                                                 (1/2 DIA. 4 FLT E.M.)
N171 G90 G54 G00 X4. Y3.25 S2600 M03   (XY start point of arc)
N172 G43 H01 Z0.1 M08
N173 G01 Z-0.375 F50.
N174 G17 G02 X5.25 Y2. R1.25 F10.            (G17 circular motion XY plane)
N175 G00 Z0.1
N176 X5. Y-.25                                               (G17 is the default when you power up machine)
N177 G01 Z-0.375 F50.
N178 X3.25 Y0.8 F10.
N179 Y-.25
N180 G00 Z1.
N181 X-0.25 Y1.
N182 G01 Z-0.375 F50.
N183 G17 G03 X1. Y-0.25 R1.25 F10.          (G17 circular motion XY plane)
N184 G00 Z1. M09
N185 G53 G49 Y0. Z0. M05
N186 M30


G18 XZ CIRCULAR PLANE SELECTION:

G18 Format:

G18 G02 X_Z_ I_ K_


The G18 code is used for doing circular motion in the XZ Plane. In G18 arc is parallel to XZ plane. In these diagrams shown here you need to look at the circular direction as if you're standing at the back of the machine looking toward the spindle, for the G02 clockwise and G03 counter clockwise directions in the G18 XZ circular plane.

NOTE: In G18 Cutter Compensation can be only applied for X and Z movement but not on Y

Example G18  ZX CIRCULAR PLANE SELECTION)

N171 T13 M06                                                   (1/2 DIA. 2 FLT BALL E.M.)
N172 G90 G54 G17 G00 X1.5 Y0. S2600 M03 (XY start point of arc)
N173 G43 H13 Z0.1 M08
N174 G01 Z0. F20.
N175 M97 P200 L80                                           (Local sub-routine call done 80 times with L80)
N176 G17 G00 Z1. M09                                      (Switch back to G17 XY-plane when done using G18)
N177 G53 G49 Y0. Z0. M05
N178 M30
                     (Local sub-routine N179 called by M97 P200 on line N105, repeated 80 times with L80)
N179 G91 G01 Y-0.01                                        (Local sub-routine N200 called by M97 on line N105)
N180 G90
N181 G18 G02 X3. Z0. R0.75 F12.                     (G18 circular motion ZX plane)
N182 G91 G01 Y-0.01
N183 G90
N184 G18 G03 X1.5 Z0. R0.75 F12.                  (G18 circular motion ZX plane)
N185 M99                                                           (An M99 will cause the program to jump back to the next line after the M97 sub-routine call in the main program.)


G19 YZ CIRCULAR PLANE SELECTION:

G19 Format:

G19 G02 Y_Z_ J_ K_


The G19 code is used for doing circular motion in the YZ plane. In G19 arc is parallel to YZ plane and you need to look at the circular direction as if you're standing on the right side of machine where the machine control is, looking toward the other end, for the G02 clockwise and G03 counter clockwise directions in the G19 YZ circular plane.

NOTE: In G19 Cutter Compensation can be only applied for Y and Z movement but not on X





Example For (G19 YZ CIRCULAR PLANE SELECTION):

N171 T13 M06 (1/2 DIA. 2 FLT BALL E.M.)
N172 G90 G54 G17 G00 X0. Y1.5 S2600 M03 (XY start point of arc)
N173 G43 H13 Z0.1 M08
N174 G01 Z0. F20.
N175 M97 P100 L80 (Local sub-routine call done 80 times with L80)
N176 G17 G00 Z1. M09 (Switch back to G17 XY-plane when finished using G19)
N177 G53 G49 Y0. Z0. M05
N1788 M30
(Local sub-routine N100 called by M97 P100 in line N5, repeated 80 times with L80)
N100 G91 G01 X-0.01
N101 G90
N102 G19 G03 Y3. Z0. R0.75 F12. (G19 circular motion YZ plane)
N103 G91 G01 X-0.01
N104 G90
N105 G19 G02 Y1.5 Z0. R.75 F12. (G19 circular motion YZ plane)
N106 M99 (An M99 will cause the program to jump back to the next line after the M97 sub-routine call in the main program.)