SMC_ReadNCFile2 (FB)

FUNCTION_BLOCK SMC_ReadNCFile2

SMC_ReadNCFile2 can read a NC-ASCII-file from the file system of the controller in order to make it available for the SMC_NCInterpreter. Thus, a NC program can be read in and interpreted at runtime.

InOut:

Scope

Name

Type

Initial

Comment

Input

bExecute

BOOL

Rising edge: starts execution.

sFileName

STRING(255)

File path of the file containing the g-code.

pvl

POINTER TO SMC_VARLIST

The variable list defines a the type and address for each variable that can be used from the g-code. If there aren't variables in the g-code, this input isn't used.

fDefaultVel

LREAL

Default velocity; used if the velocity (F-word) is not specified inside the CNC file. Note: only applies to the main program, not to subprograms.

fDefaultAccel

LREAL

Default acceleration; used if acceleration (E+ word) is not specified inside the CNC file Note: only applies to the main program, not to subprograms.

fDefaultDecel

LREAL

Default deceleration (E- word); used if deceleration is not specified inside the CNC file Note: only applies to the main program, not to subprograms.

fDefaultVelFF

LREAL

Default velocity for fast forward (G0), FF word. It is used if no velocity is specified inside the CNC file. Note: only applies to the main program, not to subprograms.

fDefaultAccelFF

LREAL

Default acceleration for fast forward (G0), EF+ word. It is used if no acceleration is specified inside the CNC file. Note: only applies to the main program, not to subprograms.

fDefaultDecelFF

LREAL

Default deceleration for fast forward (G0), EF- word. A non-negative value is expected. It is used if no deceleration is specified inside the CNC file. Note: only applies to the main program, not to subprograms.

b3DMode

BOOL

TRUE

If TRUE, a G17 command (activation of 3D-mode) is executed implicitly. Note: only applies to the main program, not to subprograms.

bStepSuppress

BOOL

When this input is TRUE, lines of the CNC program starting with ‚/’ will be ignored. Otherwise they will be processed.

aSubProgramDirs

ARRAY [0..4] OF STRING(174)

An array of up to 5 directories where subprograms are searched. For a subprogram with name "SUB", the file "sub.cnc" (lower-case) is searched in each of the given directories, starting with directory aSubProgramDirs[0], in ascending order. The first match is used. The first empty directory name ends the search.

bParenthesesAsComments

BOOL

TRUE

Usually, parentheses in g-code are treated as multi-line comments. If bParenthesesAsComments is set to FALSE, however, parentheses can be used in the usual ways to group expressions ('(a+b)*c') and for subprogram calls ('N10 sub(17)') in g-code. Multi-line comments can be started with '(' and end with ')'.

Note

Regardless of the value of this input, it is always possible to use curly braces '{}' to group expressions and for subprogram calls.

bDisableJumpBuffer

BOOL

This input, if TRUE, disables an internal jump buffer that is used to improve performance of g-code processing if jumps (G20) are used.

Output

bBusy

BOOL

TRUE while execution of function block is not finished

bError

BOOL

TRUE signals that an error has occurred within the function block.

ErrorID

SMC_ERROR

Error identification

errorPos

SMC_NC_SourcePosition

The source-position where an error has been detected.

ErrorProgramName

STRING

The name of the program where an error has been detected

sentences

SMC_GSentenceQueue

The output sentence queue that can be fed into SMC_NCInterpreter.

adwFileSize

ARRAY [0..(NUM_PARSER_CHAINS - 1)] OF DWORD

Size of the file in bytes.

adwPos

ARRAY [0..(NUM_PARSER_CHAINS - 1)] OF DWORD

Current Position of the cursor in the file.