Search This Blog

Showing posts with label cnc Programming. Show all posts
Showing posts with label cnc Programming. Show all posts

Sunday, September 20, 2015

Defining a point PT in an Apt programming

                        In NC Programming the APT programs plays a major role, the geometries are defined by APT programming and then converted into G-codes giving motions to the CNC machine.

  Defining a point in the APT programming, the statement used is GOTO/P1; the programmer must know where P1 is located before the statement can be effective. P1 therefore must be described in a geometry statement, prior to its use in the motion statement GOTO/P1.

The geometry statement for defining a point is P1 =POINT/X co-ordinate, Y co-ordinate and Z  co-ordinate where, P1 is known as a symbol Any combination of letters and numbers may be used as a symbol providing the total does not exceed six characters and at least one of them is a letter.If the Z co-ordinate is zero and the point lies on the XY plane, the Z location need not be noted.Here “PT’ is a POINT. This word is a vocabulary word. Throughout, the designers of APT have tried to use words that are as close to English as possible. A slashfollows the vocabulary word and is followed by a specific description of the particular geometry, such as the coordinates of the point P1. AnAPT programming statement for P1 might appear as P1 = POINT/1, 5, 4. The 1 would be the X ordinate; the 5, the Y ordinate; and the 4, the Z ordinate. Lines


Examples for the Point definition in APT programming:
There are other ways of defining the position of a point, such as at the intersection of two lines or where a line is tangent to a circular, intersection of two circles, single point in space etc. following pictures shows the different ways of defining the Point in an APT programming.



Point in Space: Any point in the space can be defined as shown below.

APTSource code:
P1=POINT/4,5,2
P2=POINT/2,2






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


Intersection of two lines: Point can be created by intersection of two lines.

APTSource code:
P1=POINT/INTOF, L1,L2













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



Intersection of two lines: Point can be created by intersection of line and circle. there are two possibilities, it can be written as below.

APTSource code:

P1=POINT/XLARGE,INTOF,L1,C1
                       OR
P1=POINT/YLARGE,INTOF,L1,C1
---------------------------------------
P2=POINT/XSMALL,INTOF,L1,C1
                       OR
P2=POINT/YSMALL,INTOF,L1,C1
Note: The X and Y co-ordinates of P1 is Larger than the X and Y co-ordinates of P2.


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


Intersection of two Cirlces: Point can be created by intersection of circles. there are two possibilities, it can be written as below.

APTSource code:
P1=POINT/XSMALL,INTOF,C1,C2
                         OR
P1=POINT/YLARGE,INTOF,C1,C2
---------------------------------------
P2=POINT/XLARGE,INTOF,C1,C2
                         OR
P2=POINT/YSMALL,INTOF,C1,C2
------------------------------------------------------------------------------------------------------------

Intersection of a radial line and a circle: Point can be created by intersection of circle with a radial line can be written as follows.

APTSource code:
P1=POINT/C1,ATANGL,20

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

Intersection of a radial line and a circle: Point can be created by intersection of circle with a radial line can be written as follows

APTSource code:
P1=POINT/CENTER,C1










This is how the APT codes can be written in APT programming. All software generates the APTSource fiiles using the PPtables used while generating. PPTables are the machine defined files where all the cycles and the movements are in machining standardized format

Saturday, September 19, 2015

APT programming


                   In general APT means“Automatically Programmed Tool”. The APT programming is done using the Cutter location (CL) points. APT can also be called as Cutter location File. APT programming can be classified into following below groups:

1) APT Geometry statements,
1)      Defining a point
2)      Defining a Line
3)      Defining a Circle
4)      Defining a Plane

When all these groups perform in a set then we have a complete program, Apt Geometry statements tells where the tool has to move, APT motion statement tells When and how the tool has to move will, APT postprocessor statements tells What tool has to move.

·         APT is also one of the languages that are output by many computer programs that produce CNC part programs directly from designs and drawings produced with CAD/CAM systems.
·         APT language is one of the computer languages designed to use with many NC machine tools.
·         APT was originally designed and used on mainframe computers and now it is available on mini- and microcomputers.
·         APT has also been recognised by the International Organization for Standardization (ISO) as a standardized language for NC programming.
·         APT is a very dynamic program and is continually being updated to use in CNC programming.
·         APT has the capability of programming the machining of parts in up to five axes, and also allows computations and variables to be included in the programming statements so that a whole family of similar parts can be programmed easily.

