How to program cnc machine

Mosi Li
Mosi Li

Director Project Engineer at 3Q Machining - China top CNC Machining Custom Part Manufacturer

CNC programming means that the programmer (programmer or CNC machine operator) compiles a series of instructions that can be run on the CNC machine tool to complete the specified processing tasks according to the requirements of the part drawings and process documents the process of. Specifically, CNC machine tool programming is the entire process from the analysis of the part drawing and process requirements to the program inspection.

How To Program Cnc Machine

There are two kinds of CNC programming essentials: manual programming and automatic programming. Manual programming refers to a programming process that involves manual completion of various steps including part pattern analysis, process processing, data planning, preparation of step lists, input steps to step verification. It is practically used for point processing or products with simple appearance and easy programming.

Processes of Manual Program Cnc Machine

Step 01: Analyze part drawings and process requirements:

The purpose of analyzing the part drawing and process requirements is to determine the processing method, formulate the processing plan, and confirm the problems related to the production organization. The content of this step includes:

  1. Determine which type or machine the part should be processed on.
  2. Which fixture or method of clamping position is used.
  3. Determine which tool or how many tools to use for processing.
  4. Determine the processing route, that is, select the tool setting point, the starting point of the program (also known as the starting point of processing, the processing starting point is always coincident with the tool setting point), the tool travel route, and the end point of the program (the end point of the program always coincides with the starting point of the program).
  5. Determine cutting parameters such as depth and width of cut, feed rate, spindle speed, etc.
  6. Determine whether to provide coolant, whether to change the tool, when to change the tool, etc. during the machining process.

Step 02: Numeral Calculations:

According to the geometric size of the part pattern, calculate the part contour data, or calculate the tool center (or tool tip) running track data according to the part pattern and tool path. The ultimate goal of numerical calculation is to obtain all relevant position coordinate data required for CNC machine tool programming.

3. Compile the processing procedure sheet

Commonly used CNC machine tool programming instructions

A set of code symbols in a prescribed order can be stored, transmitted and manipulated as an information unit.

Coordinate word: It is used to set the displacement of each coordinate of the machine tool. It consists of coordinate address characters and numbers, usually starting with X, Y, Z, U, V, W and other letters, followed by “-” or “-” and a String of numbers.

Prepare function words (referred to as G function):

Specify the motion mode of the machine tool to prepare for the interpolation operation of the CNC system. It is composed of the preparation function address “G” and two digits. The code of the G function has been standardized; some multi-function machine tools have instructions with numbers greater than 100. Commonly used G commands: coordinate positioning and interpolation; coordinate plane selection; canned cycle machining; tool compensation; absolute coordinates and incremental coordinates, etc.

Auxiliary function word: It is used for the manufacturability instruction of the machine tool processing operation, starting with the address character M, followed by two digits. Commonly used M instructions: rotation and start and stop of the spindle; start and stop of the coolant; program stop, etc.

Feed function word: specify the movement speed of the tool relative to the workpiece. The feed function word starts with the address character “F”, followed by a string of word codes, unit: mm/min (or mm/r for CNC lathes) three-digit code Method: F is followed by three digits, the first digit is the integer digits of the feed rate plus “3”, and the last two digits are the first two significant digits of the feed rate. For example, 1728mm/min is designated as F717. Two-digit code method: F followed by two digits specifies the speedometer corresponding to 00~99. Except for 00 and 99, when the number code increases from 01 to 98, the speed increases in a proportional relationship, and the common ratio is 1.12 . One-digit code method: For machine tools with fewer speed gears, F is followed by a number, that is, 0-9 to correspond to ten predetermined speeds. Direct designation method: write the required feed rate directly after F in the predetermined unit.

Spindle speed function word: Specify the spindle rotation speed to start with the address character S, followed by a string of numbers. Unit: r/min, which is the same as the designation method of the feed function word.

Tool function word: The tool used to select and replace starts with the address character T, followed by two digits, which represents the number of the tool.

