Skip to content

gcode conventions

Christophe Barlieb edited this page May 3, 2026 · 1 revision

G-code conventions

The lab has a small set of conventions that all generated G-code must follow. The KUKA CNC ISG post-processor enforces them automatically — never hand-edit a .nc file to bypass them. This page documents what they are and why.

S1 = extruder off

Every path the plugin emits ends with S1 (extruder off). Reasoning:

  • The CCL-ALTAR-01 SPD calibration has a dead zone from 0 to ~40 — anywhere in that range is true zero flow.
  • S1 is the smallest valid SPD command, well inside the dead zone.
  • It's the canonical idle: "the extruder is on, but commanded to its minimum, which corresponds to no clay flow."
  • Treating "off" as S1 rather than S0 is conservative — even if the dead zone shifts slightly with hardware drift, S1 stays inside it.

The post-processor emits S1 automatically as the CallPathFinish event after the last frame of every path. Don't override. See Calibration for the SPD→flow data.

F600 for Z plunge / retract

The skirt-to-part transition and the post-print retract use F600 (mm/min) on Z motion, not the operation feed rate. Reasoning:

  • Fast Z motion through wet clay tears the layer below — leaves visible scarring on the build plate or on the just-printed top surface.
  • 600 mm/min = 10 mm/s, slow enough that clay viscosity has time to relax around the moving nozzle.

Never increase Z plunge / retract speed without first testing on scrap and visually confirming no tearing.

G4 dwell unit conversion

RoboDK and KUKA CNC use different units for dwell:

Layer Dwell command Unit
RoboDK input G4 P<value> milliseconds
KUKA CNC output G4 X<value> seconds

The post-processor converts: divide by 1000 when emitting X from P.

If you find a generated .nc file with G4 X values 1000× larger than expected (e.g. 5000 where you expected 5), the post-processor is mis-handling the unit conversion — re-copy from the release bundle.

Post-processor only — never hand-write G-code

No hand-edited or hand-written .nc files are deployed to the controller. Every program must come from the documented pipeline:

Rhino geometry → CCL_Clay3DP plugin → RoboDK → KUKA CNC ISG post → .nc file

Why this rule exists:

  • The post-processor encodes the lab's lead compensation, dwell unit conversion, S1 idle, F600 plunge speed, and #HSC smoothing.
  • A hand-edited file silently drops one or more of these and produces unsafe motion.
  • An untested manual .nc is one of the highest-risk things you can run on the cell.

If you need a feature the post doesn't currently emit, modify the post, regenerate, and verify — don't patch the .nc. See Contributing for the post-processor change workflow.

#HSC BSPLINE smoothing

The post emits #HSC ON ... #HSC OFF blocks around BSPLINE motion segments. This tells the KUKA controller to:

  • Treat the BSPLINE as one continuous motion
  • Don't path-stop at every frame boundary
  • Apply axis blending across frames

Without #HSC, the robot pauses momentarily at every frame — at the high frame counts the slicer produces, this turns a smooth print into a stuttered one. The block boundaries are deterministic; the post-processor handles them.

Tool change (T10 M6 / T11 M6 / T12 M6)

The active nozzle is selected by setting the RoboDK reference frame in Settings → Tool / Nozzle. The post emits the corresponding T<N> M6 at the start of the program. The plugin and post are wired to map:

T10 → frame T10 → smallest nozzle
T11 → frame T11 → default nozzle
T12 → frame T12 → largest nozzle

There's no run-time tool change in normal printing — one nozzle per program. The T<N> M6 at the start declares the active tool to the controller.

Verifying a generated .nc

Before transferring to the controller, scan the .nc for:

  • T1[012] M6 early in the file
  • #HSC ON / #HSC OFF around motion blocks
  • S1 after the last motion of every path
  • G4 X<seconds> for any dwells (not G4 P<ms>)
  • F600 on Z plunge / retract segments

📷 Annotated excerpt of a generated .nc showing each marker and its purpose.

Any deviation = something is wrong with the post-processor or its installation. See Pipeline 6 — Post-process for the post setup.

Clone this wiki locally