Free cookie consent management tool by TermsFeed CNC macro programming - G-Code Tutor
Online courses teaching you how to be a great machinist

CNC Macro Programming


Enroll

The Advanced Course

Boost your career prospects by learning CNC parametric programming

Very few machinists understand macro B programming
Gain the upper hand when applying for jobs

This course will take you above and beyond the standard knowledge of a CNC machinist.

I conducted a poll a few years ago and found that a staggering 83% of professional CNC machinists didn't know how to code macros. The ones that do have the edge in applying for jobs and generally earn more money. I can understand why, as we have a lot to learn and many skills to master as CNC operators. This kind of programming crosses into computer science and is quite different from standard CNC programming that we are used to.

Enhanced Flexibility

Macros allow you to incorporate logic and conditional statements directly into your G-Code. This means you can execute more advanced machining operations, boosting your efficiency and decreasing the time it takes to write programs.

Customizability

Macros allow for the creation of custom canned cycles, adding to the capability of standard G-Code commands.

But fear not, it is easier to learn than you think.

Before we get you up to speed on programming with variables, logical statements, and custom macros, I recommend that you either have a good working knowledge of standard CNC programming or have completed at least one of the courses below:

CNC Lathe Programming
CNC Mill Programming

Already know G-Code but wish to learn the advanced stuff? OK, you are ready to Enroll

Macro programming will make you more versatile and valuable in the machine shop.
Variables

  • What is a variable?
  • Types of variables
  • programming with variables
  • Variable speeds and feeds
  • Expressions and functions

  • Macro functions
  • Branches and loops
  • Logical expressions
  • Trigonometric functions
  • Example programs

  • Family of parts with variables
  • Pocket subroutine program
  • Circular groove subprogram
  • and much, much more!
  • Typical macro program

    O8001 (MACRO);
    #24 = 25.4;
    #12 = #12/2;
    G90 G00 X[#24+#12] Y#25;
    #200 = #4/#3;
    #201 = FIX[#200];
    IF[#200 EQ #201] GOTO999;
    G90 G01 Z-#4;
    G03 I-#12;
    N999 G90 G00 Z0;
    M99;
    %

    A Quick Overview

    A typical macro program looks quite a bit different from standard G-Code. Once it has been broken down it makes a lot more sense.

    The numbers that start with a hash (#) symbol are variables. These are used to store values. We can define these variables by typing #100 = 10; It's as simple as that.
    We can also use them to store answers to maths equations that can be used within the program.

    For example: '#100 = 1 + 2' This little equation would make #100 equal to 3.

    If we were then to say #200 = #100 + #100; then #200 would be equal to 6.

    We can also add logic to our program by using 'IF' statements such as 'IF [A CONDITION IS TRUE] THEN [DO SOMETHING]'

    So using our same variables we could say: IF [#100 EQ 3] GOTO 10;

    EQ means 'equal to' so #100 IS equal to 3.
    This statement would be true therefore the program would jump to N10 line number. If it was not equal to 3 the computer would skip the GOTO statement and continue to read the rest of the program after this line.

    All this seem a little confusing? This advanced G-Code macro course makes learning macros easy.

    Enroll now for only $170.00

    Each time this advanced course is updated the price will increase, Buy now for lifetime free updates!

    Gcodetutor-logo

    I have been working as a CNC Lathe program editor and operator for the last year or so. I have been tossing around the idea of checking out Marcs courses. I did some searching and couldnt find a more reasonably priced and convenient course anywhere online or in person. I was incredibly impressed with the amount of knowledge I gained in a very short period of time using GCodeTutor. I am 100% satisfied with the way that Marc has put this together and would recommend GCodeTutor to anyone looking to gain knowledge in the field of CNC Programming and Machining.

    -Dylan

    Advanced Macro B Programming - Curriculum
    • Overview
    • Overview (4:26)
    • Variables
    • What is a variable? (7:32)
    • Types of variable (8:16)
    • Programming with variables (12:12)
    • Variable speeds and feeds (3:46)
    • Subroutines and subprograms
    • Subroutines (8:41)
    • Sub programs (7:02)
    • GOTO commands (2:03)
    • Macro Programming
    • Macro programming overview (7:16)
    • Macro functions (6:20)
    • IF / WHILE statements (10:37)
    • Trigonometric functions (4:09)
    • Miscellaneous functions (5:46)
    • Conditional statements (11:51)
    • Programming Examples
    • Drilling with subprograms (5:55)
    • Tool life macro (7:25)
    • WHILE / DO loop example program (10:46)
    • WHILE nested loop example (9:57)
    • Machining a pocket using macros and variables (10:50)
    • Machining a circular groove using WHILE and IF statements (12:33)
    Learn advanced CNC programming techniques for only $170.00

    14-day money back guarantee. Lifetime free updates.

    Gcodetutor-logo
    Choose Your GCodeTutor License

    Enrol in separate CNC courses or get massive savings when you enrol in a training bundle.

    G-Code Training Bundle
    • Over 14 hours of pre-recorded lessons
    • LIFETIME ACCESS to all 4 G-Code courses
    • Complete G-Code training
    • Easy to understand
    • Write CNC programs to make any part imaginable with G-Code
    $497

    +VAT


    Everything Bundle
    • Over 70 hours of machine shop training
    • 4 G-Code programming courses
    • 2 Fusion 360 CAD/CAM courses
    • 1 Machine shop maths course
    • 1 GD&T measuring equipment course
    • 1 Manual Lathe course
    $1097

    +VAT


    ALMOST Everything Bundle
    • Same as the Everything Bundle but WITHOUT the manual lathe mini apprenticeship course
    • 4 G-Code programming courses
    • 2 Fusion 360 CAD/CAM courses
    • 1 Machine shop maths course
    • 1 GD&T measuring equipment course
    $847

    +VAT


    Frequently asked questions
    Have a question? I may have been asked it before.

    If your question is not answered in this FAQ section, feel free to message me on my contact page.

    Who is GCodeTutor?
    GCodeTutor is a CNC Machine tools programming engineer called Marc who has been programming CNC machines for the aerospace industry for over 34 years.
    Do I get a certificate?
    A certificate is presented upon completion of all GCodeTutors courses
    How long is this course?
    This course is around 160 minutes long broken down into bite-size videos between 4 and 15 minutes each.
    Is it difficult to understand?
    CNC macro programming can be a complex subject. This course is designed for people that have a general understanding of G-Code programming that wishes to continue their training and add to their knowledge.
    Is payment secure?
    My courses are hosted on Teachable, the world famous course providers.

    They take care of your transaction with their secure payment processors that support several different payment methods.

    I want my money back!
    That's not a problem. I offers a 14-day money back guarantee on all my courses and I will refund you without question.

    Enroll today for lifetime free updates at this low price

    Each time new content is added to the course the price will go up

    Enroll