Table of Contents

Namespace Hi.NcParsers.LogicSyntaxs

Classes

CoordinateOffsetUtil

Shared utilities for all coordinate offset syntaxes (ISO, Siemens, Heidenhain). Handles section IO, backward lookback, and ProgramToMcTransform composition.

FeedrateSyntax

Consumes F (feedrate) from Parsing and G94/G95 mode from Flags. Both are modal — persist across blocks via backward node lookback. Writes resolved state to a IFeedrateDef section.

IsoCoordinateOffsetSyntax

ISO/Fanuc/Mazak/Okuma/Syntec: resolves G54–G59.9 work coordinate offset. Reads G54/G55/.../G59.9 from Flags, looks up offset Vec3d from IsoCoordinateTable dependency, composes into ProgramToMcTransform. Modal — active coordinate persists via backward lookback. Default coordinate ID is set by StaticInitializer.

IsoG68RotationSyntax

ISO/Fanuc: resolves G68 (2D coordinate rotation) and G69 (cancel). Computes a rotation Mat4d around the active plane normal and composes it into ProgramToMcTransform.

No IMachineKinematics dependency needed — G68 is pure geometric rotation.

Managed commands: G68, G69 (idempotent with IsoG68p2TiltSyntax).

IsoG68p2TiltSyntax

ISO/Fanuc: resolves G68.2 (tilted work plane) and G69 (cancel). Computes a tilt Mat4d from I/J/K euler angles (Fanuc ZXZ convention) and composes it into ProgramToMcTransform.

Managed commands: G68.2, G69 (idempotent with IsoG68RotationSyntax). Siemens equivalent: CYCLE800 (separate syntax). Heidenhain equivalent: PLANE SPATIAL (separate syntax).

IsoLocalCoordinateOffsetSyntax

ISO G52: Local coordinate system offset (additive to G54-series).

G52 X10 Y20 Z5 → sets local offset. G52 X0 Y0 Z0 → cancels (resets to zero). M30 (program end) → also cancels.

Reads Parsing.G52 (from G52Syntax), writes LocalCoordinateOffset section, and adds a "LocalCoordinateOffset" entry to the transformation chain. Modal — persists via backward lookback until changed or cancelled.
McAbcCyclicPathSyntax

Resolve modular rotary axes to the shortest cyclic path relative to the previous node. Uses IsModularRotary(string) to determine which axes within MachineCoordinate need cyclic resolution. Falls back to hardcoded A/B/C if no IMachineAxisConfig is available. Must be placed after ProgramXyzSyntax in NcSyntaxList.

PositioningModeSyntax

Resolves G90/G91 incremental positioning to absolute values in-place within Parsing.

Fanuc/ISO: reads G90/G91 from Flags (global modal). Heidenhain: would need a separate implementation reading I-prefix per axis. Siemens: would extend with AC()/IC() per-axis override.

Uses AxisNames to determine which tags are motion axes. Traces backward nodes for modal state and last known ProgramXyz to resolve incremental values. No instance fields for state — all state lives in JsonObject. After this syntax, all axis values in Parsing are absolute — ProgramXyzSyntax can consume them without incremental logic. Must be placed after NumberedFlagSyntax and before ProgramXyzSyntax.
ProgramXyzSyntax

Compute MachineCoordinate and ProgramXyz (leaf coordinate) from syntax XYZ tags. Writes individual double components to SyntaxPiece.JsonObject under MachineCoordinate and ProgramXyz sub-objects. Must be placed after BundleSyntax since it uses cross-node lookback for last position.

SpindleSpeedSyntax

Consumes S (spindle speed) from Parsing. Modal — persists across blocks via backward node lookback. Writes resolved state to a ISpindleSpeedDef section.

TiltTransformUtil

Shared utilities for all tilt transform syntaxes (ISO, Siemens, Heidenhain). Handles section IO, backward lookback, and ProgramToMcTransform composition.

ToolHeightOffsetSyntax

Resolves tool height offset ID to the effective offset value (mm) and composes the offset as a translation into the accumulated ProgramToMcTransform matrix.

Reads parsed G43/G43.4/G44/G49 flags and H numbers from upstream parsing syntaxes, looks up the offset value from IToolOffsetConfig dependency, writes the resolved state to a IToolHeightCompensationDef section for debuggability, and composes ProgramToMcTransform.Trans += toolOrientation * height_mm.

The tool orientation direction is read from a "ToolOrientation" key in JSON (written by a prior syntax, e.g., ToolOrientationSyntax). If absent, falls back to the current ProgramToMcTransform's AxialNormal (rotated Z). If no transformation exists yet, defaults to UnitZ.