Search This Blog

Showing posts with label Gcodes. Show all posts
Showing posts with label Gcodes. Show all posts

Tuesday, October 13, 2015

Postprocessor Statements aptcodes

                        Statements that refer to the operation of the machine rather than to the geometry of the part or the motion of the cutter about the part are called postprocessor statements. APT postprocessor statements have been standardized internationally.Some common statements and an explanation of their meaning follow:

SEQNO/N,incr,k,m ==> This command controls the output sequence line number of the NC programs, Where as N is the initial sequence number, k is the increment desired, if sequence numbers are on desired at rapid motions then m=0, if sequence numbers are desired in all blocks then m=1.   

SEQNO/OFF ==> This command terminates or turn off the sequence number output in the program.

PARTNO/ ==>  This command identify the Program Number given to the Number, Most of the Program number start with the Letter O in the output NC program. 
Example: PARTNO/100 Apt code gives the output of O100 in NC program which defines the program number. 

PPRINT/ ==> This command is called postprocessor print, The character following the command will be printed in the post processor output. the maximum number of characters used can be 66. 
For example: if you want to operator to check the diameter of the hole at M00 you can print a message after M0 as PPRINT/(Check the hole diameter 10mm) ; and your program will appear ad below.
N00001 M00;
N00002 (Check the hole diameter 10mm) ;

MACHIN/ ==> Specifies the postprocessor that is to be used. Every postprocessor has an identity code, and this code must follow the slash mark (/). For example: MACHIN/Fanuc

TOOLNO/ ==> Specifies the tool parameters use in the post processor, define the diameter and the length of the tool used in the programming. 
for example: TOOLNO/100,MILL,10,0,50. Where as 10 is the diameter of the tool, 0 is the radius of the tool and 50 is the length of the tool.

SPINDL/ ==> Refers to spindle speed. If in revolutions per minute (rpm), only the number needbe shown. If in surface feet per minute (sfm), the letters SFM need to be shown, for example:SPINDL/ 100SFM. this command gives the output gcode M03. and SPINDL/OFF gives the output of M05.

LOADTL/ ==> Describes which tool to be loaded to the spindle, the tool magazine as several number of tool with the numbers, this command calls the tool number which is loaded in the magazine. 
Example: LOADTL/12, Calls the tool number 12 and loads into the spindle in case of automatic tool changer. this command gives the output gcode T12 M06

FEDRATE/ ==> Denotes the feed rate. If in inches per minute (ipm), only the number need be shown. If in inches per revolution (ipr), IPR must be shown, for example: FEDRAT/.005,IPR

COOLNT/ ==> This command defines the control of cutting fluid into the machine. 
Example: 
COOLNT/ON - this command gives the output gcode M07.
COOLNT/MIST -this command gives the output gcode M08.
COOLNT/FLOOD - this command gives the output gcode M18 ( Changes in some machine control)
COOLNT/OFF -this command gives the output gcode M09.

TURRET/  ==> Used to call for a selected tool or turret position

CYCLE/ ==> Specifies a cycle operation such as a drilling or boring cycle. An example of adrilling cycle is: CYCLE/DRILL,RAPTO,.45,FEDTO,0,IPR,.004. The next statement might be GOTO/PI and the drill will then move to P1 and perform the cycle operation. The cycle will repeat until the CYCLE/OFF statement is read.. 
CYCLE/DRILL - Drilling cycle, it gives the output of Gcode  G81.
CYCLE/REAM - Drilling cycle, it gives the output of Gcode  G85.
CYCLE/TAP - Drilling cycle, it gives the output of Gcode  G84.
CYCLE/OFF - Drilling cycle, it gives the output of Gcode  G80.


RAPID ==> Means rapid traverse and applies only to the statement that immediately follows it. this command gives the output gcode G00.

END ==> Stops the machine but does not turn off the control system, this command stops all the operations including the coolant, spindle and the machine. its like end of the program or operation. this command gives the Output of M02.

