SMC_AvoidLoop (FB)ΒΆ
FUNCTION_BLOCK SMC_AvoidLoop
SMC_AvoidLoop
removes loops from the path.
It copies the input path, but cuts out the loops created by
self-intersections. The resulting output path is free of
self-intersections.

For a typical application see SMC_ToolRadiusCorr.
This function block needs to be activated/deactivated in the G-Code with G61/G60.
Note
The effectiveness and efficiency of SMC_AvoidLoop depend on the appropriate size of the input queue
poqDataIn
. A loop containing more objects than can be stored inpoqDataIn
is not detected. On the other hand, for each element, an intersection check is executed with all following elements of the queue. If the queue is large, completing these checks may take a long time.SMC_AvoidLoop does not support ellipses (G08/G09). An error is reported if an ellipse element is detected while loop avoidance is active.
SMC_AvoidLoop only works in 2.5D mode (see G15). An error is reported if elements with full 3D mode (such as G10 elements) are detected while loop avoidance is active.
- InOut:
Scope
Name
Type
Comment
Input
bExecute
BOOL
Execution starts on the rising edge.
bAbort
BOOL
If
TRUE
, the current processing of this function block is abortedbAppend
BOOL
As long as this input remains
FALSE
,poqDataOut
is cleared at each reset. As long as it remainsTRUE
, newly incoming data is written to the end ofpoqDataOut
.poqDataIn
POINTER TO SMC_OUTQUEUE
This variable points to the SMC_OUTQUEUE structure which contains the SMC_GEOINFO objects of the path. Typically it points on the output
poqDataOut
of the preceding function block (e.g. the SMC_NCInterpreter ).nSizeOutQueue
UDINT
This variable contains the size of the data buffer in bytes. This buffer must be able to hold at least five SMC_GEOINFO objects. It is recommended to create the buffer as described by the example below.
ExampleBuf: Array[1..50] of SMC_GeoInfo
The appropriate buffer size can then be computed using
SIZEOF(ExampleBuf)
.pbyBufferOutQueue
POINTER TO ARRAY [0..0] OF SMC_GEOINFO
This input must point to the first byte of the memory area that is allocated for the SMC_OUTQUEUE structure. This area must be at least as big as defined in
nSizeOutQueue
. Typically the allocation of the memory buffer is done in the declaration part of the IEC-program by defining an array of SMC_GEOINFO e.g.BUF: ARRAY[1..50] OF SMC_GEOINFO
; for a buffer that can store 50 path elements).Output
bDone
BOOL
Set if the entire path has been processed
bBusy
BOOL
TRUE
, while execution of function block is not finishedbError
BOOL
Signals, that an error has occurred within the function block
wErrorID
SMC_ERROR
Error identification
poqDataOut
POINTER TO SMC_OUTQUEUE
This variable points to a SMC_OUTQUEUE structure, which manages the SMC_GEOINFO objects of the output path.
iStatus
This enum variable shows the current state of the function block.
Structure: