SMC_RoundPath (FB)

FUNCTION_BLOCK SMC_RoundPath

SMC_RoundPath rounds corners between adjacent elements by inserting circular arc segments. See SMC_SmoothPath for an alternative corner smoothing with splines.

The distance between the corner and the point at which the two adjacent elements are cut is the minimum of half the length of the first element, half the length of the second element and the sum of dRadius and D. If the sum of input variable dRadius and G-code word D is 0, then no rounding is done. If one of the two elements is a G0 element, then no rounding is done.

../../../_images/SMC_RoundPath.png

Details

All SMC_GEOINFO elements of the input structure SMC_OUTQUEUE are checked one after the other. The round-path functionality is executed for all elements between G52 and G50.

M-function at a rounded corner:

If there is a M-function at the corner that will be rounded then the M-function remains but is moved to the end of the rounded corner. This behavior is consistent with the behavior of SMC_SmoothPath .

H-function at a rounded corner:

If there is an H-function between the first cut point and the corner (1), the point is moved to the rounded path (1’). The distance to the start point remains the same. If there a H-function between the corner and the second cut point (3) the point is also moved to the rounded path (3’), so that the distance to the end point remains the same.

The position of the moved H-functions is limited so that they don’t cross the center of rounded path. Otherwise the order of the H-functions might change (2’, 4’).

../../../_images/SMC_RoundPath_2.png

Example

N000 G01 X10 Y0 F100
N010 G01 X10 Y10
N020 G52 D2 (rounding with distance 2 on)
N030 G01 X20 Y10
N040 G01 X20 Y0
N050 G01 X30 Y0 D5 (cut distance 5)
N060 G01 X30 Y10
N070 G01 X40 Y10
N080 G50 (rounding off)
N090 G01 X40 Y0
N100 G01 X50 Y0
../../../_images/SMC_RoundPath_3.png

The first rounded corner is the one after sentence N020 at position X20 Y10. The cut distance is changed from 2 to 5 in sentence N050 and is valid from there. Rounding is turned off at position X40 Y10.

A rounding element always uses the tool correction information (i.e. lengths and diameter) of the preceding element.

InOut:

Scope

Name

Type

Initial

Comment

Input

bExecute

BOOL

While TRUE, the function block is active

bAbort

BOOL

If TRUE, the current processing of this function block is aborted

bAppend

BOOL

As long as this input is set to FALSE, the DataOutQueue will be cleared at each reset. As long as it is set to TRUE, newly incoming data will be written to the end of DataOutQueue.

poqDataIn

POINTER TO SMC_OUTQUEUE

Input path queue

dRadius

LREAL

This input variable contains the value, which – added to the corresponding SmoothRadius-value of the SMC_GEOINFO object (G-code word D) – defines the (maximum) distance to a corner, at which the particular objects will be cut and replaced by an arc (see above). This value can be modified online. Thus it is possible to predefine offline (using the D-word) and to change online. Default: 0

dAngleTol

LREAL

0.001

This input prescribes the value of angle tolerance, up to which a path corner is not rounded.

nSizeOutQueue

UDINT

This variable contains the size of the data buffer, the list of SMC_GEOINFO structure objects will be written to. This buffer must be able to hold at least five SMC_GEOINFO objects. Otherwise, the function block will not execute any actions at all. Its size may be predefined, but may be modified later only during a reset. It is recommended to create the buffer as described by the example below:

ExampleBuf: Array[1..50] of SMC_GeoInfo

The correct buffer size will then be retrieved by use of the operator 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). The value may be predefined, but may be modified later on only during a reset.

Output

bDone

BOOL

This variable will be set to TRUE as soon as the input data from poqDataIn has been processed completely. Thereafter, the module will not perform any further actions until it gets reset. If input bExecute is FALSE, bDone will be reset to FALSE.

bBusy

BOOL

TRUE, while execution of function block is not finished

bError

BOOL

Signals, that an error has occurred within the function block

wErrorID

SMC_ERROR

Error identification

poqDataOut

POINTER TO SMC_OUTQUEUE

This output variable points on the SMC_OUTQUEUE structure, which manages the rounded SMC_GEOINFO objects.

Structure: