LinuxCNC G5 Cubic Spline

G5 creates a cubic B-spline in the XY plane using only the X and Y axes. P and Q give the second control point as offsets from the end point and must both be specified. I and J give the first control point as offsets from the start point; on later G5 commands they can be omitted so the spline continues smoothly from the previous cubic.

Source checked19/19 values · 2026-10-26

Specification

1 source
Languagegcode
CodeG5
SyntaxG5 X- Y- <I- J-> P- Q-
DialectLinuxCNC

Parameters

NameData typeDescription
Xreal
Yreal
IrealX incremental offset from start point to first control point
JrealY incremental offset from start point to first control point
PrealX incremental offset from end point to second control point
QrealY incremental offset from end point to second control point

Study notes

  • For the first G5 command in a series, I and J must both be specified.
  • For subsequent G5 commands, either both I and J must be specified or neither.
  • If I and J are omitted on a subsequent G5 command, the starting direction matches the ending direction of the previous cubic, as if I and J are the negation of the previous P and Q.
  • P and Q must both be specified for every G5 command.
  • It is an error to specify an axis other than X or Y, or to use a plane other than G17.
  • Example initial spline: G90 G17; G0 X0 Y0; G5 I0 J3 P0 Q-3 X1 Y1.
  • Example subsequent spline: G5 P0 Q-3 X2 Y2.

Safety

  • Operating limit: the active plane must be G17, and only X and Y axis words are allowed; otherwise the command is an error.
↑↓ navigate↵ openesc close