Contents
- Index
- Previous
- Next
CNC File Specification
However NC code for WELturn is created, it is essential that the code is correctly formatted otherwise WELturn will not be able to interpret it.
For a CNC file to be recognised and processed by WELturn it must have the following characteristics:
1a. For metric (millimetre) code files, the first line of the file must consist only of a percent sign (%) in the first column, nothing else.
1b. For Imperial (inch) code files, the first line of the file must consist only of a percent sign in the first column immediately followed by a letter "eye" (%I or %i), nothing else (it is not case-sensitive: the letter can be i or I).
The last line of all code files must consist only of a percent sign (%) in the first column, nothing else.
2. Lines starting with an asterisk (*) are treated as comment lines.
3. Code lines may include an apostrophe ('). The apostrophe and anything following it on a given line are treated as a comment and discarded.
4. Code lines must start with an N. The N is the first field in a line of code.
5. Normally there will be a line number immediately following the N. This number is not used by WELturn but is helpful to people reading the code. It is suggested you increment the line numbers in tens to allow for inevitable insertions when code is manually prepared.
6. Any amount (including none) of white space, which may include punctuation marks such as a comma, may be used to separate the fields on a line.
7. The second field can be either:
one of the following linear G-codes
G0 (rapid move)
G1 (move at feed rate)
G2 (clockwise arc )
G3 (counter-clockwise arc)
(Note: clockwise and counter-clockwise are as viewed from above on a lathe with a rear tool post and in all AlphaCAM drawings, or as viewed from below on a lathe with a front tool post, eg Emco lathes) See Arcs: The Rules for Coding Them
G4 (dwell)
G33 (threading - single pass)
or one of the following cycles
G78 Threading Cycle
G84 Longitudinal Turning Cycle
G86 Grooving Cycle
G88 Facing Cycle
these Canned Cycles are explained below and illustrated elsewhere.
or one of the following special codes
Tn (change to Tool Number n where n is in the range 1 to 8 (11 for machines with an auto toolchange turret) - see below
Sxxx (set spindle speed to xxx revs/min)
8. Each G-code is followed by further fields giving, as appropriate, the X, Z , R, F and H values for the command. The meanings of these fields varies according to the G code.
All G codes, except G4, have X and Z fields: the co-ordinates of the end of the linear movement or cycle.
For G4 there is only an X field. Its value is the duration of the dwell in seconds.
For G1, G2, G3, G84, G86 and G88, F is the cutting feed rate (mm/min). G0 does not have a declared F value: it takes the default rapid traverse rate declared in File - Settings.
For G33 and G78, F is the thread pitch.
For G78, G84, and G88, H is the depth of cut.
For G2 and G3, R is the radius of the arc.
9. With WELturn, a parameter value remains the same (ie. it is modal) until a new value is declared. Therefore, it is not necessary to repeat a parameter value that remains unchanged from the previous command - but a code listing is easier to read if it is.
10. Measurements can be in either millimetres or inches. They may be positive or negative and include as many decimal places as desired.
X and Z measurements must always be absolute measurements from the X0, Z0 origin at the centre of the right-hand end of the part. Relative or incremental measurements are not allowed.
The cutting tools used by WELturn for the real-time graphic display are the from the Plansee Tizit range as supplied with these Emco lathes:
1. Right Hand
2. Left Hand
3. Neutral
4. Threading
5. Plunge
6. Parting
7. Internal Threading (minimum bore diameter 14mm)
8. Boring (minimum bore diameter 14mm)
9 to 11 various drills (auto toolchange turret only)
(See pictures of these tools in Defining Tools in AlphaCAM.)
The following examples are fragments of code from actual jobs and illustrate the code formatting requirements and commenting options:
Example 1
%
* % is the start and end of code marker for a metric file. Put nothing else on the line with the % sign.
*Lathe - Emco Compact 5PC
*Date - 03 AUG 00 Note: all lines beginning with * are information
*Designer - PETER about the job. Have none or as many as are
*Teacher - FRED useful. WELturn looks for the BILLET
*Teaching Group - 4Z Diameter line and uses the size given for the
*Name of Part - CURVES billet in the real-time graphics screen. If that
*Material - ALUMINIUM line is absent, WELturn calculates a suitable
*BILLET Diameter - 30 billet size.
*Length of PART - 60
*Length of BILLET - 85
*Tailstock Required?- NO
*Pre-drilled hole diameter -
*Pre-drilled hole depth -
'DIAMETER ROUGH RIGHT HAND TOOL
N10 T1
N20 S2400
N30 G0 X30 Z60
N50 G1 X28 Z-56.257 F100
N60 G2 X29.065 Z-58.478 R68.245 F100
N1080 G0 X30 Z60
N1090 T1 'Select tool 1 (right hand) - Always make this the last line of the code.
%
'The % sign is the end of file marker
Example 2
%
* % is the start and end of code marker for a metric file. Put nothing else on the line with the % sign.
*Lathe - Emco Compact 5PC
*Date - 03 AUG 00
*Designer - PETER
*Name of Part - M10 THREAD
*Material - BRASS
*BILLET Diameter - 15.8
*Length of PART - 26
*Length of BILLET - 41
'FACE OFF: RIGHT HAND TOOL
N10 T1
N20 S2400 'Set spindle speed
N30 G0 X30 Z30 'Tool change position
N50 G1 X-0.8 Z-0.5 F100
N690 G0 X30 Z30 'Go to tool change position
'DIAMETER GROOVING: PARTING TOOL
N700 T6 'Select tool 6
N710 S2400 'Set speed
N720 G0 X10.714 Z-14.493
N730 G1 X8.714 Z-14.493 F100
N1040 G0 X30 Z30
'THREADING: USE TOOL 4
N1050 T4 'Select tool 4
N1060 S240 'Set spindle speed
N1070 G0 X10.92 Z0.5
N1080 G0 X9.418 Z0.5
N1090 G33 X9.418 Z-16 F1.5
N1880 G0 X30 Z30
'PART-OFF: TOOL 7 PARTING
N1890 T7
N1900 S2400
N1910 G0 X17.112 Z-26
N1920 G1 X-0.02 Z-26 F32
N1930 G0 X17.112 Z-26
N1940 G0 X30 Z30
N1950 T1 'Select tool 1 (right hand) - Always make this the last line of the code.
%
'The % sign is the end of file marker
Example 3
%i
* %i is the start of code marker for an inches file. Put nothing else on this line. The end of code marker is a % sign in the first column.
*Name of Part - M10 thread: manually coded example
*Material - Brass
*Length of BILLET - 41
*BILLET Diameter - 15.8
*Length of PART - 26
N10 T1
N20 S2400
N30 G0 X1.25 Z2.5
'FACING CYCLE
N40 G0 X0.624 Z0.04
N50 G88 X-0.016 Z-0.035 F4 H0.02
N60 G0 X-0.016 Z-0.031
N70 G0 X1.25 Z2.5
N80 T1
%
'The % sign is the end of file marker
Where to Save Code Files
When you wish to turn a part, WELturn expects to find code files either in the folder C:\WELturn\TurnData or on a diskette in drive A.
We suggest you always save code files in the folder C:\WELturn\TurnData The reason for this is that, provided FILE - SETTINGS - RETAIN CALCULATED LATHE STEPS has been checked, WELturn will always save, in this folder, the machining information it has calculated from the code file. This speeds up subsequent access to the file, provided that the code and all other parameters are unchanged. If a code file is accessed directly from drive A, WELturn never saves the machining information which it calculates as there is a risk that there will not be enough space on the diskette for these data.
If a code file is saved on a diskette in drive A or in any other location on any other drive, use FILE - IMPORT/EXPORT to copy the file to C:\WELturn\TurnData
An Example of Manually Created NC Code
Arcs: The Rules for Coding Them
CAD Software as an Aid to NC Code Preparation
Canned Cycles
Feed Rates
Inches or Millimetres
Manually Prepared Code
Tool Tip Radius Compensation