CNC Custom Macros

CNC Custom Macro

Many cases of machining involve similar shapes of slightly varying dimensions, and  modifying the CNC program each time is both inefficient and the cause of error.
This is when CNC macro are the operator's biggest ally.
Just set the dimensions to a macro variable to enable machining of shapes in different dimensions.

G28X0Y0Z0  ( *********MACRO MAIN SAMPLE***    TROCHOID CURV  )
N0001 T10 M06 (DRILL)
N0002 G00X0.Y0.Z25.
N0003 G01Z0.
N0004 G00Z120.
N0011 T01 M06 (ROUGH)
N0012 G00X0.Y0.Z5.
N0013 G65A7.5B40.C1.D1.P6666
N0014 G00Z120.
N0021 T02 M06 (FINE)
N0022 G00X0.Y0.Z4.5
N0023 G65A7.5B40.C1.D2.P6666
N0031 T03 M06 (OUTER)
N0032 G00X0.Y0.Z17.0
N0033 G65A6.0B50.C1.D0 P6666
N0034 G00Z120.
N0040 M30

O6666  ( *********MACRO SUBPRO SAMPLE***    TROCHOID CURV  )
G41G01X[#1+#2]Y0D#7
#10=0.
WHILE[#10 LE 360.*3.]DO 3
(TROCHOID CURV)
G01X[#1*COS[#10]+#2*COS[#10/3.]]Y[#1*SIN[#10]+#2*SIN[#10/3.]]
#10=#10+#3(STEP)
END 3
G40
G00X0Y0
M99

trochoidcurvhalfwaku

macro_wire

Features like IF, arithmetic, trigonometric functions, and G65 sub pro calls can also be used in NC macros to allow machining in complex plate cam shapes, too.

If there is a sequence always instructed in the same way before and after tool replacement, a tool replacement macro is often created to avoid mistakes in entering these sequences.
For example, set M66 as the macro call of the M code to be used similarly to TxxM66.

In addition to these, macros for routine indexing of the machining surface, and macros for the purpose of operating a probe to confirm position are also used.

 

NCVIEW Macro Debugger

The NCVIEW Macro Debugger can not only run a simulation of this CNC macro program, but provides debugging features helpful to improve CNC macro programs.

The removal of errors in CNC macro programs is called "debugging." The fundamental way to do this is to make the machine pause at any position to check the value of the macro variables.

  • Breakpoint (Setting Pause)
  • Macro Variable Value View
  • Macro Call Stack View

Using the NCVIEW Macro Debugger for debugging work is surprisingly fast and easy.
It also leads to higher operation rates for actual machines.

mdbgMacro Debugger