Modern product and production development are one of the most important prerequisites for the successful survival of the market. This includes, among other things, the application of various software tools and technologies, including tools and technologies for the automation of design, analysis, testing, and product development occupies a key place.
The appearance of complex parts conditioned the introduction of modern processing systems: Numerical Controlled Machine Tools (NC-Numerical Control and CNC Computer Numerical Control) and machining centers etc…
For the correct use of such machines, it is necessary to develop the skills of programming them, so below will be presented a guide to programming, and then a deeper explanation of the programming methods and programming language of these machines.
One machine programming process (CNC programming guide) would look like this:
- Choice of programming method – here we choose whether to write the machine program manually, with special programming functions within the control unit (workshop or conversational CNC programming or maybe CAD/CAM CNC programming)
- Production of G-code consisting of G and M-functions as well as preparation of technical documentation (tool plan, clamping plan, operation plan …)
- Simulation and verification of programs, i.e. G code in a CNC editor or verifier (these are special software that can check the correctness of the written G-code. These are software such as VERICUT, CIMCO edit, etc. …)
- Producing the part – this procedure consists of inserting a program (G-code) into the control unit on the machine, setting up and clamping the part, installing adequate tools, etc …
What is CNC Programming?
It would be important to first define what CNC programming is, in order to move on with this topic. So, here is a definition from Autodesk – one of the leading manufacturers of software for programming CNC machines:
“CNC programming (Computer Numerical Control Programming) is utilized by manufacturers to create program instructions for computers to control a machine tool. CNC is highly involved in the manufacturing process and improves automation as well as flexibility.”
We can say this more simply without undermining the meaning of the term CNC programming. So …
“CNC programming is the production of a program written in a universal programming language (G-code) which, with its functions (G and M codes), prepares the necessary information for the CNC machine control unit so that it can produce the desired parts.”
What is G-code
Okay, I know … This term has been repeated many times and it has not yet been clarified what it means. G-code is actually a programming language for CNC machine programming. Yes, it’s that easy. But it has one feature that sets it apart from the programming languages you’ve heard of – it’s universal. This means that it is the language used for all CNC machines (more than 95% of CNC machines actually), which means that if you learn to program one CNC machine with G-code, then you have learned to program any CNC machine. Isn’t this awesome?!
But why is the G-code so-called like that? This is due to the G functions related to the Geometry of the part and they make up the vast majority of CNC programs. Also next to them there are M functions related to the machine and its operation. In the following, some basics of G and M functions and their meanings will be presented.
Different Methods of CNC Programming
Technological preparation, i.e. CNC programming depending on the degree of automation can be manual, workshop programming, or CAD / CAM programming.
In manual programming, all activities are performed by the programmer based on his own knowledge and using tables with technological data, pocket calculator, programming instructions available control units. Manual programming is recommended for workpieces (parts) of simple geometry that do not require a large number of sentences (blocks) in the program. When programming CNC manually, it is necessary to know the activities to be performed conducted during the design of technological processes (refers to the design of machining processes). Design of technological processes (manually or using the CAPP (Computer Aided Process Planning) system) for CNC is most often performed in technological bureaus of factories and includes the following groups of activities:
- Careful study of the work subject (drawing, materials, tolerances, surfaces, etc.)
- Selection of raw materials or preparation if not specified.
- Selection of the required number of clamps and machines needed to make the part.
- Defining the coordinate system on the workpiece for each clamp.
- Select accessories (if they already exist) or make requests for their design and production.
- Selection of processing methods and sequence of operations and procedures in order to achieve the desired accuracy and quality.
- Selection of cutting tools and their supports for installation in the main spindle of the machine.
- Selection of cutting mode elements (number of revolutions, auxiliary movement speed, cutting depth) for the set
- workpiece material and selected tool material).
- Writing NC programs (or G-codes)
- Input of NC programs into CU (control unit) memory (manually via keyboard, via flash memory, DNC, etc.) is performed
- its testing and errors are corrected if any.
- The first piece is processed and its control, if the quality is not satisfactory, the program is corrected.
- Preparation of necessary technological documentation.
- Archiving programs and documentation.
Workshop Programming or Programming in Operation
- CAD / CAM systems are a compact whole that allows the user to integrate functions:
- Computer-Aided Design – CAD
- Computer-Aided Manufacturing – CAM (Computer Aided Manufacturing).
They are especially suitable for parts with complex continuous geometric surfaces. CAD / CAM systems can be based on all types of CAD systems. CAD / CAM systems no support other functions of designing technological processes besides defining geometry in the G-code. Other technological information such as grips, basing and clamping, cutting tools, and cutting modes are added in an interactive dialog to the NU program. This addition does not represent a big problem with complex surfaces, because they usually do not require much technical information. However, for technologically complex parts (parts that contain a large number of simple surfaces shapes that are processed by different machining processes, which are realized with different tools and cutting modes) and other machining design functions are becoming very important. This indicates that technologically complex parts require the integration of CAD / CAM and CAPP (Computer Aided Process Planning) system thus obtaining an integrated CAD / CAPP / CAM system.
How to Learn CNC Programming
Given the development of CAD / CAM systems and programming CNC machines with them, as well as approximation and facilitation, with the help of thumbnails at the interface, workshop programming, the question arises whether it is really necessary now to learn the above G and M functions (G code) and manual programming skills.
The answer is simply yes, you need to learn the G code and you need to master it well. Why? There are three main reasons:
- CAD / CAM software provides G code as an output, which is convenient to check, referring only to the first few lines of G code (a program written in G code has several tens of thousands of lines, but if it contains an error it will be in the first lines of code, other lines are mostly related to geometry and the CAM system is inviolable).
- Also, it may happen that for some part we need to write G code and we do not have access to a computer. Then the knowledge of working in CAD / CAM systems means nothing to us, and the skill of manual programming means everything.
- There are simple parts whose manual programming would be much more efficient than working in a CAD / CAM system.
The advice is to first learn G-code, i.e. manual programming for the above reasons, and later keep up with the times and first learn one CAD / CAM software to advanced or intermediate level, and later explore more of them and decide on a few that they suit you best.
Programming CNC machines is a beautiful, cost-effective but also a demanding job. It requires not only knowledge of programming languages (In fact, as we said, one programming language – G code) and good handling in CAD / CAM systems but also the skill of creating technical documentation and process plan. As a programmer, your job is not just to type the code, but also to figure out how to process the desired part – You just have to be creative. But for a start, you need to learn the basics of G-code and work in CAD / CAM systems, the procedure as explained above, and other skills will come with experience.