Introduction
Variables like #1 and #2 store numbers that can change during a CNC program. They help make the program flexible and easier to change.
Variables like #1 and #2 store numbers that can change during a CNC program. They help make the program flexible and easier to change.
#1 = 10 G01 X#1 Y#2 #2 = #1 + 5
#1 = 20 G01 X#1 Y0
#1 = 5 #2 = #1 + 10 G01 X#2
#1 = 100 #2 = #1 - 30 G01 Y#2
This program shows how to set variables #1 and #2, use them to move the machine, then change #1 and move again.
O1000 (Simple program using variables #1 and #2) #1 = 50 (Set #1 to 50) #2 = 20 (Set #2 to 20) G00 X0 Y0 (Move to start) G01 X#1 Y#2 F100 (Move to X=50, Y=20 at feed 100) #1 = #1 + 10 (Add 10 to #1) G01 X#1 Y#2 (Move to X=60, Y=20) M30 (End program)
Variables can only hold numbers, not text.
Changing a variable updates all places where it is used after the change.
Use comments to explain what variables mean for easier reading.
Variables #1, #2 store numbers to use in CNC commands.
They make programs flexible and easier to change.
You assign values with '=', and use variables by writing #number.
#1 and #2 in CNC programs?#1 in a CNC program?#1 := 50.#1 = 10
#2 = 5
G01 X#1 Y#2
G01 X#1 Y#2, resulting in G01 X10 Y5.#1 = 20
#2 30
G01 X#1 Y#2
#1 and #2 for this?G01 X#1 Y#2 to move tool to X=15 and Y=25 using variables.Pass the test and this pattern moves unknown