Modal commands and non-modal commands G and M commands are divided into modal and non-modal commands. Modal commands: also known as continuation commands. Once specified in the block, they will remain valid until the same group appears. The instruction becomes invalid only when it is cancelled by other instructions. N001 G91 G01 X10 Y10 Z-2 F150 M03 S1500; N002 X15; N003 G02 X20 Y20 I20 J0; N004 G90 G00 X0 Y0 Z100 M02; A section of the program must be rewritten when needed.

After completing the above two steps, you can write the processing program according to the program format and code format required by the CNC system according to the determined processing plan (or plan) and the data obtained by the numerical calculation. Programmers should not only understand the functions of the CNC machine tools and systems used, and be familiar with the program instructions, but also have the process knowledge related to mechanical processing in order to compile correct and practical processing programs.

4. Make control media and enter program information

After the program list is completed, the programmer or machine tool operator can directly enter the program information into the CNC system program memory in the EDIT mode through the operation panel of the CNC machine tool; or according to the different input and output devices of the CNC system, first enter the program list The program is made or transferred to some kind of control medium. The control medium is mostly perforated tape, and it can also be an information carrier such as tape or disk. The program information on the control medium can be input into the CNC system program memory by using input (output) devices such as perforated tape readers, tape drives, and disk drives. .

5. Program check

The compiled program must be checked for program operation before it is formally used in production and processing. In some cases, it is necessary to do part trial processing inspection. According to the inspection results, modify and adjust the program, check-modify-check again-modify again…this often takes many iterations until a program that fully meets the processing requirements is obtained.

The various tasks in the above-mentioned programming steps are mainly done manually. This programming method is called “hand programming”. In various machinery manufacturing industries, there are a large number of uncomplicated parts composed of geometric elements such as straight lines and arcs that need to be processed. The numerical calculation of these parts is relatively simple, the number of program segments is small, and the program inspection is also easy to achieve, so manual programming can be used to complete the programming work. Because manual programming does not require special configuration of special programming equipment, people of different education levels can master and use it, so manual programming is still a very common programming method.

Inspection For CNC Machining

Automatic programming for cnc machine

Parts with complex shapes and structures (especially parts composed of spatial curved surfaces), or parts with many processing steps, due to the large workload of manual programming, error-prone, step verification is also difficult, and manual programming is difficult to complete, so it is necessary to adopt Active programming.

CNC machine tool programming process: change the engineering language on the drawing into the language of the CNC device, and record it on the control medium

  1. Analyze the pattern and determine the process: Perform part process analysis to determine process parameters such as processing routes and cutting parameters.
  2. Numerical calculation: For contour processing of parts with simple shapes (such as parts composed of straight lines and arcs), calculate the starting point, end point of geometric elements, the center of the arc, the coordinate value of the intersection or tangent point of two elements, etc.; for complex shapes Parts (such as parts composed of non-circular curves and curved surfaces) are approximated by straight or circular arcs, and the node coordinates are calculated according to the accuracy requirements. In this case, the computer can be used to complete the numerical calculation.
  3. Compile the part processing procedure sheet. The programmer writes the processing procedure sheet section by section according to the function instruction code and block format specified by the numerical control system.
  4. Program verification and first piece trial cutting are performed on a CNC machine tool with a CRT graphic display screen, using the method of simulating the cutting process of the tool and the workpiece. This method can only check whether the motion trajectory is correct, and cannot detect the processing of the processed part. Accuracy, therefore, a trial cut of the first piece of the part is required.

How to learn CNC programming well?

1. Have a certain knowledge of mechanical foundation and mold structure.

2. There are two types of CNC programming: manual and computer software. Manual programming has a certain mathematical foundation, and the coordinate direction must be clear (X, -X, Y, -Y).

3. Computer software programming must be proficient, proficient in the use of software (such as MasterCAM, Ug, Pro-E), etc., including mechanical processing and mold processing, must learn 2D drawing and 3D design well, and memorize operation instructions (such as G, M), etc.

4. Know the performance and operation of CNC machine tools (such as Sanling, FANUC, Ximen, HASS), and tool grinding, etc.

5. Do more research and study the actual situation, and determine the speed of the tool and the amount of knife according to the processing material.

6. Ask diligent, think over and over, take notes

Leave Your Question & Needs Here

Our project support team will have feedback for you within 1 working day!