4.5 Creating and Writing Programs
Organization of an NC program in ISO format
A part program consists of a series of program blocks. The figure at right illustrates the elements of a block.
The TNC numbers the blocks of a part program automatically depending on MP7220. MP7220 defines the block number increment.
The first block of a program is identified by %, the program name and the active unit of measure (G70/G71).
The subsequent blocks contain information on:
nThe workpiece blank nTool definitions, tool calls
nFeed rates and spindle speeds, as well as nPath contours, cycles and other functions
The last block of a program is identified by N99999999 %, the program name and the active unit of measure (G70/G71).
Define blank form: G30/G31
Immediately after initiating a new program, you define a cuboid workpiece blank. This definition is needed for the TNC’s graphic simulation feature. The sides of the workpiece blank lie parallel to the X, Y and Z axes and can be up to 100 000 mm long. The blank form is defined by two of its corner points:
nMIN point G30: the smallest X, Y and Z coordinates of the blank form, entered as absolute values.
nMAX point G31: the largest X, Y and Z coordinates of the blank form, entered as absolute or incremental values (with G91).
N10 G00 G40 X+10 Y+5 F100 M3 *
Block number
Path function Words
Blocks
You only need to define the blank form if you wish to run a graphic test for the program!
4.5 Cr eating and W riting Pr ogr ams
Creating a new part program
You always enter a part program in the Programming and Editing mode of operation:
Select the Programming and Editing mode of operation.
To call the file manager, press the PGM MGT key.
Select the directory in which you wish to store the new program:
Enter the new program name and confirm your entry with the ENT key.
To select the unit of measure, press the MM or INCH soft key. The TNC switches the screen layout and initiates the dialog for defining the blank form.
Set the spindle axis (use the default setting G17 = Z or, if required, select a different spindle axis using the soft key) and confirm with the ENT key.
Enter in sequence the X, Y and Z coordinates of the MIN point.
Define absolute/incremental input; can be defined separately for each coordinate.
FILE NAME = OLD.H
SPINDLE AXIS?
COORDINATES ?
COORDINATES ? 0
0 -40
100 4 Programming: Fundamentals of NC, File Management, Programming Aids, Pallet Management
4.5 Cr eating and W riting Pr ogr ams
Enter in sequence the X, Y and Z coordinates of the MAX point and confirm each of your entries with the ENT key.
Example: Display the blank form in the NC program
The TNC automatically generates the first and last blocks of the program.
COORDINATES ? 100
100 0
%NEW G71 * Program begin, name, unit of measure
N10 G30 G17 X+0 Y+0 Z-40 * Spindle axis, MIN point coordinates
N20 G31 G90 X+100 Y+100 Z+0 * MAX point coordinates
N9999999 %NEW G71 * Program end, name, unit of measure
If you do not wish to define a blank form, cancel the dialog at Spindle axis Z — XY plane by pressing the DEL key.
The TNC can display the graphics only if the shortest side is at least 50 µm long and the longest side is no longer than 99 999.999 mm.
4.5 Cr eating and W riting Pr ogr ams
Programming tool movements
To program a block, select an ISO function key on the alphabetic keyboard. You can also use the gray contouring keys to get the corresponding G code.
Example of a positioning block
Start block.
Enter the target coordinate for the X axis.
Enter the target coordinate for the Y axis, and go to the next question with ENT.
Select tool movement without radius compensation:
Confirm with the ENT key or
To move the tool to the left or to the right of the contour, select function G41 (to the left) or G42 (to the right) by soft key.
Enter a feed rate of 750 mm/min for this path contour and confirm with the ENT key.
Enter the desired miscellaneous function (e.g. M3 Spindle ON) and press the END key to terminate and save the block.
Select the miscellaneous function the TNC displays in the soft-key row.
The program-block window displays the following line:
You only need to make sure that capitalization is active.
COORDINATES ?
PATH OF THE CUTTER CENTER
FEED RATE ? F=
MISCELLANEOUS FUNCTION M?
1
10
5
40
750
3
102 4 Programming: Fundamentals of NC, File Management, Programming Aids, Pallet Management
4.5 Cr eating and W riting Pr ogr ams
Actual position capture
The TNC enables you to transfer the current tool position into the program, for example during
nPositioning-block programming.
nCycle programming.
nTool definition with function G99.
To transfer the correct position values, proceed as follows:
UUU
UPlace the input box at the position in the block where you want to insert a position value.
U U U
USelect the actual position capture function: In the soft-key row the TNC displays the axes whose positions can be transferred.
U U U
USelect the axis: The TNC writes the current position of the selected axis into the active input box.
In the working plane the TNC always captures the coordinates of the tool center, even though tool radius compensation is active.
In the tool axis the TNC always captures the coordinates of the tool tip and thus always takes the active tool length compensation into account.
4.5 Cr eating and W riting Pr ogr ams
Editing a program
While you are creating or editing a part program, you can select any desired line in the program or individual words in a block with the arrow keys or the soft keys:
Function Soft key/key
Go to previous page
Go to next page
Go to beginning of program
Go to end of program
Change the position of the current block on the screen: Press this soft key to display additional program blocks that are programmed before the current block.
Change the position of the current block on the screen: Press this soft key to display additional program blocks that are programmed after the current block.
Move from one block to the next
Select individual words in a block
Function Soft key/key
Set the selected word to zero
Erase an incorrect number
Clear a (non-blinking) error message
Delete the selected word
Delete the selected block
Insert the block that was last edited or deleted
104 4 Programming: Fundamentals of NC, File Management, Programming Aids, Pallet Management
4.5 Cr eating and W riting Pr ogr ams
Inserting blocks at any desired location
UUU
USelect the block after which you want to insert a new block and initiate the dialog.
Editing and inserting words
UUU
USelect a word in a block and overwrite it with the new one. The plain-language dialog is available while the word is highlighted.
U UU
UTo accept the change, press the END key.
If you want to insert a word, press the horizontal arrow key repeatedly until the desired dialog appears. You can then enter the desired value.
Looking for the same words in different blocks For this function, set the AUTO DRAW soft key to OFF.
To select a word in a block, press the arrow keys repeatedly until the highlight is on the desired word.
Select a block with the arrow keys.
The word that is highlighted in the new block is the same as the one you selected previously.
4.5 Cr eating and W riting Pr ogr ams
Marking, copying, deleting and inserting program sections The TNC provides certain functions for copying program sections within an NC program or into another NC program—see the table below.
To copy a program section, proceed as follows:
U U U
USelect the soft-key row using the marking function.
U U U
USelect the first (last) block of the section you wish to copy.
UU
UUTo mark the first (last) block: Press the SELECT BLOCK soft key. The TNC then highlights the first character of the block and
superimposes the soft key CANCEL SELECTION.
U U U
UMove the highlight to the last (first) block of the program section you wish to copy or delete. The TNC shows the marked blocks in a different color. You can end the marking function at any time by pressing the CANCEL SELECTION soft key.
U U U
UTo copy the selected program section: Press the COPY BLOCK soft key, and to delete the selected section: Press the DELETE BLOCK soft key. The TNC stores the selected block.
U U U
UUsing the arrow keys, select the block after which you wish to insert the copied (deleted) program section.
U U U
UTo insert the block, press the INSERT BLOCK soft key. For reasons of clarity, the text you have inserted remains highlighted.
U U U
UTo end the marking function, press the CANCEL SELECTION soft key.
To insert the section into another program, select the corresponding program using the File Manager and then mark the block after which you wish to insert the copied block.
Function Soft key
Switch marking function on
Switch marking function off
Delete marked block
Insert block that is stored in the buffer memory
Copy marked block
106 4 Programming: Fundamentals of NC, File Management, Programming Aids, Pallet Management
4.5 Cr eating and W riting Pr ogr ams
Changing the block number increment
If you have deleted, moved or added program sections, you can have the TNC renumber the blocks by pressing the ORDER BLOCK NUMBERS soft key:
UU
UUTo renumber the blocks, press the ORDER BLOCK NUMBERS soft key. The TNC superimposes a window where you can enter the block number increment.
U U U
UEnter the desired block number increment and confirm your entry with the ENT key. The TNC renumbers the complete program.
When the TNC inserts a new NC block, it uses the block number increment that is defined in MP7220.
4.5 Cr eating and W riting Pr ogr ams
The TNC search function
With the search function of the TNC, you can search for any text within a program and replace it by a new text, if required.
Searching for texts
UU
UUIf required, select the block containing the word you wish to find.
U U U
USelect the search function: The TNC superimposes the search window and displays the available search functions in the soft-key row (see table of search functions).
U U U
UEnter the text to be searched for. Please note that the search is case-sensitive.
U U U
UStart the search process: The TNC displays the available search options in the soft-key row (see the table of search options on the next page).
U U U
UIf required, change the search options.
U U U
UStart the search process: The TNC moves to the next block containing the text you are searching for.
U U U
URepeat the search process: The TNC moves to the next block containing the text you are searching for.
UU
UUEnd the search function.
Search functions Soft key
Show the superimposed window containing the last search items. Use the arrow keys to select a search item and confirm with the ENT key.
Show the superimposed window containing possible search items of the current block. Use the arrow keys to select a search item and confirm with the ENT key.
Show the superimposed window containing a selection of the most important NC functions.
Use the arrow keys to select a search item and confirm with the ENT key.
Activate the Find/Replace function.
40
108 4 Programming: Fundamentals of NC, File Management, Programming Aids, Pallet Management
4.5 Cr eating and W riting Pr ogr ams
Find/Replace any text
U UU
UIf required, select the block containing the word you wish to find.
U U U
USelect the Search function: The TNC superimposes the search window and displays the available search functions in the soft-key row.
U U U
UActivate the Replace function: The TNC superimposes a window for entering the text to be inserted.
UU
UUEnter the text to be searched for. Please note that the search is case-sensitive. Then confirm with the ENT key.
UU
UUEnter the text to be inserted. Please note that the entry is case-sensitive.
U U U
UStart the search process: The TNC displays the available search options in the soft-key row (see the table of search options).
U U U
UIf required, change the search options.
UU
UUStart the search process: The TNC moves to the next occurrence of the text you are searching for.
UU
UUIf you wish to replace the text and then move to the next position where the text was found, press the REPLACE soft key. If you do not want to replace the text, but move to the next position where the text was found, press the DO NOT REPLACE soft key.
UU
UUEnd the search function.
Search options Soft key
Define the search direction.
Define the end of the search: With COMPLETE, the search starts at the current block and is continued until the current block is reached again.
Start a new search.
02
03