{"id":"gcode-g05","model_id":"G5 Cubic Spline","name":"LinuxCNC G5 Cubic Spline","summary":"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.","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_notes":["Operating limit: the active plane must be G17, and only X and Y axis words are allowed; otherwise the command is an error."],"sources":[{"url":"https://linuxcnc.org/docs/html/gcode/g-code.html#gcode:g5","title":"G-Codes","accessed":"2026-10-26"}],"verification":{"status":"source_checked","checked_at":"2026-10-26","values":19,"method":"llm_source_check"},"updated_at":"2026-10-26","type":"instruction","spec":{"language":"gcode","code":"G5","syntax":"G5 X- Y- <I- J-> P- Q-","parameters":[{"name":"X","data_type":"real"},{"name":"Y","data_type":"real"},{"name":"I","data_type":"real","description":"X incremental offset from start point to first control point"},{"name":"J","data_type":"real","description":"Y incremental offset from start point to first control point"},{"name":"P","data_type":"real","description":"X incremental offset from end point to second control point"},{"name":"Q","data_type":"real","description":"Y incremental offset from end point to second control point"}],"dialect":"LinuxCNC","related":[],"standards":[]},"url":"https://machineschema.com/instruction/gcode-g05","license":"https://creativecommons.org/licenses/by/4.0/"}