FUNCTION_BLOCK SMC_RoundPath
The SMC_RoundPath function block is very similar to the SMC_SmoothPath module. It rounds edges, which arises at the junction of two objects, by circular arcs.
The distance between the edge and the point at which the two adjacent objects are to be cut, is computed by half the length of the first object, half the length of the second object and the sum (from dRadius and D). From these three variables, the minimum is formed and assigned as cut point. Thus, the objects are cut by at most half the length of the shorter object. In addition, if the sum of input variable dRadius and G-code word is 0, then no rounding is done.
Proceeding of function block ``SMC_RoundPath``:
All SMC_GEOINFO objects that are found in the input structure SMC_OUTQUEUE will be checked one after the other. The round-path functionality will be executed for all objects, located between instructions 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 a H-function bewtween 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').
Example
N000 G01 X10 Y0 F100
N010 G01 X10 Y10
N020 G52 D2 (round-path functionality with angle distance 2 on)
N030 G01 X20 Y10
N040 G01 X20 Y0
N050 G01 X30 Y0 D5 (angle distance 5)
N060 G01 X30 Y10
N070 G01 X40 Y10
N080 G50 (round-path functionality off)
N090 G01 X40 Y0
N100 G01 X50 Y0
The figure shows the turn on of the round-path functionality in sentence 20. The first rounded angle is the next one at position 20/10. The angle distance is changed in sentence 50 and is valid from there. The round-path functionality is turned off at position 40/10.
A rounding segment always contains the same tool correction information (i.e. lengths and diameter) as the first of the two segments inbetween of which it is inserted.
InOut:
Scope |
Name |
Type |
Initial |
Comment |
Input |
bExecute |
BOOL |
FALSE |
While TRUE, the function block is active |
bAbort |
BOOL |
FALSE |
If TRUE, the current processing of this function block is aborted |
|
bAppend |
BOOL |
FALSE |
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 |
NULL |
Input path queue |
|
dRadius |
LREAL |
0 |
This input variable contains the value, which – added to the corresponding ToolRadius-value of the SMC_GEOINFO object (G-code parameter D) – defines the (minimum) distance to an angle, 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 (by the SMC_GEOINFO structure) 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 |
0 |
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 |
NULL |
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 |
FALSE |
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 |
FALSE |
TRUE, while execution of function block is not finished |
|
bError |
BOOL |
FALSE |
Signals, that an error has occurred within the function block |
|
wErrorID |
SMC_ERROR |
SMC_NO_ERROR |
Error identification |
|
poqDataOut |
POINTER TO SMC_OUTQUEUE |
NULL |
This output variable points on the SMC_OUTQUEUE structure, which manages the rounded SMC_GEOINFO objects. |