Sei sulla pagina 1di 321

1

Welcome to Code Generator Compiler


Code Generator Compiler produces a Code Generator (a *.?CP file), from code generator source code (in a *.?
XT file).
The source code is written for particular CNC machine characteristics. It can be automatically written by Code
Wizard, from the CNC machine characteristics you enter in Code Wizard.
Alternatively you can write the source code yourself, either from scratch or by editing the Code Wizard source
code. More details are provided in the Code Wizard help.
Code Wizard has its own compiler, so you only need to use Code Generator Compiler if you have written your
own source code.
Note that to write your own source code you need a knowledge of CNC code, the source code language (as
detailed in this help file), and the mechanics of the Edgecam module(s) involved. Knowing a programming
language such as 'C', or BASIC would also be useful.
WARNING
To avoid any possible damage to your machine tools and material, test EVERY Code Generator File
THOROUGHLY before using it to cut material.

Edgecam User Guide

Generating CNC Code


Click the re-run button to, in one operation:
Re-compile the code generator, so it is up to date with the changes you made in the
source code.
Use this latest code generator compilation to re-generate the last CNC code file produced
by Edgecam (from the temporary files that Edgecam saves prior to processing them into
CNC code).
This means that you can quickly check the effects of your code generator source code changes
on the produced CNC code.

Edgecam User Guide

About Source Files


The Code Generator is a sequential ASCII file which, when compiled, becomes a binary file. The sequential
file, which can be edited, is usually referred to as the source text file. This file consists of a series of definitions
that each has a specific purpose.
A Code Generator is generally derived from a previously tried and tested source text file.
See Also
File Naming Conventions
Structure of Source Files
Variable Declarations
Setting the Machine Tool Environment
Macros
User-Defined System Variables
Format Table
System Variables List
Milling Cutter Radius Compensation
Multilevel Drilling

Edgecam User Guide

File Naming Conventions


The compiled file names will be the first eight characters plus the appropriate extension as listed below.
The Compiler recognises the type of Code Generator it is compiling by the source file extension. The extension
must always be ?xt where the ? is as follows:
Milling/Laser/Flame-cutting etc.

*.mxt

2-axis Turning

*.2xt

4-axis Turning

*.4xt

2 or 4-axis & C-axis Turning

*.cxt

Wire Erosion

*.wxt

The %MACHINE statement should be consistent with the extension to make recognition of the type of file
easier.
For example:
%MACHINE=MILL=...

NNCNC01.MXT compiles as
NNCNC01.MCP

%MACHINE=LATHE=...

NNCNC01.2XT compiles as
NNCNC01.TCP

%MACHINE=LATHE=...

NNCNC01.4XT compiles as
NNCNC01.TCP

%MACHINE=LATHE=...

NNCNC01.CXT compiles as
NNCNC01.TCP

%MACHINE=UVWIRE=...

NNCNC01.WXT compiles as
NNCNC01.WCP

The type of lathe Code Generator is determined by the Compiler by the existence of particular macros in the
source file. For example,. Macro 43 = C Axis file, Macro 23 = 4 Axis file.
The Compiler also outputs a *.doc file which can be given to customers with the Code Generator. This file can
be either in printed form or to be viewed using the standard Windows application Notepad.exe, as a reference
guide to the commands within the Code Generator. The Compiler outputs all lines starting with an asterisk to
the .doc file. Any remarks that are only for the applications engineer's reference should begin with a semicolon.

Edgecam User Guide

Structure of Source Files


There are four distinct sections to a source text file:
Variable Declarations
These all start with %DECLARE. They may appear anywhere within the file except within MACROS or the
FORMAT TABLE.
Machine Tool Macro
This gives information about the machine tool CONFIGURATION such as maximum feeds/speeds, and also
controls some elements of the menu configuration during the initial set up procedure within machining.
Macros
These groups of lines must all start with %MACRO={name} and end with %ENDM. One MACRO must exist for
each type of machining instruction to be used. Definitions must not be nested. MACROS may appear in any
order. %PROCEDURE={name} are a subgroup of MACRO definitions.
Format Table
This is a series of lines starting with the statement %FORMAT and ending with the statement %ENDF.
The format table must contain only valid instructions for formatting particular letter addresses.

Edgecam User Guide

Variable Declarations
Users may create their own variables which are referred to as user-defined variables. These are always
entered in upper case and may be of two kinds -numeric and string.
All user defined string and numeric variables must be declared using the statement %DECLARE=. The general
format for this is:
%DECLARE={variable1},{variable2},{variable3},......
Any number of %DECLARE= statements may appear in the post file. User defined string and numeric variables
may be declared within the same statement but for clarity it is better to separate them.
See Also
Numeric Variables
String Variables

Edgecam User Guide

Numeric Variables
All numeric variables have names beginning with a '#' and have a numeric value associated with them. This
has either been:
Declared explicitly, e.g. #BLOCK=10, or
Calculated, e.g. #BLOCK=#START+#COUNT, or
Requested from the user during code generating (using %ASK).

Edgecam User Guide

String Variables
The names for user defined character strings begin with a '$'. These string variables represent a string of alpha
characters which the user has supplied during the machining session or whilst code generating. The string will
be output by the Code Generator.
During compilation of a %MACRO, if a user-defined variable is encountered which has not been declared, then
the following error message will appear:
Variable has not been declared in {line of file in error}
User-defined variable names may be of any length but must consist solely of alphanumerics (A-Z and 0-9). It is
only necessary to declare user-defined variables, as system variables are predefined. Any attempt to declare
variables not starting with either a '#' or a '$' will result in the Code Generator compiler error:
'Invalid declaration in {line in error}'

Edgecam User Guide

Setting the Machine Tool Environment


The Code Generator source text file must contain the machine tool macro. This defines the default values
within the machining module; for example, maximum spindle speed, feedrate etc.
The macro can be used to define further options to be permitted during machining module initialisation.
The machine tool macro starts with a %MACHINE statement:
%MACHINE=[machine type]=[user defined text]
where [machine type] may be MILL, LATHE, or UVWIRE. The user-defined text may be up to 78 characters
long and will appear on the screen during code generating and would typically contain machine
tool/controller/user name information.
Here is an example layout for a turning centre:
%MACHINE=LATHE=Mori Seiki SL-35 (MM units) Fanuc 16TF controller
MM=1,4000,3000,400,1,1,1,0,0,3,50
MT=Upper Turret,10,200,0,300,500,500,1000,-500,-500,-100,2000,1000,10
MT=Lower Turret,10,-200,0,300,-200,0,300,500,500,1000,-500,-500,-100,1000,200,5
%ENDMACH
The remaining lines of the machine tool macro are Code Generator defined modifiers which can be used with
any of the Code Generator macros.
The machine tool macro is terminated by the %ENDMACH statement.
See Also
MM (Machine Details Line)
MT (Machine Tool Turret Details Line)

Edgecam User Guide

10

MM (Machine Details Line)


MM=1,2,.......,40
Position

Information

Range

Module

Units

0 = Inches
1 = Millimetres

All

Maximum Rapid Rate

Value

All

Maximum Spindle RPM

Value

Mill+Turn

Maximum Angular Feed

Value in Degrees/minute

Turn

Two tapes

0 = No
1 = Yes

Turn

Rapid 3D

0 = No
1 = Yes

Mill+Turn

Resolve rapid movement

0 = Resolved
1 = Unresolved

Mill+Turn

Compatibility

See Compatibility

Mill

Axes of Rotation

Obsolescent - only used by


Mill
Edgecam where no machine tree
file (.tmc or .mmc) exists. See
notes for Rotary and Multiplane
milling and notes for Five Axis
Machining.

10

Plane Switching

0 = XY
1 = XY, ZX
2 = XY, ZY
3 = XY, ZX, ZY

Mill

11

Initial Plane

Value

Mill

12

Not used

13

Profile or Guide Height

0 = Profile
1 = Guide

UVWire

14

Z Top Guide

Value

UV Wire

15

Z Bottom Guide

Value

UV Wire

16

90 degree Lead in approach


move (factor * toolradius)

Value

Mill+Turn

17

Rotary output mode

See Rotary Output Mode

Mill+Turn

18

Maximum Programmable
Radius

See Maximum Programmable


Radius

Mill+Turn

19

Radial Arc Output


(Rotary mode)

0 = Disabled
1 = Enabled

Mill+Turn

Edgecam User Guide

11

20

CX Interpolation

0 = Disabled
1 = Enabled

Turn

See CX Interpolation
21

Spline output support

0 = Disabled
1 = NURB (Fanuc)
2 = Spline (Heidenhain)
3 = Siemens 840D

Mill

See Spline Output


26

Helical arcs

0 = Not supported; output as


Mill+Turn
linear feed moves.
1 = Single Pitch at a time; helical
arc is limited to 360 degrees
maximum.
2 = Multi Pitch; complete helix
output as one arc move.

27

Default CNC Code filename


extension

The text of the extension.

28

Machine coordinate output


(Non-Orthogonal planes)

0=no
1=yes
(Not yet in use)

Mill

29

Machine coordinate output


(Orthogonal planes)

0=no
1=yes
(Not yet in use)

Mill

30

Pivot Point

0=Pivot around Tooltip


1=Pivot around Rotary axis

Mill

31

5 axis cycle

1=Abs Pivot Point


2=Part Coords
3=Baxis ToolTip
4=Baxis Pivot Point

Mill+Turn

32

Version

1 = EC10.5 style

Mill only

33

Inverse Time Feedrates

0=Not inverse
1=Inverse

Mill+Turn

34

Use IJK in 5 Axis

0=no
Mill+Turn
1=yes (Sw 31 must be set "2" for
IJK)

35

CRC Corner Display

0=round
1=sharp

36

Multi-plane nutated

0=Orthogonally aligned
1=Machine axis aligned

37

Multiplane coordinate output

0=CPL Coordinates
1=Machine Coordinates

All

See Default CNC Code Filename


Extension.

Edgecam User Guide

12

38

Pivot about Tool Tip

0=no
1=yes

39

Always Reset Rotary Datum


after 5 axis milling cycle

0=no
1=yes

40

CRC support in helical milling

0=no
1=yes

Here is an example MM line:


MM=1,4000,3000,400,1,1,1,0,0,3,50
So, the Maximum RPM is specified as 3000 RPM (position 3=3000).
See Also
Compatibility (Position 8 of the MM Line) Axes of Rotation (Position 9 of the MM Line)
Code Generators Configured for Rotary and Multiplane Machining
Code Generators Configured for Five Axis Machining Cycles
Rotary Output Mode (Position 17 of the MM Line)
Maximum Programmable Radius (Position 18 of the MM Line)
CX Interpolation (Position 20 of the MM Line)
Spline output (Position 21 of the MM Line)
Default CNC Code Filename Extension (Position 27 of the MM Line)

Edgecam User Guide

13

Compatibility (Position 8 of the MM Line)


Position 8 in the MM (Machine Details) line sets a bitwise flag that determines which compatibility settings are
to be used:

Bit

Meaning

Simple Index disabled. (Milling only)

Simple Index enabled. (Milling only)

Visit the Reset macro once the Mirror macro has finished. (Milling only)

Enables Reverse Offset. (Milling only)

This reverses the tool side in cases where a single 45-degree line is being profiled.
(Turning only)

16

Enable true NEXTMOVE look ahead within the Toolchange Macro. (Turning and
Milling)
See Note below.

32

Enable Edgecam Version 4 controller compensation enhancements. (Milling only)


Note: This bit should only be set in Code Generator files intended exclusively for use
with Edgecam Version 4.0 or later.

Note
There is a limitation with the NEXTMOVE system variables within the toolchange macro (%MACRO=15). If a
two stage rapid move is created directly after the toolchange (in the case of Turning by applying a Safe
Approach) the NEXTMOVE variables are set to the intermediate point rather than the final destination point.
To enable the ability to set the NEXTMOVE variables to the next destination point, you should add 16 to the
MM line switch 8. Although this feature gives improved look ahead, the logic in existing code generators can
be upset unless they are modified to take into account this change.

Edgecam User Guide

14

Code Generators Configured for Rotary and Multiplane Machining


In Rotary and Multiplane machining the secondary axis will be 'free' (that is dependent on the primary axis).
Calculate the value for position 9 of the MM line by adding the primary and secondary axis values:

PRIMARY

SECONDARY (FREE)

A AXIS

B AXIS

2 ( DEFAULT)

16

C AXIS

32

For example, a machine tool which has a fixed axis primary A and a free axis secondary B would give:
System variable MACHTYPE = 1(A) + 16(B) = 17

AMOVE BMOVE and CMOVE hold the rotational value of the primary and secondary axes dependant upon the
definition in the %Machine statement (position 9). From the above example, the machine type = 1(A primary) +
16(B secondary) = 17, therefore:
AMOVE = ROT1
BMOVE = ROT2
CMOVE = #FUNNY
ROT1 and ROT2 will always be identical to two of the variables in both planar and rotary modes. For turning,
CMOVE will always be the primary axis. These variables are accessed through the Index macro.
When rotary mode has been selected, all rotary system variables will be available in the Feed, Rapid and

Edgecam User Guide

15

Move Angular macros.

Edgecam User Guide

16

Code Generators Configured for Five Axis Machining Cycles


This information refers to the pre-Version 10.5 Five Axis Milling cycles that use PDI technology in pre-adaptive
(non-Code Wizard) templates.
For these cycles the secondary axis will be 'fixed' (that is independent of the primary axis).
Specify the value in position 9 of the MM line by adding the primary and secondary axis values:

Primary

Secondary (fixed)

A axis

64

B axis

2 (default)

128

C axis

256

Edgecam User Guide

17

Edgecam User Guide

18

Rotary Output Mode (Position 17 of the MM Line)


Toolpath cycles that have been generated using wrapped geometry can output the NC co-ordinates either at
the cycle depth, at the Wrapped radius or as unwrapped data. As this is a controller function, the MM line
switch number 17 is used.
0= Output NC co-ordinates at specified cycle depth. (Current default for Caxis)
1= Output NC co-ordinates at Wrapped Radius.
2=Output NC co-ordinates as the original unwrapped data
The Profile Milling command supports six different toolpath outputs dependent upon Switch 17 on the MM line
and the Compensation modifier.
Tool Centre path at depth: The wrapped toolpath outputs the NC co-ordinates by outputting the tool centre
position at the specified depth of the cycle.
MM 17= 0 , Compensation = Pathtrace
Tool Centre path at Wrap level: The wrapped toolpath outputs the NC co-ordinates by outputting the tool
centre position at the wrapped level of the specified entities.
MM 17= 1 , Compensation = Pathtrace
Tool Centre path at Unwrapped: The unwrapped toolpath outputs the NC co-ordinates by outputting the tool
centre position of the unwrapped specified entities.
MM 17= 2 , Compensation = Pathtrace
Tool Reverse offset at depth: The wrapped toolpath outputs the NC co-ordinates by offsetting the tool centre
position by the radius of the tool back towards the geometry boundary at the specified depth of the cycle.
MM 17= 0 , Compensation = Controller
Tool Reverse offset at Wrap level: The wrapped toolpath outputs the NC co-ordinates by offsetting the tool
centre position by the radius of the tool back towards the geometry boundary at the wrapped level of the
selected entities.
MM 17= 1 , Compensation = Controller
Tool Reverse offset Unwrapped: The unwrapped toolpath outputs the NC co-ordinates by offsetting the tool
centre position by the radius of the tool back towards the geometry boundary of the selected entities.
MM 17= 2 , Compensation = Controller

Edgecam User Guide

19

Edgecam User Guide

20

Maximum Programmable Radius (Position 18 of the MM Line)


Most machine tools have a Maximum Programmable Radius (MPR), usually limited by the controller format.
The MPR can be entered into position 18 of the MM line as shown in these examples:
*...|16 |17| 18 |19|20
MM=...,1.5,1 ,9999.999,1 ,0 (MPR set to specific value)

*...|16 |17|18|19|20
MM=...,1.5,1 ,0 ,1 ,0 (MPR set to zero will convert all arcs to feed moves)

*...|16 |17|18|19|20
MM=...,1.5,1 ,-1,1 ,0 (MPR set to -1 removes any limitations)

The MPR should be entered in the same units as set in switch 1 of the MM line. If non-default units are used in
a part program, the decimal place for the MPR will be moved up or down 1 place accordingly.

Edgecam User Guide

21

CX Interpolation (Position 20 of the MM Line)


%CXCYCLE can be used when axially machining on a lathe. If this directive is not used within a Code
Generator, switch 20 on the MM line will allow you to disable this functionality, giving a timesaving when
generating CL data within Edgecam.
%CXCYCLE Enabled = 1
%CXCYCLE Disabled = 0

Edgecam User Guide

22

Spline Output (Position 21 of the MM Line)


A macro is defined in the Code Generator called:
%MACRO=SPLINES
Within this macro, a number of system variables will be set, depending on the type of output required.
0 = Disabled
1 = NURB (Fanuc)
2 = Spline (Heidenhain)
3 = Siemens 840D
The spline output from Edgecam depends on the machine type selected, as the spline formats of the Fanuc,
Heidenhain and Siemens controllers are different. The Fanuc controller accepts any NURB spline up to degree
3, the Heidenhain controller requires a cubic polynomial parameterised over the range [1..0], and the Siemens
controller requires a cubic polynomial paramaterised over the range [0..1]. (It also accepts NURB splines of
degree 2 or 3, but Edgecam does not output these for the Siemens controller.)
See Also
Fanuc-Style Spline Output
Heidenhain-Style Spline Output
Siemens-Style Spline Output

Edgecam User Guide

23

Default CNC Code Filename Extension


Switch 27 on the MM line is a default extension for CNC code files (without the dot).
To set an extension of 'TNC' for example:
; 1|2 |3 |4|5|6|7|8|9|0|1|2|3|4|5|6|7|

8 |9|0|1|2|3|4|5|6|7

MM=1,30000,2000,0,0,0,1,39,2,0,20,0,0,0,0,1,0,9999.999,1,0,0,0,0,0,0,0,TNC
This is used if you leave the extension of the CNC code filename unspecified, when generating CNC code. It
takes precedence over the default extension specified using Options menu Preferences Toolpaths tab
Default NC File Extension.
Omit the extension, leaving a double comma ('...0,0,,0' for example), if you do not want to set it and you are
adding further switches to the line.

Edgecam User Guide

24

MT (Machine Tool Turret Details Line)


MT=1,2,...,36
Position

Information

Range

Module

Turret Name

String

All

Number of stations

Value

Mill+Turn

Toolchange X position

Value

All

Toolchange Y position

Value

All

Toolchange Z position

Value

Mill+Turn

Tool home X position

Value

All

Tool home Y position

Value

All

Tool home Z position

Value

Mill+Turn

Maximum X value

Value

All

10

Maximum Y value

Value

All

11

Maximum Z value

Value

All

12

Minimum X value

Value

All

13

Minimum Y value

Value

All

14

Minimum Z value

Value

All

15

Maximum Primary feedrate

Value

Mill+Turn

16

Maximum Secondary feedrate

Value

Mill+Turn

17

Toolchange dwell or Wire Threading dwell

Value in Seconds

All

18

Number of load points, on a single slide

Currently only
2 supported

Turn

19

Separation of tools in Z for single slide. For B Value


Axis machines this field contains the B Axis
swing distance.

Turn

20

Separation of tools in X for single slide

Value

Turn

21

B-axis Swing Configuration

Currently only upper Turn


turret supported

22

Default Spindle Id

0 or 1

Turn

23

Min B axis extent

Value

Turn

24

Max B axis extent

Value

Turn

25

Angular Increment of B Axis

Value

Turn

26

B axis angle at Tool Change

Value

Turn

27

Tool Set X

Value

Mill+Turn

28

Tool Set Y

Value

Mill+Turn

Edgecam User Guide

25

29

Tool Set Z

Value

Mill+Turn

30

Turret type

0=Indexing
1=ATC

Turn

31

Index time per station

Value

Mill+Turn

32

Move to ToolChange & Home Pivot

0=about tip
1=about pivot point

Turn

33

Move Index

Reserved - leave
blank

NA

34

Move Angular, Feed, Rapid

Reserved - leave
blank

NA

35

B axis capabilities

0= interpolates
1=indexing only

Turn

36

Turret can rotate to face sub spindle

0= no
1= yes

Turn

These parameters provide information on a specific turret (one line per turret).
Here are example MT lines:
MT=Upper Turret,10,200,0,300,500,500,1000,-500,-500,-100,2000,1000,10
MT=Lower Turret,10,-200,0,300,-200,0,300,500,500,1000,-500,-500,-100,1000,200,5
So, from the example above, the first MT line has the turret name "Upper Turret", 10 stations, and so on.
For machines with multiple turrets on one slide, also see Macro 15 Toolchange.

Edgecam User Guide

26

MS & MG (Machine Spindle & its Gears Details Line)

Please note that these lines are alternatives to using Data Arrays for specifying their information.
If Macro 252 - Spindle Control is present this method will be used for spindle and gear definitions. This is
implemented for Advanced Turning.
MS=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17
Position

Information

Values

Type

Main, Sub, Driven

ID

0,1,2,3

TurretId

Value (-1=Not Applicable)

Type

0 (Tool), 1 (Work)

Max RPM

Value

MaxAngFeed

Value

Direction

0 (CCLW),1 (CLW)

MirrorOutput

0,1

CSS Capable

0 (No), 1 (Yes)

10

Rotation

0 (none),1 (A), 2(B), 3 (C)

11

Default Location X

Value

12

Default Location Y

Value

13

Default Location Z

Value

14

DefaultTurretID

0,1

15

HorsePower

Value

16

DatumToChuckFace

Value

17

RapidRate M/Min

Value

These parameters provide information on a specific spindle (one line per spindle).
Here is an example MS line:
MS=Main,0,-1,1,7500,280,0,0,1,3,0,0,0, 0,20,130
MG=1,2,3,4,5(,2,3,4,5(,2,3,4,5(,etc.)))

Edgecam User Guide

27

Position

Information

Values

Number of gears defined in line

Value

Minimum Rev's Per Minute

Value

Theoretical Maximum Rev's Per Minute

Value

Recommend Maximum Rev's Per Minute

Value

M Code

Value

