Table of Contents

Namespace Hi.NcParsers.LogicSyntaxs.Heidenhain

Classes

HeidenhainCircleCenterSyntax

Heidenhain-specific: turns the Parsing.CC record into the modal HeidenhainCircleCenter { X, Y, Z? } section (absolute program coordinates). Self-carrying every block (PlaneSelect pattern — detected ?? previous), so the arc syntax's single-step read always works without ModalCarry involvement; a CC with partial axes merges the missing components from the previous center. Must run before HeidenhainCircularMotionSyntax.

HeidenhainCircularMotionSyntax

Heidenhain circular motion — replaces the shared CircularMotionSyntax in the Heidenhain list (never run both). Gated by the Parsing.C statement marker (klartext arcs carry no G02/G03 and no modal arc continuation): the endpoint comes from the block's resolved ProgramXyz, the center from the modal HeidenhainCircleCenterSyntax section (implicit center = current position when no CC was ever given), and the direction from DR- (CW → G02) / DR+ (CCW → G03). A closed arc on the active plane is a full circle. A missing DR warns (Arc-DR–Missing) and degrades to the modal linear move to the endpoint (chord).

HeidenhainCoordinateOffsetSyntax

Heidenhain-specific: resolves coordinate offset from CYCL DEF 247 (Datum Preset) and CYCL DEF 7 (Datum Shift).

CYCL DEF 247 Q339=N: selects datum preset table entry N — written to the shared CoordinateOffset section (kept alive modally by IsoCoordinateOffsetSyntax via HeidenhainDatumTable synthetic-id resolution).

