Table of Contents

Program Zero Alignment

Program zero (ProgramZeroAnchor) is the point an NC program treats as X0 Y0 Z0. It is related to the machine's work-coordinate offset (G54/G55/...): when the machine coordinate equals the work offset, the spindle sits at program zero.

Setting up a simulation requires relating program zero to the work offset. Which way you align depends on the scenario.

Two Alignment Directions

NC-file scenario (planning) — align G54 to program zero

When you drive the simulation from an NC file for planning, you usually keep the workpiece and fixture wherever they are convenient and set the work offset to match. The G54 value may not be obtained yet, and the layout does not need to reflect the real machine.

  • Keep the workpiece/fixture placement as-is.
  • Read the machine coordinate at program zero with GetMachinePositionAtProgramZero and store it into the ISO coordinate table (IsoCoordinateTable.SetCoordinateOffset("G54", ...)).

CSV / real-time / online-MC scenario (high-fidelity) — align program zero to G54

When you drive the simulation from a controller CSV log (see PlayCsvFile) or a real-time / online machine coordinate feed, the data is in absolute machine coordinates. To reproduce the real cut faithfully (高還原度), the workpiece + fixture must sit at their real positions so that collisions, overcut, and engagement match reality.

// Places workpiece + fixture so ProgramZeroAnchor coincides with the
// world position the spindle reaches when the machine coordinate equals G54.
AlignWorkpieceProgramZeroToIso("G54");

The same action is available in the web UI on the Controller page's ISO Coordinate Table (Align P0 per row, with a one-shot Revert Align).

AlignWorkpieceProgramZeroToIso mutates only Fixture.GeomToTableTransformer. The three buckle transformers must already be placed per the rule below.

Buckle General Rule

The workpiece/fixture assembly is built from buckle anchors (see Component Assembly and Anchors). A typical block-on-plate setup places them at the geometry bounding-box centers:

Transformer Position
Workpiece.WorkpieceGeomToFixtureBuckleTransformer bottom center of the workpiece geom
Workpiece.WorkpieceGeomToProgramZeroTransformer top center of the workpiece geom (or any chosen top tip)
Fixture.GeomToWorkpieceTransformer top center of the fixture geom

AlignWorkpieceProgramZeroToIso then derives the final Fixture.GeomToTableTransformer from the live assembly topology (anchor-to-anchor vectors), so it works for any chain — it does not assume the buckles are at bounding-box centers.

Verifying the Setup

A wrong setup (incorrect work offset or workpiece position) shows up as overcut, collision, or nocut. These are observable early — typically within the first ~100 NC lines or ~1 minute — so verify with a quick, cheap pass before a full run:

  1. Set a coarse MachiningResolution1/8 of the cutter diameter for fast feedback.
  2. Run and watch the opening Z plunge (下刀). This is where overcut/collision most often appears when the work offset or workpiece Z is wrong.
Tip

If the tool plunges far deeper than the programmed depth and the holder crashes into the workpiece (a visible gouge on the rendered stock), the work offset Z is almost certainly wrong — the workpiece is modeled higher (or lower) than its real position.

Note

Rare false positive: a roughing cut with a spiral entrance on tough material can legitimately exceed the modeled cutting conditions yet still be a correct setup. This is uncommon — in most cases early overcut/collision/nocut means the setup is wrong.

High-Fidelity Caution: Work Offset Must Reflect the Real Machine

In the CSV / online-MC scenario, the work offset (G54/G55/...) you align to must be the actual offset used on the machine, not a planned/nominal value. Operators frequently re-zero between setups (manual tool changes, re-cut stock), so a planned G54 can differ from the real one — by an amount you cannot assume in advance.

When driving from a controller log, derive the offset from the log's own machine coordinates rather than trusting a planned value: invariants that survive operator edits — a known cutting depth, a feature span — mapped onto the recorded machine coordinates, recover the real offset on those axes. (Positions the operator may have shifted are not recoverable this way.) A work-offset Z that is wrong places the workpiece away from its true height, so the tool over- or under-plunges; if too high, the holder crashes the stock at the opening plunge — exactly the failure the rough-resolution check above catches.

See Also