Open navigation

Subroutine Format

Machine Attributes - Advanced Driver Settings - Subroutine Format

Subroutines (also called sub-programmes) are used, where applicable, to output blocks, thus minimising data output. If the device does not support subroutines, then the blocks are exploded and the geometry duplicated as necessary.

Subroutine Format

Subroutine Calling Format

This is the code used to call subroutines. If the machine you are configuring uses Q as the subroutine calling command, then adding Q%<p> to this line will call the sub-programme. %<p> is the Plotter Substitution Code for the subroutine programme number.

Subroutine Header Format

This is the code to be sent for a sub-programme header. This will typically contain information such as the subroutine number.

Subroutine Message

This is an optional message that will be output between the subroutine header and the start of the subroutine.

Subroutine Options

Number of Levels

Enter the maximum level to which subroutines can be nested for CNC type machines. Setting zero levels of subroutines will have the effect of suppressing the use of subroutines. Setting the number of levels of subroutines to a value greater than zero will enable the Create Top-Level Block option.

Subroutines at Start

This option causes the main programme to be output last, after all the sub-programmes.

Create Top-Level Block

Geometry not contained within a block is known as the top-level geometry. If the number of levels of subroutines is set to zero, this option will be disabled. Setting the number of levels of subroutines to a value greater than zero will move all top-level geometry into a subroutine and create a dummy main programme to call the top-level block. This option is used for controllers that require a main programme and subroutines, but you want the programme to be output in the same format as when not using subroutines. When selected, two further options will be enabled:

As Necessary - This is the default option. Top-level blocks will only be created if the design contains some top-level geometry.

Always - If the design does not contain any top-level geometry and only contains blocks, a top-level block will not normally be created. Selecting this option will force a top-level block regardless of the type of geometry contained within the design.

If the design contains a combination of blocks and top-level geometry, a number of different outputs can be generated depending on the number of levels of subroutines:

Number of levels of subroutines = 1. All the geometry contained in blocks will be exploded and added to the top-level block with the top-level geometry.

Number of levels of subroutines = 2. The top-level geometry is added to the top-level block, which then calls the second level of blocks.

Number Subroutines First

This option is only available when the Custom Driver is selected on the General page of the Plotter Machine.

If the first programme number was, for example, 20 and the programme output had two subroutines, the default numbering sequence for the programmes would be:

Main Programme = 20
Subroutine 1 = 21
Subroutine 2 = 22

When this option is selected the programmes would be numbered as follows:

Main Programme = 22
Subroutine 1 = 20
Subroutine 2 = 21

Maximum characters in subroutine name

Enter the maximum number of characters that are allowed for this machine. Leave it as zero if there is no limit.

See also: Plotter Substitution Codes

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.

You may like to read -