Macro Introduction

10. Custom Macro

Macro Introduction

Introduction to Custom Macros

Custom Macros (also called Macro B or parametric programming) allow creating flexible CNC programs using variables, mathematical operations, and control structures.

Benefits of Parametric Programming

  • Reusable programs with variable dimensions
  • Reduced programming errors
  • Part families with a single program
  • Automatic calculations
  • Custom cycles

Basic Example

#1 = 50        ; Diameter
#2 = 30        ; Depth
#3 = [#1/2]    ; Radius (calculated)

G00 X#3 Y0 Z5
G01 Z-#2 F100
G02 X#3 Y0 I-#3 J0 F200
G00 Z5

Compatibility

Macro syntax varies between controllers (Fanuc, Haas, Siemens). CNC Simulator Pro primarily supports Fanuc syntax.