Table of Contents

Namespace Hi.NcParsers.Dependencys.Fanuc

Classes

FanucGotoIterationDependency

Watchdog for Fanuc Custom Macro B GOTO loops. Holds a MaxIterationsPerTarget limit (XML-persisted user config — the soft cap above which the upcoming FanucGotoSyntax stops firing and emits a warning) plus a runtime per-target hit counter (CountByTarget — not serialised, cleared at session start by RunControlLines(string, IEnumerable<string>, MachiningSession, SessionProgress, CancellationToken)).

The dependency is syntax-managed: FanucGotoSyntax reads the limit, increments the counter, and decides whether to fire. There is no host Func provider — the dep is placed in Hi.NcParsers.Dependencys.Fanuc rather than Hi.NcParsers.Dependencys.SystemWired because nothing outside the syntax pipeline writes it; Reset() is a plain method call the runner invokes, not a host-wired Func.

The counter key is (FileName, TargetN) where FileName is the source-level file path of the block containing the GOTO (the relative path form carried on FilePath — same form used by IndexedFileLine labels). Source-level keying means multiple inline invocations of the same subprogram pool their counts (they ARE the same source-code GOTO), while two different files with their own N100 stay isolated (they ARE different jumps).

Default MaxIterationsPerTarget is 1000 — a runaway-loop guard, not a precise iteration budget. Legitimate macro loops (multi-hole drill matrices, calibration sweeps) sit well below this; truly infinite loops hit the limit fast. Projects with batch-style macros that legitimately need higher counts can raise the value in the project XML.

FanucParameterTable

Fanuc controller parameter table. Stores system parameters (single value) and axis parameters (per-axis value) following real Fanuc parameter numbering.

FanucPositionVariableLookup

Fanuc-style position system variables read from the previous block's runtime-state JSON sections:

  • #5001-#5003Block-end position X/Y/Z (workpiece) → previous block's ProgramXyz.
  • #5021-#5023Current machine position X/Y/Z → previous block's MachineCoordinateState.
  • #5041-#5043Current absolute position X/Y/Z → previous block's ProgramXyz.

Stateless. Configured on RuntimeVariableLookups rather than NcDependencyList because the read needs the block node for Previous access — there is no long-lived dependency object that owns this data.

FanucToolOffsetVariableLookup

Fanuc-side adapter that exposes a wrapped ToolOffsetTable (resolved at call time from the dependency list) as an IRuntimeVariableLookup following Fanuc Memory C tool offset addressing: #2001+N → effective height of offset N (geometry − wear).

The underlying ToolOffsetTable stays brand-neutral — Heidenhain / Siemens can use the same storage with different addressing by registering their own adapter alongside the table. Stateless: holds no reference of its own and resolves the table from the per-call dependencies list, so XML round-trip is trivial (an empty element).

Registered on a brand preset's VariableEvaluatorSyntax.RuntimeVariableLookups, not on NcDependencyList — the wrapper owns no long-lived data, only the Fanuc-style id addressing scheme. The underlying ToolOffsetTable still lives in NcDependencyList as the data dependency.

RetainedCommonVariableTable

Fanuc-style ISO controller common variable table for the retained range #500-#999. These variables survive a power cycle (in real hardware they live in NV-RAM) and are serialised into the project file.

Excluded by design:

  • Local #1-#33Call-frame scoped (Fanuc local variables); lives in the SyntaxPiece JSON dataflow, not here.
  • Non-retained common #100-#499Cleared by program-end / power reset; lives in the SyntaxPiece JSON dataflow as well, not in this table.
  • System #1000+Read-only or computed from runtime state; resolved by dedicated reading syntaxes against other dependencies (e.g. FanucParameterTable, tool offset / WCS tables).

Vacant (Fanuc <vacant>) is represented by null: either the dictionary has no entry for the key, or the entry maps to null. Both are treated identically by GetVariable(int).

Naming rationale: Fanuc official documentation calls #500-#999 "retained common variables" (and #100-#499 "non-retained common variables"). The umbrella term "macro variable" was avoided because it conflicts with Custom Macro B's call-frame concept (G65/G66 push a frame containing the local #1-#33); using RetainedCommonVariableTable reserves "macro" for the call-frame topic.

Enums

CutterCompensationType

Fanuc #5003: Cutter compensation startup/cancellation type.