FINI ==> This command ends the programs and resets the program to the beginning of the program, it give the output of gcode M30  

STOP ==> This Command stops the program and let the operator to check the dimensions on the part, and cycle start to continue the program, it gives the out put of mcode M0.

OPSTOP==> This Command Halts the program Similar to STOP, and cycle start to continue the program, it gives the out put of mcode M1. to check the difference go to mcodes section.

INSERT ==> Inserts the command directly into the program, ignoring the postprocesser, use this command carefully, Example INSERT M01, it gives the out put of mcode M01 without calling OPSTOP command.

ORIGIN/ ==> This Apt command gives the origin defined by programmer, 
Example: ORIGIN/54, gives the out put of mcode G54.

FROM/X,Y,Z ==>  FROM Statement initializes the spindle start position from the coordinate system. if the FROM command not used the postprocesser will assume the start point coordinates are X0,Y0,Z0. most of the postprocesser developed gives the warning message for not using FROM command.

ROTABL/ATANGL ==> This command rotates the table at a specified defined angle. 
for example: ROTABL/ATANGL,45 in an 4axis horizontal table machine this command rotates the table at B45, it takes the shortest angle of rotation to reach B45 degrees it may be either clockwise or the anticlockwise.

ROTABL/INCR,45 ==> This command rotates the table 45 degrees incremental from its current position in clockwisse direction.

ROTABL/ATANGL,45,(A)(B)(C)AXIS ==> This command rotates the table 45 degrees in the specified axis either A or B or C as per the programmer commands.


There are several apt commands for the NC Programming, we will be updating one by one to cover all the code list. 

Enjoy learning CNC Programming and APT Programming.



Saturday, September 05, 2015

CNC Procedure Step by step procedure


In a CNC machine we can create a CNC Program in hundreds of ways to machine the same work piece and all the ways we can expect the same finished part.
                                When you receive a 3D model to do CNC program, check the 3D Model for the numbers of ways we can place fixtures and number of setups required to finish the part. But, in addition to creating the CNC program, there is many other factors need to Know to machine the work-piece. There are many questions on your mind about how to hold the work, which cutting tools to be selected and which machining conditions to be used to get a perfect part on CNC machine.

Step #1: Selecting a Machine.
-       As described above we can machine a part in hundreds ways, but it’s wise to select the machine if you have many options in your shop floor. 
-       If the machining part has a difficult angles and surface profile, an ideal 3-axis machine may take number of setups consuming time and may be difficult to achieve the tolerance.
-       A 5-Axis machine can reduce the setup and give the best tolerance for the complicated parts.
-       A simple part can’t be machine on a 5-axis machine due to the high cost. So we need to decide wisely keeping in mind of machining time and the labour.

Step #2: Work holding Selection for the Part.
-       There are number of ways to hold a part on the machine, it always depends on the billet you are using. Billet may be a rectangular block, forging stock, casting block.
-       If you are using a rectangular block, you can use a machine wise on the machine table. If the block is big for machine wise you can use the push clamps to hold the block on machine table.
-       If the stock is an forging or a casting then you need to design the special fixture which can hold the stock comfortable and rigid.

Step #3: Choose the cutting Tools.
-       Choosing the tools for cutting the part is an important factor for the finishing the part. We need to choose the cutting tools depending on the type of material we are cutting.
-       For aluminium stainless steel cutting tools can perform well, but for the hard material like titanium and steel better consideration are carbide tools.
-       Before generating the programs it’s better to check the tools available in the shop floor, instead of waiting for the tools to be ordered.
-       Always shorter tools give more accurate results than the longer tools, so wisely use the tools in your programs depending on the height and depth of the part.

Step #4: Gather all Cutting Condition Data.
-       After the tools have been decided, calculate your cutting data such as speed & feed which can suit easy removal of material.
-       Recommended to use the cutting data given by the tools catalog given from tool manufacturers.
-       You can experiment using the different feeds and speeds later while optimizing the programs.

