Block Numbers

The block numbers in a CNC control program are an important guide and are always at the beginning of an NC block. The major part of a CNC program consists of successive NC blocks where the toolpaths for machining a workpiece are defined.

Because often changes need to be carried out, i.e. new NC blocks are inserted between two old ones, the definition of 'interval' between two NC blocks according to the expected number of NC blocks is an important decision that affects the size of the block numbers, and therefore their readability for the user. If the block number sequence is disturbed by many changes, a 'renumbering' might be required.

To configure renumbering and/or automatic block numbering, select Block numbers from the File types menu in the left tree of the Editor setup dialog, or click the Configure Block Numbering icon in the File Type menu within the Editor tab. The block number configuration dialog is shown below.

Block number configuration dialog.

Renumber Settings


Auto block numbering

Inserts line numbers automatically, according to the format described. If you make a new line (after the existing lines), the new line number will be governed by the preceding line number and the setting for Interval. If you insert a line in an existing program, the new line number will be midway between the preceding line and the following line.


Skip lines without block numbers

Check this field to skip lines without a block number when renumbering. The block numner sequence is continued on the next line with block number.


Renumber empty lines

Check this field to renumber empty lines - a single empty line or several consecutive empty lines.


Show quick setup

Check this field to show a 'Quick Setup' dialog when renumbering a program.

Quick block numbers setup dialog.

You can change the default values shown in the dialog (defined under 'Block format' in the Block numbers setup dialog) to fit your renumbering requirements and click OK.


Disable undo prompt for large files

When this field is not checked, you will be told when you are about to renumber a large file, which cannot be undone. If this is switched on, no such warning will appear.


Auto indent lines

Indents new lines. The indention is set at the same level as the line above.

Block Format



This field provides a list of available block number formats. Select a format from the drop-down list. I.e. for 4 digit block numbers and max. 9999, select format "0001".

This will not limit the number of digits in the line number. If you wish to limit the number of digits, you have to specify a maximum line number in the Restart every field.


Start with

Makes it possible to specify the starting value of the block number.


Restart every

Specify when the line number must restart. This number is equal to the maximum line number.

Example: To use line numbers from 0-9999, specify 9999 in this field. If no value is specified, the line number will increment until it reaches 100000000, before it restarts.



Use this drop-down list to select the interval by which the block number must increase for each block. Preset intervals are 1, 2, 5, 10, 20, 100, 1000 and Auto.

If you select one of the Auto ... options, the number selected is the maximum block number, and the interval will be selected to distribute the block numbers as evenly as feasible, within this maximum block number.

Example: For a CNC program of 482 NC blocks, select the option 'Auto 1000' for the interval. After clicking the button Renumber in the NC Functions toolbar Block Numbers, the highest calculated block number is N0964 (under 1000) and determines the best interval is 2.
On the other hand, for the same program with 'Auto 10000', the highest block number obtained is N4820 and the 'optimum interval' is 10.


Start from line

Specify the first line in the program that will be given a line number.



Use this field to specify if block numbers should skip lines.

Example: If you specify 2 in this field, only every 3rd line will be numbered.


Precede lines with

Here, you can enter a string that will be inserted before the line number. For ISO type machines, this is normally the letter 'N'.


Alternate block number character

Use this field to specify an alternate block number character.

Example: If the control uses both 'N' and ':' for block numbers, specify ':' in this field.


Spaces after block number

Use this field to specify the number of spaces to insert after the block number. To insert block numbers with a specific column width, specify a negative value.


From line

Specify the number of lines that should be skipped before the renumbering begins.


To line

Use this field to specify the maximum number of lines that should be renumbered.

If a positive number is written here, it specifies the last line to be renumbered, counted from the beginning of the program.

Example 1: If your CNC program starts with 4 comment lines and a program start line (with program start trigger and number, but without 'N'), only the first 10 NC blocks will be renumbered if you specify 15 in this field.

If a negative value (-N) is specified, the last N lines (counted from the end of the program) will not be renumbered.

Example 2: If you specify the value -2, and the last line of your CNC program (line containing the program end code M30) is followed by another line containing a special character (e.g. %), then only the last line is not renumbered.


Skip lines starting with

Defines that lines starting with a particular string and/or characters should be omitted, i.e. '%', 'O', '(', etc. Multiple strings can be specified using a comma ',' as separator. If you wish to omit lines beginning with a comma ',', specify ',,'.


Restart on lines starting with

Use this field to specify when the block numbers should be restarted.

Example: To renumber several programs in the same file, specify 'O' in this field, then the block numbers will be reset everytime an O-Number is encountered.


Skip lines containing

Here you can specify that lines containing a string and/or character should be omitted. Multiple strings can be specified using a comma ',' as separator.


Start renumbering from line containing

Use this field to specify a renumbering start trigger. If you specify a renumbering start trigger, renumbering will start from the first block containing the specified string. To start from the first block after the block containing the string, check the Start at next block option below.


Start at next block

Check this field to start renumbering from the block after the line containing the renumbering start trigger.

The Block numbers settings will only affect the selected file type.