·         APT programing can be done by giving guide to the basic geometry andusing motion statements which is then converted by postprocessor to the machine readable G-codes and M-codes language.



Monday, December 15, 2014

G52 Offset Local Coordinate System


G52 - Offset Local Coordinate System:

In CNC Programming G52 G-Code used to shift the program to given distance locally.
·         The G52 works the same as G54. This code sets the origin of the local (child) coordinate system to the command location, relative to the current work system origin.
·         G52 shifts the local coordinate system origin by a specified distance.
·         Multiple G52 codes are not cumulative; subsequent shifts replace earlier ones. The G52 shift may therefore be cancelled by specifying a shift of zero.
·         If you are using multiple coordinate systems, the G52 shift amount will affect all coordinate systems.
·         G52 is a non-modal, no motion code. The G52 coordinate system will stay in effect for all work systems until it is cancelled.
·         The G52 is cancelled when RESET is pressed and at the end of a program. It is also cancelled during a program by M30, G52, X0 Y0 Z0.

Example for G52:

G0 X0 Y0; move to origin
M98 P9100; call subprogram
G52 Y4; shift coordinate system 4 inches in Y
G0 X0 Y0; move to new origin
M98 P9100; call subprogram again with new coordinates

G52 Y0; restore un-shifted coordinate system

Friday, December 12, 2014

G43 G44 and G49 tool length compensation

G-Code G43, G44 and G49 (TOOL LENGTH COMPENSATION)

 In an CNC Programming Tool length compensation Code is used to adjust for differences in length between different tools, without worrying about those differences in your part program.
This standard length is the Reference Tool. In general, you load the Reference Tool, jog the Z axis down until that tool touches some surface, and set the Z Reference position there. The control memorizes this position of its Z axis. You then load each other tool, bring that tool down until it touches the same surface, and tell the control to measure the tool. The control compares the Z axis position with this tool touching the surface to the previously stored Z Reference position. The difference in Z axis positions is stored as the length offset for the tool.

Clearly, to touch the same surface with a shorter tool, you have to move the Z axis down further. This results in a negative offset. The shorter the tool, the more the negative offset.  To touch the same surface with a longer tool, you don't have to move the Z axis down as far. This results in a positive offset. The longer the tool, the larger (or less negative) the offset.

Listed below are the Three G-Code used only for the tool length compensation,
G43 Tool Length Compensation + (plus)
G44 Tool Length Compensation - (Minus)
G49 Cancel Tool length Comp G43 and G44

G43 Tool Length Compensation + (plus):


This code selects tool length compensation in a positive direction. The tool length offsets are added to the commanded axis positions. An Hnn must be programmed to select the correct offset register from the offset display for that tool being used. During the setup process, each tool point was touched-off to the part zero surface. From this position a Tool length distance offset was recorded for that tool with the Tool offset measure key. This Tool length is referred to as the "Z" axis origin move to the part zero surfaces.

G44 TOOL LENGTH COMPENSATION - (MINUS)

This code selects tool length compensation in a negative direction. The tool length offsets are subtracted from the commanded axis positions. A Hnn must be programmed to select the correct entry from offsets memory. G44 is a rarely-used alternative to G43. It tells the control to begin applying tool length compensation, by subtracting the current length offset from all Z axis positions. In this scheme, larger length offset numbers identify shorter tools (as if they were measured from the table up rather than from the spindle down).


G49 CANCELS G43/G44

This G code cancels tool length compensation. Putting in a H00 will also cancel tool length compensation. M30 and RESET will also cancel tool length comp.

Example for G43 and G44 Programs:

O1234
N170 T02 M06
N171 G90 G54 G00 X50 Y50 Z50 S800
N172 G43 H02 Z5 M08 (or G44 and H value will not be changed)
N172 G01 Z20 F50.

Friday, December 05, 2014

G28 Return Home

G-Code G28 Return home:

G28 Is the G-Code that instructs the Controller of the machine to move the tool automatically to the reference point.  The Reference point is the fixed position on the machine, to which the tool can be moved.  This reference point is also called the “Home position”. Machine has the reference point for  X, Y and Z Axis.

G28 G-Code Format:

N170 G90 G28 X_ Y_ Z_; (Absolute Code)
Or
N170 G91 G28 X_ Y_ Z_; (Incremental Code)
                    Where X, Y and Z can be used to indicate an intermediate point, through which the tool will pass, before continuing to the reference point.  If the intermediate point is not set, tool may move in non-vector type path.  It may collide with the part or the fixture, so you can put the intermediate values in X, Y and Z to move the tool first to safety plane.
                     The move to any intermediate point and the reference point are performed at a rapid traverse rate.