Step #5: NC-Axis Selection on the Part.
-       Decide the NC axis Point on the part. Example: you can select a corner of the part where X, Y and Z meet.
-       Selection of NC axis must make the machine operator to probe the part X, Y and Z easily. There is only on machine Zero axis, But you can create a number of NC axis i.e., Work co-ordinate offset.
-       If you are using a rectangular block, you can select the corner of the block for your NC axis XYZ=0, operator can probe the three walls of the block to make XYZ=0 on the machine and store the value on the machine Work offset. Usually we can use G54 which is standard..
Step #6: Creating a CNC PROGRAM.
-       An NC Program can be created in many ways, now a day’s using software like UNIGRAPHS, Catia, Mastercam etc. is the common way to create a NC program.
-       If it’s a simple program it can be done manually, such as program involving only drilling, reaming and tapping cycles.
-       After creating the tool paths’ using the software’s you can generate a NC-program which as G-codes directly within built postprocessor.
-       If you have a customized postprocessor loaded with the control of your machine, then the results are accurate.

Step #7: Checking the CNC PROGRAM.
-       There are number of ways to check the programs, program can be simulated for errors in the software’s used for generating the tool path.
-       You can use simulator software like Vericut, where we can build our machine and load the controls and test our G-code. The simulation can be actual like it’s been milled on machine.
-       If you want to verify only the tool paths you can use software’s like cimco edit. You can find much software on internet to visualize the tool paths.

Step #8: Setting up the CNC Machine.
-       Setting up your machine for testing the program is very important. Load all the fixtures decided to hold the part and mount the part as you designed while generating tool path.
-       Load the NC-program on the CNC machine memory or you can use the DNC software’s.
-       Load the tools into the tool magazine on the machine as per the tool numbers described in the program.
-       Define the individual tool offsets and store on the machine.
-       Probe and define NC program Zero and store G54 on the machine.

Step #9: PROGRAM PROVE OUT.
-       After all the setup. Here we go we can test our programs.
-       There are number of ways to test the programs if you are not sure of your program go well..
-       Testing the programs can be done on the dry run option on the machine.
-       Testing the programs can be done by cutting the wood instead of metal.

Good luck, have fun learning CNC Programming... 
If you have any questions and comments please let me know



Monday, December 15, 2014

G50 and G51 Scaling and Mirroring


G50, G51 - Scaling / Mirroring (Optional):
G51 scales program G-codes relative to a scaling center point defined as position (X, Y, and Z).
G50 – Cancels the scaling factor applied

 A G51 applies scaling/mirror to all positions, lines, and arcs following this G-code until a G50 are entered. Specify scaling factors with a value I, J, K. The X, Y, and Z parameters are the coordinates of the scaling center. If the scaling center is not specified, the default scaling center is the current cutter position. To mirror, enter a negative value for the scaling factor.

Example, Scaling:

G51 X0.0 Y0.0 Z0.0 I3.0 J2 K1; turn scaling on
G00 X0.0 Y0.0 Z1.0; rapid to x0, y0, Z1
G01 X1.0 Y0.0 Z1.0; line to X1, Y0, Z1
G01 X1.0 Y1.0 Z1.0; line to X1, Y1, Z1
G01 X0.0 Y1.0 Z1.0; line to X0, Y1, Z1
G01 X0.0 Y0.0 Z1.0; line to X0, Y0, Z1
G01 X0.0 Y0.0 Z0.0; line to X0, Y0, Z0

G50; cancel scale
For this G51, the following program lines were scaled 3:1 in the X direction, 2:1 in the Y direction, and
1:1 in the Z direction. If no scale factor is specified, the default is 1:1 for all axes.

Example, Mirroring:

G51 X-0.5 Y0.0 Z.0 I-1 J1 K1; turn mirror on.
G00 X0.0 Y0.0 Z1.0; rapid traverse to X0, Y0, Z1
G01 X1.0 Y0.5 Z1.0; line to X1, Y.5, Z1
G01 X0.0 Y1.0 Z1.0; line to X0, Y1, Z1
G01 X0.0 Y0.0 Z1.0; line to X0, Y0, Z1
G50; cancel scale
If scaling factors are the same for all the axes, parameter P can be used.