CYCL DEF 7 (#N table row or direct X/Y/Z) is additive on top of the active preset (TNC semantics; HardNc oracle composes -preset + shift): it is written to its own DatumShift section with a separate ProgramToMcTransform entry (DatumShiftTransformSource) so preset and shift compose in the transform chain instead of replacing each other. The shift is carried modally by this syntax itself: on blocks without a CYCL DEF, a numbered row re-resolves from the table and a direct shift carries its values forward. Cancelling is a zero shift (CYCL DEF 7.1 X+0 Y+0 Z+0).

For DIN/ISO compatibility (G54–G59), use IsoCoordinateOffsetSyntax in addition to this syntax in the Heidenhain syntax list. Uses replace-by-source so both syntaxes coexist without double-composing.
HeidenhainMFunctionSyntax

Heidenhain-specific M-function semantics for the near-universal corpus family:

  • M126/M127 — shortest-path rotary traverse on/off. Writes the modal RotaryWrap { Shortest } section consumed by McAbcCyclicPathSyntax (absent = shortest, the shared default); the Heidenhain preset's Logic ModalCarry tracks the section.
  • M128/M129 — RTCP on/off. P1 consume-level: the captured Parsing.M128 record (with its feed-limit F) and the M129 flag are consumed into an Rtcp { IsActive, Term } record; activation warns Rtcp--NotSimulated until the P3 pivot transform lands. M129 (the off state — matching the simulation) is silent.
  • M140 MB — tool-axis retract. Executes a machine-coordinate move along +Z (the P1 tool axis; the P3 tilt work generalizes it): MB+n retracts by n mm, MB MAX retracts to the positive Z stroke limit (IStrokeLimitConfig; unresolvable limit warns M140--NoStrokeLimit and skips). The retract runs at the modal feed (the statement's F is recorded on the MotionEvent as RetractFeedrate, not folded into the modal feedrate).
Must run before McAbcCyclicPathSyntax (RotaryWrap) and before LinearMotionSyntax/McXyzSyntax (M140 occupies the block's MotionEvent).
HeidenhainMotionModeSyntax

Heidenhain-specific: maps the klartext L statement marker (written by HeidenhainLSyntax) onto the shared ISO motion-mode vocabulary. An L block carrying the one-shot FMAX flag becomes a rapid (G00) block; every other L block is a feed move (G01) driven by the modal feedrate. The injected G00/G01 flag is consumed downstream exactly like a DIN/ISO block — by LinearMotionSyntax on ordinary moves and by MachineCoordSelectSyntax on machine-coordinate (M91) moves — so no shared syntax needs Heidenhain-specific behavior.

FMAX is one-shot on the real TNC: because every klartext motion is an L statement and this syntax stamps a mode per statement, the rapid mode never leaks into the next block — the following L without FMAX is stamped G01 again. FAUTO (feed from cycle) is consumed as a feed move. Must be placed at the top of the Logic bundle, before MachineCoordSelectSyntax and LinearMotionSyntax.

HeidenhainPathSmoothingSyntax

Heidenhain-specific: consumes the structured CYCL DEF 32 TOLERANCE record (HeidenhainToleranceCyclSyntax) into the shared modal PathSmoothing section (tracked by the Logic ModalCarry): a positive tolerance arms smoothing ({IsEnabled:true, Term:“CYCL DEF 32”, Tolerance, HscMode?, Ta?}); a bare or zero-tolerance cycle cancels it. Untouched blocks are left to ModalCarry; the stream's first block seeds a conservative {IsEnabled:false} (Siemens sibling shape). Replaces the dead FanucPathSmoothingSyntax in the Heidenhain list (it read Parsing[“G05.1”], which no Heidenhain capture produces).

HeidenhainProgramHeaderSyntax

Heidenhain-specific: consumes the Parsing.PGM record (BEGIN|END PGM name MM|INCH) — the unit word is pushed into Parsing.Flags for the UnitModeSyntax instance configured with InchCodes=[“INCH”], MetricCodes=[“MM”] (which must run after this syntax), and END PGM writes the shared one-shot ProgramEnd section (existence-checked by its consumers exactly like M30). Consuming PGM also removes the program-header unconsumed noise every klartext file used to emit.

HeidenhainRadiusCompSyntax

Heidenhain-specific: maps the klartext radius-compensation words captured by HeidenhainLSyntax (RL/RR/R0 boolean Parsing-root records) onto the shared vocabulary consumed by the radius-compensation pass: RL → Parsing.G41 {D: toolId}, RR → G42, R0 → G40 flag. The offset id is the current tool number (klartext has no D word; IToolOffsetConfig documents the offset id as the Heidenhain tool number), resolved by walking back to the most recent ToolChange section. A missing or non-numeric tool id degrades to mode-only injection (radius 0 — the compensation pass records the state but applies no geometric offset) with an RadiusComp–ToolUnresolved warning.

Must run before the PostLogic radius-compensation pass (any Logic position works — PostLogic sees completed Logic output) and after HeidenhainToolChangeSyntax so a same-block TOOL CALL is visible.

HeidenhainToolChangeSyntax

Heidenhain-specific: consumes the Parsing[“TOOL CALL”] record (written by HeidenhainToolCallSyntax) into the shared SectionName section so ToolChangeSemantic fires the tooling act. A klartext TOOL CALL always performs the change — no separate M06 trigger exists — so IsChangeKey is always true with Term = “TOOL CALL”.

The spindle-speed word (S) is relocated to the root of Parsing so the shared SpindleSpeedSyntax — which must run after this syntax in the Logic bundle — records it modally. Numeric tool ids are written as ints (the act chain is int-keyed); non-numeric ids stay strings and resolve (or warn) at the semantic layer.

P0 limits recorded as diagnostics: non-Z tool axis (ToolChange--AxisUnsupported), non-zero DL/DR deltas (ToolChange--DeltaUnsupported; zero deltas are consumed silently), and a TOOL CALL without a tool id (ToolChange--MissingToolId, e.g. a variable tool number the parser could not capture).

Known P2 limitation: a quoted tool NAME that happens to spell a Q token (TOOL CALL "Q1" Z) loses its quotes at capture, so the evaluator substitutes the Q parameter's value and the numeric branch below treats it as a tool number. Corpus-zero (real names are "B40R"-style); fixing it needs the capture to preserve the quoted-ness, which would change the P0-pinned record shape.

HeidenhainToolOffsetSyntax

Heidenhain-specific: klartext TOOL CALL always applies tool-length compensation (there is no cancel word — HardNc compensates unconditionally). On TOOL CALL blocks the effective height = GetToolHeightOffset_mm(int)(tool id) + the TOOL CALL's DL delta; the shared ToolHeightCompensation section is written (Term = “TOOL CALL”, OffsetId = tool id — the offset id is documented as the Heidenhain tool number) and the translation composes into the transform chain via the shared ToolHeightCompensation source (mutual exclusion with the ISO G43 sibling by same-source replace).

Modal: on following blocks the section is re-resolved per block from the table (mirroring the Siemens D sibling — give-way when a same block ISO term took ownership; carry Term/OffsetId/Delta_mm otherwise). Must sit after ToolHeightOffsetSyntax (the ISO anchor — last writer wins on mixed-dialect blocks) and after HeidenhainToolChangeSyntax (reads its ToolChange section), before the pivot/tilt syntaxes.