# Spline Interpolation

## transBSpline

`transBSpline (BreakAngle:=LReal, BreakLength:=LReal, MergeDiff:=LReal, LineBreakAngle:=LReal,LineBreakLength:=LReal, LineMergeDiff:=LReal)`

transBSpline generates a continuous curve from a piecewise linear polyline.

The curve is bounded by the input polyline, the start and end points are interpolated, interior points are the control points (DeBoor points) of the curve. At least three points are required. A BSpline curve exhibits local control and is thereby amenable to control point manipulation.

//Enable

transBSpline(BreakAngle := 70, BreakLength := 1000);

//Disable

transBSpline();

**Example:**

!//BSpline

N10 G00 X18.498 Y0

!transBSpline(BreakAngle:=70.0, BreakLength:=1000.0);

N20 G01 X18.498 Y0 Z0 F6000

N30 X16.572 Y6.543 Z1

N40 X15.616 Y9.715 Z2

N50 X15.121 Y11.275 Z3

N60 X14.838 Y13.196 Z4

N70 X14.982 Y15.085 Z5

N80 X15.595 Y16.485 Z6

N90 X16.396 Y17.490 Z7

N100 X18.653 Y19.243 Z8

N110 X25.07 Y22.526 Z9

N120 X22.228 Y22.997 Z8

N130 X19.569 Y23.174 Z7

N140 X16.488 Y22.884 Z6

N150 X13.634 Y22.228 Z5

N160 X9.533 Y20.793 Z4

N170 X6.668 Y19.009 Z3

N180 X4.224 Y16.877 Z2

N190 X2.376 Y14.61 Z1

N200 X1.068 Y11.959 Z0

! transBSpline();

M02

**Parameters**

**BreakAngle (mandatory)**: Allows preservation of sharp angle features in the path. The spline will break when the path deviates more than BreakAngle. The spline will terminate and interpolate the point.

**BreakLength (mandatory)**: Allows preservation of long features in the path. The spline will break for segments longer than BreakLength. The spline will terminate and interpolate the start and end points of the long segment.

**MergeDiff (optional)**: The BSpline is comprised of Bezier segments. To potentially improve processing speed the spline may be compressed by merging. Adjacent segments will be merged together when the difference in control points is less than MergeDiff. Below adjacent segments are merged into one.

Excessive curvature Overly aggressive merging can result in excessive contortion and a segment of excessive curvature will be rejected with a run time error. Acceptable curvature is derived from path velocity and acceleration. |

The BSpline is constructed from a control point polyline formed by G01 segments, eg: CADCAM. To improve processing speed the control point polyline may be compressed or simplified by merging adjacent segments.

**LineBreakAngle (optional)**: Merging of adjacent control points will break if the deviation angle exceeds LineBreakAngle.

**LineBreakLength (optional)**: Merging of adjacent control points will break if the length exceeds LineBreakLength.

**LineMergeDiff (optional)**: Adjacent control points will be merged if the difference (perpendicular distance) is less than LineMergeDiff. In the example N30 may be eliminated, simplifying the control polygon.

If the optional parameters aren’t parameterized or if they are 0, no merging will take place. |

Excessive curvature Overly aggressive merging can result in excessive contortion and a segment of excessive curvature will be rejected with a run time error. Acceptable curvature is derived from path velocity and acceleration. |

**Processing order:**

If the BreakAngle or BreakLength are 0. No further processing will take place. LineBreakAngle, LineBreakLength and LineMergeDiff are processed firstly to simplify the control point polyline. BreakAngle BreakLength and MergeDiff are processed finally to generate the BSpline curve.

## Decoder Stops and Handshake M functions:

The BSpline should be terminated with `!transBSpline();`

prior to either a decoder stop or a M-function type handshake.

!//BSpline

N10 G00 X18.498 Y0

!transBSpline(BreakAngle:=70.0, BreakLength:=1000.0);

N20 G01 X18.498 Y0 Z0 F6000

N30 X16.572 Y6.543 Z1

N40 X15.616 Y9.715 Z2

N50 X15.121 Y11.275 Z3

N60 X14.838 Y13.196 Z4

N70 X14.982 Y15.085 Z5

N80 X15.595 Y16.485 Z6

N90 X16.396 Y17.490 Z7

N100 X18.653 Y19.243 Z8

N110 X25.07 Y22.526 Z9

!transBSpline();

!sync();

!transBSpline(BreakAngle:=70.0, BreakLength:=1000.0);

N120 X22.228 Y22.997 Z8

N130 X19.569 Y23.174 Z7

N140 X16.488 Y22.884 Z6

N150 X13.634 Y22.228 Z5

N160 X9.533 Y20.793 Z4

N170 X6.668 Y19.009 Z3

N180 X4.224 Y16.877 Z2

N190 X2.376 Y14.61 Z1

N200 X1.068 Y11.959 Z0

! transBSpline();

M02

## Compatible G-Codes and functions

G-Codes other than` G01 `

are supported`.`

The BSpline will terminate before and continue afterwards.

G00

G02, G03 (Circle and Helix): `G04`

and other transformations

G09, G60

G54

disableMask()

runFile(path:= )

smoothingSet(mainType:=smoothingTwinBezier,subType:=smoothingRadius,value:= )

ToolRadiusCompensation is not supported.

## Requirements

Development Environment | Target System |
---|---|

TwinCAT V3.1.4024.4 | PC or CX (x86 or x64) |