Example:

G51 X1.0 Y2.0 Z0.0 P2.5; scale all axes a factor of 2.5. If an arc is scaled with uneven scaling factors, the result will depend on how the arc center and radius were specified:

NOTE: If the arc radius was specified with R, the radius will be scaled by the larger of the two circular plane scale factors. The result will be a circular arc between the scaled arc start and the scaled arc end.

NOTE: If the arc center was specified with I, J, and/or K, the centers will be scaled by the appropriate axis scale factors. The result will be a circular arc from the scaled arc start, around the scaled center, and usually with a line from the end of the circular arc to the scaled arc end.

NOTE: In no case can an ellipse be generated using scaling.


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.

Wednesday, June 11, 2014

How should be a CNC Programming structure ???



CNC Programming has a defined structure which machine can read the codes without errors. NC Programming can be categorized into 3 parts:

1.      Main Program.

2.      Part program.

3.      Sub program.

1.     Main Program Structure


The main program is first read or accessed on machine tool when the entire part program sequence is run. Normally, the controller operates according to one program. In this case the main program is also the part program. This controlling program can then call a number of smaller programs into operation. These smaller programs, called Sub Programs. These subprograms are generally used to perform repeat tasks, before returning control back to the main program.

Each block, or program line, contains addresses which appear in this order:

N, G, X, Y, Z, F, M, S, T;

This order should be maintained throughout every block in the program, although individual blocks may not necessarily contain all these addresses.


Meaning of addresses:

N          - Refers to the block number.

G          - Refers to the G code (Preparatory function).

X          - Refers to the distance travelled by the tool in the X axis direction.

Y          - Refers to the distance travelled by the tool in the Y axis direction.

Z          - Refers to the distance travelled by the tool in the Z axis direction.

F          - Refers to the feed rate.

M         - Refers to the M code (Miscellaneous function).

S          - Refers to the spindle speed.

T          - Refers to the tooling management.






2.      PART PROGRAM STRUCTURE


A part program is a list of coded instructions with series of letters and numbers. The part program includes all the geometrical and technological data to perform the required machine functions and movements to manufacture the part.

The part program can be further broken down into separate lines of data, each line describing a particular set of machining operations. These lines run in sequence, are called blocks. A block of data contains words which is called codes. Each word refers to a specific cutting/movement command or machine function. The programming language recognised by the CNC, the machine controller, is an I.S.O. code, which includes the G-Code and M-code groups. Each program word is composed from a letter, called the address, along with a number.


BLOCK EXAMPLE:  N010 G01 X50 Y100 F100


Word Example: G01


Address Example: G


The part program can contain a number of separate programs, which together describe all the operations required to manufacture the part.


3.      SUB PROGRAM STRUCTURE


In order to simplify the main Program in case of repeated patterns or fixed sequences the Sub program is called in between the main program. The Sub program always ends with M99 which indicates the end of sub program. Sub program can be called any number of times in a main program. When the main program calls one sub program into operation, the process is called a one-loop sub program call. It is possible to program a maximum four loop sub program call within the main program. Shown below is an illustration of a two-loop sub program call.  








Note:


1.      If cutter compensation is required on a tool and the co-ordinates for the tool are within the sub program, the cutter compensation must be applied and cancelled within the sub program.

2.      A sub program call command (M98 P1000) can be specified along with a move command in the same block. For example, G01 X63.2 M98 P1000;


Sub Program Repeat:



A call command can be set to call a sub program repeatedly. This call can specify up to 999 repetitions of a sub program. A sub program repeat command has the following format:

M98 P000 0000

When the repetition is omitted, the sub program will be called once only.

For example,

M98 P100001

This command is read call the sub program number 0001 ten times.