(2,...

Start of next gear specification - you repeat 2 to 5 for


each gear you want to set up.

These parameters provide information on a set of gears for a spindle (one line per set of gears).
Here is an example MG line:
MG=2,28,5000,5000,41,5001,7500,7500,42

Edgecam User Guide

28

Macros
The macro definitions within the Code Generator parameter files follow a standard layout as follows:
%MACRO=[Number]=..=[Description]=[Modifier List]=[Option List]
:
: [directives to control and generate CNC output]
:
%ENDM

The format of the %MACRO line itself is most important as it controls the screen menus which appear during
machining.
Note that the '=..=' portion of the first line must be included - it is a relic of an earlier product (PAMS).

Edgecam User Guide

29

Number
This is used to direct the Code Generator and machining programs as to what function is being defined.
Relevant macros must be defined within the Code Generator, otherwise the corresponding command
will not be available during an Edgecam machining worksession using it.

The macro number falls into four groups:

1-50

Executive macros whose number relates to a predefined list of machining functions (see
relevant module chapters) and may produce cutter motions on the graphics screen, e.g.
toolchange, profile, rapid, feed etc. These macros are defined within the Code Generator.

51-100

Non executive macros whose number relates to a predefined list of non-machining


functions.
Others in this group are contained within the Code Generator (for example, START, END,
CLW, CCLW, SUBSTART, RESET and so on). They control the start and end of CNC
programs and other special requirements such as subroutines. They do not form part of
any menus offered to the user during machining and are referred to by name rather than
number within the Code Generator although they do have numbers which can be
accessed by the NEXTMACRO system variable.

101-150 User-defined macros which allow control of M code type CNC operations or special
customer requirements (for example, probing, part changer), including PDIs. These
macros will have no graphical effect on the tool path graphics when invoked. User defined
macros become additional commands within Edgecam and are automatically merged into
the M-Functions menu, when the machine tool file is selected for a machining sequence.
We advise that M-Functions should use macros from 101 upwards and PDIs should use
macros from 150 downwards.
151-199 Reserved exclusively for use when writing a C Axis Code Generator.
200

Reserved for use in connection with PDIs. Allows PDIs to define tooling.

Note that macros with numbers greater than 200 are not permitted.

Edgecam User Guide

30

Description
This is a test string that describes the function of the macro.
This string is automatically merged into the Edgecam's Manufacture mode M-Functions menu for user defined
macros, numbers 101 to 151.
Code Generators can support non-English language descriptions. For these macros, the descriptions should
not be longer than 25 characters.

Edgecam User Guide

31

Modifier List
The modifier list defines which parameters or modifiers are requested when that macro is invoked. The
parameters are numbers which refer to the parameter list defined in the particular machining language file (see
the relevant module chapters for an explanation and example of the machining language file).
For example:
%MACRO=15=..=Toolchange=8,4,7,48,15,
Each modifier number is separated by a comma. The last entry is also followed by a comma.
Certain parameters will always appear in the menus by default, for example the Cycles menu Rough Profile
command has the modifier Canned Cycle, which is a check box. To remove these from the menu, prefix the
parameter number by a negative sign (-).
For example, the macro line shown below would remove the modifier Canned Cycle from the Rough Turn cycle:
%MACRO=4=..=ROUGH TURN=4,5,7,10,30,31,-21,40, 41,
If the CANNED CYCLE modifier is removed from the menu of any macro, you must redirect processing through
"%NOCYCLE". The system variable PATHTRACE automatically returns the value of 1, but only after
regenerating the menu file and regenerating the machining instructions.
Any modifier displayed in a Edgecam machining command can be removed in this way. This is very useful
where some complex Edgecam functionality is not required.
A good example is the threading command, which can be greatly simplified for many applications.
Edgecam may refuse to execute a command if certain essential modifiers are removed. Also, you can get
inconsistent results if you removed modifiers from generic commands such as Profile, Areaclear and
Crosshatch (Lace).
See Also
Assigning Values to Specific System Variables
Setting Default Modifier Values

Edgecam User Guide

32

Assigning Values to Specific System Variables


Any Edgecam modifier value can be accessed by Code Generators by defining which modifier sets up which
system variable in the %MACRO line.
For example:
%MACRO=3=..=ARC=1,2,5,7,124|176
In this example the value of the MOVE ARC command 2POINT modifier will be set up in variable number 176,
FIELD1.
A better use of this feature is to obtain variable information from PDI-defined commands.
Do not re-assign system variables, used by the current machining session, with inappropriate data.
See Also
System Variables List

Edgecam User Guide

33

Setting Default Modifier Values


You can set pre-assigned values for modifiers within the Code Generator. To do this, enclose the value with
square brackets '[]' after the modifier number.
For example:
%MACRO=153=..=Circular Feed Move=1,2,5,7,62[.001],
In this case the Tolerance modifier now defaults to a value of 0.001.

Edgecam User Guide

34

Option List
If the option list part of the %MACRO definition is present, an appropriate text list box will be available within
the command.
For example:
%MACRO=104=..=Coolant==Flood/Off
This example adds 'Coolant' to the M-Functions menu. If the command is selected, a drop down list box
containing the options Flood and Off is displayed:

Within the user-defined macro, the value is assigned to the system variable SUBFUNCT.
Also note the two consecutive equals signs in this definition '=='. This is because the optional modifier's
numbers are not required for this user-defined macro.

Edgecam User Guide

35

Numeric Variable Assignment


User numeric variables (those starting with #) can have a value assigned within a macro or procedure.
Although it is also possible to assign values to some system variables (those without a #) in this way, the
practice is not usually recommended since their values are normally set up according to data passed from
Edgecam.
Assignment statements may not contain space characters.
Any use of parentheses must be properly paired.
As with other Code Generator commands, the use of a colon : character denotes a new command on
the same input line.
The order of evaluation of (), */ and +- follows the usual rule of ( ) then ^ then */ then +The = symbol is used to denote assign value

Variables may be assigned as follows:


Simple Assignments
Arithmetic Calculations
Use of Operators

Edgecam User Guide

36

Simple Assignment, (variable)=(variable/number)


#BNUM=10

Assigns the value of 10 to the variable #BNUM.

#BNUM=#START

Assigns the value held in #START to the variable #BNUM

Edgecam User Guide

37

Arithmetic Calculations,(variable)=(variable/number)(operator)(variable/number)
Where {operator} is:
+

(plus)

(minus)

(divide)

(multiply)

(raise to the power)

For example:
#BNUM=#BNUM+10

Assigns the old value of #BNUM with 10 added to it

#IVALUE=XCENTRE-XSTART

Assigns the difference between XCENTRE and XSTART

#DIAM=2*#RADIUS

Assigns a value 2 times that of #RADIUS

#TEST=(#TEST1+#TEST2)*#TEST3-#TEST4

There is also a shortened form for expressions of the form {num1}={num1}{operator}{num2} where the operator
is + -/ or *,
for example #BNUM=#BNUM+#BNUMVAR May be written as: #BNUM=+#BNUMVAR

Edgecam User Guide

38

Use of Operators, {variable}={operator}({variable/number})


Where {operator} is one of these trigonometric or arithmetic functions:
SIN

sine

COS

cosine

TAN

tangent

ATAN

arc tangent

ASIN

arc sine

ACOS

arc cosine

SQR

square root

INT

integer value of *

ABS

remove sign

Note that trigonometric angular arguments are in DEGREES.


* INT converts real numbers to integers by rounding down. Thus 74.6 becomes 74 and 74.3 becomes -75. If
rounding to nearest is required it can be achieved as follows
#PRECISION=1000
#XMOVE=(#XMOVE*#PRECISION+0.5
#XMOVE=INT(#XMOVE)
#XMOVE=#XMOVE/#PRECISION

For example, the coding to calculate incremental unsigned arc centres could be:
#IVALUE=XCENTRE-XSTART:#IVALUE=ABS(#IVALUE)
#JVALUE=YCENTRE-YSTART:#JVALUE=ABS(#JVALUE)
Multiple operator functions and parentheses ( ) may be used; for example:
#TEST=(ABS(#TEST1))/2

Edgecam User Guide

39

String Variable Assignment


String variables can be assigned by in much the same manner as numeric variables.
Here is an example of their use:
$PROGID=MSG
...
%IF $ANSWER<>Y %THEN %GOTO @SKIP
...
...
...
@SKIP
String comparisons are space dependent. There should be no space after the operator and a space should be
placed after the testing string.
String variables may be defined as in the following example to obtain strings which contain spaces; for
example:
$STRING="This is a string variable"
$MESSAGE="***A string message ***"

Edgecam User Guide

40

Labels
Labels are positional indicators within a macro that define where code generating should continue after a
conditional or unconditional jump.
All labels must start with the character @ and must then be followed by the alphanumeric name of that label. A
label statement must appear on a line of its own.
The jump label destination of %GOTO must be within the macro in which that %GOTO occurred.
The same label name can occur in different macros.
Should more than 100 labels be defined in any one macro the compiler error message will be issued:
TOO MANY LABELS
An example of a label is:
:
:
%GOTO @JUMP
:
:
@JUMP

Edgecam User Guide

41

Directives
Directives are the commands available within macros and procedures that allow the manipulation of the data
available within each macro.
See Also
%ASK
%COMMAND... %ENDCOMMAND (Integrating PDIs)
%DEBUG
%GOTO \{jump label\}
%IF ... %THEN ...
%IF... %THEN ... %ELSE ...
%INCLUDE
%OPTIONS

Edgecam User Guide

42

%ASK
%ASK={promptstring}={user defined variable name}
This is a statement that prompts the user to answer a question during code generating and the reply is then
stored as a variable. The variable may be either numeric or character string.
For example:
%ASK=Enter program label=$LABEL; string assignment
%ASK=Enter program ID number=#NUMBER ;numeric assignment

If no replay string is entered (or Escape or Abort selected) the return value is set as #FUNNY for numeric
variables or a null string("") for string variables.

Edgecam User Guide

43

%COMMAND... %ENDCOMMAND (Integrating PDIs into Edgecam)


These directives indicate that all data between the %COMMAND and %ENDCOMMAND is to be included
within the Edgecam menu structure.
This feature is specifically designed to allow a PDI program (Edgecam Development Interface program) to be
integrated within Edgecam and to be invoked in an identical manner to any other core Edgecam command.
Here is a typical example allowing a PDI function (a PLANAR CIRCLE POCKET cycle) to be included within the
Edgecam menu structure:
%COMMAND
#CYCLES

20

PLANAR

CIRCLE_POCKET|circpkt

121

26

FEEDRATE

105

PLUNGE_FEED

106

SPEED

107

%_STEPOVER

16

16

116

DEPTH_PARMS

162

256

169

-2

285

CLEARANCE

28

28

128

LEVEL

161

168

287

DEPTH

109

%ENDCOMMAND

The above example will access a PDI called circpkt.exe using those modifiers specified within the Code
Generator. This format is consistent with that found within Edgecam*.cmd files.

Edgecam User Guide

44

%DEBUG
%DEBUG=ON
%DEBUG=OFF
This statement allows debug mode to be switched on and off from within a Code Generator.

Edgecam User Guide

45

%GOTO {jump label}


This is an unconditional jump which commands the Code Generator to continue code generating at a position
within the macro defined by a jump label.
For example:
%GOTO @DONT-ASK
...
...
...
@DONT-ASK

Edgecam User Guide

46

%IF ... %THEN ...


This is a conditional jump which sets up a test condition which can be used to control the subsequent flow of
the Macro or procedure.
Valid tests for the %IF directives are:
=

equal to

<>

not equal to

<

less than

<= or =<

less than or equal to

>

greater than

>= or =>

greater than or equal to

For example:
%IF #FRED=2 %THEN %GOTO @DONT-ASK
%ASK=Enter value for #FRED=#FRED
@DONT-ASK
or the shortened version (which cannot be used with %ELSE):
%IF #FRED=2 @DONT-ASK
%ASK=Enter value for #FRED=#FRED
@DONT-ASK
See Also
Controlling the CNC Output Precision

Edgecam User Guide

47

%IF... %THEN ... %ELSE ...


%IF {var}{test}{var} %THEN {action 1} %ELSE {action 2}
This command tests for {action 1} to be applied if the {test} is true, if false apply {action 2} where
{action 1} could be #BNUMVAR=0
{action 2} could be #BNUMVAR=10
The label at which post processing will continue if the conditional test passes must be defined within the current
macro.
More than 100 conditional/unconditional jumps within a macro will cause the compiler error message:
TOO MANY JUMPS
%GOTO statements increment the jump counter by one.
%IF %THEN %ELSE statements increment the jump counter by two.
If the jump label within a %IF directive has not been defined the compiler error message will be:
UNDEFINED JUMP DESTINATION IN {line in error}
For example,
%IF UNIT=1 %THEN #GCODE=21 %ELSE #GCODE=20
Note that more than one assignment or directive can be made on each line by separating the commands by a
colon:
%IF UNIT=1 %THEN #GCODE=21:%CALL=METRIC_SETUP:%ELSE
#GCODE=20:%CALL=INCH_SETUP:%GOTO @SKIP
Multiple %IF...%THEN...%ELSE... statements are allowed:
%IF #CURRENTMACRO=8 %THEN
<NUM_STARTS=[FIELD1=27]>
.
.
%ELSEIF #CURRENTMACRO=5 %THEN
<LEAD_IN_ANG=[FIELD1=27]>
.
.
%ELSEIF etc....
.
.
%ELSE
<STRATEGY=[FIELD1=27]>
%ENDIF
Multiple statements using %ELSEIF must be terminated with the %ENDIF directive.
The tab separation and indentation is vital for the %IF and %ELSEIF statements to work correctly.
%IF statements may NOT be nested.

Edgecam User Guide

48

See Also
Controlling the CNC Output Precision

Edgecam User Guide

49

%INCLUDE
%INCLUDE=filename
This directive allows you to include a secondary text file; this is useful where the same source code is repeated
in many text files. The text file must be in the same directory as the .?xt Code Generator source file.
The %INCLUDE instruction must not be inside a macro or procedure.
%INCLUDE files may not be nested.
Note that after use of %INCLUDE it may be necessary to program an additional %ENDM either at the end of
the included file or immediately after the %INCLUDE instruction.
%INCLUDE=txt1.mac
%ENDM
It is permissible to call more than one file from a base file:
%INCLUDE=txt1.mac
%INCLUDE=txt2.mac
%ENDM

Edgecam User Guide

50

%OPTIONS
%OPTIONS={Prompt string^Option1^Option2...}={user-defined var}
This is similar to %ASK but displays an option list for the user to select from. The prompt string contains the
title of the option box, and selectable options are separated by "^".
The user variable is set up as the option number selected.
For example:
%OPTIONS=Select Rapid Rate^HighFeed^RapidRate=#RAPID
This statement would cause the following option box to be displayed at the time of starting the Code Generator
for CNC output.

The user variable #RAPID is set up as 1 for High Feed and 2 for Rapid Rate.
If Escape or Abort is detected the #RAPID variable is set to #FUNNY .

Edgecam User Guide

51

Format Output Control


Four directives control the outputting of variables to CNC code. The first three are mutually exclusive.
% A L W A Y S-OUTPUT

is the default for all variables. It cancels the variables


%OUTPUT-IF-CHANGED and %DONT-OUTPUT

% O U T P U T-IFCHANGED

restrains the output if the variable value has not changed


from the previous output. It cancels %ALWAYS-OUTPUT
and %DONT-OUTPUT

% D O N T-OUTPUT

allows modal inhibition of the output of variables.


It cancels %ALWAYS-OUTPUT and %OUTPUT-IF-CHANGED

%CANCEL

is a non modal command that causes the output of the listed


variables at the next applicable opportunity. The output will
occur independently of the setting of %OUTPUT-IF-CHANGED,
and so output will be forced if the variable value has or has not changed.

A variable included in the %DONT-OUTPUT statement can still be output in the CNC code if its output line is
preceded by a %CANCEL directive.
PRECISION is a system variable that sets the accuracy limit for the %OUTPUT-IF-CHANGED, %DONTOUTPUT and %ALWAYS-OUTPUT directives.
The syntax for the variable is:
PRECISION=0.001
Using this example (0.001), if the last X move was X5.123456 and the next move is X5.12345786, the
%OUTPUT-IF-CHANGED directive would only consider the first 3 decimal places, and the X move would be
suppressed.
See Also
Example of %ALWAYS-OUTPUT
Example of %OUTPUT-IF-CHANGED
Example of %DONT-OUTPUT
Controlling the CNC Output Precision

Edgecam User Guide

52

Example of %ALWAYS-OUTPUT
During machining three rapid moves had been defined as:
X2 Y3 Z4,
X2 Y3 Z0,
X6 Y3 Z0
Within the Code Generator the X,Y, and Z are set as follows:
%ALWAYS-OUTPUT=XMOVE,YMOVE,ZMOVE
the CNC code would be
...
N130 G00X2.0Y3.0Z4.0
N140 G00X2.0Y3.0Z0.0
N150 G00X6.0Y3.0Z0.0
...

Edgecam User Guide

53

Example of %OUTPUT-IF-CHANGED
%OUTPUT-IF-CHANGED=XMOVE,YMOVE,ZMOVE,#GCODE
The CNC code would be:
...
N130 G00X2.0Y3.0Z4.0
N140 Z0.0
N150 X6.0
...

Edgecam User Guide

54

Example of %DONT-OUTPUT
%DONT-OUTPUT=YMOVE
The CNC code would be:
...
N130 G00X2.0Z4.0
%CANCEL=#YMOVE
N140 G00Z0.0Y3.0
N150 G00X6.0
...
The directive used most commonly is %OUTPUT-IF-CHANGED and it is usually placed within the START
macro with all the required variables.
The %CANCEL directive is used to emulate a controller which has turned off a modal function - for example, a
toolchange M06 might turn off the coolant, therefore the coolant could be canceled so that it was restated after
the toolchange was complete.
Note that the %OUTPUT-IF-CHANGED and %CANCEL directives may only be used for numeric variables,
whereas the %ALWAYS-OUPUT and %DONT-OUTPUT directives may be used for numeric or string variables.

Edgecam User Guide

55

CNC Code Output


A macro line enclosed by < > is interpreted for conversion to CNC code.
The description of a CNC output line may take more than one line within the macro. If a > is not found within a
macro after a < has been encountered, this will cause the compiler error message:
UNEXPECTED END OF CNC CODE IN {line in error}
Within the <...> three types of CNC code instruction exist:
Literal characters

which will always appear without any change in the CNC output.
For example <G90>

String variables

They must be surrounded by square brackets. No formatting will


take place unless the author restricts the string length by adding
the number of characters required onto the end of the string
(for example [$FRED=12]) - this will left justify the string to a
length of 12 characters.

System or User Defined


numeric variables

Each numeric variable must be equated to a line number in the


format table and be surrounded by square brackets. For example,
[XMOVE=1] commands the code generator to interpret the numeric
value of the system variable XMOVE, formatted as defined in line
1 of the format table, then output to the CNC code.

A numeric variable must always be followed by an = and then a number representing its format reference
number. A number less than zero or greater than the number of lines in the format table will cause the compiler
error:
FORMAT REFERENCE ERROR: {line in error}
Examples of CNC macro lines are:
<[#BNUM=19] G01[XMOVE=0]

;Notethatthisline

[YMOVE=1][ZMOVE=2][XYFEED=7]

; of CNC code has been

[ZFEED=7][#COOL=15]>

;createdover3textlines

Edgecam User Guide

56

Special Characters
You may often need to include special characters in CNC code which already have a designated meaning
within Edgecam.
To do this, place the ASCII value of the required character between curly brackets { }.
For example:
<[#BNUM=20] (IF P67{60}{62}1 GOTO [#BNUMJUMP=20])>
because the ASCII value of < is 60, and the ASCII value of > is 62
This allows the output of any valid ASCII character (the next sub-section displays all common ASCII values.
ASCII characters 128-255 vary depending on the country).
WARNING: If an output line spilling over into two lines contains hard coded spaces, these spaces
may be truncated by the compiler.

For example:
<[#BNUM=20]... (80 spaces) ...(CR)
(40 spaces)... M30>
may be truncated to:
<[#BNUM=20]... (10 spaces) ...(CR)
(40 spaces)... M30>
This line is therefore best written as:
<[#BNUM=20]... (120 spaces) M30>

Edgecam User Guide

57

ASCII Table
ASCII Value ASCII Character
032

SPACE

033

034

"

035

036

037

038

&

039

'

040

041

042

043

044

045

046

047

048

049

050

051

052

053

054

055

056

057

058

059

060

<

061

062

>

Edgecam User Guide

58

063

064

065

066

067

068

069

070

071

072

073

074

075

076

077

078

079

080

081

082

083

084

085

086

087

088

089

090

091

092

093

094

095

096

Edgecam User Guide

59

097

098

099

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

DEL

Edgecam User Guide

60

Controlling the Size of CNC Files


By default Edgecam directs CNC output to one CNC file. However, the size of this file can be limited by the use
of the NUMBLOCKS or NUMCHARS system variables.
To restrict the number of blocks (lines) to 1500, define this statement in the START macro:
NUMBLOCKS=1500
The NUMCHARS system variable is used in a similar way.
See Also
Multiple Files and Naming

Edgecam User Guide

61

Multiple Files and Naming


When multiple files are created, the Code Generator modifies the original file name to allow each CNC file to
be stored on disk.
Each file created has the -# appended to the name, where # is the consecutive number of the file being output.
The file name extension remains as .NC
For example if the CNC file name is:
Bracket left side-Rev3.nc
then additional CNC files would be
Bracket left side-Rev3-1.nc
Bracket left side-Rev3-2.nc...

If the output is directed to a disk which does not support long file names then:
Bracket left side-Rev3.nc, becomes
Bracket .nc
Bracke-1.nc
Bracke-2 .nc...
Up to 99 files may be created.

Edgecam User Guide

62

%DATA
You may need to use a logic loop to access a numeric value. The most common example is that of spindle
speed codes on an NC control which need to be output.
%DATA consists of two lists of values that have a fixed sequential relationship. The %DATA statements can
appear anywhere in the text file except within Macros, Procedures or the Format table. They are usually placed
at the top of the file immediately after the variable declarations, and before the %MACHINE statement.
These values are available within any macro or procedure in the form of an array.
An example of the use of %DATA is:
%DATA1=10,33,45,57,67,87,102,121, ;Speeds
%DATA2=1,2,3,4,5,6,7,8, ;Speed codes
...
...

...
...
%MACRO=15=TL=Toolchange=8,47,48,
%CALL=SPEED ;Call process to calculate speed code
...
%ENDM
...

...
%PROCEDURE=SPEED
#LOOP=1 @LOOP ;SPEED CODE LOOP
%IF NEXTSPEED=121 %THEN #SPEED=8:%GOTO @ELOOP
%IF DATA1(#LOOP)=NEXTSPEED %THEN %GOTO @ELOOP
#SPEED=DATA2(#LOOP)
#LOOP=#LOOP+1
%GOTO @LOOP
@ELOOP
%ENDM
The value referenced by DATA1(4) (where #LOOP=4) will be 57, and correspondingly DATA2(4) will be 4.
Note that six data arrays are allowed, %DATA1 to %DATA6.
See Also
Limitations and Requirements

Edgecam User Guide

63

Limitations and Requirements


Values must be integers between -32767 and 32767.
There may only be 100 values per %DATA statement and a maximum of six %DATA statements in a
source file.
Assignment of data variables is not supported, for example DATA1(10)=#Fred is not allowed.
DATA statements need not appear in order, or even together.
If the DATA declaration exceeds one line it may be continued on the following line, for example:
%DATA1=1,2,3,4
,5,6,7,8
,9,10,
That is, if the first character of the next line is a space, comma or numeric then it is assumed to be part of the
preceding %DATA statement.

Edgecam User Guide

64

User Data Array


A one-dimensional array UARRAY1(#) is available and can be used to store and retrieve numerical data.
Syntax
Assign Value
UARRAY1(1)=23.6 or UARRAY1(#COUNTER)=#SPEED
Retrieve Value
#SPEED=UARRAY1(1) or #SPEED= UARRAY1(#COUNTER)
It is also possible to read from or write to the Drill array, but if a Hole cycle is used the stored values will be lost.

Edgecam User Guide

65

SUBFUNCT
Within macros the system variable SUBFUNCT may be set by Edgecam to known values so that decisions can
be made within the macro based upon a number of methods.
See Also
Multi Selection Choice
Accessing Tool Used Data
Accessing CPL Data
Accessing Retrospective Manipulation Commands
Accessing Cutting Conditions
Controlling Cutter Compensation in Milling and Wire EDM

Edgecam User Guide

66

Multi Selection Choice


SUBFUNCT is used to obtain the result from the selection choice of a Code Generator-defined macro.
In this case SUBFUNCT is set to 1, 2 or 3 for Coolant Mist, Flood and Off respectively:
%MACRO=104=..=Coolant==Mist/Flood/Off
More than three options may be specified, except for the Compensation macro, where the maximum is four in
turning and three in milling.
The macro name (in this case Coolant) should be a maximum of 25 characters long.

Edgecam User Guide

67

Accessing Tool Used Data


Obtain data for the current tool, use SUBFUNCT in conjunction with the %LOAD statement.
For details of the %LOAD statement see %LOAD section.
For example:
%MACRO=15=..=TOOLCHANGE=8,47,48,
%LOAD=SUBFUNCT
...
...
The data available for the current tool selected is now available using the standard system variables.

Edgecam User Guide

68

Accessing CPL Data


SUBFUNCT is used in conjunction with %GETCPL to obtain positional and rotational information about a CPL.
For example:
%MACRO=43=..=INDEX PALLET=57,
%GETCPL=SUBFUNCT
...
This will make available via system variables the relevant data about the current CPL.

Edgecam User Guide

69

Accessing Retrospective Manipulation Commands


The commands translate, rotate and mirror are related to the SUBFUNCT values 1, 2 and 3 respectively.
After the retrospective macros have been completed the processing will be passed to the RESET macro, by
testing the value of SUBFUNCT, the axis positions can be corrected.
For example:
%MACRO=RESET
...
%IF SUBFUNCT=3 %THEN %CALL=MIRROR_RESET
...
...
%ENDM

Edgecam User Guide

70

Accessing Cutting Conditions


The macros Rough Turn and Simple Turn assign the system variable SUBFUNCT the tool drive and cut
condition number.
Testing SUBFUNCT will yield a value within the range of 0 to 8. The value is directly related to the 'white
arrows' in the machining module:

A value of 0 implies that the toolpath generated did not match any of the possible canned cycles. In this case
%NOCYCLE should be used.
For example:
%MACRO=3=..=Simple turning cycle=1,2,5,7,10,21,
%IF MASK=1...
%IF SUBFUNCT=0 %THEN %NOCYCLE ;not a valid cutting condition so
;expand using FE, RA and CIRCLE
%IF PATHTRACE=1 %THEN %NOCYCLE;expand using FE, RE and CIRCLE
%IF SUBFUNCT=2 @FACE
%IF SUBFUNCT=4 @FACE
%IF SUBFUNCT=6 @FACE
%IF SUBFUNCT=8 @FACE
@TURN

Edgecam User Guide

71

%IF XMOVE=#XLAST @END


#BNUM=...
<[...][...][...]>
#XLAST=XMOVE ; save current X position
@FACE
%IF ZMOVE=#ZLAST @END
#BNUM=...
<[...][...][...]>
#ZLAST=ZMOVE
@END
%ENDM

Edgecam User Guide

72

Controlling Cutter Compensation in Milling and Wire EDM


It is possible to test against SUBFUNCT in the Feed, CLW and CCLW macros to determine if the move is a
profile cycle lead in or lead out move.

SUBFUNCT
0 = Not a lead move
1 = Lead in move
2 = Lead out move

Edgecam User Guide

73

User Defined Variable #FUNNY


The output within a line of CNC code of a particular variable may be temporarily inhibited by value assignment
(by convention, a user-defined variable called #FUNNY).
#FUNNY has a specific value and is beyond the practical output of the Code Generator and must be set in the
start macro, as follows:
%MACRO=START
...
...
#FUNNY=9989999000000
...
...
%ENDM
It is also necessary to declare #FUNNY in the declaration table.
For example, to enable a Block Delete character '/' at the beginning of CNC lines via a user defined macro:
...
N0100X10Y10
(BLOCK DELETE ON)
/N0110X15Y25
(BLOCK DELETE OFF)
N0120X50Y30
...
The user defined macro will be for this example:
%MACRO=148=..=Block delete==Off/On
%IF SUBFUNCT=2 %THEN #DELETE=0 %ELSE #DELETE=#FUNNY
%ENDM
Each CNC output line will begin:
<[#DELETE=23][#BNUM=20]....>
The entry in the format table will control the output of '/' followed by no value:
/,0,0,0,0,0,0, 23 BLOCK DELETE

Edgecam User Guide

74

%LOAD
%LOAD={variable}
This is designed to allow the 'loading' of tooling information at any point within any Macro or Procedure. The
{variable} allows incrementing of a counter so that the information for all tools used during the last work session
can be examined.
For example:
...
#HEADER=1
@RELOAD
%LOAD=#HEADER
#BNUM=+#BNUMVAR: <[#BNUM=20][POSITION=10]>
#HEADER=#HEADER+1
%IF #HEADER < NUMTOOLS %THEN %GOTO @RELOAD
...
This will load the system variable POSITION with the turret number entered for each tool used. This is usually
set up within the START macro to display a complete list of all the tooling information used for each machining
file.
%LOAD is also used at Toolchange to load the information required for the CNC output:
%MACRO=15=..=Toolchange=8,47,48,15,
...
#TOOLINFO=SUBFUNCT: #TOOLINFO=#TOOLINFO+1
; access next tool and hold
%LOAD=#TOOLINFO: #NEXTOOL=POSITION
%IF SUBFUNCT=NUMTOOLS %THEN #TOOLINFO=1
; reload first tool for preselect if on last toolchange
%LOAD=#TOOLINFO: #NEXTOOL=POSITION
; reload current tooling values
%LOAD=SUBFUNCT
...
%ENDM
SUBFUNCT at Toolchange is always set to the correct value to allow access to the current tooling information.
Therefore the logic above will load the next tool's turret position for pre-selection and then reload the current
information.
When %LOAD is used the user variables defined for the toolchange macro will also be set with the values
given in Edgecam.
USERVAR1 to USERVAR5
Note that the content of these variables is dependent on the Code Generator file content.

Edgecam User Guide

75

%GETCPL
%GETCPL={variable}
This directive is designed to allow access to co-ordinate and rotational information attached to a CPL at any
point within any macro or procedure. The {variable} allows incrementing a counter so that information about all
CPLs used can be extracted. By setting %GETCPL = SUBFUNCT the current information is loaded.
List of variables affected:
INDEX

= Pallet angle position

GROUPDESCRIPTION

= CPL name

STYPE

= Coord shift type ABS = 1 INC = 0

ROT1

= Primary angle

ROT2

= Secondary angle

XSUB*

= Absolute X datum origin

YSUB*

= Absolute Y datum origin

ZSUB*

= Absolute Z datum origin

SYSID

= Unique coord system identifier

DIRECTION

= Index direction

SUBFUNCT

= Current CPL pointer ( used with %GETCPL )

SFMOD

= Defines rotary axis, 1=X axis, 2=Y axis, 3=Z axis

* The system variables XSUB, YSUB and ZSUB (not #XSUB etc) contain the current position from world origin,
in current coordinates.

For example:
#POINTER=0
@AGAIN
#POINTER=#POINTER+1
%GETCPL=#POINTER
%IF SYSID=#FUNNY @BREAKOUT
<[GROUPDESCRIPTION=10] [XSUB=0] [YSUB=1] [ZSUB=2] [ROT1=27] [ROT2=9] [SYSID=22]>
%GOTO @AGAIN
@BREAKOUT
This example will loop through all selected CPLs and output their relevant X, Y and Z values (where reference
to the format table is suitable for debug).
Once all the selected CPLs have been processed, the system variable SYSID is set to #FUNNY and the loop is
terminated.
%MACRO=43=..=Index=57,
%IF MASK=1 %THEN #BNUMVAR=0 %ELSE #BNUMVAR=#BNUMINC
%GETCPL=SUBFUNCT
#AMOVE=ROT1

Edgecam User Guide

76

#BMOVE=ROT2
<[#AMOVE=32][#BMOVE=33]>
; Load current CPL information so as
; to output new index position
...
...
%MACRO=48=DS=DATUM SHIFT
%GETCPL=SUBFUNCT
...
...

Edgecam User Guide

77

%PROCEDURE and %CALL


The same routine may often be required by more than one macro within a source file. To reduce the size of the
source text file it is more efficient to hold the common cycle in a separate macro definition, analogous to a
subroutine, and then 'call' it as and when required.
The macro which holds the common code is called a PROCEDURE, the structure being similar to a macro.
For example:
%PROCEDURE=HOLD
#XHOLD=#XMOVE:#YHOLD=#YMOVE:#ZHOLD=#ZMOVE
%ENDM
A PROCEDURE can be called from within any other macro or procedure, the syntax being as follows:
%MACRO=...
...
...
%CALL=HOLD
...
%ENDM
A macro cannot be called from within a macro or procedure.

Edgecam User Guide

78

Array Expansions
Data within Edgecam machining is sometimes held in the form of an array. This data may be accessed by
setting up a loop to interrogate the array.
An example is the XY co-ordinates of a drill pattern:
XPOINT(#)
YPOINT(#)
where # is a numeric variable. It operates as follows:
XPOINT(1) holds the X co-ordinate of the first hole, YPOINT(1) holds the Y co-ordinate of the first hole in the
drill pattern.
Turn profiles are also held in the XPOINT(), YPOINT() array. A third element, RADIUS(), is also set up, and this
will be non-zero if this point refers to an arc centre. The radius value is signed (+'ve is counterclockwise and 've is clockwise).
UV Wire Profiles and Thread Milling information also use this array. See the relevant machining discipline
section for more information.
When you need to output the pattern co-ordinates, increment through the array and output the values held
within the array. The expansion is terminated by testing a System Variable LAST which is set to the number of
co-ordinates in the pattern.
For example:
%PROCEDURE=LOOPEXPAND
#LOOP=2 ;DRILL REST FROM COORD TWO
@LOOP
%IF #LOOP>LAST %THEN %GOTO @ENDLOOP
#BNUM=+#BNUMVAR: #XMOVE=XPOINT(#LOOP): #YMOVE=YPOINT(#LOOP)
<[#DELETE=24][#BNUM=20] [#XMOVE=0][#YMOVE=1]>
#LOOP=#LOOP+1
%GOTO @LOOP
@ENDLOOP
#BNUM=+#BNUMVAR:#GCODE=80
<[#DELETE=24][#BNUM=20] [#GCODE=19]>
%CALL=HOLD ;STORE CURRENT AXIS POSITION
%ENDM

Edgecam User Guide

79

XYZ Array for Drilling in Different Environments


The hole cycles use an array to hold the co-ordinates of the selected points.
The following table shows what the values represent within different environments and modes:
Milling
Planar

XPOINT() = X co-ordinate
YPOINT() = Y co-ordinate
ZPOINT() = ZLEVEL (Multi-level only) or #FUNNY
MZDEPTH()= Z drilling depth
MRPLANE()= Retract plane

Rotary Radial

XPOINT() = X or Y co-ordinate dependent on machine


config.
YPOINT() = Angular position
ZPOINT() = Not used
MZDEPTH()= Z drilling depth
MRPLANE()= Retract plane

Rotary Axial

XPOINT() = X co-ordinate
YPOINT() = Y co-ordinate
ZPOINT() = Not used
MZDEPTH()= Z drilling depth
MRPLANE()= Retract plane

When axially machining, the co-ordinates are always Cartesian for both rotary and planar modes.
Turning
Rotary Radial

XPOINT() = Z co-ordinate
YPOINT() = Angular position (C)
ZPOINT() = Not used

Planar Radial

XPOINT() = Z co-ordinate
YPOINT() = Y co-ordinate
ZPOINT() = Not used

Planar/ Rotary
Axial

XPOINT() = X co-ordinate
YPOINT() = Y co-ordinate
ZPOINT() = ZLEVEL (Multi-level only) or #FUNNY
MZDEPTH()= Z drilling depth
MRPLANE()= Retract plane

Edgecam User Guide

80

When axially machining, the co-ordinates are always Cartesian for both rotary and planar modes.
Multi-level drilling is available in axial and B-axis orientation where supported by the Code Generator file.

Edgecam User Guide

81

%NOCYCLE
The statement is used to force longhand output of CNC. The command can force output of the following types
of code:
Generation of rapid, feed, clockwise and counterclockwise moves instead of controller canned cycles.
The expansion of retrospective operations to full CNC code instead of utilising controller canned cycles
The executive modifier 'Canned Cycle' sets the value of the system variable PATHTRACE, the selection of
'Pathtrace' or 'Controller' will result in 1 or 0 respectively.
The variable PATHTRACE can be tested to conditionally execute the command %NOCYCLE.
The action of %NOCYCLE is to exit the macro definition, immediately passing the axis moves to the Feed,
Rapid and Circle macros (CLW, CCLW).
For example:
%MACRO=32=TR=Translate=43,44,45,14,26,37,21,
*
%IF PATHTRACE=Y %THEN %NOCYCLE ; redirect through Rapid, Feed
* ; and CLW, CCLW macros
*
*
%IF MASK=1 %THEN ...
#XSUB=...
#YSUB=...
#BNUM=+#BNUMVAR:<[...] [...]>
#BNUM=+#BNUMVAR: <[...] [...]>
#BNUM=+#BNUMVAR:<[...] [...]>
%ENDM
See Also
System Variable NOCYCLE

Edgecam User Guide

82

System Variable NOCYCLE


Redirection by the %NOCYCLE statement can be verified by testing the system variable NOCYCLE.
NOCYCLE set to 1 indicates redirection. While NOCYCLE set to 0 indicates no redirection has occurred.

%NOCYCLE has no function within the Wire Erosion module. See Wire Notes for explanation of
equivalent functionality.

Edgecam User Guide

83

%SUBROUTINE
The statement defines the output position of controller subroutines. A controller subroutine is defined as a
sequence of blocks customising repeated machining cycles that can be called from a main program.
The macro Code Generator supports the output of subroutines in all the machining modules.
Nested controller subroutines are fully supported within the Edgecam Code Generator, and therefore care
should be taken to ensure that the controller is also capable of nesting.
If nested subroutines occur and are not supported by the controller, you may want to add tests to the Code
Generator to output error messages.
A typical test is as follows:
(In start macro )

#NESTED=0

(In macros SUBSTART and CYCLSUB)

#NESTED=#NESTED+1
%IF #NESTED > 1 %THEN <ERROR:NESTING OF SUBS
NOT POSSIBLE ON THIS CONTROL -USE PATHTRACE CYCLES>

(In macro SUBEND)

#NESTED = #NESTED -1

(#NESTED will always return the current level of subroutine nesting if used in this way).
%SUBROUTINE may not appear more than once and must only be defined within the macros as listed below.
The position of %SUBROUTINE within the source file governs the output position of the controller subroutines.
The following rules apply to the relevant positional definitions:
%MACRO=START
...
...
%SUBROUTINE
...
...
%ENDM
Controller subroutines output as the start of the CNC code:
%MACRO=END
...
...
%SUBROUTINE
...
...
%ENDM
Controller subroutines output as the end of the CNC code.
No occurrence of %SUBROUTINE. The subroutine will be output as the subroutines occur in the machining file
and nesting of subroutines will not be accepted by the controller.
See Also

Edgecam User Guide

84

MASK
Macro Definitions Related to Controller Subroutines
Controller Subroutine Calls by Block Number

Edgecam User Guide

85

Macro Definitions Related to Controller Subroutines


%MACRO=SUBSTART
SUBSTART should contain the CNC code which defines the controller subroutine starting blocks. The system
variable SUBROUTINE is available for controller subroutine number identification.
%MACRO=SUBEND
SUBEND should contain the CNC code which defines the controller subroutine terminating blocks.
%MACRO=SUBCALL
SUBCALL should contain the CNC code which defines the controller subroutine call blocks.
%MACRO=CYCLSUB
CYCLSUB is called when subroutines can be output during drilling, tapping, reaming and boring. The macro
definition should contain the following CNC code:

1. Controller subroutine start definition


2. Macro statements to expand arrays (see array expansion)
3. Controller subroutine end definition

Edgecam User Guide

86

Controller Subroutine Calls by Block Number


CNC controllers which call subroutines by block number references are supported by use of the pseudo system
variables STARTSUB and ENDSUB. STARTSUB and ENDSUB should only contain block numbers.
The assignment of STARTSUB and ENDSUB should be in the SUBSTART and SUBEND macro definition
respectively.
If used, these variables must be set to zero in the start macro. If not used, processing will be noticeably faster.

Edgecam User Guide

87

Notes on Translate Command


Here are some details on the way the Translate command works, particularly for controller subroutines.
Translated moves
Edgecam translates the toolpath as represented by move end points within the designated labels. From a
machine tool point of view the "Start" of a sub-routine is, therefore, the End of the move leading to that first
endpoint. Slightly different results will be seen depending on the type of move. A direct rapid or feed move will
result in its end point being the subroutine start and the move will effectively be "lost" in repeats of the
subroutine. A 2D rapid, doglegged, move (e.g. XY and then Z) will give the dogleg point as subroutine start and
only the first segment or the move will be lost.
Note that the graphics often show an apparent dogleg when resolved rapids are not used. This intermediate
points does not exist on the NC data - it is purely for visualisation purposes - and will not be used as a start
point.
Good practice
For safety reasons, subroutines should always start and finish at a safe clearance height. If this practice is
followed then the link moves between subroutines can be expected to also be at the safe height. The
subroutine should always include the liftout move at the end of a cut.
A specific move to a point near to the required start of the subroutine before defining the subroutine is
recommended. This is generally preferable to making a move direct from, say, toolchange and relying on the
2D rapid's dogleg to be the start point. If the machine tool movements are not exactly as represented on screen
then this will minimise the discrepancy.
Code Generators
There are some system variables that pass the subroutine start point:
In macros TRANSLATE and RESET, the variables XEND, YEND, ZEND now represent the end of any
approach move and thus the start of the subroutine.
In macros SUBSTART and SUBCALL, the existing variables NEXTXMOVE, NEXTYMOVE,
NEXTZMOVE can be used.
The TRANSLATE Macro (No. 32) should now use XEND etc. as subroutine start point instead of XSUB
etc. Rapid approach moves to this point should be output.
The SUBSTART Macro (No. 55 ) should use NEXTXMOVE etc. as a "HOLD" point for calculation of
incremental moves.
The SUBCALL Macro (No. ) should include a rapid approach move to NEXTXMOVE etc.
There is logic within the Code Wizard templates to determine whether to use the Rapid or Translate code
constructors, and G90/91 blocks will only be output by subroutine start and end if they are required. This is
within the default sequence of the code constructors.
Note that the exact action of a machine tool running controller cycles is beyond the control of Edgecam, so you
must ensure that code generators are correctly configured and that the on-screen representation closely
matches the actions of controllers.

Edgecam User Guide

88

MASK
The MASK command is used to control output of data to the NC file. Setting it to 0 or 1 allows or prevents
output during processing:

MASK = 0

allows output as normal

MASK = 1

prevents output

MASK is used in the processing of the machining data file to CNC output code which utilises controller
subroutine calls. Examining MASK allows for the maintaining of block numbers and system variables during
multiple pass processing.
EG. %IF MASK=1 %THEN #BNUMVAR=0 %ELSE #BNUMVAR=10
See Also
Simple Usage of MASK
Complex Usage of MASK

Edgecam User Guide

89

Simple Usage of MASK


Typical CNC output required:
...
L1

Subroutine Definition

L2

Punch Component

L3

Pause

L4

Axis movement

L5

End of Definition

L6

...

L7

...

L8

Start of main code

L9

Axis movement

L10

Call Subroutine - 20 times

L11

End of code

The example will reduce the amount of output code required, but for full simulation the full graphical axes
movement is required to be output.
Therefore the graphics display will be as below:
Previous axis movement
...
O1 Axis movement
O2 Punch Component
O3 Axes movement
O4 Punch Component
O5 Axis movement
etc....
O36 Punch and move 17 times more ...
O37 ...
O38 End of Code
As can be seen in the example, the length of code generated would be of greatly differing lengths, and so by
the same definition the block numbers would also be different.
MASK and multi-processing of the machining file overcomes the block numbering problem. To explain MASK in
the outputting of L1 - L11 using the machining input data 1 - 038, MASK will be set to 0 to output the subroutine
definition, and to 1 to simulate the main CNC code.
The code is then processed again with MASK set to 1 during the subroutine definition and calls, but toggling to
0 to output the main CNC code.
Therefore, by testing the value of MASK, the block number sequence can be maintained correctly.

Edgecam User Guide

90

Complex Usage of MASK


The first complex use of MASK is when the controller subroutines are to be output at the start or end of the
CNC code.
The output of the main CNC code and the subroutines is governed by the %SUBROUTINE statement.
The machining data file will be scanned to obtain all the subroutine definitions, and output, if required, with
MASK set to 0. The data file is then scanned again with MASK set to 1 in the main CNC code, but toggling
MASK to 0 when calling the subroutines.
The second complex use of MASK is when subroutines call other subroutines.
The data file is scanned to output the subroutine, MASK set to 0, and as the call to the next subroutine occurs
MASK toggles to 1. After the completion of the subroutine MASK is toggled back to 0 and the calling subroutine
definition is completed.

Subroutine at start

Subroutine at end

1st Pass

2nd Pass

1st Pass

2nd Pass

Main Code

MASK=1

MASK=0

MASK=0

MASK=1

Subroutine

MASK=0

MASK=1

MASK=1

MASK=0

Main Code

MASK=1

MASK=0

MASK=0

MASK=1

Processing
The data file is totally rescanned to output the lower subroutine with MASK set to 1 where output has been
made, and toggled to give output as required.
See Also
%SUBROUTINE

Edgecam User Guide

91

Circle Programming
As circular interpolation which ranges over one or more quadrant is not available on all machine tool control
systems, the statement CIRCLE is available to output either full circle or quadrant programming.
Variable CIRCLE can be assigned the values:
1

CIRCLE=1

quadrant programming

CIRCLE=0

full circle programming

The statement should be placed in the START macro, but can be altered at any time if output needs to be
switched between single and multi quadrant output.
A circular move of 360 is therefore processed by either calling the circular macros once or four times as
appropriate to the CIRCLE definition.
Edgecam can also output plane switching arcs in both the ZX and ZY planes. The system variable
TRUEARCOP may be set to control output between true arc co-ordinates and fixed XYZ co-ordinates. The
differences in the system variables as set up are illustrated in the table below. If plane switched arcs are not
supported, the arcs are broken down into linear movements.

TRUEARCOP

XYARCS

0 (Milling default)

1 (Turning default)

XSTART, YSTART,

XSTART, YSTART,

XCENTRE, YCENTRE,

XCENTRE, YCENTRE,

XEND, YEND

XEND, YEND

ZXARCS

ZSTART, XSTART,
ZCENTRE, XCENTRE,
ZEND, XEND

ZYARCS

ZSTART, YSTART,
ZCENTRE, YCENTRE,
ZEND, YEND

The system variable XYPLANE is set as 0, 1 and 2 for XY, ZX and ZY respectively when processing arcs.
See also:
Arc Bulge when using Radius NC Output

Edgecam User Guide

92

Arc Bulge when using Radius NC Output


Two system variables control arc bulging when using circular interpolation defined by a radius - see below.
When an arc is bulging more than the specified resolution the Arc is automatically output in two sections.
Variable

Explanation

NOBULGECORRECTION

0 = Bulge correction enabled


1 = Bugle correction disabled
When not specified the option is enabled. This means existing Code
Generators will be enabled.
The system variable should be set in the START macro.
Bulge correction is NOT required if the circular interpolation format uses
arc centre (I J K) or the Controller is set to single quadrant.

RESOLUTION

Specify the resolution of the Controller. This used for the bulge
calculation error check.
The system variable should be set in the START macro.

%MACRO=START
NOBULGECORRECTION=0

; 0=Bulge correction On

%IF UNIT=0 %THEN RESOLUTION=0.0001 %ELSE RESOLUTION=0.001


The reason for the error is that the arc radius and start
and end points have to be rounded to the limit set by the
controller, which can cause an error of up to 0.0005mm
for controllers with a limit of 3 decimal places. There is a
similar effect on Inch parts, but to 4 decimal places. The
worst case is when the start and end points have been
rounded down so they are closer together and the radius
is rounded up. This very small change is enough to make
the arc bulge outwards by an amount far exceeding the
specified tolerance.

A rounding error
of 0.0005mm can
cause the arc to
bulge by up to
0.317mm on a
50mm radius.

The opposite effect can also occur where the end point is
further away than the arc radius. In this case the
controller appears to still try and cut the arc, but we
suspect this causes the arc to be too shallow. The
rounding by Edgecam is mathematically correct and the
error is inherent in the method used by the G2/G3 R
construction of arcs and limit of 3 decimal places. The
error is most commonly seen on circular Bosses or
pockets, which have a tapered wall. As the arc radius
changes size down the wall, the rounding varies slightly
the effect can be easily seen at some levels as a dig
inwards or a bulge.

This type of error can occur in 2D, contour or the Profiling cycle. The error is more noticeable when machining
a with contour wall or 3D shape as the amount of error changes down the part, as shown in this side view of
NC toolpath files containing Arcs:

Edgecam User Guide

93

Edgecam User Guide

94

Controlling the CNC Output Precision


The system variable PRECISION affects these areas:
%OUTPUT-IF-CHANGED
%IF= and %IF<>
PRECISION sets the accuracy when using the directive %OUTPUT-IF-CHANGED or when testing the
difference between two values. If the difference is less than or equal to the PRECISION value, the values are
treated as being equal.
Setting the PRECISION value
The format is:
PRECISION=value
For example,
%IF UNIT=1 %THEN PRECISION=0.001 %ELSE PRECISION=0.0001
PRECISION can only be set in the START macro and will not take effect until the START macro has finished.
If the PRECISION value is not set, the system assumes these values:
UNIT=0 (inches)

PRECISION=0.0001

UNIT=1 (metric)

PRECISION=0.001

Example of using %OUTPUT-IF-CHANGED


Output Value

Variable Value

* PRECISION=0.00001
N20 X20.0 Z10.0

(XMOVE=20.0)

N30 X20.0 Z0.0

(XMOVE=20.0001)

In this example, the X value has been output twice because the %OUTPUT-IF-CHANGED directive considers
the change in the X value to be different, but the output value appears the same because the format table has
rounded the value down to three decimal places (for the sake of the example).
* PRECISION=0.001
N20 X20.0 Z10.0

(XMOVE=20.0)

N30 Z0.0

(XMOVE=20.0001)

In this example, the X value has been suppressed because the %OUTPUT-IF-CHANGED directive considers
the change in the X value to be the same, because the difference is less than the PRECISION.
Example of using %IF
#XHOLD=20:#XMOVE=20.0001
%IF #XMOVE=#XHOLD @SKIP
If PRECISION has been set to 0.01, the statement above would pass the test (and GOTO the skip label) as the
difference between the values is less than the PRECISION. If PRECISION=0.00001, the statement would fail
and the GOTO would be ignored.

Edgecam User Guide

95

Debugging
The system variable MACRONAMEOP can be set so the name of each macro processed is output to the CNC
file. The statement MACRONAMEOP = [value] is normally included within the start macro.
Valid settings are:
0 = No debug output
1 = All macro executions output to CNC file.
2 = Macro names output only if MASK=0 (that is, CNC output turned on).

Edgecam User Guide

96

Silent Output
The system variable SILENT can be set to inhibit output of CNC code to the screen. This will increase the
speed of code generating. A status message is displayed every 100 lines of output if silent output mode is
selected.
Valid settings are:
0 = Output to screen
1 = Inhibit output

The following lines included within the start macro. These allow this mode to be selected interactively when
generating CNC code. SILENT defaults to 0.
%OPTIONS=SILENTMODE^ON^OFF=SILENT
%IF $SILENT=Y %THEN SILENT=1
$SILENT must be declared in a %DECLARE statement.

Edgecam User Guide

97

Textcase
The system variable TEXTCASE provides the option of formatting the output so that comments, file name and
any ASCII text characters will be output as uppercase text. This is useful as some machines must have all text
as uppercase characters, otherwise the machine ignores the character.
Valid settings are:
1 = Will convert all text string to uppercase.
2 = Will convert all text strings to lowercase.
Note that word letter addresses output from Format Table are not converted. If NC code is written as text
strings in output blocks (or Code Wizard code constructors) those strings will be converted by TEXTCASE.
Any other value for TEXTCASE will result in the text being left unchanged.

Edgecam User Guide

98

Matrix Processing
The matrix operation provides a method of producing a series of identical components using one of the
following methods:

1. Full, longhand CNC code - for controllers with no subroutine facilities.


2. Controller subroutines and datum shifts.
Longhand Code
Testing the system variable PATHTRACE (modifier 21) can direct processing through the RAPID, FEED, CLW
and CCLW macros.
PATHTRACE=1 can be interpreted to mean the user has requested to generate longhand code.
Subroutines and Datum Shifts
The testing of the system variable PATHTRACE can cause processing to be directed through the manipulative
macros.
Controller (0) - generate controller subroutines.
Pathtrace (1) - generate longhand code.

Edgecam User Guide

99

%Output
%OUTPUT controls the output of separate CNC output files (a tooling setup sheet and a main body program).
These files have the same prefix, the - character as a delimiter, and the assigned value of $NAME as a suffix.
To enable the creation of the two files, you must specify the following macro commands in the START macro:
%MACRO=START
... ; output filename="TEST"
APPEND=1 ; enable suffix file creation
$NAME=SETUP ; assign 'SETUP' as suffix to $NAME
%OUTPUT=$NAME ; output to secondary file
... ; direct output to a CNC file
... ; called TEST-SET'
...
...
%OUTPUT=STANDARD ; direct output to standard TEST
... ; filename
...
You can redirect the output at any time by assigning %OUTPUT as either STANDARD or $NAME.
The suffix assignment must only be made once.
Where the files are directed to a disk which cannot support long file names (for example, Novell 3.1) Edgecam
abbreviates the name to fit, by using the first six characters and then adding a dash plus the first character of
the $NAME.
Here are some examples:
Long Filename

Truncated Filename

testcode-setup.nc

testco-s.nc

testcode-1.nc

testco-1.nc

testcode-2.nc

testco-2.nc

testcode-header.nc

testco-h.nc

Edgecam User Guide

100

Leader
LEADER is NOT a system variable.
The use of LEADER is to output a length of null characters within the output file. The RS232 software interprets
this command during a RS232 communication session.
The statement is a CNC output command therefore the syntax should be as below:
%MACRO=...
...
<LEADER=####>
...
%ENDM
where #### is the number of null characters required to be output.
It should be noted that it is also possible to insert the statement in an output file using the Editor.

Edgecam User Guide

101

User-Defined System Variables (Q201 - 210)


This set of variables (Q201 to Q210) replaces the set Q67 to Q71; we recommend you use this new set, but the
old set is still available.
Note - You can use a combination of old and new Q vars in one code generator, but not in the same macro.
Q201-205 and Q67-71 both use USERVAR1 to USERVAR5 so you couldn't use these together.
Q201 populates USERVAR1
Q202 populates USERVAR2
and so on....
Q210 populates USERVAR10
The definition syntax is: Qnnn=_type=description [macro number(s)]
Where _type may be one of the following
"_radio"
"_list"
"_check"
"_$text"
"_real"
,"_int"
"_separator"
For example: Q201=_check=Turret Face [104]
If a "_$text" type is used it will set up USERVARSTRING (this can only be used once per command) but may
be used in more than one macro.
Language Translation is also supported. In this example, string 345 from Ptmach.Txt will be used as the
modifier name:
Q202=_check=Through Spindle On [104]
Q203=_int=Tool Length Register [12]
Q207=_list=Output Type^Longhand^Single Block Cycle^Canned Cycle [8]
Q206=_separator=... [15,165,104]
_check variables will be set to 1 if the box is checked.
_list and _radio variables will be set to a number corresponding with the position in the defined list of the
selected item.
_int _real and _$text variables will be set to the entered value
If you are adding one of these to an existing executive macro, check in the edgekrnl.cmd that the command in
question does not already use the modifier ID you want to use - some commands use modifier numbers 200
upwards already.

Edgecam User Guide

102

Format Table
When numeric variables (either system- or user-defined) are output as part of a line of CNC code, the post
must be instructed to format the number in terms of the letter address, leading zeros, trailing zeros etc., for
both millimetre and inch programs.
When a numeric variable is to be output as CNC code, a format table number is associated with it and the
numeric value associated with that variable name will be formatted as the line definition.
The first line after the %FORMAT is numbered zero, the next line is 1, and so on until the %ENDF statement.
An example format table follows:
%FORMAT ;Inch MM

Comments

X,3,4,128,4,3,128,0

X MOVE

Y,3,4,128,4,3,128,

Y MOVE

I,3,4,128,4,3,128,

I MOVE

J,3,4,128,4,3,128,

J MOVE

R,3,4,128,4,3,128,

R MOVE

G,2,0,1,2,0,1,

GCODE

N,5,0,0,5,0,0,

BLOCK NUMBER

%ENDF

The table must start with the line '%FORMAT' and the lines following must be in the order shown. Each line in
the table must contain seven entries followed by commas. Each entry has the following function:

Order

Line

Function

Letter Address Code

Character(s) which will precede the


numeric value when formatted.

Significant Digits

Number of significant digits before


the decimal point for Inch CNC format.

Decimal Places

Number of places after the decimal


point for Inch CNC format.

Control Code

Control code required for Inch CNC


format (see below).

Significant Digits

Number of significant digits before


the decimal point for Millimetre CNC format.

Decimal Places

Number of places after the decimal point


for Millimetre CNC format.

Control Code

Control code required for Millimetre CNC


format (see below).

Edgecam User Guide

103

The control code is crucial to controlling the format of a number in a CNC program. The code is made up by
adding together the control values from this table:

Control Value

Control Function

Leading zeros required

Leading blanks required

Trailing zeros required

Trailing blanks required

16

No decimal point must be present

32

Use ',' instead of '.'

64

Force '.' on end of integers (whole numbers)

128

Force '.0' on end of integers

256

Force '+' on front of positive numbers

512

Force '0.' on front of numbers between -1 and


+1

1024

Right fill with spaces to a total width of five

2048

Right fill with spaces to width of ten

The following examples show the result of different control codes:

Format Table

Number

CNC Code

X,3,3,128,3,3,128

X2.0

2.125

X2.125

.25

X.25

Y2.0

2.125

Y2.125

25

Y25.0

I2.

2.125

I2.125

25

I25.

J000200

2.125

J000212

25

J002500

Y,3,3,128,3,3,128

I,4,3,64,4,3,64

J,4,2,21,4,2,21

Edgecam User Guide

104

The format table must end with the line '%ENDF'.


An example of format table implementation is below
%MACRO=1=FE=...
...
...
#BNUM=+#BNUMVAR:#XMOVE=XMOVE:#YMOVE=YMOVE:#GCODE=1
...
<[#BNUM=7] [#GCODE=6][#XMOVE=0][#YMOVE=1]>
...
%ENDM
This would output the following type of code:
N110 G01X25.352Y-42.1

Edgecam User Guide

105

Numeric System Variables by Number


1XSTART
4YCENTRE
8XMOVE
12XHOME
15XTOOL
18TOOLNUM
21ZCLEAR
24SPEED
28FPECK
31RPLANE
34XSUB
38YINC
42NEXTOOL
45ZEND
48TOOLWIDTH
51TOOLUNIT
54TOOLTYPE
57ZSAFE
60OFFSETX
63STCOMMAND
66ZSTARTPOS
69 XCURRENTPOS
72FEEDTYPE
75NEXTCOMP
78NEXTOOLPOS
81FEED
85NEXTXYFEED
88XMAX
91NEXTZMOVE
94dummy
97CMOVE
100MASK
103NUMTOOLS
106STEP
109YDELTA
113XSHEET
116OFFSET
119ROWPRIORITY
122MAXRAPID
125TZMAX
128MACHTIME1
131IDLE2
134YSTEP
137TLYLEN
140ZHOME1
143QUADRANT
146USERVAR2
149USERVAR5
152PECKRETRACT
155RSTART
158CEND
161NUMCHARS
164VMOVE
167TOLERANCE

2YSTART
5RADIUS
9YMOVE
13YHOME
16YTOOL
19TOOLRAD
22XYFEED
25LAST
29DEGR
32IPLANE
35YSUB
39ZINC
43ZSTART
46TOOLXSET
49TOOLANGLE
52TOOLANGLE1
55NEXTYMOVE
58PITCH
61NEXTMACRO
64ENCOMMAND
67XENDPOS
70 ZCURRENTPOS
73NEXTSPEED
76NEXTCSS
79STARTSUB
82CSS
86NEXTZFEED
89NEXTGEAR
92TOOLCHANGE
95ZLEVEL
98TOTDEPTH
101NEXTARC
104SFMOD
107STANGLE
110XREP
114YSHEET
117LEFTRIGHT
120MAXFEED
123TXMAX
126ZTOOL1
129MACHTIME2
132YMAX
135ORIENTATE
138PUNCHMODE
141XHOME1
144INDEX
147USERVAR3
150YDATUM
153CONTMATRIX
156CCENTRE
159REND
162CAXIS
165WMOVE
168dummy

Edgecam User Guide

3XCENTRE
6XEND
7YEND
10ZMOVE
11UNIT
14ZHOME
17ZTOOL
20TOOLEN
23ZFEED
26CIRCLE
27ZDEPTH
30DWELL
33SUBROUTINE
36ZSUB
37XINC
40REPEAT
41POSITION
44ZCENTRE
47TOOLZSET
50TURRET
53TOOLANGLE2
56XSAFE
59OFFSETZ
62PATHTRACE
65XSTARTPOS
68ZENDPOS
71 TOTALDEPTH
74NEXTFEED
77DEPTH
80ENDSUB
83COMP
84DIRECTION
87ZMAX
90NEXTXMOVE
93SUBFUNCT
96RMOVE
99NEXTOOLLEN
102DRILLSUB
105ANGLE
108XDELTA
111YREP
112PIP
115PASS
118LACECUT
121MAXRPM
124TYMAX
127XTOOL1
130IDLE1
133FPASS
136TLXLEN
139ZSHEET
142NUMTOOLS1
145USERVAR1
148USERVAR4
151XDATUM
154CSTART
157RCENTRE
160NUMBLOCKS
163UMOVE
166PRECISION
169SCALE

106

170THICKNESS
171XYPLANE
172UVPLANE
173LOWERWIRE
174UPPERWIRE
175WIREDIAM
176FIELD1
177FIELD2
178FIELD3
179FIELD4
180FIELD5
181FIELD6
182FIELD7
183FIELD8
184FIELD9
185FIELD10
186FIELD11
187FIELD12
188TAPERTYPE1
189TAPERTYPE2
190TAPER1
191TAPER2
192NEXTXCENTRE
193NEXTYCENTRE
194NEXTRADIUS
195MACRONAMEOP
196APPEND
197CMT1
198CMT2
199LIBTYPE
200USERMATRIX
201CIT1
202CIT2
203NOCYCLE
204ROT1
205ROT2
206WRAPRADIUS
207RTYPE
208STYPE
209SYSID
210SILENT
211YGAUGE
212TRUEARCOP
213AMOVE
214BMOVE
215 OUTPUTTOL
216 MAINTAININDEX
217 TOOLOFFSET
218GEAR
219STARTANGLE
220ENDANGLE
221INCANGLE
222SPINDLEID1
223SPINDLEID2
224INDEXID
225SPINDLE
226GEARMAXRPM
227 GEARMINRPM
228 GEARUSERMAXRPM
229 NUMGEARS
230BAXIS
231PRIORITY
232PARTLENGTH
233 MAINPARTSTICKOUT
234 sUBPARTSTICKOUT
235 MAINDATUMTOCHUCKFACE
236 SUBDATUMTOCHUCKFACE
237 MCSUBDATUMX
238 MCSUBDATUMY
239 MCSUBDATUMZ
240DOCKGRIPZ
241MAINSAFEZ
242SUBSAFEZ
243STRATEGY
244USERVAR6
245USERVAR7
246USERVAR8
247USERVAR9
248USERVAR10
249USERVAR11
250USERVAR12
251TEXTCASE
252ZAPPROACH
253XAPPROACH
254XSUBTURN
255YSUBTURN
256ZSUBTURN
257FLUTELENGTH
258PRIORITYMAIN
259PRIORITYSUB
260MILLMODE
261YEAR
262MONTH
263DAY
264 NUMBEROFTURNS
265 GEARCODE
266 SPINDLEUPPER
267 SPINDLELOWER
268 SUBOUTPUTPASS
269 TSTOREUSER1
270 TSTOREUSER2
271 THROUGHCOOLANT
272 ROTSUB
273 XBPIVOTLENGTH
274 ZBPIVOTLENGTH
275 XSCRATCH
276YSCRATCH
277ZSCRATCH
278REACH
279 NOBULGECORRECTION
280 RESOLUTION
281 CORNERRAD
282XCPL
283YCPL
284ZCPL
285INORMAL
286JNORMAL
287KNORMAL
288FIVEAXIS
289WORKDATUMID
290MCOORD
291EULER1
292EULER2
293EULER3
294CPLPLANE
295PIVOT
296GROUPNUMBER
297 IDNUMBER
298 TURRETBANGLE
299 ATCSPINANGLE

Edgecam User Guide

107

Numeric System Variables by Name


AMOVE213
ATCSPINANGLE299
CAXIS162
CIRCLE26
CMOVE97
COMP83
CPLPLANE294
DAY263
DIRECTION84
dummy94
ENCOMMAND64
EULER1291
FEED81
FIELD10185
FIELD2177
FIELD5180
FIELD8183
FLUTELENGTH257
GEAR218
GEARMINRPM 227
GROUPNUMBER296
IDNUMBER297
INDEXID224
JNORMAL286
LAST25
LOWERWIRE173
MACRONAMEOP 195
MAINPARTSTICKOUT 233
MASK100
MAXRPM121
MCSUBDATUMY 238
MONTH262
NEXTCSS76
NEXTMACRO61
NEXTOOLPOS78
NEXTXCENTRE192
NEXTYCENTRE193
NEXTZMOVE 91
NUMBEROFTURNS 264
NUMGEARS229
OFFSET116
ORIENTATE135
PASS115
PIP112
POSITION41
PRIORITYMAIN 258
QUADRANT143
REACH278
RESOLUTION280
ROT2205
RPLANE31
SCALE169
SPEED24
SPINDLEID2 223

ANGLE105
APPEND196
BAXIS230
BMOVE214
CCENTRE156
CEND158
CIT1201
CIT2202
CMT1197
CMT2198
CONTMATRIX153
CORNERRAD281
CSS82
CSTART154
DEGR29
DEPTH77
DOCKGRIPZ240
DRILLSUB102
dummy168
DWELL30
ENDANGLE220
ENDSUB80
EULER2292
EULER3293
FEEDTYPE72
FIELD1176
FIELD11186
FIELD12187
FIELD3178
FIELD4179
FIELD6181
FIELD7182
FIELD9184
FIVEAXIS288
FPASS133
FPECK28
GEARCODE265
GEARMAXRPM226
GEARUSERMAXRPM 228
IDLE1130
IDLE2131
INCANGLE221
INDEX144
INORMAL285
IPLANE32
KNORMAL287
LACECUT118
LEFTRIGHT117
LIBTYPE199
MACHTIME1128
MACHTIME2129
MAINDATUMTOCHUCKFACE 235
MAINSAFEZ 241
MAINTAININDEX 216
MAXFEED120
MAXRAPID122
MCOORD290
MCSUBDATUMX237
MCSUBDATUMZ 239
MILLMODE 260
NEXTARC101
NEXTCOMP75
NEXTFEED74
NEXTGEAR89
NEXTOOL42
NEXTOOLLEN99
NEXTRADIUS194
NEXTSPEED73
NEXTXMOVE90
NEXTXYFEED85
NEXTYMOVE55
NEXTZFEED86
NOBULGECORRECTION 279
NOCYCLE 203
NUMBLOCKS 160
NUMCHARS 161
NUMTOOLS103
NUMTOOLS1142
OFFSETX60
OFFSETZ59
OUTPUTTOL215
PARTLENGTH232
PATHTRACE62
PECKRETRACT152
PITCH58
PIVOT295
PRECISION166
PRIORITY231
PRIORITYSUB 259
PUNCHMODE 138
RADIUS5
RCENTRE157
REND159
REPEAT40
RMOVE96
ROT1204
ROTSUB272
ROWPRIORITY119
RSTART155
RTYPE207
SFMOD104
SILENT210
SPINDLE225
SPINDLEID1222
SPINDLELOWER 267
SPINDLEUPPER 266

Edgecam User Guide

108

STANGLE107
STCOMMAND63
STYPE 208
SUBOUTPUTPASS 268
SUBSAFEZ242
TAPER2191
TEXTCASE 251
TLXLEN136
TOOLANGLE49
TOOLCHANGE92
TOOLOFFSET217
TOOLUNIT51
TOOLZSET47
TRUEARCOP 212
TURRET50
TZMAX125
UPPERWIRE174
USERVAR10248
USERVAR2146
USERVAR5149
USERVAR8246
VMOVE164
WORKDATUMID 289
XBPIVOTLENGTH273
XCURRENTPOS69
XEND6
XHOME1141
XMOVE8
XSCRATCH275
XSTARTPOS65
XTOOL15
XYPLANE171
YDATUM150
YEND7
YINC38
YREP111
YSTART2
YSUBTURN255
ZBPIVOTLENGTH274
ZCPL284
ZEND45
ZHOME14
ZLEVEL95
ZSAFE57
ZSTART43
ZSUBTURN256

STARTANGLE219
STARTSUB79
STEP106
STRATEGY243
SUBDATUMTOCHUCKFACE 236
SUBFUNCT 93
sUBPARTSTICKOUT 234
SUBROUTINE 33
SYSID209
TAPER1190
TAPERTYPE1188
TAPERTYPE2189
THICKNESS 170
THROUGHCOOLANT 271
TLYLEN137
TOLERANCE167
TOOLANGLE152
TOOLANGLE253
TOOLEN20
TOOLNUM18
TOOLRAD19
TOOLTYPE54
TOOLWIDTH48
TOOLXSET46
TOTALDEPTH71
TOTDEPTH98
TSTOREUSER1 269
TSTOREUSER2 270
TXMAX123
TYMAX124
UMOVE163
UNIT11
USERMATRIX200
USERVAR1145
USERVAR11249
USERVAR12250
USERVAR3147
USERVAR4148
USERVAR6244
USERVAR7245
USERVAR9247
UVPLANE172
WIREDIAM175
WMOVE165
WRAPRADIUS 206
XAPPROACH 253
XCENTRE3
XCPL282
XDATUM151
XDELTA108
XENDPOS67
XHOME12
XINC37
XMAX88
XREP110
XSAFE56
XSHEET113
XSTART1
XSUB34
XSUBTURN254
XTOOL1127
XYFEED22
YCENTRE4
YCPL283
YDELTA109
YEAR261
YGAUGE211
YHOME13
YMAX132
YMOVE9
YSCRATCH276
YSHEET114
YSTEP134
YSUB35
YTOOL16
ZAPPROACH252
ZCENTRE44
ZCLEAR21
ZCURRENTPOS70
ZDEPTH27
ZENDPOS68
ZFEED23
ZHOME1140
ZINC39
ZMAX87
ZMOVE10
ZSCRATCH277
ZSHEET139
ZSTARTPOS66
ZSUB36
ZTOOL17
ZTOOL1126

Edgecam User Guide

109

String System Variables


1 USERDEFINEDSTRING 2 TOOLDESCRIPTION
3 GROUPDESCRIPTION
4 TOOLLIBRARY
5 TIME
6 DATE
7 PARTNAME
8 SEQUENCENAME
9 MACHINENAME
10 JOBDESC
11 JOBCOM
12 JOBFAM
13 JOBSTAT
14 JOBMACH
15 JOBCUST
16 JOBPROG
17 JOBMATL
18 JOBREV
19 USERVARSTRING
20 UKDATE
21 STRTSTOREUSER1
22 STRTSTOREUSER2
23 CUSTOMERNAME
24 SERVERCODE
25 GROUPSTRING
26 IDSTRING
27 GROUP
28 ID

Edgecam User Guide

110

Milling Cutter Radius Compensation


Compensation Application/Removal
If a 90 degree, linear only, manual lead has been requested it is extended by the tool radius.
If no lead is specified a 90 degree straight lead will be created. The length will be the tool radius multiplied by
the radius compensation factor.
For all other manual linear leads a move at 90 degrees is appended to the lead. The length of this move is
calculated by multiplying the tool radius by the radius cutter compensation factor stored in the code generator.
For arc and arc/linear combinations a 90 degree move (with the length of the tool radius multiplied by the radius
cutter compensation factor) is appended to the lead.
In all cases these compensation moves are calculated from the nominal offset path to ensure that there is
sufficient movement for the cutter radius compensation to be applied.
End Point Lift Out
The end point of the lead out move has been adjusted to prevent the 3D moves that were previously generated
and to represent more closely the situation on the machine tool.
Code Generators
In order to take advantage of this new compensation logic you have to use the updated milling templates. All
existing code generators will function as previously. A user update on the template will implement these
changes for Code Wizard based code generators.
Custom posts will need minor changes to benefit from this logic:

1. Switch 8 on the MM= definition line must be incremented by 32.


2. Procedure PT=LEAD_OUT must be changed to set #LEADOUTCOUNT=FIELD12
Remaining Potential Issues
In the case of external work where a profile finishes on a sharp corner, controller compensation should always
be used with square corner strategy set. Otherwise, the offset path will add a coupling arc and the
calculated leads for controller and Pathtrace are very different.
In the case of approach moves and intermediate rapid moves generated within a profile cycle Edgecam will
show both the geometry based tool centre line and a nominal offset simulation line. Whilst for FEED moves,
with a nominal cutter radius offset, the tool centre can be expected to follow the simulation line, for RAPID
moves (no compensation) the tool will follow the geometry based line but the screen simulation will, at present,
follow the offset simulation line.

Edgecam User Guide

111

Multilevel Drilling
This section clarifies the role of the Retract option in drilling cycles.
When completing a Hole Cycle dialog you are asked for depth settings of ZLEVEL, RETRACT DISTANCE,
DEPTH and ZCLEAR.
For single level cycles the RETRACT DISTANCE is passed to the Code Generator as a Retract Plane set at
ZLEVEL+RETRACT. If no retract distance is given the Retract Plane defaults to the Clearance Plane Height.
For Multilevel drilling the ZLEVEL is ignored and a RETRACT distance is passed to the Code Generator. If a
RETRACT distance is not stated it defaults to the ZCLEAR height. The Code Generator will then set up a
Retract plane based on the height of the first point and that Retract Distance. For this reason it is
recommended that in Multilevel Drilling a RETRACT distance should always be entered in the dialog.
If any multilevel cycles are to be used it is suggested that for best results all hole cycles with the same tool
should be treated as multilevel. A combination of multilevel and single level cycles with the same tool may not
give the expected NC output.

Edgecam User Guide

112

Milling Modifiers
This table shows the system variable set up for each of the modifiers that may be included in the Code
Generator macro definition line.
Number

Heading

System Variables

Name

GROUPDESCRIPTION

Feedrate

XYFEED

Plunge feed

ZFEED

Speed

SPEED

Tool No.

TOOLNUM

Depth

ZDEPTH

10

Cut increment

DEPTH

12

Offset

OFFSET

13

Side

LEFTRIGHT

14

From

STCOMMAND

15

Comment

USERDEFINEDSTRING

16

%Stepover

STEP

21

Subroutines

PATHTRACE

23

Degression

DEGR

24

Angle

ANGLE

25

Radius

RADIUS

26

To

ENCOMMAND

27

Time

DWELL

28

Clear

ZCLEAR

29

Retract

RPLANE

37

Matrix/Repeats

REPEAT

38

X repeats

XREP

39

Y repeats

YREP

40

Direction/Priority

ROWPRIORITY

41

Lace Cut

LACECUT

43

{X} increment/length

XINC

44

{Y} increment/length

YINC

45

{Z} increment/length

ZINC

51

Quadrant

QUADRANT

57

Angle

INDEX

Edgecam User Guide

113

59

Move type

FIELD2

60

Distance

FIELD1

63 - 66

- Not defined -

67

USERVAR1

68

USERVAR2

69

USERVAR3

70

USERVAR4

71

USERVAR5

72 - 81

- Not defined -

82

Define layout

200

Multilevel in drill cycles ZPOINT()

201

Multidepth in drill
cycles

USERMATRIX

ZDEPTH()

Edgecam User Guide

114

Milling Cycle Commands


The diagram uses the drilling macro command (macro number 9), for the purposes of illustration only.

The flow diagram also applies to the chipbreak, tap, ream and bore macros.
See Also
System Variable - DRILLSUB
Procedure - LOOPEXPAND
Using MASK in Milling

Edgecam User Guide

115

System Variable - DRILLSUB


DRILLSUB = 1 indicates the present drill point array has repeated machining operations to be carried out and
generate controller subroutine definitions.
DRILLSUB = 0 indicates the present drill point array has only one machining operation and therefore output
array points immediately.

Edgecam User Guide

116

Procedure - LOOPEXPAND
A call to the user-defined LOOPEXPAND procedure will expand the number of points to be machined. The
following macro definitions ordinarily contain a LOOPEXPAND call:
DRILL CYCLE
TAP CYCLE
BORE CYCLE
CHIPBREAK CYCLE
CYCLESUB

Edgecam User Guide

117

Using MASK in Milling


The actual output of CNC code is affected by the MASK system variable.

Edgecam User Guide

118

Milling Macro Reference Overview


Expand the Milling Macro Reference book in the Table of Contents to see the full list of milling macro
reference topics.

Edgecam User Guide

119

Milling Macro Reference

1 - MOVE RAPID
Recommended Syntax
%MACRO=1=..=Move Rapid =1,2,3,
System Variables Modified

System Variable Description

AMOVE
BMOVE
CMOVE
RMOVE

Radial distance from centre of rotation

ROT1

Angular position

WRAPRADIUS

Rotary mode. Defines the radius of the wrapped geometry

XMOVE

X Axis Motion

YMOVE

Y Axis Motion

ZMOVE

Z Axis Motion

Edgecam User Guide

120

Milling Macro Reference

2 - MOVE FEED
Recommended Syntax
%MACRO=2=..=Move Feed=1,2,3,5,6,7,
System Variables Modified

System Variable Description

AMOVE
BMOVE
CMOVE
FEED

Feedrate*

FIELD 12

Number of elements in lead move (only set if SUBFUNCT = 1 or 2)

RMOVE

Radial distance from centre of rotation

ROT1

Angular position

SPEED

Spindle Speed

SUBFUNCT

0 = Not a lead move


1 = Lead in move
2 = Lead out move

WRAPRADIUS

Rotary mode. Defines the radius of the wrapped geometry

XMOVE

X Axis Motion

XYFEED

Feedrate in XY Plane

YMOVE

Y Axis Motion

ZFEED

Feedrate in Z Axis

ZMOVE

Z Axis Motion

*Feedrate Control for the Milling Code Generator


This sample of code tests for the slope of the tool movement and uses the appropriate feed system variable:
%IF #ZMOVE=#ZHOLD %THEN #FEED=XYFEED %ELSE #FEED=ZFEED
This could be replaced by this sample, using the later FEED system variable:
#FEED=FEED

Edgecam User Guide

121

Milling Macro Reference

3 - MOVE ARC
Recommended Syntax
%MACRO=3=..=Move Arc=1,2,5,7,
System Variables Modified System Variable Description
SPEED

Spindle Speed

XYFEED

Feedrate in XY Plane

Edgecam User Guide

122

Milling Macro Reference

4 - FACEMILL CYCLE
Recommended Syntax
%MACRO=4=..=Facemill Cycle=1,2,9,5,7,
System Variables Modified

System Variable Description

FEED

Feedrate (see Move Feed for details)

SPEED

Spindle Speed

X DELTA

Incremental X Distance

XEND

X Finish Position

XSTART

X Start Position

XYFEED

Feedrate in XY Plane

Y DELTA

Incremental Y Distance

YEND

Y Finish Position

YSTART

Y Start Position

ZDEPTH

Z Height of Cut

ZFEED

Feedrate in Z Axis

Edgecam User Guide

123

Milling Macro Reference

5 - PROFILE CYCLE
Recommended Syntax
%MACRO=5=..=Profile Cycle=4,5,6,7,9,12,13,21,22,24,25,
System Variables Modified

System Variable Description

ANGLE

Angle of Lead In

FEED

Feedrate (see Move Feed for details)

LEFTRIGHT

Offset Direction

OFFSET

Offset Value

PATHTRACE

Controller Compensation Flag

SPEED

Spindle Speed

XYFEED

XY Plane Feed

ZDEPTH

Z Height of Cut

ZFEED

Z Axis Feed

Edgecam User Guide

124

Milling Macro Reference

6 - AREACLEAR CYCLE
Recommended Syntax
%MACRO=6=..=Areaclear Cycle=4,5,6,7,9,12,16,22,24,
System Variables Modified

System Variable Description

FEED

Feedrate (see Move Feed for details)

OFFSET

Offset Value

SPEED

Spindle Speed

STEP

Percentage Cutter Overlap

XYFEED

XY Plane Feed

ZFEED

Z Axis Feedrate

Edgecam User Guide

125

Milling Macro Reference

7 - SLOT CYCLE
Recommended Syntax
%MACRO=7=..=Slot Cycle=4,5,6,7,9,
System Variables Modified

System Variable Description

FEED

Feedrate (see Move Feed for details)

SPEED

Spindle Speed

XYFEED

XY Plane Feed

ZDEPTH

Z Height of Cut

ZFEED

Z Axis Feed

Edgecam User Guide

126

Milling Macro Reference

8 - CROSSHATCH CYCLE
Recommended Syntax
%MACRO=8=..=Crosshatch Cycle=4,5,6,7,9,12,16,49,
System Variables Modified

System Variable Description

FEED

Feedrate (see Move Feed for details)

OFFSET

Offset Value

SPEED

Spindle Speed

STEP

Percentage Cutter Overlap

XYFEED

XY Plane Feed

ZDEPTH

Z Height of Cut

ZFEED

Z Axis Feed

Edgecam User Guide

127

Milling Macro Reference

9 - DRILL CYCLE
Recommended Syntax
%MACRO=9=..=Drill Cycle=4,6,7,9,10,21,23,27,29,28,50,53|176,200,201,
System Variables Modified

System Variable Description

DEGR

Degression Value

DEPTH

Depth of Peck

DRILLSUB

Subroutine Indicator
0 = Longhand Code
1 = Subroutines Present

DWELL

Dwell in Seconds

FEED

Feedrate

LAST

Number of Points

MRPLANE(#)

Retract Plane for each position*

MZDEPTH(#)

Z Drilling Depth for each position*

PATHTRACE

Controller Canned Cycle Flag

RPLANE

Retraction Plane

SPEED

Spindle Speed

XPOINT(#)

X Axis Position*

YPOINT(#)

Y Axis Position*

ZCLEAR

Z Clearance Plane

ZDEPTH

Final Z Depth, if multilevel not selected

ZFEED

Z Axis Feed

ZLEVEL

Work Plane, if multilevel not selected

ZPOINT(#)

Zlevel for each position*

ZSAFE

Safe Distance

Note that 176 (FIELD1) contains the Entry feed value.


* See Also XYZ Array for Drilling in Different Environments

Edgecam User Guide

128

Milling Macro Reference

10 - CHIPBREAK CYCLE
Recommended Syntax
%MACRO=10=..=Chipbreak Cycle=4,6,7,9,10,21,23,29,28,50,53|176,200,201,
System Variables Modified

System Variable Description

DEGR

Degression Value

DEPTH

Depth of Peck

DRILLSUB

Subroutine Indicator
0 = Longhand Code
1 = Subroutines Present

DWELL

Dwell in Seconds

FEED

Feedrate

MRPLANE (#)

Retract Plane for each position*

MZDEPTH (#)

Z Drilling Depth for each position*

PATHTRACE

Controller Canned Cycle Flag

RPLANE

Retraction Plane

SPEED

Spindle Speed

XEND

X End Position

XPOINT(#)

X Axis Position*

XSTART

X Start Position

YEND

Y End Position

YPOINT(#)

Y Axis Position*

YSTART

Y Start Position

ZCLEAR

Z Clearance Plane

ZDEPTH

Final Z Depth, if multilevel not selected

ZFEED

Z Axis Feed

ZLEVEL

Work Plane, if multilevel not selected

ZPOINT(#)

Zlevel for each position*

Note that 176 (FIELD1) contains the Entry feed value.


* See Also XYZ Array for Drilling in Different Environments

Edgecam User Guide

129

Milling Macro Reference

11 - REAM CYCLE
Recommended Syntax
%MACRO=11=..=Ream Cycle=4,6,7,9,21,27,29,28,50,53|176,200,201,
System Variables Modified

System Variable Description

DWELL

Dwell in Seconds

DRILLSUB

Subroutine Indicator
0 = Longhand Code
1 = Subroutines Present

FEED

Feedrate

LAST

Number of Points

MRPLANE (#)

Retract Plane for each position*

MZDEPTH (#)

Z Drilling Depth for each position*

PATHTRACE

Controller Canned Cycle Flag

RPLANE

Retraction Plane

SPEED

Spindle Speed

XEND

X End Position

XPOINT(#)

X Axis Position*

XSTART

X Start Position

YEND

Y End Position

YPOINT(#)

Y Axis Position*

YSTART

Y Start Position

ZCLEAR

Z Clearance Plane

ZDEPTH

Final Z Depth, if multilevel not selected

ZFEED

Z Axis Feed

ZLEVEL

Work Plane, if multilevel not selected

ZPOINT(#)

Zlevel for each position.*

Note that 176 (FIELD1) contains the Entry feed value.


* See Also XYZ Array for Drilling in Different Environments

Edgecam User Guide

130

Milling Macro Reference

13 - TAP CYCLE
Recommended Syntax
%MACRO=13=..=Tap Cycle=4,6,7,9,21,27,29,28,200,201,
System Variables Modified

System Variable Description

DWELL

Dwell in Seconds

DRILLSUB

Subroutine Indicator
0 = Longhand Code
1 = Subroutines Present

FEED

Feedrate

LAST

Number of Points

MRPLANE(#)

Retract Plane for each position*

MZDEPTH(#)

Z Drilling Depth for each position*

PATHTRACE

Controller Canned Cycle Flag

RPLANE

Retraction Plane

SPEED

Spindle Speed

XEND

X End Position

XPOINT(#)

X Axis Position*

XSTART

X Start Position

YEND

Y End Position

YPOINT(#)

Y Axis Position*

YSTART

Y Start Position

ZCLEAR

Z Clearance Plane

ZDEPTH

Final Z Depth, if multilevel not selected

ZFEED

Z Axis Feed

ZLEVEL

Work Plane, if multilevel not selected

ZPOINT(#)

Zlevel for each position*

* See Also XYZ Array for Drilling in Different Environments

Edgecam User Guide

131

Milling Macro Reference

14 - MOVE RELATIVE
Recommended Syntax
%MACRO=14=..=Move Relative=4,9,12,13,60,59,7,5,
System Variables Modified

System Variable Description

FIELD1

Distance

FIELD2

Move type:
1 = Feed
2 = Rapid

LEFTRIGHT

Offset Direction

OFFSET

Offset Value

SPEED

Spindle Speed

XYFEED

XY Plane Feed

Edgecam User Guide

132

Milling Macro Reference

15 - TOOLCHANGE
Recommended Syntax
%MACRO=15=..=Toolchange=8,12,47,48,57,61,15,
These system variables are available following a %LOAD call for the current tool number. The current tool
number is the value of SUBFUNCT.
System Variables Modified

System Variable Description

CMT1

Cumulative Tool Usage at Toolchange in Minutes

CSS

Constant surface speed

CORNERRAD

Corner radius of selected tool (or #FUNNY)

DIRECTION

Spindle rotation direction: Forward or reverse

FEEDTYPE

Feed/Rev (1) or Feed/Minute (2)

FLUTELENGTH

Flute Length

GEAR

Gear

GROUP

The string value of the 'Group Code' modifier on the


ToolChange dialog.

GROUPSTRING

A string comprising the first sequence of letter characters in


the GROUP variable ('abc123def').

GROUPNUMBER

A numeric variable converted from the first numerical


character sequence in the GROUP variable ('abc123def').
A '.' character is classed as the decimal point of a number
('abc12.3def' gives 12.3, '.12def' gives 0.12).

ID

The string value of the 'Code ID' modifier on the


ToolChange dialog.

IDSTRING

A string comprising the first sequence of letter characters in


the ID variable ('abc123def')

IDNUMBER

A numeric variable converted from the first numerical


character sequence in the ID variable ('abc123def').
A '.' character is classed as the decimal point of a number
('abc12.3def' gives 12.3, '.12def' gives 0.12).

MAINTAININDEX

Setting of the Maintain Index checkbox used in the


Toolchange command (rotary head indexes only).
0 = not checked
1 = checked

MAXRPM

Maximum revs per minute

POSITION

Turret Number

QUADRANT

Select corner from which to start Matrix Mode

STRTSTOREUSER1

User defined text variable from ToolStore

Edgecam User Guide

133

STRTSTOREUSER2

User defined text variable from ToolStore

SUBFUNCT

Current Tool Pointer

THROUGHCOOLANT

Through Tool Coolant flag from ToolStore; 0=off, 1=0n

TOOLDESCRIPTION

Toolname

TOOLEN

Tool Length Setting

TOOLNUM

How tool is defined


0 = Tool defined interactively
1 = Loaded from Cutting Tools Library
2 = Loaded from Assembly Library
3 = Loaded from Tool Kit

TOOLOFFSET

Tool length offset register

TOOLRAD

Tool Radius

TOOLTYPE

Tool Type information


0 = Endmill
1 = Ballnose
2 = Tap
3 = Drill
4 = Taper
5 = Other - NO LONGER USED
6 = T-Slot
7 = Lollipop

TOOLZSET

Z Gauge Length

TSTOREUSER1

User defined numeric variable from ToolStore

TSTOREUSER2

User defined numeric variable from ToolStore

USERDEFINEDSTRING

Comment

XCPL, YCPL, ZCPL

The tool tip position after the toolchange, in current CPL


coordinates.

Note that the user defined system variable Q69 is usually used for the tool length offset register number.
The ToolStore has been developed to make use of this and where a TLO value is entered it will be passed
through as USERVAR3.
Tool Offset is now the system variable TOOLOFFSET. The modifier 12 must be defined on the macro line
to display and use this new system variable to retain compatibility with existing posts. This method of setting
tool offset replaces the use of user vars.

Edgecam User Guide

134

Milling Macro Reference

21 - FEED TYPE
Recommended Syntax
%MACRO=21=..=Feed Type
System Variables Modified

System Variable Description

SUBFUNCT

1 = Feed Per Revolution


2 = Feed Per Minute

Edgecam User Guide

135

Milling Macro Reference

22 - DWELL
Recommended Syntax
%MACRO=22=..=Dwell=27,
System Variables Modified System Variable Description
DWELL

Dwell in Seconds

Edgecam User Guide

136

Milling Macro Reference

29 - RADIUSCOMP
Recommended Syntax
%MACRO=29=..=Radiuscomp=
System Variables Modified

System Variable Description

SUBFUNCT

Assigned as Selected
Value
1 = No compensation
2 = Compensation Left
3 = Compensation Right

Edgecam User Guide

137

Milling Macro Reference

30 - MATRIX MODE ON
Recommended Syntax
%MACRO=30=..=Matrix Mode On=43,44,38,39,40,41,21,82,
System Variables Modified

System Variable Description

LACECUT

Lacecut
1 = Yes
0 = No

ROWPRIORITY

Row or Column Priority


0 = Column
1 = Row

USERMATRIX

User Defined Matrix

XINC

Incremental X Move

XREP

Number of Repeats in X Axis

YINC

Incremental Y Move

YREP

Number of Repeats in Y Axis

Edgecam User Guide

138

Milling Macro Reference

31 - MATRIX MODE OFF


Recommended Syntax
%MACRO=31=..=Matrix Mode Off=
System Variables Modified

System Variable Description

None - End of Matrix Definition

Edgecam User Guide

139

Milling Macro Reference

32 - TRANSLATE
Recommended Syntax
%MACRO=32=..=Translate=43,44,45,14,26,37,21,
System Variables Modified

System Variable Description

PATHTRACE

Controller Canned Cycle Flag

REPEAT

Number of Repeats

SUBROUTINE

Subroutine Number

XINC

X Translation Value

XSUB

X Coord of First Point

YINC

Y Translation Value

YSUB

Y Coord of First Point

ZINC

Z Translation Value

ZSUB

Z Coord of First Point

XEND

X End of First Move

YEND

Y End of First Move

ZEND

Z End of First Move

The RESET macro is called on exit from this macro.


When Mill Mode=Rotary, the Rotate command treats it as a translation about an angle:
System Variables Modified

System Variable Description

ANGLE

Angular rotation

PATHTRACE

Controller Canned Cycle Flag

REPEAT

Number of repeats

SUBROUTINE

Subroutine number

Edgecam User Guide

140

Milling Macro Reference

33 - ROTATE
Recommended Syntax
%MACRO=33=..=Rotate=1,2,14,26,24,37,21,
System Variables Modified

System Variable Description

ANGLE

Angle of Rotation

PATHTRACE

Controller Canned Cycle Flag

REPEAT

Number of Repeats

SUBROUTINE

Subroutine Number

XCENTRE

X Coord of Rotation

XSUB

X Coord of First Point

YCENTRE

Y Coord of Rotation

YSUB

Y Coord of First Point

The RESET macro is called on exit from this macro.


When Rotate is accessed while in Mill Mode=Rotary, the command is treated as a Transform, Translate. See
Macro 32.

Edgecam User Guide

141

Milling Macro Reference

34 - MIRROR
Recommended Syntax
%MACRO=34=..=Mirror=1,2,14,26,21,
System Variables Modified

System Variable Description

PATHTRACE

Controller Canned Cycle Flag

SUBROUTINE

Subroutine Number

XEND

X Coord of Second Point on mirror line

XSTART

X Coord of First Point on mirror line

XSUB

X Coord First Machining Position

YEND

Y Coord of Second Point on mirror line

YSTART

Y Coord of First Point on mirror line

YSUB

Y Coord First Machining Position

The RESET macro is called on exit from this macro.

Edgecam User Guide

142

Milling Macro Reference

35 - PECK
Recommended Syntax
%MACRO=35=..=Peck=14,26,45,9,29,21,58,
System Variables Modified

System Variable Description

PATHTRACE

Controller Canned Cycle Flag

PECKRETRACT

Retraction Flag

REPEAT

Number of Repeats

RPLANE

Clearance Plane [Optional]

SUBROUTINE

Subroutine Number

XSUB

X Coord of First Point

YSUB

Y Coord of First Point

ZINC

Z Translation Value

ZSUB

Z Coord of First Point

The Reset macro is called on exit from this macro.

Edgecam User Guide

143

Milling Macro Reference

36 - TECHNOLOGY
Recommended Syntax
%MACRO=36=..=Technology=

Edgecam User Guide

144

Milling Macro Reference

37 - THREAD MILLING
Note that this information also applies to Macro 187 - the CY turning version.
Recommended Syntax
%MACRO=37=..=Thread Mill=7,

System Variables Modified

System Variable Description

Field 1

Clearance

Field 2

Retract

Field 3

Diameter

Field 4

Level

Field 5

Depth of Thread

Field 6

Pitch

This macro will either set up the data array for machines which are capable of helical interpolation, or direct the
output through %NOCYCLE. If the user selects 'canned cycle' processing takes place using the array
described below, otherwise output is via RAPID and FEED macros.
Pathtrace

0 = Helical interpolation
1 = Pathtrace expansion to linear moves (use NOCYCLE
command)

For machines which are capable of helical interpolation the following applies:
The System variable XPOINT(#) must be tested for the type of movement being output.
LAST

Number of elements in the array

XPOINT(#)

0 = Rapid
1 = Feed
2 = Clockwise direction arc
3 = Counterclockwise direction arc
4 = Clockwise direction helical arc
5 = Counterclockwise direction helical arc

(#) is the subscript to gain access to a particular element.


The array comprises elements of three variables each. Each move type will occupy 2 or more elements, as
follows:

Edgecam User Guide

145

Rapid

Feed

CLW

CCLW

Helical CLW

Helical CCLW

Element

XPOINT(#)

YPOINT(#)

RADIUS(#)

Feedrate

X Destination

Y Destination

Z Destination

Feedrate

X Destination

Y Destination

Z Destination

Feedrate

X Centre

Y Centre

Radius

X Destination

Y Destination

Not used

Feedrate

X Centre

Y Centre

Radius

X Destination

Y Destination

Not used

Feedrate

X Centre

Y Centre

Not used

X Destination

Y Destination

Z Destination

Start Radius

End Radius

Not used

Feedrate

X Centre

Y Centre

Not used

X Destination

Y Destination

Z Destination

Start Radius

End Radius

Not used

System Variables Modified

System Variable Description

Field 1

Clearance

Field 2

Retract

Field 3

Diameter

Field 4

Level

Field 5

Depth of Thread

Field 6

Pitch

Edgecam User Guide

146

Milling Macro Reference

40 - MOVE HOME
Recommended Syntax
%MACRO=40=..=Move Home=
System Variables Modified System Variable Description
FIELD1

X Axis Lock. Non-zero if X FIXED

FIELD2

Y Axis Lock. Non-zero if Y FIXED

FIELD3

Z Axis Lock. Non-zero if Z FIXED

FIELD4

Edgecam User Guide

147

Milling Macro Reference

41 - MOVE TOOLCHANGE
Recommended Syntax
%MACRO=41=..=Move Toolchange=
System Variables Modified System Variable Description
FIELD1

X Axis Lock. Non-zero if X FIXED

FIELD2

Y Axis Lock. Non-zero if Y FIXED

FIELD3

Z Axis Lock. Non-zero if Z FIXED

FIELD4

Axis priority
0 = No priority
1 = X move first
2 = Y move first
3 = Z move first

Edgecam User Guide

148

Milling Macro Reference

42 - MOVE INITIAL PLANE


Recommended Syntax
%MACRO=42=..=Move Initial Plane=

Edgecam User Guide

149

Milling Macro Reference

43 - INDEX PALLET
Recommended Syntax
%MACRO=43=..=Index=57,
System Variables Modified

System Variable Description

These system variables are available following a %GETCPL.


CPLPLANE

Orthogonal alignment of the tool in terms of Initial CPL's X, Y and Z


axes.
Note that '+' values are where the tool tip has the lowest X, Y or Z
value. '-' values are in the opposite direction.
0 = non-orthogonal.
1 = +X.
2 = -X
3 = +Y
4 = -Y
5 = +Z (corresponds to machine's Initial CPL)
6 = -Z

DIRECTION

Index direction of secondary axis (or primary axis if only one axis)
0 = Shortest
1 = Clockwise
2 = Anticlockwise

EULER1, EULER2, EULER3

Euler angles - coordinate system re-orientation for rotary head indexing

GROUPDESCRIPTION

CPL name

INDEX

Pallet angle position

PIVOT

For rotary head indexing


0 = Pivot around rotary axis
1 = Pivot around tool tip
Note that you only see the corresponding option in the Index dialog if
position 32 of the MM line is set to 1.

ROT1

Primary angle

ROT2

Secondary angle

SFMOD

Defines rotary axis:


1 = X Axis
2 = Y Axis
3 = Z Axis

STYPE

Co-ordinate shift type


0 = Incremental

Edgecam User Guide

150

1 = Absolute
SUBFUNCT

Current CPL pointer

SYSID

Unique co-ordinate system identifier

XINC, YINC, ZINC

Position of current CPL origin, in Initial CPL coordinates

XSUB, YSUB, ZSUB

Position of Machine Datum, in World coordinates

XCPL, YCPL, ZCPL

The tool tip position after the index, in current CPL coordinates

Edgecam User Guide

151

Milling Macro Reference

44 - SELECT MILL MODE (Rotary/Planar Milling)


Recommended Syntax
%MACRO=44=..=Rotary/Planar
System Variables Modified System Variable Description
SUBFUNCT

Assigned as Selected
0 = Rotary, Z X & C interpolation
1 = Planar, Z X & Y interpolation

Edgecam User Guide

152

Milling Macro Reference

45 - MOVE ANGULAR
Recommended Syntax
%MACRO=45=..=Move Angular=5,6,7,59,
Re-direction MUST occur using the %NOCYCLE command.
System Variables Modified System Variable Description
AMOVE
BMOVE
CMOVE
FEED
RMOVE

Radial distance from centre of rotation

ROT1

Angular position

SPEED
WRAPRADIUS

Rotary mode. Defines the radius of the wrapped geometry.

ZFEED

Edgecam User Guide

153

Milling Macro Reference

46 - MOVE RELATIVE 2
Recommended Syntax
%MACRO=46=..=Move Relative 2=4,59,7,5,
System Variables Modified System Variable Description
FIELD2

Move type:
1 = Feed
0 = Rapid

SPEED
XYFEED

Edgecam User Guide

154

Milling Macro Reference

47 - MOVE CONSTRAINED
Recommended Syntax
%MACRO=47=..=Move Constrained=4,59,7,5,
System Variables Modified System Variable Description
FIELD2

Move type:
1 = Feed
0 = Rapid

SPEED
XYFEED

Edgecam User Guide

155

Milling Macro Reference

48 - DATUM SHIFT
This can only be accessed when MILL MODE=Planar.
Recommended Syntax
%MACRO=48=..=DATUM SHIFT
System Variables Modified System Variable Description
These system variables are available following a %GETCPL each with the index number, SUBFUNCT.
GROUPDESCRIPTION

CPL name

STYPE

Co- ordinate shift type

SUBFUNCT

Current CPL pointer

SYSID

Unique co- ordinate system identifier

XINC(1)

Absolute value in X from the


current CPL origin to the Initial CPL origin.

XSUB(2)

Absolute X datum origin

YINC(1)

Absolute value in Y from the


current CPL origin to the Initial CPL origin.

YSUB(2)

Absolute Y datum origin

ZINC(1)

Absolute value in Z from the


current CPL origin to the Initial CPL origin.

ZSUB(2)

Absolute Z datum origin

(1) The system variables XINC, YINC and ZINC (not #XINC etc) contain the current CPL position in Initial CPL
coordinates.
(2) The system variables XSUB, YSUB and ZSUB (not #XSUB etc) contain the current position from world
origin, in current coordinates.

Edgecam User Guide

156

Milling Macro Reference

49 - RESET ROTARY DATUM


Recommended Syntax
%MACRO=49=..=RESET ROTARY DATUM
System Variables Modified System Variable Description
AMOVE / BMOVE / CMOVE Rotary axis
ROT1

Primary rotary axis

ROT2

Secondary rotary axis

Either ROT1 or ROT2 will be updated with the new angular position obtained from this command.

Edgecam User Guide

157

Milling Macro Reference

12 - BORE CYCLE
Recommended Syntax
%MACRO=12=..=Bore Cycle=4,6,7,9,21,29,28,50,53|176,200,201,
System Variables Modified

System Variable Description

DWELL

Dwell in Seconds

DRILLSUB

Subroutine Indicator
0 = Longhand Code
1 = Subroutines Present

FEED

Feedrate

LAST

Number of Points

MRPLANE (#)

Retract Plane for each position*

MZDEPTH (#)

Z Drilling Depth for each position*

PATHTRACE

Controller Canned Cycle Flag

RPLANE

Retraction Plane

SPEED

Spindle Speed

XEND

X End Position

XPOINT(#)

X Axis Position*

XSTART

X Start Position

YEND

Y End Position

YPOINT(#)

Y Axis Position*

YSTART

Y Start Position

ZCLEAR

Z Clearance Plane

ZDEPTH

Final Z Depth, if multilevel not selected

ZFEED

Z Axis Feed

ZLEVEL

Work Plane, if multilevel not selected

ZPOINT(#)

Zlevel for each position*

Note that 176 (FIELD1) contains the Entry feed value.


* See Also XYZ Array for Drilling in Different Environments

Edgecam User Guide

158

Milling Macro Reference

51 - START
Recommended Syntax
%MACRO=51=..=START System Macro
System Variables
Modified

System Variable Description

NUMTOOLS

Total Number of Tools Used

UNIT

0 = Inches
1 = Millimetres

JOBDESC

Job Manager Description

JOBCOM

Job Manager Comment

JOBFAM

Job Manager Family

JOBMACH

Job Manager Machine

JOBCUST

Job Manager Customer

JOBPROG

Job Manager Programmer

JOBMATL

Job Manager Material

JOBREV

Job Manager Revision

APPEND = #

Create Secondary File Flag

CIRCLE = 1 or 0

Single or Multi Quadrant Interpolation

CUSTOMERNAME

Retrieved from Edgecam licensing.

SERVERCODE

Retrieved from Edgecam licensing.

DATE

String variable containing date at code generation time, using the format MM/DD/YY

UKDATE

String variable containing date at code generation time, using the format DD/MM/YY

DAY.MONTH.YEAR

Numeric variables that allow you to format the date according to your requirements

ENDSUB = 0

End of Subroutine Block Number

MACHINENAME

String variable containing code generator name.

MACHTIME1

Total Machining Time

MACRONAMEOP=0

No Debug output to CNC File

MACRONAMEOP=1

All Macro Executions output to CNC File

MILLMODE

0=Rotary, 1=Planar

MACRONAMEOP=2

Macro Executions output only if MASK=0

NUMBLOCKS = #

Maximum Limit of Blocks

NUMCHARS = #

Maximum Limit of Characters

Edgecam User Guide

159

PARTNAME

String variable containing Edgecam partname.

PRECISION

Controls the CNC output precision

SEQUENCENAME

String variable containing machining sequence name.

STARTSUB = 0

Start of Subroutine Block Number

TIME

String variable containing time at code generation time.

Edgecam User Guide

160

Milling Macro Reference

53 - CLW
Recommended Syntax
%MACRO=53=..=CLW System Macro
System Variables Modified System Variable Description
ENDANGLE

The end angle of the arc (always positive and less than
STARTANGLE)

FIELD 12

Number of elements in lead move (only set if SUBFUNCT = 1 or 2)

INCANGLE

The included angle in the arc (always positive)

LEFTRIGHT

Side of offset for feed adjustment


#Funny = No feed adjustment
0 = Right offset (conventional)
1 = Left offset (climb)

RADIUS

Radius of Arc

STARTANGLE

Starting angle of the arc (always positive and greater than


ENDANGLE)

SUBFUNCT

0 = Not a lead move


1 = Lead in move
2 = Lead out move

XCENTRE

X Centre of Arc (XY, ZX Arcs)

XEND

X Arc End (XY, ZX Arcs)

XSTART

X Arc Start (XY, ZX Arcs)

XYPLANE

Plane Switch (see TRUEARCOP).

YCENTRE

Y Centre of Arc (XY, ZY Arcs)

YEND

Y Arc End (XY, ZY Arcs)

YSTART

Y Arc Start (XY, ZY Arcs)

Edgecam User Guide

161

Milling Macro Reference

54 - CCLW
Recommended Syntax
%MACRO=54=..=CCLW System Macro
System Variables
Modified

System Variable Description

ENDANGLE

The end angle of the arc (always positive and greater than
STARTANGLE)

FIELD 12

Number of elements in lead move (only set if SUBFUNCT = 1 or 2)

INCANGLE

The included angle in the arc (always positive)

LEFTRIGHT

Side of offset for feed adjustment


#Funny = No feed adjustment
0 = Right offset (conventional)
1 = Left offset (climb)

STARTANGLE

Starting angle of the arc (always positive and less than ENDANGLE)

RADIUS

Radius of Arc

SUBFUNCT

0 = Not a lead move


1 = Lead in move
2 = Lead out move

XCENTRE

X Centre of Arc (XY, ZX Arcs)

XEND

X Arc End (XY, ZX Arcs)

XSTART

X Arc Start (XY, ZX Arcs)

XYPLANE

Plane Switch (see TRUEARCOP).

YCENTRE

Y Centre of Arc (XY, ZY Arcs)

YEND

Y Arc End (XY, ZY Arcs)

YSTART

Y Arc Start (XY, ZY Arcs)

Edgecam User Guide

162

Milling Macro Reference

55 - SUBSTART
Recommended Syntax
%MACRO=55=..=SUBSTART System Macro
System Variables Modified System Variable Description
SUBROUTINE

Subroutine Number

Edgecam regards the start of subroutines as the END of the first move after the label. In this macro the
coordinates of this move are stored in NEXTXMOVE, NEXTYMOVE, NEXTZMOVE. It is from this point that
incremental moves in a subroutine should be calculated.

Edgecam User Guide

163

Milling Macro Reference

56 - SUBEND
Recommended Syntax
%MACRO=56=..=SUBEND System Macro
System Variables Modified System Variable Description
SUBROUTINE

Subroutine Number

Edgecam User Guide

164

Milling Macro Reference

58 - END
Recommended Syntax
%MACRO=58=..=END System Macro
System Variables Modified

System Variable Description

JOBDESC

Job Manager Description

JOBCOM

Job Manager Comment

JOBFAM

Job Manager Family

JOBMACH

Job Manager Machine

JOBCUST

Job Manager Customer

JOBPROG

Job Manager Programmer

JOBMATL

Job Manager Material

JOBREV

Job Manager Revision

Edgecam User Guide

165

Milling Macro Reference

59 - SUBCALL
Recommended Syntax
%MACRO=59=..=SUBCALL System Macro
System Variables Modified System Variable Description
SUBROUTINE

Subroutine Number

Edgecam regards the start of subroutines as the END of the first move after the label. In this macro the
coordinates of the move are stored in NEXTXMOVE, NEXTYMOVE, NEXTZMOVE and any positioning block
should be to that point except in the case of hole cycle position subroutines.

Edgecam User Guide

166

Milling Macro Reference

60 - RESET
Recommended Syntax
%MACRO=60=..=RESET System Macro
System Variables Modified System Variable Description
PATHTRACE

0 = Controller Subroutines
1 = Subroutines expanded within Edgecam

SUBFUNCT

1 = Translate
2 = Rotate
3 = Mirror

The RESET macro is accessed after each manipulative macro call.

Edgecam User Guide

167

Milling Macro Reference

61 - CYCLSUB
Recommended Syntax
%MACRO=61=..=CYCLSUB System Macro

Edgecam User Guide

168

Milling Macro Reference

69 - ANGCLW
Recommended Syntax
%MACRO=69=..=ANGCLW
This macro handles the output of radially machined arcs in rotary mode.
System Variables Modified System Variable Description
CIRCLE

0=Multi-quadrant arcs
1=Single-quadrant arcs

CSTART /CCENTRE /CEND C Arc Coords (Angular co-ordinate)*


RADIUS

Radius of Arc

ROT1 / ROT2 / AMOVE /


BMOVE / CMOVE

Angular position

WRAPRADIUS

Wrap radius value

XEND

X Arc End - Radius of Cylinder

XSTART / XCENTRE

X Arc Coords

YEND

Y Arc End

YSTART / YCENTRE

Y Arc Coords

ZEND

Z Arc End

ZSTART / ZCENTRE

Z Arc Coords

*The arc co-ordinate variables that are set up will be dependent upon the axis configuration, but CSTART /
CCENTRE /CEND always represent the angular position irrespective of machine configuration.
Note: this macro will only be visited if wrapped geometry is machined at the depth at which the original
geometry was wrapped, or switch 17 on the MM line has been set to 1 (see Rotary Output Mode)

Edgecam User Guide

169

Milling Macro Reference

70 - ANGCCLW
Recommended Syntax
%MACRO=70=..=ANGCCLW
This macro handles the output of radially machined arcs in rotary mode.
System Variables Modified System Variable Description
CIRCLE

0=Multi-quadrant arcs
1=Single-quadrant arcs

CSTART/CCENTRE /CEND C Arc Coords*


RADIUS

Radius of Arc

ROT1 / ROT2 / AMOVE /


BMOVE / CMOVE

Angular position

WRAPRADIUS

Wrap radius value

XEND

X Arc End - Radius of Cylinder

XSTART / XCENTRE

X Arc Coords

YEND

Y Arc End

YSTART / YCENTRE

Y Arc Coords

ZEND

Z Arc End

ZSTART / ZCENTRE

Z Arc Coords

*The arc co-ordinate variables that are set up will be dependent upon the axis configuration, but CSTART /
CCENTRE /CEND always represent the angular position irrespective of machine configuration.
Note: this macro will only be visited if wrapped geometry is machined at the depth at which the original
geometry was wrapped, or switch 17 on the MM line has been set to 1 (see Rotary Output Mode)

Edgecam User Guide

170

Milling Macro Reference

71 - ATTRIBUTE
Recommended Syntax
%MACRO=71=..=ATTRIBUTE System Macro
System Variables Modified System Variable Description
SUBFUNCT

Attribute type:
3 = True position
(Edgecam 5 Axis extension only)
2 = Secondary feed rate
(XYFEED is also set up in MILL)
(FEED is set up in TURN)

Attributes are currently only set up by PDI executables.

Edgecam User Guide

171

Milling Macro Reference

72 - SPLINES
Recommended Syntax
%MACRO=SPLINES
Output
Fanuc (output type = NURB)
Heidenhain (output type = cubic polynomial spline)
Siemens (output type = cubic polynomial spline)

The actual output type is specified in the machine details line, position 21.

Edgecam User Guide

172

Milling Macro Syntax


In the following macro definitions, the recommended syntax should be taken to mean the following:
%MACRO=[macro number]=..=[Description]=[Modifier List...]
For example:
%MACRO=1=..=RAPID=1,2,3,
At all times the following variables are available:
NEXTMACRO

Next macro to be processed.

These variables are set up by a system that looks ahead to the next tool movement:
NEXTSPEED

Next spindle speed selected.

NEXTXYFEED

Next XY feedrate

NEXTZFEED

Next Z feedrate

NEXTCOMP

1 = No compensation
2 = Left compensation
3 = Right compensation

NEXTXMOVE

Next X axis movement

NEXTYMOVE

Next Y axis movement

NEXTZMOVE

Next Z axis movement

These variables are all set up from the %MACHINE section:


XTOOL

Toolchange X position

YTOOL

Toolchange Y position

ZTOOL

Toolchange Z position

XHOME

Toolhome X position

YHOME

Toolhome Y position

ZHOME

Toolhome Z position

TXMAX

Maximum machine extents in X

TYMAX

Maximum machine extents in Y

TZMAX

Maximum machine extents in Z

IPLANE

Initial plane

MAXFEED

Maximum feedrate

MAXSPEED

Maximum speed

MAXRPM

Maximum spindle speed

NUMTOOLS

Number of tools used in the machining sequence

MACHTIME1

Machining time

During %NOCYCLE processing (through RAPID, FEED, CLW and CCLW macros) the following additional
variables are available:
Edgecam User Guide

173

During %NOCYCLE processing (through RAPID, FEED, CLW and CCLW macros) the following additional
variables are available:
NEXTARC

0 = Nextmove is linear
1 = Nextmove is counterclockwise
2 = Nextmove is clockwise
3 = End of %NOCYCLE processing

If the nextmove is an arc move,


NEXTXCENTRE
NEXTYCENTRE

Two out of three of these will be set up


depending on the plane switch of the arc
and the current setting of the TRUEARCOP variable.

NEXTZCENTRE

Edgecam User Guide

174

Turning Modifiers
Number

Heading

System Variables

Name

GROUPDESCRIPTION

Feedrate

FEED

Plunge feed

ZFEED

Speed

SPEED

Tool Number

TOOLNUM

Total Depth

TOTALDEPTH

10

Cut Increment

DEPTH

12

Pitch

PITCH

13

CSS

CSS

14

From

STCOMMAND

15

Comment

USERDEFINEDSTRING

17

Override

FIELD1

21

Canned Cycle

PATHTRACE

23

Xinc

YINC

24

Drive

RMOVE

25

Cut

CMOVE

26

End #

ENCOMMAND

27

Time

DWELL

28

Lead angle

TOOLANGLE1

29

Trail angle

TOOLANGLE2

30

Z Offset

OFFSETZ

31

X Offset

OFFSETX

43

Z mirror

STCOMMAND

44

Z lead

ENCOMMAND

45

Z Increment

XINC

49

L/R

LEFTRIGHT

50

Offset

OFFSET

62

Tolerance

TOLERANCE

63

Finish Depth

TOTDEPTH

64

Offset

OFFSET

65

L/R

LEFTRIGHT

66

Step

STEP

67

USERVAR1

68

USERVAR2

Edgecam User Guide

175

69

USERVAR3

70

USERVAR4

71

USERVAR5

73

Degression

DEGR

74

Angle

ANGLE

75

Radius

RADIUS

76

Clear

ZCLEAR

77

Retract

RPLANE

78

Xinc

XINC

79

Yinc

YINC

81

XH Angle

ANGLE

82

Retract

PECKRETRACT

Edgecam User Guide

176

PASS
The system variable PASS is the turret processing pointer. PASS is assigned the following values:
PASS = 1 = Upper turret processing
PASS = 2 = Lower turret processing

Edgecam User Guide

177

TURRET
The system variable TURRET is used to output the tooling data for the upper and lower turrets.
TURRET = 0 = Upper turret data
TURRET = 1 = Lower turret data

Edgecam User Guide

178

File Output
If parameter 5 in the appropriate machine format ('mm') line in the machine tool macro is set to:
0

Processing will output to a single file as follows: upper turret to first sync code,
lower turret to first sync code, upper turret to next sync code, lower turret to next
sync code and so on until all CNC code has been output.

Two tapes will be produced, one for each turret. If the name supplied for the
CNC file is TEST, the CNC files produced will be named TEST-1.NC and
TEST-2.NC

The file for the lower turret will be merged with the upper turret file at the
synchronisation points.

Edgecam User Guide

179

4 Axis Synchronisation
The SYNCHRONISE TURRETS macro causes either turret to wait until the other turret has completed its
operations. When the SYNCHRONISE TURRETS command is issued, a 'wait code' is sent to both turrets.
The command can be issued at any point within machining and is not turret dependent. It may also be applied
as a retrospective command.
The effect of the SYNCHRONISE command is that both turrets will start to perform their operations
simultaneously. Normally one turret will finish before the other and will read the SYNCHRONISE command.
This instructs the turret to wait until the second turret also reads the SYNCHRONISE command, at which point
both turrets are started again.

Edgecam User Guide

180

Axis Output
UPPER TURRET

LOWER TURRET

Toolchange

Toolchange

Rapid

Rapid

Rough Turn

Waiting
SYNCHRONISATION

Rapid Home

Profile

Toolchange

...

Rapid

...

Waiting

...

...

...

...

Feed
SYNCHRONISATION

Threading

Rapid Home

...

End of operations

...
Rapid Home
End of operations

Edgecam User Guide

181

Turning Macro Syntax


In the following macro definitions, the recommended syntax should be taken to mean the following:
%MACRO=[macro number]=..=[Description]=[variables...]
For example:
%MACRO=1=..=Rapid=1,2,
At all times the following variables are available (items marked with a * only apply to 4 axis lathe configurations.
Macros marked with a * should be removed from 2 axis configurations):
NEXTMACRO

Next macro to be processed.

These variables are set up by a system that looks ahead to the next tool movement:
NEXTSPEED

Next spindle speed selected.

NEXTXYFEED

Next used XY feedrate

NEXTZFEED

Next used Z feedrate

NEXTCOMP

1 = No compensation
2 = Left compensation
3 = Right compensation

NEXTXMOVE

Next X axis movement

NEXTZMOVE

Next Z axis movement

These variables are all set up from the %MACHINE section:


XTOOL

Upper turret X toolchange position

*XTOOL1

Lower turret X toolchange position

ZTOOL

Upper turret Z toolchange position

*ZTOOL1

Lower turret X toolchange position

XHOME

Upper turret X home position

*XHOME1

Lower turret X home position.

ZHOME

Upper turret Z home position

*ZHOME1

Lower turret Z home position

TXMAX

Maximum machine extents in X

TZMAX

Maximum machine extents in Z

IPLANE

Initial plane

MAXFEED

Maximum Feedrate

MAXSPEED

Maximum Spindle Speed

MAXRPM

Maximum Spindle Revolutions Per Minute

NUMTOOLS

Number of Tools used

MACHTIME1

Machining time

Edgecam User Guide

182

NUMTOOLS

Number of Tools in Upper Turret

*NUMTOOLS1

Number of Tools in Lower Turret

MACHTIME1

Machining Time for Upper Turret

*MACHTIME2

Machining Time for Lower Turret

MAXFEED

Maximum Feedrate -as %MACHINE

MAXRAPID

Maximum Rapid -as %MACHINE

MAXRPM

Maximum RPM -as %MACHINE

PASS

Turret currently being processed:


0 = Upper turret
1 = Lower turret

TURRET

May be set in the post. Defines which turret %LOAD is to be directed:

0 = Upper turret
1 = Lower turret

During %NOCYCLE processing the following additional variables are available:


NEXTARC

0 = Nextmove is linear
1 = Nextmove is counterclockwise
2 = Nextmove is clockwise
3 = End of %NOCYCLE processing

If the nextmove is an arc move,


NEXTXCENTRE

Two out of three will be set up depending

NEXTYCENTRE

on the plane switching of the arc and the

NEXTZCENTRE

setting of the TRUEARCOP variable.

Edgecam User Guide

183

Turning Macro Reference


Expand the Turning Macro Reference book in the Table of Contents to see the full list of turning macro
reference topics.

Edgecam User Guide

184

Turning Macro Reference

1 - MOVE RAPID
Recommended Syntax
%MACRO=1=..=Move Rapid=1,2,
System Variables Modified System Variable Description
XMOVE

X Axis Motion

ZMOVE

Z Axis Motion

Edgecam User Guide

185

Turning Macro Reference

2 - MOVE FEED
Recommended Syntax
%MACRO=2=..=Move Feed=1,2,5,7,
System Variables
Modified

System Variable Description

FEED

Feedrate

FIELD 12

Number of elements in lead move (only set if SUBFUNCT = 1 or


2)

SPEED

Spindle Speed

SUBFUNCT

0 = Not a lead move


1 = Lead in move
2 = Lead out move

XMOVE

X Axis Motion

ZMOVE

Z Axis Motion

Edgecam User Guide

186

Turning Macro Reference

3 - SIMPLE TURN CYCLE


Recommended Syntax
%MACRO=3=..=Simple Turn Cycle=1,2,5,7,10,21,41,84,
System Variables Modified System Variable Description
DEGR

Degression

DEPTH

Depth of Cut

FEED

Feedrate

FIELD2

Link Type

FIELD7

Z Start Position

FIELD8

X Start Position

FIELD11

Rough Cuts Only modifier


1 = Yes
0 = No

PATHTRACE

Controller Canned Cycle Flag

SPEED

Spindle Speed

SUBFUNCT

Tool Drive Condition

XEND

X Axis End Position

ZEND

Z Axis End Position

Edgecam User Guide

187

Turning Macro Reference

4 - ROUGH TURN CYCLE


Recommended Syntax
%MACRO=4=..=Rough Turn Cycle=4,5,7,10,12,30,31,21,40,41,84,
Note that 12 is optional and enables the Constant Offset modifier in the cycle dialog.
System Variables Modified System Variable Description
DEGR

Degression factor used to calculate depth of cut

DEPTH

Depth of Cut

ENDSUB

End Subroutine Block Number

FEED

Feedrate

FIELD2

Link Type
1 = Rapid
2 = Feed

FIELD7

Billet Z co-ordinate (only if FIELD9=1)

FIELD8

Billet X co-ordinate (only if FIELD9=1)

FIELD9

Billet selection:
0 = Start point specified by current tool position
1 = Billet specified by digitised position
(co-ordinates held in fields 7 & 8)
2 = Geometric or toolpath billet selected

FIELD10

Corner Type
0 = Round corners
1 = Square corners

FIELD11

Rough Cuts Only modifier


0 = Not selected
1 = Selected

FIELD12

Cycle Finish position


1 = Finish at cycle start

OFFSETX

X Axis Offset Value

OFFSETZ

Z Axis Offset Value

PATHTRACE

Controller Canned Cycle Flag

SPEED

Spindle Speed

STARTSUB

Start Subroutine Block Number

SUBFUNCT

Drive Condition

SUBROUTINE

Subroutine identifying number

Edgecam User Guide

188

XEND

X Axis End Position of profile

XSTART

X Axis Start Position of profile

ZEND

Z Axis End Position of profile

ZSTART

Z Axis Start Position of profile

Important Note
For the Retract and Approach angles to work correctly, you must use a suitably modified Code Generator file.
The line (in the Code Generator source file) containing the Rough Turn macro must be modified as follows:
%MACRO=4=RT=Rough turn area clearance=5,7,10,30,31,21,40,41,135

Edgecam User Guide

189

Turning Macro Reference

5 - FINISH TURN CYCLE


Recommended Syntax
%MACRO=5=..=Finish Turn Cycle=4,5,7,12,30,31,21,
Note that 12 is optional and enables the Constant Offset modifier in the cycle dialog.
System Variables Modified System Variable Description
ENDSUB

End Subroutine Block Number

FEED

Feedrate

FIELD1

Lead in Angle

FIELD2

Lead in Radius

FIELD3

Lead in Length

FIELD4

Lead out Angle

FIELD5

Lead out Radius

FIELD6

Lead out Length

FIELD7

Start Point Z co-ordinate (if FIELD9=1)

FIELD8

Start Point X co-ordinate (if FIELD9=1)

FIELD9

Digitise Start (Point):


0 = Start point specified by current tool position
1 = Billet specified by digitised position
(co-ordinates held in fields 7 & 8)
2 = Geometric or toolpath billet selected

FIELD10

Corner Type:
0 = Round corners
1 = Square corners

OFFSETX

X Axis Offset Value

OFFSETZ

Z Axis Offset Value

PATHTRACE

Controller Canned Cycle Flag

SPEED

Spindle Speed

STARTSUB

Start Subroutine Block Number

SUBROUTINE

Subroutine identifying number

XEND

X Axis End Position of profile

XSTART

X Axis Start Position of profile

ZEND

Z Axis End Position of profile

ZSTART

Z Axis Start Position of profile

Edgecam User Guide

190

Turning Macro Reference

6 - ROUGH GROOVE CYCLE


Recommended Syntax
%MACRO=6=..=Rough Groove Cycle=4,5,7,10,30,31,41,
System Variable Modified

System Variable Description

DEPTH

Depth of Cut

FEED

Feedrate

FIELD1

Grooving Strategy
1 = Sequential
2 = Centre Sequential
3 = Centre Alternate

FIELD2

Link Type
1 = Rapid
2 = Feed

FIELD7

Billet Z co-ordinate (only if FIELD9=1)

FIELD8

Billet X co-ordinate (only if FIELD9=1)

FIELD9

Billet selection:
0 = Start point specified by current tool position
1 = Billet specified by digitised position
(co-ordinates held in fields 7 & 8)
2 = Geometric or toolpath billet selected

FIELD10

Corner Type :
0 = Round corners
1 = Square corners

FIELD12

Finish At (1 implies a return to cycle start)

OFFSETX

X Axis Offset Value

OFFSETZ

Z Axis Offset Value

PATHTRACE

Controller Canned Cycle Flag

SPEED

Spindle Speed

SUBROUTINE

Subroutine identifying number

XEND

X Axis End Position of profile

XSTART

X Axis Start Position of profile

ZEND

Z Axis End Position of profile

ZSTART

Z Axis Start Position of profile

Edgecam User Guide

191

Turning Macro Reference

7 - FINISH GROOVE CYCLE


Recommended Syntax
%MACRO=7=..=Finish Groove Cycle=4,5,7,30,31,
System Variables Modified System Variable Description
FEED

Feedrate

FIELD7

Start Point Z co-ordinate

FIELD8

Start Point X co-ordinate

FIELD9

Digitise Start selection:


0 = Start point specified by current tool position
1 = Billet specified by digitised position
(co-ordinates held in fields 7 & 8)
2 = Geometric or toolpath billet selected

FIELD10

Corner Type
0 = Round corners
1 = Square corners

FIELD12

Finish At
1 = Return to cycle start

OFFSETX

X Axis Offset Value

OFFSETZ

Z Axis Offset Value

SPEED

Spindle Speed

SUBROUTINE

Subroutine identifying number

XEND

X Axis End Position of profile

XSTART

X Axis Start Position of profile

ZEND

Z Axis End Position of profile

ZSTART

Z Axis Start Position of profile

Edgecam User Guide

192

Turning Macro Reference

8 - THREAD CYCLE
Recommended Syntax
%MACRO=8=..=Thread Cycle=4,12,7,9,10,21,
System Variables Modified System Variable Description
ANGLE

Approach Angle
Note: If the above is equal to #FUNNY, then the angles are equivalent
to the tool angles.

DEGR

Degression

DEPTH

Depth of Cut

FIELD1

Number of Starts (the value is negative if the ALTERNATE modifier


has been specified)

FIELD2

Start Depth

FIELD3

Final Increment

FIELD4

Spring Depth

FIELD5

Link Type
0 = Chase both
1 = Chase in
2 = Chase out
3 = No feed moves in or out

FIELD6

Number of passes

FIELD12

Finish At
1 = Return to cycle start

FPASS

Spring Cuts

PATHTRACE

Controller Canned Cycle Flag

PITCH

Pitch of Thread

SPEED

Spindle Speed

STANGLE

Retract Angle
Note: If the above is equal to #FUNNY, then the angles are equivalent
to the tool angles.

TOTALDEPTH

Final Depth Of Thread

XCURRENTPOS

Current X Axis Position

XEND

X Axis End Position

XSTART

X Axis Start Position

ZCURRENTPOS

Current Z Axis Position

Edgecam User Guide

193

ZEND

Z Axis End Position

ZSTART

Z Axis Start Position

Edgecam User Guide

194

Turning Macro Reference

9 - DRILL CYCLE
Recommended Syntax
%MACRO=9=..=Drill Cycle=1,10,5,7,21,50,53|176,200,201,
System Variables Modified System Variable Description
DEGR

Degression

DEPTH

1st cut depth

DWELL

Dwell time

FEED

Feedrate

MRPLANE(#)

Retract Plane for each position*

MZDEPTH(#)

Z Drilling Depth for each position*

PATHTRACE

Controller Canned Cycle Flag

RPLANE

R-plane

SPEED

Spindle Speed

XCURRENTPOS

Current X Axis Position

ZCLEAR

2nd clear

ZCURRENTPOS

Current Z Axis Position

ZEND

Final depth, if multilevel not selected

ZFEED

Feedrate

ZLEVEL

Zlevel, if multilevel not selected

ZSAFE

Safe distance

Note: 176 (FIELD1)contains the Entry feed value.


* See Also XYZ Array for Drilling in Different Environments

Edgecam User Guide

195

Turning Macro Reference

10 - TAP CYCLE
Recommended Syntax
%MACRO=10=..=Tap Cycle=1,7,12,27,21,200,201,
System Variables Modified System Variable Description
DWELL

Dwell time

FEED

Feedrate

MRPLANE(#)

Retract Plane for each position*

MZDEPTH(#)

Z Drilling Depth for each position*

PATHTRACE

Controller Canned Cycle Flag

PITCH

Thread Pitch

RPLANE

R-plane

SPEED

Spindle Speed

XCURRENTPOS

Current X Axis Position

ZCLEAR

2nd clear

ZCURRENTPOS

Current Z Axis Position

ZEND

Final depth, if multilevel not selected

ZFEED

Modified Feedrate, as Feed Per Minute

ZLEVEL

Zlevel, if multilevel not selected

ZSAFE

Safe distance

* See Also XYZ Array for Drilling in Different Environments

Edgecam User Guide

196

Turning Macro Reference

11 - ROUGH PROFILE CYCLE


Recommended Syntax
%MACRO=11=..=Rough Profile Cycle=4,5,7,10,30,31,21,
System Variables Modified System Variable Description
DEPTH

Depth of Cut

ENDSUB

End Subroutine Block Number

FEED

Feedrate

FIELD7

Start Point Z co-ordinate

FIELD8

Start Point X co-ordinate

FIELD9

Digitise Start (Point):


0 = start point specified by current tool position
1 = billet specified by digitised position (co-ordinates held in fields 7
& 8)
2 = geometric or toolpath billet selected

FIELD12

Finish at Start or End


1 = Return to cycle start

OFFSETX

X Axis Offset Value

OFFSETZ

Z Axis Offset Value

PATHTRACE

Controller Canned Cycle Flag

STARTSUB

Start Subroutine Block Number

SUBROUTINE

Subroutine identifying number

XEND

X Axis End Position

XSTART

X Axis Start Position of profile

ZEND

Z Axis End Position

ZSTART

Z Axis Start Position of profile

Edgecam User Guide

197

Turning Macro Reference

12 - TOOL DATUM
Recommended Syntax
%MACRO=12=..=Tool Datum
System Variables Modified System Variable Description
SUBFUNCT

1 = Primary
2 = Secondary
3 = Orthogonal

Note that the user defined system variable Q69 is usually used for the tool length offset register number.
The ToolStore has been developed to make use of this and where a TLO value is entered it will be passed
through as USERVAR3.

Edgecam User Guide

198

Turning Macro Reference

14 - MOVE RELATIVE
Recommended Syntax
%MACRO=14=..=Move Relative=4,50,49,60,59,7,5,
System Variables Modified System Variable Description
FEED

Feedrate

SPEED

Spindle Speed

Edgecam User Guide

199

Turning Macro Reference

15 - TOOLCHANGE
Recommended Syntax
%MACRO=15=..=Toolchange=8,12,15,47,48,16,
These system variables are available following a %LOAD call for the current tool number.
The current tool number is the value of SUBFUNCT.
System Variables Modified

System Variable Description

ATCSPINANGLE

Reverse unchecked = 0
Reverse checked = 180

CMT1

Cumulative tool usage at toolchange (upper)

CMT2

Cumulative tool usage at toolchange (lower)

CSS

Constant surface speed

FIELD1

Load point (two turrets on one slide)


0 = Front Load Point
1 = Rear Load Point

DIRECTION

Spindle rotation direction: Forward or reverse

FEEDTYPE

Feed/Rev (1) or Feed/Minute (2)

GEAR

Gear

GROUP

The string value of the 'Group Code' modifier on the


ToolChange dialog.

GROUPSTRING

A string comprising the first sequence of letter characters in


the GROUP variable ('abc123def').

GROUPNUMBER

A numeric variable converted from the first numerical


character sequence in the GROUP variable ('abc123def').
A '.' character is classed as the decimal point of a number
('abc12.3def' gives 12.3, '.12def' gives 0.12).

ID

The string value of the 'Code ID' modifier on the ToolChange


dialog.

IDSTRING

A string comprising the first sequence of letter characters in


the ID variable ('abc123def')

IDNUMBER

A numeric variable converted from the first numerical


character sequence in the ID variable ('abc123def').
A '.' character is classed as the decimal point of a number
('abc12.3def' gives 12.3, '.12def' gives 0.12).

LIBTYPE

Set up as follows:
0 = Fixed tooling
1 = Driven Tooling

Edgecam User Guide

200

MAXRPM

Maximum revs per minute

POSITION

Turret Number

STRTSTOREUSER1

User defined text variable from ToolStore

STRTSTOREUSER2

User defined text variable from ToolStore

SUBFUNCT

Current Tool Pointer

THROUGHCOOLANT

Through Tool Coolant flag from ToolStore; 0=off, 1=0n

TOOLANGLE1

Angle 1

TOOLANGLE2

Angle 2

TOOLDESCRIPTION

Set up as the name of the selected cutting tool

TOOLLIBRARY

String variable set as follows:


"" = Tooling defined within TOOLCHANGE command
Cutting Tool Name if from Cutting Tools database
Assembly Name if from Assembly database

TOOLNUM

Tooling definition
0 = Tooling defined within TOOLCHANGE command
1 = Tooling selected from the Cutting Tools database
2 = Tooling selected from Assemblies database
3 = Tooling selected from the active Kit.

TOOLOFFSET

Tool length offset register

TOOLRAD

Tool Tip Radius

TOOLTYPE

The quadrant containing the tool datum and the permitted


tool type:
0 = 090 degrees (Thread)
1 = 135 degrees (Thread, Back Turn)
2 = 180 degrees
3 = 225 degrees (Back Bore)
4 = 270 degrees (Internal Thread)
5 = 315 degrees (Bore)
6 = 000 degrees (Drill)
7 = 045 degrees (Thread, Turn)

Edgecam User Guide

201

TOOLUNIT

Tool Unit of Measure

TOOLWIDTH

Width of Tool

TOOLXSET

Tool X Setting Distance

TOOLZSET

Tool Z Setting Distance

TSTOREUSER1

User defined numeric variable from ToolStore

TSTOREUSER2

User defined numeric variable from ToolStore

USERDEFINEDSTRING

Set up as the Comment modifier in the TOOLCHANGE


command

XBPIVOTLENGTH,
ZBPIVOTLENGTH

Distance back to the pivot point

XCPL, YCPL, ZCPL

The tool tip position after the toolchange, in current CPL


coordinates.

YGAUGE

Tool Y Setting Distance

XSCRATCH, YSCRATCH,
ZSCRATCH

The tool tip position after the toolchange, in Machine Datum


coordinates.

Note that Tool Offset is now the system variable TOOLOFFSET. The modifier 12 must be defined on the macro
line to display and use this new system variable to retain compatibility with existing posts. This method of
setting tool offset replaces the use of user vars.
Note that the user defined system variable Q69 is usually used for the tool length offset register number. The
ToolStore has been developed to make use of this and where a TLO value is entered it will be passed through
as USERVAR3.
For machines with two turrets on one slide the separation must be set in the MT line and the modifier 237/176

Edgecam User Guide

202

must be added to the macro definition line.


For example:
%MACRO=15=TL=Toolchange=8,47,48,16,237/176

Edgecam User Guide

203

Turning Macro Reference

16 - SELECT TURRET
Recommended Syntax
%MACRO=16=..=Select Turret
Note that this is a 4 Axis Turning Macro.
System Variables Modified System Variable Description
TURRET

Turret Number
0 = Upper turret
1 = Lower turret

Edgecam User Guide

204

Turning Macro Reference

17 - CUT DIRECTIONS
Recommended Syntax
%MACRO=17=..=Cut Directions=24,25,17,
System Variables Modified System Variable Description
FIELD1

Override
0 = No
1 = Yes

TOOLANGLE1

Lead angle

TOOLANGLE2

Trail angle

Edgecam User Guide

205

Turning Macro Reference

18 - CLEARANCE ANGLES
Recommended Syntax
%MACRO=18=..=Clearance Angles=28,29,17,
System Variables Modified System Variable Description
CMOVE

Overpass

FIELD1

Override
0 = No
1 = Yes

RMOVE

Drive angle

Edgecam User Guide

206

Turning Macro Reference

19 - SAFE DISTANCE
Recommended Syntax
%MACRO=19=..=Safe Distance=1,2,3,
System Variables Modified System Variable Description
XSAFE

X Safe Distance

ZSAFE

Z Safe Distance

Edgecam User Guide

207

Turning Macro Reference

20 - SURFACE SPEED
Recommended Syntax
%MACRO=20=..=Surface Speed=13,
System Variables Modified System Variable Description
CSS

1 = CSS
0 = RPM

Edgecam User Guide

208

Turning Macro Reference

21 - FEED TYPE
Recommended Syntax
%MACRO=21=..=Feed Type
System Variables Modified System Variable Description
SUBFUNCT

1 = Feed Per Revolution


2 = Feed Per Minute

Edgecam User Guide

209

Turning Macro Reference

22 - DWELL
Recommended Syntax
%MACRO=22=..=Dwell=27,
System Variables Modified

System Variable Description

DWELL

Dwell in Seconds

Edgecam User Guide

210

Turning Macro Reference

23 - SYNCHRONISE TURRETS
Recommended Syntax
%MACRO=23=..=Synchronise Turrets=15,40,
Note that this is a 4 Axis Turning Macro. It sets up turret priority and a comment for each synchronisation
point.
System Variables
Modified

System Variable Description

PRIORITY

0 or 1 to indicate if a change in Priority has taken place.

PRIORITYMAIN

0 = Upper Turret, 1 = Lower Turret

PRIORITYSUB

0 = Upper Turret, 1 = Lower Turret

Edgecam User Guide

211

Turning Macro Reference

24 - SELECT PRIORITY
Recommended Syntax
%MACRO=24=..=Select Priority
Note that this is a 4 Axis Turning Macro.
System Variables Modified System Variable
SUBFUNCT

Determines turret selection:


1 = Upper turret
2 = Lower turret

Edgecam User Guide

212

Turning Macro Reference

25 - MIRROR TURN CYCLE


Recommended Syntax
%MACRO=25=..=Mirror Turn Cycle=1,2,5,7,10,43,
This macro accesses the synchronisation macro.
Note that this is a 4 Axis Turning Macro.
System Variables Modified System Variable Description
DEPTH

Depth of Cut

FEED

Feedrate

FIELD2

Link Type:
1 = Rapid move
2 = Feed move

FIELD7

Start Point Z co-ordinate (if FIELD9=1)

FIELD8

Start Point X co-ordinate (if FIELD9=1)

FIELD9

Digitise Start (Point):


0 = Start point specified by current tool position
1 = Billet specified by digitised position
(co-ordinates held in fields 7 & 8)
2 = Geometric or toolpath billet selected

FIELD10

Corner Type
0 = Round corners
1 = Square corners

SPEED

Spindle Speed

STCOMMAND

Z Coord of Mirror Line

SUBFUNCT

Tool Drive Condition

XEND

X Axis End Position

ZEND

Z Axis End Position

Edgecam User Guide

213

Turning Macro Reference

26 - MIRROR ROUGH TURN CYCLE


Recommended Syntax
%MACRO=26=..=Mirror Rough Turn Cycle=4,5,7,10,30,31,43,
This macro accesses the synchronisation macro.
Note that this is a 4 Axis Turning Macro.

System Variables Modified System Variable Description


DEPTH

Depth of Cut

FEED

Feedrate

FIELD2

Link Type:
1 = Rapid move
2 = Feed move

FIELD7

Billet Z co-ordinate (if FIELD9=1)

FIELD8

Billet X co-ordinate (if FIELD9=1)

FIELD9

Billet selection:
0 = Start point specified by current tool position
1 = Billet specified by digitised position
(co-ordinates held in fields 7 & 8)
2 = Geometric or toolpath billet selected

FIELD10

Corner Type
0 = Round corners
1 = Square corners

NEXTXMOVE

Next X Axis Motion

NEXTZMOVE

Next Z Axis Motion

OFFSETX

X Axis Offset Value

OFFSETZ

Z Axis Offset Value

SPEED

Spindle Speed

STCOMMAND

Z Coord of Mirror Line

SUBFUNCT

Drive Condition

XEND

X Axis End Position

XSTART

X Axis Start Position of profile

ZEND

Z Axis End Position

ZSTART

Z Axis Start Position of profile

Edgecam User Guide

214

Turning Macro Reference

27 - BALANCED TURN CYCLE


Recommended Syntax
%MACRO=27=..=Balanced Turn Cycle=1,2,5,7,10,44,
This macro accesses the synchronisation macro.
Note that this is a 4 Axis Turning Macro.

System Variables Modified System Variable Description


DEPTH

Depth of Cut

ENCOMMAND

Z Lead Value

FEED

Feedrate

FIELD2

Link Type:
1 = Rapid move
2 = Feed move

FIELD7

Start Point Z co-ordinate (if FIELD9=1)

FIELD8

Start Point X co-ordinate (if FIELD9=1)

FIELD9

Billet selection:
0 = Start point specified by current tool position
1 = Billet specified by digitised position
(co-ordinates held in fields 7 & 8)
2 = Geometric or toolpath billet selected

FIELD10

Corner Type
0 = Round corners
1 = Square corners

SPEED

Spindle Speed

SUBFUNCT

Tool Drive Condition

XEND

X Axis End Position

ZEND

Z Axis End Position

ZMOVE

Z Axis Motion

Edgecam User Guide

215

Turning Macro Reference

28 - BALANCED ROUGH TURN CYCLE


Recommended Syntax
%MACRO=28=..=Balanced Rough Turn Cycle=4,5,7,10,30,31,44,40,
This macro accesses the synchronisation macro.
Note that this is a 4 Axis Turning Macro.

System Variables Modified System Variable Description


DEPTH

Depth of Cut

ENCOMMAND

Z Lead Value

FEED

Feedrate

FIELD2

Link Type:
1 = Rapid move
2 = Feed move

FIELD7

Billet Z co-ordinate (if FIELD9=1)

FIELD8

Billet X co-ordinate (if FIELD9=1)

FIELD9

Billet selection:
0 = Start point specified by current tool position
1 = Billet specified by digitised position
(co-ordinates held in fields 7 & 8)
2 = Geometric or toolpath billet selected

FIELD10

Corner Type
0 = Round corners
1 = Square corners

NEXTXMOVE

Next X Axis Motion

NEXTZMOVE

Next Z Axis Motion

OFFSETX

X Axis Offset Value

OFFSETZ

Z Axis Offset Value

SPEED

Spindle Speed

SUBFUNCT

Drive Condition

XEND

X Axis End Position

XSTART

X Axis Start Position

ZEND

Z Axis End Position

ZSTART

Z Axis Start Position

Edgecam User Guide

216

Turning Macro Reference

29 - RADIUSCOMP
Recommended Syntax
%MACRO=29=..=Compensation
System Variables Modified System Variable Description
SUBFUNCT

1 = Compensation Off
2 = Compensation Left
3 = Compensation Right
4 = Pathcomp

Edgecam User Guide

217

Turning Macro Reference

32 - TRANSLATE
Recommended Syntax
%MACRO=32=..=Translate=45,23,14,26,37,21,
System Variables Modified System Variable Description
ENDSUB

End Subroutine Block Number

PATHTRACE

Output Mode

REPEAT

Number Of Repeats

STARTSUB

Start Subroutine Block Number

SUBROUTINE

Subroutine Number

XINC

Z Translation Value

XSUB

Z Coord of First Point

YINC

X Translation Value

YSUB

X Coord of First Point

XCURRENTPOS

Current X Axis Position

ZCURRENTPOS

Current Z Axis Position

XEND

X End of First Move

YEND

Y End of First Move

Edgecam User Guide

218

Turning Macro Reference

36 - TECHNOLOGY
Recommended Syntax
%MACRO=36=..=Technology=85,

Edgecam User Guide

219

Turning Macro Reference

40 - MOVE HOME
Recommended Syntax
%MACRO=40=..=Move Home=
System Variables Modified System Variable Description
FIELD1

X Axis Lock. Non-zero if X FIXED

FIELD2

Y Axis Lock. Non-zero if Y FIXED


(only available for Y Axis machines).

FIELD3

Z Axis Lock. Non-zero if Z FIXED

FIELD4

Axis priority
0 = No priority
1 = X move first
2 = Y move first (only for Y Axis machines)
3 = Z move first

Edgecam User Guide

220

Turning Macro Reference

41 - MOVE TOOLCHANGE
Recommended Syntax
%MACRO=41=..=Move Toolchange
System Variables Modified System Variable Description
FIELD1

X Axis Lock. Non-zero if X FIXED

FIELD2

Y Axis Lock. Non-zero if Y FIXED


(only available for Y Axis machines).

FIELD3

Z Axis Lock. Non-zero if Z FIXED

FIELD4

Axis priority
0 = No priority
1 = X move first
2 = Y move first (only for Y Axis machines)
3 = Z move first

Edgecam User Guide

221

Turning Macro Reference

51 - START
Recommended Syntax
%MACRO=51=..=START System Macro
System Variables
Modified

System Variable Description

UNIT

0 = Inches
1 = Millimetres

JOBDESC

Job Manager Description

JOBCOM

Job Manager Comment

JOBFAM

Job Manager Family

JOBMACH

Job Manager Machine

JOBCUST

Job Manager Customer

JOBPROG

Job Manager Programmer

JOBMATL

Job Manager Material

JOBREV

Job Manager Revision

APPEND = #

Create Secondary File Flag

CIRCLE = 1 or 0

Single or Multi- Quadrant Interpolation

DATE

String variable containing date at code generation time, using the format MM/DD/YY

CUSTOMERNAME

Retrieved from Edgecam licensing.

SERVERCODE

Retrieved from Edgecam licensing.

UKDATE

String variable containing date at code generation time, using the format DD/MM/YY

DAY.MONTH.YEAR

Numeric variables that allow you to format the date according to your requirements

ENDSUB = 0

End of Subroutine Block Number

MACHINENAME

String variable containing code generator name

MILLMODE

0 = Rotary, 1 = Planar

NUMBLOCKS = #

Maximum Limit of Blocks

NUMCHARS = #

Maximum Limit of Characters

PARTNAME

String variable containing Edgecam partname

SEQUENCENAME

String variable containing machining sequence name

STARTSUB = 0

Start of Subroutine Block Number

TIME

String variable containing time at code generation time

XSUB/YSUB/ZSUB

Distance between the Initial CPL and the Machine Datum

Edgecam User Guide

222

There are also variables which indicate how the part is loaded into the spindle, and how the transfer to the SubSpindle takes place. These variables are applicable to Advanced Turn Code Generator files only:
PARTLENGTH

Part Length

MAINPARTSTICKOUT

Stick out amount of part when loaded in the Main Spindle

SUBPARTSTICKOUT

Stick out amount of part when transferred to the Sub Spindle

MAINDATUMTOCHUCKFACE Machine Datum to Chuck Face on Main Spindle


SUBDATUMTOCHUCKFACE
MCSUBDATUMX

Machine to Sub Spindle Datum X distance

MCSUBDATUMY

Machine to Sub Spindle Datum Y distance

MCSUBDATUMZ

Machine to Sub Spindle Datum Z distance

DOCKGRIPZ

Grip Position for Sub Spindle transfer (relative to Main Spindle CPL)

MAINSAFEZ

Z Extents of safe cutting on Main Spindle.

SUBSAFEZ

Z Extents of safe cutting on Sub Spindle

PRIORITYMAIN

Which turret has priority for Main Spindle (0 = Upper, 1= Lower)

PRIORITYSUB

Which turret has priority for Sub Spindle (0 = Upper, 1= Lower)

Edgecam User Guide

223

Turning Macro Reference

53 - CLW
Recommended Syntax
%MACRO=53=..=CLW System Macro
System Variables
Modified

System Variable Description

ENDANGLE

The end angle of the arc (always positive and less than
STARTANGLE)

INCANGLE

The included angle in the arc (always positive)

STARTANGLE

Starting angle of the arc (always positive and greater than


ENDANGLE)

RADIUS

Radius of Arc

XCENTRE

X Centre of Arc (XY, ZX Arcs)

XEND

X Arc End (XY, ZX Arcs)

XSTART

X Arc Start (XY, ZX Arcs)

XYPLANE

Plane Switch (see the notes on TRUEARCOP).

YCENTRE

Y Centre of Arc (XY, ZY Arcs)

YEND

Y Arc End (XY, ZY Arcs)

YSTART

Y Arc Start (XY, ZY Arcs)

ZCENTRE

Z Centre of Arc (ZX, ZY Arcs)

ZEND

Z Arc End (ZX, ZY Arcs)

ZSTART

Z Arc Start (ZX, ZY Arcs)

Edgecam User Guide

224

Turning Macro Reference

54 - CCLW
Recommended Syntax
%MACRO=54=..=CCLW System Macro
System Variables
Modified

System Variable Description

ENDANGLE

The end angle of the arc (always positive and greater than
STARTANGLE)

INCANGLE

The included angle in the arc (always positive)

STARTANGLE

Starting angle of the arc (always positive and less than


ENDANGLE)

RADIUS

Radius of Arc

XCENTRE

X Centre of Arc (XY, ZX Arcs)

XEND

X Arc End (XY, ZX Arcs)

XSTART

X Arc Start (XY, ZX Arcs)

XYPLANE

Plane Switch (see the notes on TRUEARCOP).

YCENTRE

Y Centre of Arc (XY, ZY Arcs)

YEND

Y Arc End (XY, ZY Arcs)

YSTART

Y Arc Start (XY, ZY Arcs)

ZCENTRE

Z Centre of Arc (ZX, ZY Arcs)

ZEND

Z Arc End (ZX, ZY Arcs)

ZSTART

Z Arc Start (ZX, ZY Arcs)

Edgecam User Guide

225

Turning Macro Reference

55 - SUBSTART
Recommended Syntax
%MACRO=55=..=SUBSTART System Macro
System Variables Modified System Variable Description
SUBROUTINE

Subroutine Number

Edgecam regards the start of subroutines as the END of the first move after the label. In this macro the
coordinates of this move are stored in NEXTXMOVE, NEXTYMOVE, NEXTZMOVE. It is from this point that
incremental moves in a subroutine should be calculated.

Edgecam User Guide

226

Turning Macro Reference

56 - SUBEND
Recommended Syntax
%MACRO=56=..=SUBEND System Macro
System Variables Modified System Variable Description
SUBROUTINE

Subroutine Number

Edgecam User Guide

227

Turning Macro Reference

58 - END
Recommended Syntax
%MACRO=58=..=END System Macro
System Variables Modified

System Variable Description

JOBDESC

Job Manager Description

JOBCOM

Job Manager Comment

JOBFAM

Job Manager Family

JOBMACH

Job Manager Machine

JOBCUST

Job Manager Customer

JOBPROG

Job Manager Programmer

JOBMATL

Job Manager Material

JOBREV

Job Manager Revision

Edgecam User Guide

228

Turning Macro Reference

59 - SUBCALL
Recommended Syntax
%MACRO=59=..=SUBCALL System Macro
System Variables Modified System Variable Description
SUBROUTINE

Subroutine Number

Edgecam regards the start of subroutines as the END of the first move after the label. In this macro the
coordinates of the move are stored in NEXTXMOVE, NEXTYMOVE, NEXTZMOVE and any positioning block
should be to that point except in the case of hole cycle position subroutines.

Edgecam User Guide

229

Turning Macro Reference

60 - RESET
Recommended Syntax
%MACRO=60=..=RESET System Macro
System Variables Modified System Variable Description
PATHTRACE

0 = Controller Subroutines
1 = Subroutines expanded within Edgecam

SUBFUNCT

1 = Translate
2 = Rotate
3 = Mirror

The RESET macro is accessed after each manipulative macro call.

Edgecam User Guide

230

Turning Macro Reference

61 - CYCLSUB
Recommended Syntax
%MACRO=61=..=CYCLSUB System Macro

Edgecam User Guide

231

Turning Macro Reference

71 - ATTRIBUTE
Recommended Syntax
%MACRO=71=..=ATTRIBUTE System Macro
System Variables Modified

System Variable Description

SUBFUNCT

Attribute type:
2 = True position (Edgecam 5 Axis extension only)
3 = Secondary feed rate
(XYFEED is also set up in MILL)
(FEED is set up in TURN)

Attributes are currently only set up by PDI executables.

Edgecam User Guide

232

251 - Spindle Selection


%MACRO=251=..=Spindle Selection=
These system variables are available following a %GETCPL call for the current spindle number held is the
value of SUBFUNCT.

System Variables
Modified

System Variable Description

SPINDLE

ID of the selected spindle

INDEXID

CPL ID for that spindle

GROUPDESCRIPTION

Spindle Name

XINC(1)

Absolute values from current CPL to Initial CPL

YINC
ZINC
XSUB (2)

Absolute datum origin

YSUB
ZSUB
SUBFUNCT

Current CPL/Spindle pointer

Use the %GETCPL directive with Subfunct to get information relating to the datum of the selected spindle. The
variable SPINDLE gives the ID of the selected spindle - this value can be tested against SPINDLEID1 and
SPINDLEID2 to determine which spindle has been selected.
(1) The system variables XINC, YINC and ZINC (not #XINC etc) contain the current CPL position in Initial CPL
coordinates.
(2) The system variables XSUB, YSUB and ZSUB (not #XSUB etc) contain the current position from world
origin, in current coordinates

Edgecam User Guide

233

252 - Spindle Control


%MACRO=252=..=Spindle Control=
System Variables
Modified

System Variable Description

DIRECTION

Spindle Direction

GEAR

Gear pointer, see below (=0 indicates automatic selection)

MAXRPM

Maximum RPM for this tool

CSS

1 = CSS mode, 0 = RPM

A new gear access array GEAR() allows Gear Definition from the %MACHINE statement to be accessed and
will give information for the currently selected spindle (or driven tool).
After use of the instruction #TEMP=GEAR(0) the number of gear ranges defined for the gear range for the
current spindle is available.
NUMGEARS Number of gear ranges defined
For any gear range further variables can then be made available by use of GEAR(NUM) where NUM is the
range number. NUM must be a positive integer between 1 and NUMGEARS inclusive.
GEARMINRPM Minimum RPM available in that gear
GEARMAXRPM Maximum RPM available in that gear
GEARUSERMAXRPM User Maximum RPM
If the GEAR required is specified by the value in GEAR then these last variables can be accessed directly
using #TEMP=GEAR(GEAR).

Edgecam User Guide

234

254 - Spindle Docking


Note this is the single-turret version of the macro, superseded by the multi-turret version.
%MACRO=254=..=Spindle Docking=1,5,7,27,
System Variables
Modified

System Variable Description

STRATEGY

Spindle Running = 1, Spindles Stopped = 2, Pick and Return


=3

FEED

Sub spindle movement feed in units/min

SPEED

Spindle speed in RPM

DWELL

Docking Dwell Time

CMOVE

Main Spindle C angle

WMOVE

Sub Spindle C angle

ZAPPROACH

Z Coordinate of rapid approach move

XAPPROACH

Z Coordinate of rapid approach move

DOCKGRIPZ

Z position where sub spindle chuck is to close (Main Spindle


coordinate)

FIELD1

Push Check Distance (creep forward to contact)

FIELD2

Push Check Back Off (relief move before closing chuck)

Generally the will be 3 separate strategies for Docking (Running, Static and Pick & Return for piece parts).
These will usually be arranged through 3 matching code constructors. The actions are code generator
dependant according to the content of the Code Constructors.
Note that the X coordinate will be zero and that only movement in Z is implemented.
If spindle synchronisation is required then this must be included in the code constructor. If the spindle
synchronization has to be coordinated across both turrets as for MoriSeiki (Fanuc) controls then it will be
necessary to add the appropriate instructions to the Edgecam sequences before coding the Docking.
For example:
Back Turret

Front Turret

Turret Synch

Turret Synch

Insert Spindle Synch

Insert Spindle Synch

Turret Synch

Turret Synch

Docking

Turret Synch

Turret Synch

Edgecam User Guide

235

262 - Spindle Docking


Note this is the multi-turret version of the macro, superseding the single-turret version.
%MACRO=262=..=Spindle Docking=1,5,7,27,
System Variables
Modified

System Variable Description

STRATEGY

Spindle Running = 1, Spindles Stopped = 2, Pick and Return


=3

FEED

Sub spindle movement feed in units/min

SPEED

Spindle speed in RPM

DWELL

Docking Dwell Time

CMOVE

Main Spindle C angle

WMOVE

Sub Spindle C angle

ZAPPROACH

Z Coordinate of rapid approach move

XAPPROACH

Z Coordinate of rapid approach move

DOCKGRIPZ

Z position where sub spindle chuck is to close (Main Spindle


coordinate)

FIELD1

Push Check Distance (creep forward to contact)

FIELD2

Push Check Back Off (relief move before closing chuck)

Generally the will be 3 separate strategies for Docking (Running, Static and Pick & Return for piece parts).
These will usually be arranged through 3 matching code constructors. The actions are code generator
dependant according to the content of the Code Constructors.
Note that the X coordinate will be zero and that only movement in Z is implemented.
If spindle synchronisation is required then this must be included in the code constructor. If the spindle
synchronization has to be coordinated across both turrets as for MoriSeiki (Fanuc) controls then it will be
necessary to add the appropriate instructions to the Edgecam sequences before coding the Docking.
For example:
Back Turret

Front Turret

Turret Synch

Turret Synch

Insert Spindle Synch

Insert Spindle Synch

Turret Synch

Turret Synch

Docking

Turret Synch

Turret Synch

Edgecam User Guide

236

255 - Move Sub Spindle


Note this is the single-turret version of the macro, superseded by the multi-turret version.
%MACRO=255=..=Move Sub Spindle=1,5,30,59,
System Variables
Modified

System Variable Description

FEED

Sub Spindle movement rate - units/minute

SPEED

Spindle Speed

DWELL

Program dwell time

OFFSETZ

Z position adjustment

FIELD2

Move Type Modifier, Rapid=0, Feed=1

FIELD1

Return Home Modifier, No=0, Yes=1

ZEND

Z Movement coordinate (set if FIELD1=0)

XEND

X Movement coordinate (set if FIELD1=0)

If the return to Home box has been checked in Edgecam then Field1 will be set to 1 and XEND,ZEND will not
be set.
The X coordinate will be zero and that only movement in Z is implemented.

Edgecam User Guide

237

263 - Move Sub Spindle


Note this is the multi-turret version of the macro, superseding the single-turret version.
%MACRO=263=..=Move Sub Spindle=1,5,30,59,
System Variables
Modified

System Variable Description

FEED

Sub Spindle movement rate - units/minute

SPEED

Spindle Speed

DWELL

Program dwell time

OFFSETZ

Z position adjustment

FIELD2

Move Type Modifier, Rapid=0, Feed=1

FIELD1

Return Home Modifier, No=0, Yes=1

ZEND

Z Movement coordinate (set if FIELD1=0)

XEND

X Movement coordinate (set if FIELD1=0)

If the return to Home box has been checked in Edgecam then Field1 will be set to 1 and XEND,ZEND will not
be set.
The X coordinate will be zero and that only movement in Z is implemented.

Edgecam User Guide

238

256 - Bar Feed


%MACRO=256=..=Bar Feed=1,5,7,27,
System Variables
Modified

System Variable Description

FEED

Feed rate in units/min

SPEED

Spindle speed RPM

DWELL

Dwell time

STRATEGY

Z First = 1, X First = 2, Direct = 3

ZAPPROACH

Z Coordinate, rapid approach

XAPPROACH

X Coordinate, rapid approach

ZSTART

Z Coordinate, start of bar feed

XSTART

X Coordinate, start of bar feed

ZEND

Z Coordinate, end of bar feed

XEND

X Coordinate, end of bar feed

The action is code generator dependant but generally the expected result is to rapid move to
XAPPROACH,ZAPPROACH and then feed to contact with the bar at XSTART, ZSTART. The chuck will then
be opened and a feed move made to XEND,ZEND where the chuck will close. The following 3 macros were
previously in the User Defined group and have now been changed to Edgecam executive macros.

Edgecam User Guide

239

257 - Chuck
%MACRO=257=..=Chuck=
System Variables
Modified

System Variable Description

FIELD 1

1= Chuck Open, 2= Chuck Closed

Edgecam User Guide

240

258 - Part Catcher


%MACRO=258=..=Part Catcher=
System Variables
Modified

System Variable Description

FIELD 1

1= catcher Advance, 2= Catcher Retract

FIELD 2

1=Eject Part

Edgecam User Guide

241

259 - Tailstock
%MACRO=259=..=Tailstock=
System Variables
Modified

System Variable Description

FIELD 1

1 = Tailstock Advance, 2= Tailstock Retract)

FIELD 2

1 = Quil

Edgecam User Guide

242

264 - Bar Pull


%MACRO=264=..=Bar Pull 4-Axis=1,5,59,

System Variable
Modified

System Variable Description

FIELD1

Datum Shift Flag 0= no shift 1= datum shift

FIELD2

Feed/Rapid flag. 0=Rapid move, =1 for


feed move

ZEND

End position

FEED
SPEED

Edgecam User Guide

243

C/Y Axis Macro Numbers


The Code Generator source file definitions are exclusively in the range of 151 to 200. With the additional macro
CX.OUTPUT most machine tool configurations can be supported. These macros encompass functionality
offered by driven tooling and the macro numbers are in general 150 higher than the equivalent milling macro.

Edgecam User Guide

244

C/Y Axis Limitations


The C/Y Axis extension does not support Mirror, Translate or Rotate milling type operations, and therefore the
definitions should not be included in the text source file.

Edgecam User Guide

245

CAXIS
The CAXIS system variable is assigned a value which relates to the type of machining currently active:
0 = Static (Milling or Turning) Tool
1 = Axial/Reverse Axial, Driven (0 or 180)
2 = Radial/Reverse Radial, Driven (90 or 270)
3 = Other Orientation (B AXIS), Driven

0 = Normal Turning
1 = Axial Machining
2 = Radial Machining
The following macro definitions assign a value to CAXIS (therefore the variable should not be assigned by the
user):
%MACRO=43=AX/RD=Axial/Radial C-axis machining=

(And 193)

%MACRO=45=..=Move Angular=5,6,7,
%MACRO=253=..=Lathe Index=..
%MACRO=165=..=Tool Change=..
These values are maintained while processing for reference by the code generator file.
CAXIS can be tested and conditional actions can be executed.

Edgecam User Guide

246

Y Axis
Edgecam is switched between Y Axis and C Axis milling by the use of the SELECT MILL MODE macro. This
sets up SUBFUNCT as 0 for C Axis and 1 for Y Axis milling (the default condition is C Axis). A user variable
should be set to flag that status in other macros.
For example:
%MACRO=44=..=SELECT MILL MODE...etc.
%IF SUBFUNCT=1 %THEN #YAXIS=1 %ELSE #YAXIS=0

Edgecam User Guide

247

%CXCYCLE
This statement is used to force output of axial motion in terms of C Axis motion and the radial length, the polar
co-ordinate system.
%CXCYCLE is used to calculate axial movements for controllers that do not support the Cartesian co-ordinate
system, therefore the output must be expressed in the polar co-ordinate system.
%CXCYCLE action is similar the %NOCYCLE command but redirection is effected through the macro
CX.OUTPUT (macro number 66).
The macro definition CX.OUTPUT must be written in the text source file to enable the redirection to occur.
Example:
%MACRO=164=..=4,64,65,59,60,7,5,62,
%IF CAXIS=1 %THEN %CXCYCLE %ELSE %NOCYCLE
%ENDM

In the above example, redirection to the macro definition CX.OUTPUT will only occur when set to Axial mode.
It is also important to understand the consequence of %NOCYCLE when encountered in C/Y Axis mode.
Redirection will occur through macros 1 and 2, and it is therefore necessary to test the system variable CAXIS
in macros 1 and 2 which must call a user-defined procedure to effect axis output.
If the Code Generator does not require %CXCYCLE, it can be disabled in switch 20 of the MM line for faster
processing (see MM Line).
Controller compensation is available in Radial and Axial modes.
supported when using CXCYCLE in Axial Turning.

Edgecam User Guide

Note that Controller compensation is not

248

C Axis - Angular Co-ordinates


When processing arc or linear movement in CAXIS, the position expressed in angular co-ordinates is made
available. The additional variables are as follows:
Linear Motion
CMOVE Angle
RMOVE Radius
ROT1 Rotary angle (same as CMOVE but is available for compatibility with rotary milling)

Arc Motion
CSTART
RSTART
CCENTRE
RCENTRE
CEND
REND

Edgecam User Guide

249

C Axis Macro Syntax


In the following macro definitions, the recommended syntax should be taken to mean the following:
%MACRO=[macro number]=..=[long description]=[variables...]
For example:
%MACRO=1=..=RAPID=1,2,3,

Edgecam User Guide

250

C Axis Macro Reference


Expand the C Axis Macro Reference book in the Table of Contents to see the full list of C axis macro
reference topics.

Edgecam User Guide

251

C Axis Macro Reference

38 - ROTARY ROTATE
Recommended Syntax
%MACRO=38=..=Rotary Rotate=1,2,14,26,24,37,
Only supports the %NOCYCLE directive.

Edgecam User Guide

252

C Axis Macro Reference

43 - AXIAL OR RADIAL MODE


Recommended Syntax
%MACRO=43=..=Axial or Radial Mode
System Variables Modified System Variable Description
CAXIS

C Axis Implemented Flag


1 = Axial
2 = Radial

SUBFUNCT

Assigned as Selected

This macro is called following a toolchange between either fixed and driven tooling or between axially and
radially loaded tooling.

Edgecam User Guide

253

C Axis Macro Reference

44 - SELECT MILL MODE


Recommended Syntax
%MACRO=44=..=Select Mill Mode
System Variables Modified System Variable Description
SUBFUNCT

Assigned as Selected
0 = Rotary, Z X & C interpolation
1 = Planar, Z X & Y interpolation

Edgecam User Guide

254

C Axis Macro Reference

45 - MOVE ANGULAR
Recommended Syntax
%MACRO=45=..=Move Angular=5,6,7,59,
Re-direction MUST occur using the %NOCYCLE command.
System Variables Modified System Variable Description
AMOVE
BMOVE
CMOVE
FEED
RMOVE

Radial distance from centre of rotation

ROT1

Angular position

SPEED
ZFEED

Edgecam User Guide

255

C Axis Macro Reference

49 - RESET ROTARY DATUM


Recommended Syntax
%MACRO=49=..=RESET ROTARY DATUM
System Variables Modified System Variable Description
CMOVE

Rotary axis

ROT1

Primary rotary axis

Both ROT1 and CMOVE will be updated with the new angular position obtained from this command.

Edgecam User Guide

256

C Axis Macro Reference

53 - CLW
Recommended Syntax
%MACRO=53=..=CLW System Macro
System Variables Modified System Variable Description
RADIUS

Radius of Arc

XCENTRE

X Centre of Arc (XY, ZX Arcs)

XEND

X Arc End (XY, ZX Arcs)

XSTART

X Arc Start (XY, ZX Arcs)

XYPLANE

Plane Switch (see the notes on TRUEARCOP)

ZCENTRE

Z Centre of Arc (ZX, ZY Arcs)

ZEND

Z Arc End (ZX, ZY Arcs)

ZSTART

Z Arc Start (ZX, ZY Arcs)

Edgecam User Guide

257

C Axis Macro Reference

54 - CCLW
Recommended Syntax
%MACRO=54=..=CCLW System Macro
System Variables Modified System Variable Description
RADIUS

Radius of Arc

XCENTRE

X Centre of Arc (XY, ZX Arcs)

XEND

X Arc End (XY, ZX Arcs)

XSTART

X Arc Start (XY, ZX Arcs)

XYPLANE

Plane Switch (see the notes on TRUEARCOP)

ZCENTRE

Z Centre of Arc (ZX, ZY Arcs)

ZEND

Z Arc End (ZX, ZY Arcs)

ZSTART

Z Arc Start (ZX, ZY Arcs)

Edgecam User Guide

258

C Axis Macro Reference

66 - CX.OUTPUT
Recommended Syntax
%MACRO=66=..=CX.OUTPUT
System Variables Modified

System Variable Description

CMOVE

C Axis Motion

RMOVE

Radial Motion

ROT1

Rotary axis motion

SUBFUNCT

1 = Rapid Motion
2 = Feedrate Linear Motion
3 = Feedrate Arc Motion

Edgecam User Guide

259

C Axis Macro Reference

69 - ANGCLW
Recommended Syntax
%MACRO=69=..=ANGCLW
This macro handles the output of radially machined arcs in rotary mode.
System Variables Modified System Variable Description
CEND

C Arc End

CIRCLE

0=Multi-quadrant arcs
1=Single-quadrant arcs

CSTART / CCENTRE

C Arc Coords

RADIUS

Radius of Arc

ROT1 / ROT2 / AMOVE /


BMOVE / CMOVE

Angular position

WRAPRADIUS

Wrap radius value

XEND

X Arc End - Radius of Cylinder

XSTART / XCENTRE

X Arc Coords

ZEND

Z Arc End

ZSTART / ZCENTRE

Z Arc Coords

This macro will only be visited if wrapped geometry is machined at the depth at which the original geometry
was wrapped, or switch 17 on the MM line has been set to 1 (see Rotary Output Mode)

Edgecam User Guide

260

C Axis Macro Reference

70 - ANGCCLW
Recommended Syntax
%MACRO=70=..=ANGCCLW
This macro handles the output of radially machined arcs in rotary mode.
System Variables Modified System Variable Description
CEND

C Arc End

CIRCLE

0=Multi-quadrant arcs
1=Single-quadrant arcs

CSTART / CCENTRE

C Arc Coords

RADIUS

Radius of Arc

ROT1 / ROT2 / AMOVE /


BMOVE / CMOVE

Angular position

WRAPRADIUS

Wrap radius value

XEND

X Arc End - Radius of Cylinder

XSTART / XCENTRE

X Arc Coords

ZEND

Z Arc End

ZSTART / ZCENTRE

Z Arc Coords

This macro will only be visited if wrapped geometry is machined at the depth at which the original geometry
was wrapped, or switch 17 on the MM line has been set to 1 (see Rotary Output Mode)

Edgecam User Guide

261

C Axis Macro Reference

151 - MOVE RAPID


Recommended Syntax
%MACRO=151=..=Move Rapid=1,2,3
Redirection must occur by using the %NOCYCLE command. Axis output is then effected by testing the system
variable CAXIS within the RAPID macro (1) and finally calling a procedure.

Edgecam User Guide

262

C Axis Macro Reference

152 - MOVE FEED


Recommended Syntax
%MACRO=152=..=Move Feed=1,2,3,5,6,7,61,62,
System Variables Modified System Variable Description
FEED

Z Axis Feedrate

SPEED

Spindle Speed

Redirection must occur by using the %NOCYCLE command. Axis output is then effected by testing the
system variable CAXIS within the FEED macro (2) and finally calling a procedure.

Edgecam User Guide

263

C Axis Macro Reference

153 - MOVE ARC


Recommended Syntax
%MACRO=153=..=Move Arc=1,2,5,7,62,
System Variables Modified System Variable Description
FEED

Feedrate in XY Plane

SPEED

Spindle Speed

Edgecam User Guide

264

C Axis Macro Reference

155 - PROFILE CYCLE


Recommended Syntax
%MACRO=155=..=Profile Cycle=4,5,6,7,63,64,65,21,72,74,75,62,
System Variables Modified System Variable Description
FEED

Axis Feedrate

SPEED

Spindle Speed

TOTDEPTH

Total Depth

ZFEED

Z Axis Feedrate

Edgecam User Guide

265

C Axis Macro Reference

156 - AREACLEAR CYCLE


Recommended Syntax
%MACRO=156=..=Areaclear Cycle=4,5,6,7,63,64,66,72,62,
System Variables Modified System Variable Description
FEED

Axis Feedrate

SPEED

Spindle Speed

TOTDEPTH

Total Depth

ZFEED

Z Axis Feedrate

Edgecam User Guide

266

C Axis Macro Reference

157 - SLOT CYCLE


Recommended Syntax
%MACRO=157=..=Slot Cycle=4,5,6,7,63,64,66,72,62,
System Variables Modified System Variable Description
FEED

Axis Feedrate

SPEED

Spindle Speed

TOTDEPTH

Total Depth

ZFEED

Z Axis Feedrate

This macro should only consist of the %NOCYCLE command.

Edgecam User Guide

267

C Axis Macro Reference

158 - CROSSHATCH CYCLE


Recommended Syntax
%MACRO=158=..=Crosshatch Cycle=4,5,6,7,9,62,63,64,66,81,
System Variables Modified System Variable Description
OFFSET

Offset Value

SPEED

Spindle Speed

STEP

Percentage Cutter Overlap

XYFEED

XY Plane Feed

ZDEPTH

Z Height of Cut

ZFEED

Z Axis Feed

Edgecam User Guide

268

C Axis Macro Reference

159 - DRILL CYCLE


Recommended Syntax
%MACRO=159=..=Drill Cycle=4,6,7,63,10,27,21,73,76,77,50,53|176,
System Variables Modified System Variable Description
DEPTH

Depth of Peck

DRILLSUB

Subroutine indicator
0 = Longhand code
1 = Subroutines present

DWELL

Dwell in Seconds

FEED

Feedrate

LAST

Number of Points

PATHTRACE

Controller Canned Cycle Flag

RPLANE

Retract Plane

SPEED

Spindle Speed

TOTDEPTH

Total Z Axis Depth

XPOINT(#)

X Axis Point*

YPOINT(#)

Y Axis Point*

ZCLEAR

Z Clearance Plane

ZFEED

Z Axis Feed

* See Also XYZ Array for Drilling in Different Environments

Edgecam User Guide

269

C Axis Macro Reference

160 - CHIPBREAK CYCLE


Recommended Syntax
%MACRO=160=..=Chipbreak Cycle=4,6,7,63,10,27,21,73,76,77,50,53|176,200,201,
System Variables Modified System Variable Description
DEPTH

Depth of Peck

DRILLSUB

Subroutine indicator
0 = Longhand code
1 = Subroutines present

DWELL

Dwell in Seconds

FEED

Feedrate

LAST

Number of Points

MRPLANE(#)

Retract Plane for each position*

MZDEPTH(#)

Z Drilling Depth for each position*

PATHTRACE

Controller Canned Cycle Flag

RPLANE

Retract Plane

SPEED

Spindle Speed

TOTDEPTH

Total Z Axis Depth, if multilevel not selected

XPOINT(#)

X Axis Point*

YPOINT(#)

Y Axis Point*

ZCLEAR

Z Clearance Plane

ZFEED

Z Axis Feed

ZLEVEL

Zlevel, if multilevel not selected

Note that 176 (FIELD1) contains the Entry feed value.


* See Also XYZ Array for Drilling in Different Environments

Edgecam User Guide

270

C Axis Macro Reference

161 - REAM CYCLE


Recommended Syntax
%MACRO=161=..=Ream Cycle=4,6,7,63,21,76,77,50,53|176,200,201,
System Variables Modified System Variable Description
DRILLSUB

Subroutine indicator
0 = Longhand code
1 = Subroutines present

LAST

Number of Points

MRPLANE(#)

Retract Plane for each position*

MZDEPTH(#)

Z Drilling Depth for each position*

PATHTRACE

Controller Canned Cycle Flag

RPLANE

Retract Plane

SPEED

Spindle Speed

TOTDEPTH

Total Z Axis Depth, if multilevel not selected

XPOINT(#)

X Axis Point*

YPOINT(#)

Y Axis Point*

ZCLEAR

Z Clearance Plane

ZFEED

Z Axis Feed

ZLEVEL

Zlevel, if multilevel not selected

Note that 176 (FIELD1) contains the Entry feed value.


* See Also XYZ Array for Drilling in Different Environments

Edgecam User Guide

271

C Axis Macro Reference

162 - BORE CYCLE


Recommended Syntax
%MACRO=162=..=Bore Cycle=4,6,7,63,21,76,77,50,53|176,200,201,
System Variables Modified System Variable Description
DRILLSUB

Subroutine indicator
0 = Longhand code
1 = Subroutines present

FEED

Feedrate

LAST

Number of Points

MRPLANE(#)

Retract Plane for each position*

MZDEPTH(#)

Z Drilling Depth for each position*

PATHTRACE

Controller Canned Cycle Flag

RPLANE

Retract Plane

SPEED

Spindle Speed

TOTDEPTH

Total Z Axis Depth, if multilevel not selected

XPOINT(#)

X Axis Point*

YPOINT(#)

Y Axis Point*

ZCLEAR

Z Clearance Plane

ZFEED

Z Axis Feed

ZLEVEL

Zlevel, if multilevel not selected

Note that 176 (FIELD1) contains the Entry feed value.


* See Also XYZ Array for Drilling in Different Environments

Edgecam User Guide

272

C Axis Macro Reference

163 - TAP CYCLE


Recommended Syntax
%MACRO=163=..=Tap Cycle=4,6,7,63,21,76,77,
System Variables Modified System Variable Description
DRILLSUB

Subroutine indicator
0 = Longhand code
1 = Subroutines present

LAST

Number of Points

PATHTRACE

Controller Canned Cycle Flag

RPLANE

Retract Plane

SPEED

Spindle Speed

TOTDEPTH

Total Z Axis Depth

XPOINT(#)

X Axis Point*

YPOINT(#)

Y Axis Point*

ZCLEAR

Z Clearance Plane

ZFEED

Z Axis Feed

* See Also XYZ Array for Drilling in Different Environments

Edgecam User Guide

273

C Axis Macro Reference

164 - MOVE RELATIVE


Recommended Syntax
%MACRO=164=..=Move Relative=4,64,65,59,60,7,5,62,
System Variables Modified System Variable Description
FEED

Axis Feedrate

SPEED

Spindle Speed

Edgecam User Guide

274

C Axis Macro Reference

165 - TOOLCHANGE
Recommended Syntax
%MACRO=165=..=Toolchange=8,12,80,48,
These system variables are available following a %LOAD call for the current tool number. The current tool
number is the value of SUBFUNCT.
When indexing with driven tooling, the variables BMOVE and CMOVE give the requested orientation after
toolchange.
System Variables Modified

System Variable Description

CMT1

Cumulative Tool Usage at Toolchange in Minutes

CSS

Constant surface speed

CORNERRAD

Corner radius of selected tool (or #FUNNY)

DIRECTION

Spindle rotation direction: Forward or reverse

FEEDTYPE

Feed/Rev (1) or Feed/Minute (2)

FLUTELENGTH

Flute Length

GEAR

Gear

GROUP

The string value of the 'Group Code' modifier on the


ToolChange dialog.

GROUPSTRING

A string comprising the first sequence of letter characters in


the GROUP variable ('abc123def')

GROUPNUMBER

A numeric variable converted from the first numerical


character sequence in the GROUP variable ('abc123def').
A '.' character is classed as the decimal point of a number
('abc12.3def' gives 12.3, '.12def' gives 0.12).

ID

The string value of the 'Code ID' modifier on the ToolChange


dialog.

IDSTRING

A string comprising the first sequence of letter characters in


the ID variable ('abc123def')

IDNUMBER

A numeric variable converted from the first numerical


character sequence in the ID variable ('abc123def').
A '.' character is classed as the decimal point of a number
('abc12.3def' gives 12.3, '.12def' gives 0.12).

MAINTAININDEX

Setting of the Maintain Index checkbox used in the


Toolchange command.
0 = unchecked
1 = checked

MAXRPM

Maximum revs per minute

POSITION

Turret Number

Edgecam User Guide

275

STRTSTOREUSER1

User defined text variable from ToolStore

STRTSTOREUSER2

User defined text variable from ToolStore

SUBFUNCT

Current Tool Pointer

THROUGHCOOLANT

Through Tool Coolant flag from ToolStore, 0=off, 1=0n

TOOLOFFSET

Tool length offset register

TSTOREUSER1

User defined numeric variable from ToolStore

TSTOREUSER2

User defined numeric variable from ToolStore

TOOLDESCRIPTION

Toolname

TOOLEN

Tool Length Setting

TOOLNUM

Tool Library Number

TOOLRAD

Tool Radius

TOOLTYPE

The quadrant containing the tool and the permitted tool type
0 = 090 degrees (Thread)
1 = 135 degrees (Thread, Back Turn)
2 = 180 degrees
3 = 225 degrees (Back Bore)
4 = 270 degrees
5 = 315 degrees (Bore)
6 = 000 degrees (Drill)
7 = 045 degrees (Thread, Turn)

TOOLXSET

Y Gauge Length

TOOLZSET

Z Gauge Length

USERDEFINEDSTRING

Comment

XBPIVOTLENGTH,
ZBPIVOTLENGTH

Distance back to the pivot point

XCPL, YCPL, ZCPL

The tool tip position after the toolchange, in current CPL


coordinates.

XSCRATCH, YSCRATCH,
ZSCRATCH

The tool tip position after the toolchange, in Machine Datum


coordinates.

Note: Tool Offset is now the system variable TOOLOFFSET. The modifier 12 must be defined on the macro
line to display and use this new system variable to retain compatibility with existing posts. This method of
setting tool offset replaces the use of user vars.

Edgecam User Guide

276

C Axis Macro Reference

166 - SELECT TURRET


Recommended Syntax
%MACRO=166=..=Select Turret
System Variables Modified System Variable Description
SUBFUNCT

Assigned as Selected
1 = Upper turret
2 = Lower Turret

Edgecam User Guide

277

C Axis Macro Reference

172 - DWELL
Recommended Syntax
%MACRO=172=..=Dwell=27,
System Variables Modified System Variable Description
DWELL

Dwell in Seconds

Edgecam User Guide

278

C Axis Macro Reference

182 - TRANSLATE
Recommended Syntax
%MACRO=182=..=Translate=43,44,45,14,26,37,21,
System Variables Modified

System Variable Description

PATHTRACE

Controller Canned Cycle Flag

REPEAT

Number of Repeats

SUBROUTINE

Subroutine Number

XINC

X Translation Value

XSUB

X Coord of First Point

YINC

Y Translation Value

YSUB

Y Coord of First Point

ZINC

Z Translation Value

ZSUB

Z Coord of First Point

The RESET macro is called on exit from this macro.

Edgecam User Guide

279

C Axis Macro Reference

186 - TECHNOLOGY
Recommended Syntax
%MACRO=186=..=Technology

Edgecam User Guide

280

Turning Macro Reference

187 - THREAD MILLING


Recommended Syntax
%MACRO=187=..=Thread Mill=7,

System Variables Modified

System Variable Description

Field 1

Clearance

Field 2

Retract

Field 3

Diameter

Field 4

Level

Field 5

Depth of Thread

Field 6

Pitch

This macro will either set up the data array for machines which are capable of helical interpolation, or direct the
output through %NOCYCLE. If the user selects 'canned cycle' processing takes place using the array
described below, otherwise output is via RAPID and FEED macros.
Pathtrace

0 = Helical interpolation
1 = Pathtrace expansion to linear moves (use NOCYCLE
command)

For machines which are capable of helical interpolation the following applies:
The System variable XPOINT(#) must be tested for the type of movement being output.
LAST

Number of elements in the array

XPOINT(#)

0 = Rapid
1 = Feed
2 = Clockwise direction arc
3 = Counterclockwise direction arc
4 = Clockwise direction helical arc
5 = Counterclockwise direction helical arc

(#) is the subscript to gain access to a particular element.


The array comprises elements of three variables each. Each move type will occupy 2 or more elements, as
follows:

Edgecam User Guide

281

Rapid

Feed

CLW

CCLW

Helical CLW

Helical CCLW

Element

XPOINT(#)

YPOINT(#)

RADIUS(#)

Feedrate

X Destination

Y Destination

Z Destination

Feedrate

X Destination

Y Destination

Z Destination

Feedrate

X Centre

Y Centre

Radius

X Destination

Y Destination

Not used

Feedrate

X Centre

Y Centre

Radius

X Destination

Y Destination

Not used

Feedrate

X Centre

Y Centre

Not used

X Destination

Y Destination

Z Destination

Start Radius

End Radius

Not used

Feedrate

X Centre

Y Centre

Not used

X Destination

Y Destination

Z Destination

Start Radius

End Radius

Not used

System Variables Modified

System Variable Description

Field 1

Clearance

Field 2

Retract

Field 3

Diameter

Field 4

Level

Field 5

Depth of Thread

Field 6

Pitch

Edgecam User Guide

282

C Axis Macro Reference

190 - MOVE HOME


Recommended Syntax
%MACRO=190=..=Move Home
System Variables Modified

System Variable Description

FIELD1

X Axis Lock. Non-zero if X FIXED

FIELD2

Y Axis Lock. Non-zero if Y FIXED

FIELD3

Z Axis Lock. Non-zero if Z FIXED

FIELD4

Axis priority
0 = No priority
1 = X move first
2 = Y move first
3 = Z move first

Edgecam User Guide

283

C Axis Macro Reference

191 - MOVE TOOLCHANGE


Recommended Syntax
%MACRO=191=..=Move Toolchange=
System Variables Modified System Variable Description
FIELD1

X Axis Lock. Non-zero if X FIXED

FIELD2

Y Axis Lock. Non-zero if Y FIXED

FIELD3

Z Axis Lock. Non-zero if Z FIXED

FIELD4

Axis priority
0 = No priority
1 = X move first
2 = Y move first
3 = Z move first

Edgecam User Guide

284

C Axis Macro Reference

193 - TURNING AXIAL OR RADIAL MODE


Recommended Syntax
%MACRO=193=..=Turning Axial or Radial Mode
System Variables Modified System Variable Description
CAXIS

C Axis Implemented Flag


0 = Turning
1 = Axial
2 = Radial

SUBFUNCT

Assigned as Selected

Edgecam User Guide

285

C Axis Macro Reference

196 - MOVE RELATIVE 2


Recommended Syntax
%MACRO=196=..=Move Relative 2=4,59,7,5,
System Variables Modified System Variable Description
FIELD2

Move type
1 = Feed
0 = Rapid

SPEED
XYFEED

Edgecam User Guide

286

C Axis Macro Reference

197 - MOVE CONSTRAINED


Recommended Syntax
%MACRO=197=..=Move Constrained=4,59,7,5,
System Variables Modified System Variable Description
FIELD2

Move type
1 = Feed
0 = Rapid

SPEED
XYFEED

Edgecam User Guide

287

253 - B Axis Index


%MACRO=253=..=B Axis Index=
System Variables
Modified

System Variable Description

SUBFUNCT

Current CPL pointer

BMOVE (ROT1)

Baxis angle

CMOVE (ROT2)

Caxis angle (current spindle)

XINC(1)

Absolute values from current CPL to Initial CPL

YINC

ZINC

XSUB (2)

Absolute datum origin

YSUB
ZSUB
XSUBTURN (3)

CY milling reference position

YSUBTURN
ZSUBTURN
XCPL, YCPL, ZCPL

The tool tip position after the index, in current CPL


coordinates.

The B-axis indexing macro uses %GETCPL to get information relating to the new B-axis Datum. The Angles
are setup in ROT1,ROT2 as has historically been the case with %GETCPL - however to make things easier the
variables BMOVE and CMOVE are set up as well (this also applies for CY Milling).
(1) The system variables XINC, YINC and ZINC (not #XINC etc) contain the current CPL position in Initial CPL
coordinates.
(2) The system variables XSUB, YSUB and ZSUB (not #XSUB etc) contain the current position from world
origin, in current coordinates.
(3) The system variables XSUBTURN, YSUBTURN, ZSUBTURN contain the distances from the CPL turn
origin (or currently selected Spindle) to the origin of the new Coordinate system. Any C rotation is discounted,
with so the values are calculated as if the component was rotated to C0.

Edgecam User Guide

288

Wire Notes
Output for wire erosion machines is different to that of either Milling and Turning. Pathtrace have developed a
method to access data, which is used in EDGEWIRE.WXT. What follows is a description of this technique, and
we recommend that it is used in all Edgecam Wire Code Generators.
Four axis CNC output is performed through two macros, Macro 17, Machine Design and Macro 26, Cut Glue
Stop.
Information about the upper and lower profiles is made available in the XPOINT(), YPOINT(), ZPOINT() array.
All data required for both cycle output and expanded output (that is, point to point links for XYUV output) is
contained within this array. This array is composed of the three variables and is of variable length.
For each pair of entities being linked (upper and lower), the X, Y ,ZPOINT() array is filled with:

1.
2.
3.
4.

Header block.
Block for the XY entity.
Block for the UV entity.
Block of expanded data required for longhand output.

The array is loaded from element one through to the value indicated by the system variable LAST.
Guide height values are only applied to longhand output. Code Generators working at guide heights should
have taper mode disabled and 4-axis circular arcs should be converted to linear moves.

Edgecam User Guide

289

Wire Array Structure


The first block of data is a header block. The external procedure GETHEADER reads this and sets up these
user variables:

Procedure: GETHEADER
Index

XPOINT()

YPOINT()

ZPOINT()

#XYSTARTBEAR

#XYENDBEAR

#UVSTARTBEAR

Start bearing of XY element

End bearing of XY element

Start bearing of UV element

#UVENDBEAR

#STARTLEAD

#ENDLEAD

End bearing of UV element

Start lead angle

End lead angle

#STARTSIDE

#ENDSIDE

#XYUVPAIRS

Start side angle

End side angle

Number of xyuv pairs for long


hand output

#XYELEMENT

#UVELEMENT

#TYPE

Element type on XY profile, see Element type on UV profile,


below
see below

Element type couple

#XYNEXTSTARTBEAR

Not used

#UVNEXTSTARTBEAR

See below

Start bearing of next XY element End bearing of next UV


element
6

#XYNEXTELEMENT

#UVNEXTELEMENT

Next element type on XY profile Next element type on UV


profile

#NEXTTYPE

Next element couple type

Edgecam Wire Erosion can effectively link any two of four entity types to each other, giving a possible sixteen
combinations, for example a Line can be linked to a Point.
The four entities are POINT, LINE, ARC, and CONIC (not arc). The user defined variable #TYPE is set up to
identify which type of link is occurring:

#TYPE
XY

UV

Line

16

Point

32

Arc

64

Conic

128

#TYPE returns the sum of the XY and UV couple.


For example:
%IF #TYPE=33 %THEN %CALL=LINE_TO_POINT

Edgecam User Guide

290

When TYPE is checked, an internal procedure to handle this case can be called. Within this procedure, a
check is made to determine whether to use long hand output or cycle output.

Edgecam User Guide

291

Wire Cycle Output


The external procedure GETHEADER checks both #XYELEMENT and #UVELEMENT, then calls a procedure
for each type. These external procedures are:

Procedure : XYLINE
Index

XPOINT()

YPOINT()

ZPOINT()

#XSTART

#YSTART

#ZSTART

X start of line

Y start of line

Z start of line

#XEND

#YEND

#ZEND

X end of line

Y end of line

X end of line

Procedure : UVLINE
Index

XPOINT()

YPOINT()

ZPOINT()

#USTART

#VSTART

#WSTART

U start of line

V start of line

W start of line

#UEND

#VEND

#WEND

U end of line

V end of line

W end of line

Procedure : XYARC
Index

XPOINT()

YPOINT()

ZPOINT()

#XCENTRE

#YCENTRE

#XYRADIUS

X centre of arc

Y centre of arc

Radius

#XEND

#YEND

Not used

X end of arc

Y end of arc

XYARCSTARTANGLE

#XYARCENDANGLE

#XYELLIPENDARC

XY arc start angle

XY arc end angle

only set up if #XYELEMENT=15


(CONIC)

Edgecam User Guide

292

Procedure : UVARC
Index

XPOINT()

YPOINT()

ZPOINT()

#UCENTRE

#VCENTRE

#UVRADIUS

U centre of arc

V centre of arc

Radius

#UEND

#VEND

Not used

U end of arc

V end of arc

UVARCSTARTANGLE

#UVARCENDANGLE

#UVELLIPENDARC

UV arc start angle

UV arc end angle

only set up if #UVELEMENT=15


(CONIC)

Procedure : XYPOINT
Index

XPOINT()

YPOINT()

ZPOINT()

#XPOINT

#YPOINT

#ZPOINT

X point

Y point

Z point

Procedure : UVPOINT
Index

XPOINT()

YPOINT()

ZPOINT()

#UPOINT

#VPOINT

#WPOINT

U point

V point

W point

At this point all applicable user defined variables are now initialised. Therefore in the example under Array
Structure where #TYPE = 33 we would call the procedures XYLINE and UVPOINT.
Other procedures used in WIREDATA.MAC are:
%PROCEDURE = CALC_ARC_CORNER
This calculates the corner point on a blend radius between two lines and the start point of an arc.

These variables are set up:


#XSTART
#YSTART
#XCORNER
#YCORNER

Edgecam User Guide

293

Use the procedure by:


%CALL = CALC_ARC_CORNER
%PROCEDURE = TEST_ARC
This procedure should be used to determine if the arc to arc move can be supported via the control or if long
hand output is required.
TEST_ARC sets up a variable #ARCTYPE which returns the value:
Unsupported arc #ARCTYPE=0
Standard 2D arc #ARCTYPE =1
Standard taper conical #ARCTYPE = 2
Standard taper cylinder #ARCTYPE = 3
Taper with different start/end tapers #ARCTYPE = 4
Use the procedure by:
%CALL = TEST_ARC
%PROCEDURE = WIRE_VECTOR
This procedure calculates the IJK vectors of the wire.
Values returned are:
#IVECTOR = X
#JVECTOR = Y
#KVECTOR = Z
(The resultant is a unit vector.)
Use the procedure by:
%CALL = WIRE_VECTOR
The vectors are calculated from #XEND #YEND Z U V W
Ensure that these variables are correctly set before calling this procedure.

Edgecam User Guide

294

Expanded CNC Output for Wire


Immediately following the Cycle information, data in expanded form links the elements by using the selected
tolerance to generate line-to-line movement.
If you do not need expanded output, call the external procedure SKIP_LONG_HAND. This increments the array
over the expanded data and sets the array index #LOOP to the next header block.
The size and number of links is dependent on the system variable TOLERANCE (selected by the user). The
following variables will be set up until the next header is encountered:
Procedure : GETPAIR
Index

XPOINT()

YPOINT()

ZPOINT()

#XEND

#YEND

#ZEND

#UEND

#VEND

#WEND

All link types which include conics should be forced to be long hand code, using an internal procedure
LONG_HAND. This procedure in turn calls the external procedure GET_PAIR to process the expanded links.

Edgecam User Guide

295

Wire Macro Syntax


In the following macro definitions, the recommended syntax should be taken to mean the following:
%MACRO=[macro number]=..=[Description]=[variables...]
For example:
%MACRO=17=..=Machine=5,12,21,24,25,

Edgecam User Guide

296

Wire Macro Reference


Expand the Wire Macro Reference book in the Table of Contents to see the full list of Wire macro reference
topics.

Edgecam User Guide

297

Wire Macro Reference

1 - MOVE RAPID
Recommended Syntax
%MACRO=1=..=Rapid Move=
System Variables Modified

System Variable Description

XMOVE

X Axis Motion

YMOVE

Y Axis Motion

Edgecam User Guide

298

Wire Macro Reference

2 - MOVE FEED
Recommended Syntax
%MACRO=2=..=Feed Move=5,
System Variables Modified

System Variable Description

FIELD 12

Number of elements in lead move (only set if SUBFUNCT = 1 or 2)

SUBFUNCT

0 = Not a lead move


1 = Lead in move
2 = Lead out move

XMOVE

X Axis Motion

XYFEED

XY Axis Feed

YMOVE

Y Axis Motion

Edgecam User Guide

299

Wire Macro Reference

3 - MOVE ARC
Recommended Syntax
%MACRO=3=..=Circular Feed Move=5,
System Variables Modified

System Variable Description

RADIUS

Radius of Arc

XCENTRE

X Centre of Arc

XEND

X Arc End

XSTART

X Arc Start

XYFEED

XY Axis Feed

YCENTRE

Y Centre of Arc

YEND

Y Arc End

YSTART

Y Arc Start

Edgecam User Guide

300

Wire Macro Reference

5 - 2D PROFILE
Recommended Syntax
%MACRO=5=..=2D Profile=4,5,12,13,21,24,25,
System Variables Modified

System Variable Description

NONE
This cycle only supports %NOCYCLE. This means that the wire moves are redirected to the Feed (macro 2),
Rapid (macro 1), CLW (macro 53) and CCLW (macro 54) macros. Provision will have to made within the
redirected macros CLW and CCLW for control of the CNC code.
The syntax for the macro is:
%MACRO=5=..=2D Profile=4,5,12,13,21,24,25,
%NOCYCLE
%ENDM

Edgecam User Guide

301

Wire Macro Reference

6 - 2D DESTRUCT
Recommended Syntax
%MACRO=6=..=2D Destruct=4,5,12,16,
System Variables Modified

System Variable Description

NONE
This cycle only supports %NOCYCLE. This means that the wire moves are redirected to the Feed (macro 2),
Rapid (macro 1), CLW (macro 53) and CCLW(macro 54) macros. Provision will have to made within the
redirected macros CLW and CCLW for control of the CNC code.
The syntax for the macro is:
%MACRO=6=..=2D Destruct=4,5,12,16,
%NOCYCLE
%ENDM

Edgecam User Guide

302

Wire Macro Reference

15 - MACHINING CONDITIONS
Recommended Syntax
%MACRO=15=..=Machining Conditions=47,170,171,
System Variables Modified

System Variable Description

LOWERWIRE

Lower guide

UPPERWIRE

Upper guide

WIREDIAM

Wire Diameter

Edgecam User Guide

303

Wire Macro Reference

17 - MACHINE DESIGN
Recommended Syntax
%MACRO=17=..=Machine Design=5,12,21,47,101,177,
System Variables Modified

System Variable Description

COMP

Controller Radius Compensation

FIELD1

Lead in Angle

FEILD2

Lead in Radius

FIELD3

Lead in Length

FIELD4

Lead in Angle

FIELD5

Lead in Radius

FIELD6

Lead out Length

FIELD7

Stop Size

FIELD8

Constant Cut

FPASS

Number of Passes

LACECUT

Constant cut

LAST

Number of elements in the XPOINT array

OFFSET

Offset amount

PATHTRACE

Pathtrace Compensation

SUBFUNCT

Design Type
4 = Link Profile
5 = Taper Profile
6 = Transform Profile

TOLERANCE

Tolerance

XPOINT()

Variable, see Wire Erosion notes

XYFEED

XY Axis Feed

YPOINT()

Variable

ZPOINT()

Variable

Edgecam User Guide

304

Wire Macro Reference

22 - DWELL
Recommended Syntax
%MACRO=22=..=DWELL=27,
System Variables Modified

System Variable Description

DWELL

Dwell Time in Seconds

Edgecam User Guide

305

Wire Macro Reference

26 - CUT SUPPORT TAG


Recommended Syntax
%MACRO=26=..=Cut Support Tag=5,12,21,24,25,
System Variables Modified

System Variable Description

COMP

Controller Radius Compensation

FIELD1

Lead in Angle

FIELD2

Lead in Radius

FIELD3

Lead in Length

FIELD4

Lead in Angle

FIELD5

Lead in Radius

FIELD6

Lead out Length

OFFSET

Offset amount

PATHTRACE

Pathtrace Compensation

SUBFUNCT

Design type
4 = Link Profile
5 = Taper Profile
6 = Transformed Profile

TOLERANCE

Tolerance

XYFEED

XY Axis Feed

Edgecam User Guide

306

Wire Macro Reference

29 - COMPENSATION
Recommended Syntax
%MACRO=29=..=Compensation=
System Variables Modified

System Variable Description

COMP

Assigned as selected:
1 = None
2 = Left
3 = Right

Edgecam User Guide

307

Wire Macro Reference

32 - TRANSLATE
Recommended Syntax
%MACRO=32=..=Translate=43,44,14,26,37,21,
System Variables Modified

System Variable Description

PATHTRACE

Controller Canned Cycle Flag

REPEAT

Number of Repeats

SUBROUTINE

Subroutine Number

XINC

X Translation Value

YINC

Y Translation Value

The RESET macro is called on exit from this macro.

Edgecam User Guide

308

Wire Macro Reference

33 - ROTATE
Recommended Syntax
%MACRO=33=..=Rotate=1,2,14,26,24,37,21,
System Variables Modified

System Variable Description

ANGLE

Angle of Rotation

PATHTRACE

Controller Canned Cycle Flag

REPEAT

Number of Repeats

SUBROUTINE

Subroutine Number

XCENTRE

X Coord of Rotation

XSUB

X Coord of First Point

YCENTRE

Y Coord of Rotation

YSUB

Y Coord of First Point

The RESET macro is called on exit from this macro.

Edgecam User Guide

309

Wire Macro Reference

34 - MIRROR
Recommended Syntax
%MACRO=34=..=Mirror=1,2,14,26,21,
System Variables Modified

System Variable Description

PATHTRACE

Controller Canned Cycle Flag

SUBROUTINE

Subroutine Number

XEND

X Coord of Second Point

XSTART

X Coord of First Point

XSUB

X Coord of First Machining Position

YEND

Y Coord of Second Point

YSTART

Y Coord of First Point

YSUB

Y Coord of First Machining Position

The RESET macro is called on exit from this macro.

Edgecam User Guide

310

Wire Macro Reference

40 - MOVE HOME
Recommended Syntax
%MACRO=40=..=Rapid To Wire Home=
System Variables Modified

System Variable Description

XHOME

X Axis Motion

YHOME

Y Axis Motion

Edgecam User Guide

311

Wire Macro Reference

51 - START
Recommended Syntax
%MACRO=51=..=START System Macro
System Variables
Modified

System Variable Description

LOWERWIRE

Lower Wire Guide Position

UNIT

0 = Inches
1 = Millimetres

UPPERWIRE

Upper Wire Guide Position

UVPLANE

Upper Profile Level

XYPLANE

Lower Profile Level

CUSTOMERNAME

Retrieved from Edgecam licensing.

SERVERCODE

Retrieved from Edgecam licensing.

Pseudo Systems
APPEND = #

Create Secondary File Flag

CIRCLE = [1/0]

Single/Multi Quadrant Interpolation

DATE

String variable containing date at code generation time, using the format MM/DD/YY

UKDATE

String variable containing date at code generation time, using the format DD/MM/YY

DAY.MONTH.YEAR

Numeric variables that allow you to format the date according to your requirements

ENDSUB = 0

End of Subroutine Block Number

MACHINENAME

String variable containing code generator name.

MACRONAMEOP=0

No Debug output to CNC File

MACRONAMEOP=1

All Macro Executions output to CNC File

MACRONAMEOP=2

Macro Executions output only if MASK=0

NUMBLOCKS = #

Maximum Limit of Blocks

NUMCHARS = #

Maximum Limit of Characters

PARTNAME

String variable containing Edgecam partname.

SEQUENCENAME

String variable containing machining sequence name.

STARTSUB = 0

Start of Subroutine Block Number

TIME

String variable containing time at code generation time.

Edgecam User Guide

312

Wire Macro Reference

53 - CLW
Recommended Syntax
%MACRO=53=..=CLW System Macro
FIELD 12

Number of elements in lead move (only set if SUBFUNCT = 1 or 2)

SUBFUNCT

0 = Not a lead move


1 = Lead in move
2 = Lead out move

Edgecam User Guide

313

Wire Macro Reference

54 - CCLW
Recommended Syntax
%MACRO=54=..=CCLW System Macro
FIELD 12

Number of elements in lead move (only set if SUBFUNCT = 1 or 2)

SUBFUNCT

0 = Not a lead move


1 = Lead in move
2 = Lead out move

Edgecam User Guide

314

Wire Macro Reference

55 - SUBSTART
Recommended Syntax
%MACRO=55=..=SUBSTART System Macro
System Variables Modified

System Variable Description

SUBROUTINE

Subroutine Number

Edgecam User Guide

315

Wire Macro Reference

56 - SUBEND
Recommended Syntax
%MACRO=56=..=SUBEND System Macro
System Variables Modified

System Variable Description

SUBROUTINE

Subroutine Number

Edgecam User Guide

316

Wire Macro Reference

58 - END
Recommended Syntax
%MACRO=58=..=END System Macro

Edgecam User Guide

317

Wire Macro Reference

59 - SUBCALL
Recommended Syntax
%MACRO=59=..=SUBCALL System Macro
System Variables Modified

System Variable Description

SUBROUTINE

Subroutine Number

Edgecam User Guide

318

Wire Macro Reference

60 - RESET
Recommended Syntax
%MACRO=60=..=RESET System Macro
System Variables Modified

System Variable Description

PATHTRACE

0 = Controller Subroutines
1 = Subroutines expanded within Edgecam

SUBFUNCT

1 = Translate
2 = Rotate
3 = Mirror

The RESET macro is accessed after each manipulative macro call.

Edgecam User Guide

319

File Menu Commands in the Code Generator


Select Code Generator - Selects the Code Generator source file to be compiled.
Print - Sends the current file to the printer.
Print Preview - Shows how the current file would appear if sent to the printer.
Print Setup - Configures the printer setup.
Compile - Displays a dialog box containing the file compilation options. An input file is selected and the
filenames for all other options are automatically entered. These filenames default to the same name as the
input filename followed by the appropriate extension. The name can be re-specified by the user if required.

This option is applicable to the Code Generator Compiler only, and will be greyed out if you do not have a
licence.
Exit - Returns to the previous application.

Edgecam User Guide

320

View Menu Commands in the Code Generator


Toolbar - Shows/hides the Toolbar.
Status Bar - Shows/hides the Status bar.
Large Icons - Uses the larger of the two icon sets for the Code Generator's buttons.
Tool Tips - Allows command names to be displayed if you hold the cursor over a button.

Edgecam User Guide

321

Options Menu Commands in the Code Generator


Re-run - Regenerates the CNC code using the data files for the last code generation. This forces a recompilation of the Code Generator file if the date and time of the source is later that of the Code Generator.
Pause - Pauses\continues the active process. This lets you inspect the information displayed in the text box.
Use the horizontal and vertical scroll bars to move up and down the file.
Stop - Aborts the process.
Remove Unused Variables - Instructs the compiler to remove any duplicate or unused variables from the
source file (*.?xt)
Quick Compile - Forces a quicker compilation by displaying the minimum amount of feedback in the viewing
window.
Specify Output Filename - Selecting this Code Generator Compiler-only option displays a dialog box similar to
this after you click on the Compile button:

Enter a different name for the compiled Code Generator file. If this option is not selected, the source filename
will be used by default.

Edgecam User Guide

Potrebbero piacerti anche