Example Below shows the collision scenario 1:

 The diagram below shows how the tool could collide with the billet when moving towards the reference point with Non-vector type movement.
To avoid this collision, the tool is sent on a path which includes intermediate point P2. The intermediate point is used to allow the tool to move completely clear from the billet, before continuing onto the reference point, P3.
The above tool path can be programmed as follows (In absolute mode, G9Ø):
G90 G28 X60 Z60;
The above tool path can be programmed as follows (In incremental mode, G91):
G91 G28 X0 Z40;
So that the Tool moves to the safety plane before it reaches the Reference Point.

Example Below shows the collision scenario 2:

In the diagram below, the tool is in a position (P1) where there is no obstacle to collide. The intermediate point, in this case, is not required, so the block can be written as follows:
(In incremental mode, G91): G91 G28 X0 Y0 Z0; 

NOTE :  G28 is a non-modal G code. It is only active in the block in which it is programmed.

NOTE: If no X, Y, Z, or A is specified, all axes will be moved directly to machine zero. Any auxiliary axes (B, C...) are returned to the machine home after the X, Y, Z, and A axes. G28 will not recognize any tool length offsets in this move.






Monday, December 01, 2014

G20 & G21 (Unit Selection Codes)

G-Code G20 & G21 (Unit Selection Codes):

The CNC Programming can be done either with Imperial Unit (Inches G20) or The Metric Unit (Millimeter G21).  The following items are also changed depending on whether G20 or G21 in the programs.
1) Positioning command values (X, Y and Z).
2) Incremental movement distances.
3) Feed rates commanded by the F code.
4) Offset values.
In the world the US, Canada region are particularly use in inches, and other part of the world used Millimeter and some parts they use both inches and Millimeter depending on their requirements.
Lowest input value in G20 (Inch) is 0.0001 inch and the Lowest input value in G21 (Millimetre) 0.001 mm, this give an advantage for G21 for more accuracy.

NOTE: G20 and G21 are the modal G-codes, so G20 can only be cancelled by G21 and vice versa.

NOTE:  Units have to be defined in the beginning of the program or else Machine considers the default set by previous programs.

NOTE: Units cannot be reversed by changing only G20 or G21 in your program. It has to be defined before Post processing the program.

Example G20 Inch programming selection:

N170 O1000
N171 T02 M06
N172 G20
N173 G94 G54 G00 X10 Y10 Z100


G21 metric programming selection:

N170 O1000
N171 T02 M06
N172 G21
N173 G94 G54 G00 X10 Y10 Z100

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.)





Sunday, November 16, 2014

"What is M-CODE M97, M98 & M99 (Sub Programs or Sub Routines) Mean in CNC Programming"

M-Code M97, M98 and M99 Subprogramming M-Codes

M97 Local Sub-Program Call (P, L):  

M97 is the M-code Used to call a Subprogram with the reference of the line number N within the same program. Pxxxx code is used as a line number to be repeated. Xxxx is the line number in the same program. This is used for the simple program within the program and does not require complication of creating a sub program. A local sub-program must end with an M99. If there is a repetition of the loop of subprogram L count on the M97 line, the sub-program will be repeated L number of times.

M97 Program Format:


M97 Pxxxx Lnn
Whereas,        xxxx is the line number
                        nn is the number of repetitions

Example:


Main program:
O01234 (Program number and Start of main program)
N0001 T02 M06;
N0002 T03
N0003 G54 G90 G00 Z50
...
...
...  (Part program)
...
M97 P0015 L3 (Jumps to line N0015, after the M30, to execute a local sub-program for 3 times)
...         (The M99 at the end of the sub-program will cause it to jump back here.)
...
...
... (Finish part program)
...
M30 (End of main program)
N0015 (Identifies the start of the Local Sub-Program called up by M97 P0015)
...
... (Local sub-program portion of Main program)
...
M99 (Jumps back to the line after local sub-program call in the main program)

M98 Sub-Program Call (P, L):  

M98 is the M-code Used to call a Subprogram with the reference to the separate program created and loaded on the controller. The Pxxxx code is the sub-program number being called; it must be in the same block as the M98. A sub-program must end with an M99 to enter to main program after the subprogram. If there is a repetition of the loop of subprogram L count on the M98 line, the sub-program will be repeated L number of times before continuing to the next block.

M98 Program Format:


