top of page

MACROS, ROTATION & SCALING

Rotation and Scaling.png
Coord Rot and Scaling Æ’.png

Macros:

Macros give the programmer the ability to perform arithmetic and comparison
functions within a CNC program. Values for variables (V1- V100) can be entered from input statements or passed to the macro from R variables or from the fixture, tool data, and tool time tables. Macros can also be used with probe functions.

 

Values from macrostatements can also be passed to the CNC program by using parametric variables(R0-R9). Parametric variables are used when programming words require change
during the execution of a program or need to be changed at different runs.

 

Rotation/Scaling:
Rotation provides the ability to rotate the coordinate system from a rotation center across the current plane. Scaling allows the programmer to scale all or individual axis dimensions.

Example macro program

This is a simple program to check the length of tool number 1 and enter this length into the tool offset table. Fixture offset number 23 must contain the distance from the Z zero surface to the top of the Tool Probe. Fixture offset number 24 must contain the X and Y location of the tool probe.


N1 O99 (CHECK TOOL
Contains the program number and a comment
N2 G90 G0 E24 X0 Y.25 S250. M4
Sets absolute and rapid modes, moves to X0 Y.25 on the Tool Probe and turns the spindle on backward at 250. RPM
N3 M65
Turns on the TS-20 tool setting probe
N4 H1 E23 Z1.
Applies the tool length offset for tool #1 plus the Z axis correction for the Fixture location plus one inch. This moves the tool tip to one inch above the tool probe
N5 G1 G31 Z-.1 F20.
Commands the probe skip function and feeds the tool into the tool probe
N6 G91 Z.05
Commands an incremental Z axis move .05 off of the tool probe
N7 G90 S500
Sets absolute mode and increases the RPM to 500
N8 G1 G31 Z-.1 F1.

Commands probe skip function and feeds the Z axis back into the tool probe at a slower feed for improved accuracy
N9 #R9=AZ
Reads the current Z location (AZ) into register 9 (R9). This is the actual Z value from the Home position
N10 #R8=R9-FZ23
This macro statement subtracts the Z fixture location in FIXTURE OFFSET 23 (FZ23) from the value in register 9 (R9) and places it in register 8 (R8) This compensates for the difference in Z from the Z zero position to the top of the tool probe
N11 G10 L10 P1 R0+R8
Uses the G10 function to store the value in register 8 (R8) into tool offset number 1
N12 M5 G0
Turns off the spindle and sets rapid mode
N13 G0 G90 H0 Z0
Sets absolute mode, cancels the tool offset and moves to Z zero
N14 E0 X0 Y0 Z0
Cancels the fixture offset and moves to X0 Y0 and Z0
N15 M99
Code to return

bottom of page