SMC_ReadNCFromStream (FB)¶
FUNCTION_BLOCK SMC_ReadNCFromStream
SMC_ReadNCFromStream
can read an NC-ASCII-file from a stream
in order to make it available for the SMC_NCInterpreter.
Thus, an NC program can be read in and interpreted at runtime.
- InOut:
Scope
Name
Type
Initial
Comment
Input
bExecute
BOOL
Rising edge: starts execution.
bAppend
BOOL
If
TRUE`
, no default values are added (like G17 for 3D mode). Intended to be used together with the inputbAppend
of SMC_NCInterpreter. Note: must not be TRUE for the first rising edge ofbExecute
.bAbort
BOOL
If
TRUE
, the current processing of this function block is abortedaStream
ARRAY [0..SMC_CNC_LibParams.MAX_SUBPROGRAM_NESTING_DEPTH] OF SMC_ITextStream
An array of streams. aStream[0] has to contain the main program. It must be open and ready for reading. The streams 1 .. N-1 are (only) used to process subprogram calls. The streams must be of the correct type for the implementation of
lookupCNCProgram
.lookupCNCProgram
An object that looks up subprograms by name. Used to open the streams for the subprograms (
aSubStreams
).pvl
POINTER TO SMC_VARLIST
A variable list defining type and address for each variable that can be used from the g-code. If there are no variables in the g-code, this input is not 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. A non-negative value is expected. 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.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 ‘)’.
For more control over the delimiters, call the method SMC_ReadNCFromStream.SetDelimiters before calling the main method of this FB. If SetDelimiters is called, this input is ignored.
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.pCustomFunTable
POINTER TO SMC_NC_GFunctionTable
Allows to define custom functions that can be used in G-Code expressions. If there are no custom G-Code functions, this input is null.
aTokenModifier
ARRAY [0..SMC_CNC_LibParams.MAX_SUBPROGRAM_NESTING_DEPTH] OF SMC_ITokenModifier
Optional modifier function blocks that can change the tokens on the fly. This can be used to translate between G-Code dialects. Leave 0 if not needed. Otherwise, set all members of the array to valid function block instances.
aSentenceModifier
ARRAY [0..SMC_CNC_LibParams.MAX_SUBPROGRAM_NESTING_DEPTH] OF SMC_IGSentenceModifier
Optional modifier function blocks that can change the g-code sentences on the fly. This can be used to translate between G-Code dialects. Leave 0 if not needed. Otherwise, set all members of the array to valid function block instances.
Output
bBusy
BOOL
TRUE
while execution of function block is not finishedbError
BOOL
TRUE
signals that an error has occurred within the function block.ErrorID
SMC_ERROR
Error identification
errorPos
The source-position where an error has been detected.
ErrorProgramName
STRING
The name of the program where an error has been detected
nActiveChain
UDINT
The currently active parsing chain, 0 <= nActiveChain < NUM_PARSER_CHAINS.
Inout
sentences
Out: The output sentence queue that can be fed into SMC_NCInterpreter.
Methods:
Structure: