SMC_ReadNCFile (FB)¶
FUNCTION_BLOCK SMC_ReadNCFile
SMC_ReadNCFile
can read a NC-ASCII-file from the file system of
the controller in order to make it available for the SMC_NCDecoder.
Thus, a NC program can be read in and decoded at runtime.
Note
This function block has been superseeded by SMC_ReadNCFile2 and is kept only for compatibility. It is recommended to use SMC_ReadNCFile2, which has additional features like mathematical expressions or sub programs in g-code
- InOut:
Scope
Name
Type
Initial
Comment
Input
bExecute
BOOL
Rising edge: Starts execution. While
TRUE
, the function block is active.sFileName
STRING(255)
‘’
File path
pvl
POINTER TO SMC_VARLIST
If there aren’t variables in the CNC programm, this input isn’t set. SMC_VARLIST
pBuffer
POINTER TO BYTE
Pointer on a sufficiently large, free data area (buffer) that is allocated in the IEC application. It is strongly recommended to allocate the buffer as
ARRAY[0..x] OF |ioSMC_GCODE_WORD|
in order to make sure to have a correct data alignment. A definition ofARRAY[0..x] OF BYTE
may lead to a misaligned data access on some platforms.dwBufferSize
DWORD
Size of the buffer in byte
fDefaultVel
LREAL
Default velocity; used if velocity is not specified inside the CNC file.
fDefaultAccel
LREAL
Default acceleration; used if acceleration is not specified inside the CNC file
fDefaultDecel
LREAL
Default deceleration used if deceleration is not specified inside the CNC file
fDefaultVelFF
LREAL
Default velocity for fast forward (G0), FF word. It is used if no velocity is specified inside the CNC file.
fDefaultAccelFF
LREAL
Default acceleration for fast forward (G0), EF+ word. It is used if no acceleration is specified inside the CNC file.
fDefaultDecelFF
LREAL
Default deceleration for fast forward (G0), EF- word. A non- negative value is expected used if no deceleration is specified inside the CNC file.
b3DMode
BOOL
If
TRUE
, a G17 command (activation 3D-mode) is executed implicitly.pStringBuffer
POINTER TO SMC_StringBuffer
Pointer to an object of type SMC_StringBuffer. This object is used to store strings that are defined in the G-code program in order to write them to variables using G36&37. If the pointer is not set (0) and string constants are used in the G-code program, an error will be generated.(
SMC_RNCF_NO_STRINGBUFFER
).bEnableSyntaxChecks
BOOL
Turns on syntax checks that will detect invalid G-code and stop with an error in this case
Output
bDone
BOOL
TRUE
if parameter is availablebBusy
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,
SMC_ERROR
bExecuteDecoder
BOOL
Signal for triggering the input Execute of the SMC_NCDecoder module.
ncprog
STRUCT(nElements := 0)
CNC program, input of the succeeding SMC_NCDecoder module.
dwFileSize
DWORD
Size of the file in bytes.
dwPos
DWORD
Current Position of the cursor in the file.