

To do this, we just need this simple line of G-Code. Now that we have our profile already written, we don’t need to write it out again when we use a finishing tool, we just need to recall the G-Code subroutine. I usually keep these ‘N’ numbers the same as the tool number, so if I am cutting with T05, then I will start the section of G-Code with N5.įor more on roughing cycles, check out my article called “ G71 roughing cycle on a CNC Lathe“. This is so I can search quickly to that section of code. You will notice that I start my blocks of programs with N1, N2 etc. Now, we just tend to use them as a way to jump around the program.

In the old days (now I’m showing my age), we used to add ‘N’ numbers on every line. P100 tells the control to read the subroutine that starts at N100, while Q200 defines the last line of the subroutine that ends with N200. These values can be any number but they must be identical to the ‘N’ numbers found at the start and end of our profile subroutine. These commands define the start (P100) and end (Q200) of our subroutine. The thing to note here is the P100 Q200 commands.
HOW DO I CONTROL LINK ORDER IN NCPLOT HOW TO
For a full explanation of how to program a roughing cycle and any operation on a CNC lathe check out this.
HOW DO I CONTROL LINK ORDER IN NCPLOT CODE
Note: The example above is not the full block of code needed to program the cycle, it is written to demonstrate calling a subroutine within a G71 roughing cycle. This block of code will turn a 12mm spherical radius and turn a 24mm diameter at 20mm length. Let’s take a look at how we can write a roughing and finishing cycle on a CNC lathe writing the profile once. The best way to explain subroutines is with an example. To speed up the programming of a part using G-Code, we can reuse sections of the code and recall it within the program.
