SMC_GCodeViewer (FB)

 

FUNCTION_BLOCK SMC_GCodeViewer

This function block can be used in combination with the SMC_NCDe­coder. It gathers and stores the textual representation (G-code) of the particular SMC_GEOINFO objects and dumps those as an ARRAY OF STRING, which e.g. via a table can be displayed in a visualization. Via an entry, typically connected with the interpolator output iActObject­SourceNo, the module gets information on which line already has been processed and then deletes this line. So an visual display element for the current G-code can be created.

..note:: that the output of the function block does not exactly match

with the G-code stored in the editor or in the text file, because e.g. no blank lines or comments will be copied. Also, variables will already be replaced with their value.

The function block is called in the same task as SMC_NCDecoder.

It must get an sufficient buffer. The number of SMC_GCODEVIEWER_­DATA objects at least must be as big as the sum of all SMC_GEOINFO objects which are located in the buffers of the SMC_NCDecoder module and the path-preprocessing modules.

InOut:

Scope

Name

Type

Comment

Inout

GCodeText

SMC_GCODE_TEXT

Data source connected to the eponymous output of the SMC_NCDecoder module.

Input

bEnable

BOOL

A rising edge at this entry will start the execution of the function block.

iActObjectSourceNo

DINT

Number of line currently processed by interpolator

uiNumberOfBufferEntries

UINT

Size of array that is passed by pBuffer

pBuffer

POINTER TO SMC_GCODEVIEWER_DATA

Address of array allocated as buffer for the function block

Output

bError

BOOL

Signals, that an error has occurred within the function block

bBusy

BOOL

TRUE, if execution of function block is not finished

wErrorID

SMC_ERROR

Error identification

asGCode

ARRAY [0..c_uiLines] OF STRING

Currently active G-code lines