M98 Pxxxx Lnn
Whereas,        xxxx is the line number
                        nn is the number of repetitions

Example:

Main program:

O01234 (Program number and Start of main program)
N0001 T02 M06;
N0002 T03
N0003 G54 G90 G00 Z50
...
...
... (Part program)
...
...
M98 P111 (Jumps to program O00111 to execute sub-program)
... (The M99 at the end of the sub-program will jump back here)
...
... (Finish part program)
...
M30 (End of main program)

Sub-program:

O00111 (Identifies the start of a separate sub-program)
...
... (Sub-program portion of part)
...
M99 (Jumps back to the line after the sub-program call in the main program).

M99 End Sub-Program or Return or Loop:

           This M-code is used to end the sub-program.  If M99 is used in the main program, it will cause the program to loop back to the beginning and repeat over and over again without stopping.

Example:


Main program:


O01234
...
... (Complete part program)
...
...
M99 (This will cause the program to jump back to the beginning and repeat itself)
An M99 without a P code at the end of a sub-program will return to the main Program.)

Main program:


O01234
...
... (Part program)
...
M98 P111 (Jumps to program O00111 to run)
... (The M99 at the end of the sub-program will jump back here)
...
... (Finish part)
...
M30 (End of main program)

Sub-program:


O00111 (sub-program number)
...
... (Sub-program portion of part)
...

M99 (Jumps back to the line after the sub-program call)

"What is M06 M-code (Tool Change Command) In CNC Programming"

M-Code M06 Automatic Tool Changer code

M06 (Tool Change Command) and Pre Tool:

M06 is the M-code Used in the CNC Program to activate the automatic tool change along which T number called on the program. As soon as the controller reads the T number with M06 it will search the Tool magazine for the T number specified and rotates and brings the tool into the spindle.

Example:  

T02 M06, this Command activate the controller to change the tool to T02, so the controller searches the Tool magazine for tool number 2 and it rotates to the tool change position and then it takes up the Tool number 2 into the spindle.

Pre-tool:  

In Modern CNC Tool machines to save the time pre-tool can be called and kept ready for next tool change in the magazine. As soon as the controlled reads the next block of Tool change, the T number given in program will be detected by the controller and reads the tool number on the magazine to prepare the tool and kept in position of tool change while the current tool is in cutting progress.

Examples:

N170 T02 M06      (Automatic Tool change to Number 2)
N171 T03               (Pre-tool to keep ready in magazine for next)
N172 G54 G90 G00 X10 Y10 Z50 (Origins and safety planes Approach)

Note: Since M06 is the Automatic Tool changer, In the older machine which does not have Tool magazines to store the Tool and the tool has to be manually changed by the operator the M06 will be ineffective in those machine controllers.


Note:  When the program calls for the M06 tool change command, the coolant and the spindle will automatically stopped but the controller if they are active.

"What is M-CODES M03, M04 & M05 (Spindle motion codes) used in CNC PROGAMMING "

M-COde M03 and M04 Spindle Motion M-codes:

M03 (Spindle ON Clockwise Direction):

M03 Is the M-code used in the CNC Program to activate the Spindle along the clockwise Direction with given Spindle speed Specified with the alphabet S.
Example: After the Tool change the spindle (Clockwise direction) is activated using the M03 code with the spindle speed of S1000 means spindle rotation at 1000 RPM.
N170 T6 M06
N171 G54 G90 G00 X10 Y10 Z50 M03 S1000

M04 (Spindle ON Counter Clockwise Direction):

M04 Is the M-code used in the CNC Program to activate the Spindle along the counter clockwise Direction with given Spindle speed Specified with the alphabet S.
Example: After the Tool change the spindle (Counter Clockwise direction) is activated using the M04 code with the spindle speed of S1000 means spindle rotation at 1000 RPM.
N170 T6 M06
N171 G54 G90 G00 X10 Y10 Z50 M04 S1000

Note: M04 is commonly used in the reverse helix tools. For example: Slot cutters with reverse direction of teeth

M05 (Spindle OFF):

M05 is the M-code Used in the CNC Program to stop the Spindle any point of time required on the Program. Remember that once M05 is called in your program see that the tool does not move in the material to take cut until M03 or M04 is called again, it may lead into tool breakage.
Example:
N170 G0Z50                (Retract to Safety)
N171 M05 M09           (Spindle OFF & Coolant OFF)
N172 G91 G28 Z0       (Retract to Z Home Position)

N173 M30                    (End of the Program)