fix SoftNcRunner GM code normalization.

This commit is contained in:
2026-05-06 13:21:19 +08:00
parent 0fe9497552
commit 2f57932000
1238 changed files with 69405 additions and 22511 deletions
@@ -137,26 +137,21 @@ Must be placed after <a class="xref" href="Hi.NcParsers.LogicSyntaxs.CannedCycle
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.CannedCycleResolveSyntax.html">CannedCycleResolveSyntax</a></dt>
<dd><p>Resolves canned cycle parameters for the current block:
modal repetition detection, G91 incremental-to-absolute conversion,
and missing-axis fallback from last known position.</p>
<dd><p>Resolves the canned-cycle Group-09 state for the current block
and writes the result to the <a class="xref" href="Hi.NcParsers.Keywords.CannedCycle.html">CannedCycle</a> section.</p>
<ul><li><b>Active cycle</b> (direct G81..G89 or modal repeat): merges
<code>Parsing</code> overrides with previous-cycle stored params, applies
G91 incremental-to-absolute conversion and missing-axis fallback,
writes <a class="xref" href="Hi.NcParsers.Keywords.CannedCycle.html">CannedCycle</a> with <a class="xref" href="Hi.NcParsers.Keywords.ICannedCycleDef.html#Hi_NcParsers_Keywords_ICannedCycleDef_Term">Term</a>,
<a class="xref" href="Hi.NcParsers.Keywords.ICannedCycleDef.html#Hi_NcParsers_Keywords_ICannedCycleDef_ReturnMode">ReturnMode</a>, and
<a class="xref" href="Hi.NcParsers.Keywords.ICannedCycleDef.html#Hi_NcParsers_Keywords_ICannedCycleDef_Params">Params</a>. The resolved cycle sub-section
is left in <code>Parsing</code> under the cycle code for downstream cycle
syntaxes (<a class="xref" href="Hi.NcParsers.LogicSyntaxs.DrillingCycleSyntax.html">DrillingCycleSyntax</a>, etc.) to read.</li><li><b>Explicit cancel</b> (G80 flag present on a non-cycle block):
consumes the G80 flag and writes
<a class="xref" href="Hi.NcParsers.Keywords.CannedCycle.html">CannedCycle</a> = <code>{ Term: "G80" }</code>, acting as a hard
sentinel for <span class="xref">Hi.NcParsers.LogicSyntaxs.CannedCycleSyntaxUtil</span> modal lookback.</li><li><b>No Group-09 activity</b>: leaves the block untouched.</li></ul>
<p>
After this syntax, the cycle sub-section in <code>Parsing</code>
(e.g., <code>Parsing.G83</code>) contains fully resolved absolute
coordinates — downstream cycle syntaxes
(<a class="xref" href="Hi.NcParsers.LogicSyntaxs.DrillingCycleSyntax.html">DrillingCycleSyntax</a>, <a class="xref" href="Hi.NcParsers.LogicSyntaxs.PeckDrillingCycleSyntax.html">PeckDrillingCycleSyntax</a>)
can read them directly without incremental or modal logic.
</p>
<p>
For modal repetition (no cycle G-code in the current block),
merges stored parameters from the previous block's
<a class="xref" href="Hi.NcParsers.Keywords.CompoundMotion.html">CompoundMotion</a>.<span class="xref">Hi.NcParsers.LogicSyntaxs.CannedCycleSyntaxUtil.ResolvedParamsKey</span>
with current-block overrides from <code>Parsing</code> root, removes
consumed keys from <code>Parsing</code> root, and writes the merged
section to <code>Parsing</code> under the cycle code key.
</p>
<p>
Must be placed after <a class="xref" href="Hi.NcParsers.LogicSyntaxs.PositioningModeSyntax.html">PositioningModeSyntax</a> and before
Must be placed after <a class="xref" href="Hi.NcParsers.LogicSyntaxs.PositioningSyntax.html">PositioningSyntax</a> and before
the individual cycle syntaxes in the chain.
</p>
</dd>
@@ -167,18 +162,30 @@ the individual cycle syntaxes in the chain.
(ISO G02/G03).
Detects motion mode from <a class="xref" href="Hi.NcParsers.Keywords.IFlagsDef.html#Hi_NcParsers_Keywords_IFlagsDef_Flags">Flags</a>, reads
I/J/K center offsets or R radius from <a class="xref" href="Hi.NcParsers.Keywords.IParsingDef.html#Hi_NcParsers_Keywords_IParsingDef_Parsing">Parsing</a>,
computes arc center in program coordinates, and writes
<a class="xref" href="Hi.NcParsers.Keywords.IMotionDef.html">IMotionDef</a> + <a class="xref" href="Hi.NcParsers.Keywords.IArcMotionDef.html">IArcMotionDef</a> data.</p>
computes arc center in program coordinates, and writes a one-shot
<a class="xref" href="Hi.NcParsers.Keywords.MotionEvent.html">MotionEvent</a> (form + arc params) plus a modal
<a class="xref" href="Hi.NcParsers.Keywords.MotionState.html">MotionState</a> (Term).</p>
<p>
G02/G03 mode is modal (Group 01) — persists via backward lookback.
Arc parameters (I/J/K/R) are per-block and must be present
in every arc block.
G02/G03 mode is modal (Group 01) — persists across blocks via
<a class="xref" href="Hi.NcParsers.Keywords.MotionState.html#Hi_NcParsers_Keywords_MotionState_Term">Term</a>. Arc parameters (I/J/K/R) are
per-block and must be present in every arc block.
</p>
<p>
Must be placed before <a class="xref" href="Hi.NcParsers.LogicSyntaxs.LinearMotionSyntax.html">LinearMotionSyntax</a> in the
syntax chain. Both share the Group 01 <a class="xref" href="Hi.Motion.html">Hi.Motion</a> slot;
whichever writes first claims it.
syntax chain. Both share the Group 01 motion slot; whichever
writes a <a class="xref" href="Hi.NcParsers.Keywords.MotionEvent.html">MotionEvent</a> first claims it.
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.CoolantSyntax.html">CoolantSyntax</a></dt>
<dd><p>Consumes M07 (mist ON), M08 (flood ON), and M09 (coolant OFF) from
<a class="xref" href="Hi.NcParsers.Keywords.IFlagsDef.html#Hi_NcParsers_Keywords_IFlagsDef_Flags">Flags</a> and writes the <a class="xref" href="Hi.NcParsers.Keywords.ICoolantDef.html">ICoolantDef</a>
section with both <a class="xref" href="Hi.NcParsers.Keywords.ICoolantDef.html#Hi_NcParsers_Keywords_ICoolantDef_IsOn">IsOn</a> (convenience flag)
and <a class="xref" href="Hi.NcParsers.Keywords.ICoolantDef.html#Hi_NcParsers_Keywords_ICoolantDef_Mode">Mode</a> (abstract mode name:
<a class="xref" href="Hi.NcParsers.Keywords.Coolant.html#Hi_NcParsers_Keywords_Coolant_Flood">Flood</a> / <a class="xref" href="Hi.NcParsers.Keywords.Coolant.html#Hi_NcParsers_Keywords_Coolant_Mist">Mist</a> /
<a class="xref" href="Hi.NcParsers.Keywords.Coolant.html#Hi_NcParsers_Keywords_Coolant_Off">Off</a>).
Modal — persists via backward lookback.</p>
</dd>
</dl>
<dl class="jumplist">
@@ -230,6 +237,39 @@ Reads absolute coordinates from the cycle section, which is
resolved by <a class="xref" href="Hi.NcParsers.LogicSyntaxs.CannedCycleResolveSyntax.html">CannedCycleResolveSyntax</a> before this
syntax runs.
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.G43p4RtcpSyntax.html">G43p4RtcpSyntax</a></dt>
<dd><p>Handles G43.4 RTCP (Rotary Tool Center Point) activation. Writes
the <a class="xref" href="Hi.NcParsers.Keywords.IToolHeightCompensationDef.html">IToolHeightCompensationDef</a> section and the
<a class="xref" href="Hi.NcParsers.Syntaxs.TransformationUtil.html#Hi_NcParsers_Syntaxs_TransformationUtil_ToolHeightCompensationSource">ToolHeightCompensationSource</a> entry
in <a class="xref" href="Hi.NcParsers.Keywords.ITransformationDef.html#Hi_NcParsers_Keywords_ITransformationDef_ProgramToMcTransform">ProgramToMcTransform</a> — a
tool-normal · offset_mm translation at the block endpoint ABC. The
chain entry is tagged <a class="xref" href="Hi.NcParsers.Syntaxs.TransformationUtil.html#Hi_NcParsers_Syntaxs_TransformationUtil_KindDynamic">KindDynamic</a>
when RTCP is active and ABC changes across the block, and
<a class="xref" href="Hi.NcParsers.Syntaxs.TransformationUtil.html#Hi_NcParsers_Syntaxs_TransformationUtil_KindStatic">KindStatic</a> otherwise.</p>
<p>
The RTCP kinematic rotary part (Pn→MC rigid transform) is orthogonal
to this syntax and is written by <a class="xref" href="Hi.NcParsers.LogicSyntaxs.PivotTransformationSyntax.html">PivotTransformationSyntax</a>
on <b>every</b> block, because rotary state remains in effect beyond
the RTCP modal (e.g. a non-RTCP <code>G01</code> after <code>G49</code> still
inherits the last ABC from the program).
</p>
<p>
The "rotary dynamic" distinction lives on the chain entry's
<a class="xref" href="Hi.NcParsers.Syntaxs.TransformationUtil.html#Hi_NcParsers_Syntaxs_TransformationUtil_KindKey">KindKey</a> alone and is read via
<a class="xref" href="Hi.NcParsers.Syntaxs.TransformationUtil.html#Hi_NcParsers_Syntaxs_TransformationUtil_HasDynamicEntry_System_Text_Json_Nodes_JsonObject_">HasDynamicEntry(JsonObject)</a> by
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.LinearMotionSyntax.html">LinearMotionSyntax</a> to pick
<a class="xref" href="Hi.NcParsers.Keywords.Generic.MotionForm.html#Hi_NcParsers_Keywords_Generic_MotionForm_ClLinear">ClLinear</a> vs <a class="xref" href="Hi.NcParsers.Keywords.Generic.MotionForm.html#Hi_NcParsers_Keywords_Generic_MotionForm_McLinear">McLinear</a>.
</p>
<p>
G43.4 is used by Fanuc, Mazak, Syntec, and Okuma. Siemens (TRAORI) and
Heidenhain (M128) are handled by separate syntaxes. Must be placed
<b>after</b> <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ToolHeightOffsetSyntax.html">ToolHeightOffsetSyntax</a> (to override the
ToolHeightCompensation entry when RTCP is active) and <b>before</b>
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.PivotTransformationSyntax.html">PivotTransformationSyntax</a> (which runs last in the chain).
</p>
</dd>
</dl>
<dl class="jumplist">
@@ -247,7 +287,7 @@ to solve for the target A/B/C via inverse kinematics.
Must be placed <b>after</b> <a class="xref" href="Hi.NcParsers.LogicSyntaxs.IsoG68p2TiltSyntax.html">IsoG68p2TiltSyntax</a>
(needs tilt data) and <b>before</b> <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramXyzSyntax.html">ProgramXyzSyntax</a>
in the syntax chain. Writes A/B/C into
<a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateDef_MachineCoordinate">MachineCoordinate</a>.
<a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateStateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateStateDef_MachineCoordinateState">MachineCoordinateState</a>.
Motion is handled by <a class="xref" href="Hi.NcParsers.LogicSyntaxs.LinearMotionSyntax.html">LinearMotionSyntax</a> via modal G00/G01.
</p>
</dd>
@@ -275,8 +315,8 @@ Must be placed after <a class="xref" href="Hi.NcParsers.LogicSyntaxs.CannedCycle
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.IncrementalResolveSyntax.html">IncrementalResolveSyntax</a></dt>
<dd><p>Resolves G91 incremental axis values to absolute in-place
within <a class="xref" href="Hi.NcParsers.Keywords.IParsingDef.html#Hi_NcParsers_Keywords_IParsingDef_Parsing">Parsing</a> and its sub-sections.
Reads <a class="xref" href="Hi.NcParsers.Keywords.IPositioningModeDef.html#Hi_NcParsers_Keywords_IPositioningModeDef_PositioningMode">PositioningMode</a> written
by <a class="xref" href="Hi.NcParsers.LogicSyntaxs.PositioningModeSyntax.html">PositioningModeSyntax</a>.</p>
Reads <a class="xref" href="Hi.NcParsers.Keywords.IPositioningDef.html#Hi_NcParsers_Keywords_IPositioningDef_Term">Term</a> written
by <a class="xref" href="Hi.NcParsers.LogicSyntaxs.PositioningSyntax.html">PositioningSyntax</a>.</p>
<p>
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.IncrementalResolveSyntax.html#Hi_NcParsers_LogicSyntaxs_IncrementalResolveSyntax_WorkingPathList">WorkingPathList</a> specifies which JSON paths
contain axis values that need incremental-to-absolute conversion.
@@ -305,7 +345,8 @@ incremental logic.
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.IsoCoordinateOffsetSyntax.html">IsoCoordinateOffsetSyntax</a></dt>
<dd><p>ISO/Fanuc/Mazak/Okuma/Syntec: resolves G54G59.9 work coordinate offset.
Reads G54/G55/.../G59.9 from <a class="xref" href="Hi.NcParsers.Keywords.IFlagsDef.html#Hi_NcParsers_Keywords_IFlagsDef_Flags">Flags</a>,
looks up offset Vec3d from <a class="xref" href="Hi.NcParsers.Dependencys.Generic.IsoCoordinateTable.html">IsoCoordinateTable</a> dependency,
looks up offset Vec3d via <a class="xref" href="Hi.NcParsers.Dependencys.IIsoCoordinateConfig.html">IIsoCoordinateConfig</a> dependencies
(e.g. brand parameter table or <a class="xref" href="Hi.NcParsers.Dependencys.Generic.IsoCoordinateTable.html">IsoCoordinateTable</a>),
composes into <a class="xref" href="Hi.NcParsers.Keywords.ITransformationDef.html#Hi_NcParsers_Keywords_ITransformationDef_ProgramToMcTransform">ProgramToMcTransform</a>.
Modal — active coordinate persists via backward lookback.
Default coordinate ID is set by <a class="xref" href="Hi.NcParsers.Initializers.StaticInitializer.html">StaticInitializer</a>.</p>
@@ -347,24 +388,24 @@ Heidenhain equivalent: PLANE SPATIAL (separate syntax).
M30 (program end) → also cancels.
</p>
Reads <code>Parsing.G52</code> (from <a class="xref" href="Hi.NcParsers.Syntaxs.GenericSyntaxKit.html#Hi_NcParsers_Syntaxs_GenericSyntaxKit_G52Syntax">G52Syntax</a>),
writes <a class="xref" href="Hi.NcParsers.Keywords.LocalCoordinateOffset.html">LocalCoordinateOffset</a> section,
and adds a <code>"LocalCoordinateOffset"</code> entry to the transformation chain.
writes <a class="xref" href="Hi.NcParsers.Keywords.IsoLocalCoordinateOffset.html">IsoLocalCoordinateOffset</a> section,
and adds an <code>"IsoLocalCoordinateOffset"</code> entry to the transformation chain.
Modal — persists via backward lookback until changed or cancelled.
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.LinearMotionSyntax.html">LinearMotionSyntax</a></dt>
<dd><p>Writes <a class="xref" href="Hi.NcParsers.Keywords.Generic.MotionForm.html#Hi_NcParsers_Keywords_Generic_MotionForm_McLinear">McLinear</a> motion for linear commands
(ISO G00/G01, Heidenhain L/LN).
Detects motion mode from <a class="xref" href="Hi.NcParsers.Keywords.IFlagsDef.html#Hi_NcParsers_Keywords_IFlagsDef_Flags">Flags</a>, writes
<a class="xref" href="Hi.NcParsers.Keywords.IMotionDef.html">IMotionDef</a> section when
<a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateDef_MachineCoordinate">MachineCoordinate</a> exists.</p>
(ISO G00/G01, Heidenhain L/LN). Detects motion mode from
<a class="xref" href="Hi.NcParsers.Keywords.IFlagsDef.html#Hi_NcParsers_Keywords_IFlagsDef_Flags">Flags</a>, writes a one-shot
<a class="xref" href="Hi.NcParsers.Keywords.MotionEvent.html">MotionEvent</a> section (form + isRapid) plus a modal
<a class="xref" href="Hi.NcParsers.Keywords.MotionState.html">MotionState</a> section (Term) when
<a class="xref" href="Hi.NcParsers.Keywords.MachineCoordinateState.html">MachineCoordinateState</a> exists on the block.</p>
<p>
<a class="xref" href="Hi.NcParsers.Semantics.McLinearMotionSemantic.html">McLinearMotionSemantic</a> discriminates between
XYZ-only and XYZABC motion by checking whether rotary axis values
are present in <a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateDef_MachineCoordinate">MachineCoordinate</a>.
are present in <a class="xref" href="Hi.NcParsers.Keywords.MachineCoordinateState.html">MachineCoordinateState</a>.
</p>
Modal — persists across blocks via backward node lookback.
Must be placed after <a class="xref" href="Hi.NcParsers.LogicSyntaxs.McAbcSyntax.html">McAbcSyntax</a> in the syntax chain.
</dd>
</dl>
@@ -379,7 +420,7 @@ If G91 (incremental) is active, G53 is ignored per ISO standard.</p>
Must be placed <b>before</b> <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramXyzSyntax.html">ProgramXyzSyntax</a> in the
syntax chain. When G53 is active, this syntax consumes X/Y/Z from
<a class="xref" href="Hi.NcParsers.Keywords.IParsingDef.html#Hi_NcParsers_Keywords_IParsingDef_Parsing">Parsing</a> and writes
<a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateDef_MachineCoordinate">MachineCoordinate</a> directly,
<a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateStateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateStateDef_MachineCoordinateState">MachineCoordinateState</a> directly,
preventing <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramXyzSyntax.html">ProgramXyzSyntax</a> from processing them
as program coordinates.
</p>
@@ -389,7 +430,7 @@ as program coordinates.
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.McAbcCyclicPathSyntax.html">McAbcCyclicPathSyntax</a></dt>
<dd><p>Resolve modular rotary axes to the shortest cyclic path relative to the previous node.
Uses <a class="xref" href="Hi.NcParsers.Dependencys.IMachineAxisConfig.html#Hi_NcParsers_Dependencys_IMachineAxisConfig_IsModularRotary_System_String_">IsModularRotary(string)</a> to determine which axes
within <a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateDef_MachineCoordinate">MachineCoordinate</a> need cyclic resolution.
within <a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateStateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateStateDef_MachineCoordinateState">MachineCoordinateState</a> need cyclic resolution.
Falls back to hardcoded A/B/C if no <a class="xref" href="Hi.NcParsers.Dependencys.IMachineAxisConfig.html">IMachineAxisConfig</a> is available.
Must be placed after <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramXyzSyntax.html">ProgramXyzSyntax</a> in <a class="xref" href="Hi.NcParsers.SoftNcRunner.html#Hi_NcParsers_SoftNcRunner_NcSyntaxList">NcSyntaxList</a>.</p>
</dd>
@@ -397,35 +438,87 @@ Must be placed after <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramXyzS
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.McAbcSyntax.html">McAbcSyntax</a></dt>
<dd><p>Writes rotary axis values (A/B/C) into
<a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateDef_MachineCoordinate">MachineCoordinate</a> from
<a class="xref" href="Hi.NcParsers.Keywords.IParsingDef.html#Hi_NcParsers_Keywords_IParsingDef_Parsing">Parsing</a>.</p>
<a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateStateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateStateDef_MachineCoordinateState">MachineCoordinateState</a> from
<a class="xref" href="Hi.NcParsers.Keywords.IParsingDef.html#Hi_NcParsers_Keywords_IParsingDef_Parsing">Parsing</a> and modal lookback.</p>
<p>
Only active when <a class="xref" href="Hi.NcParsers.Dependencys.IMachineAxisConfig.html">IMachineAxisConfig</a> declares rotary axes.
Works for both 3+2-axis (no <a class="xref" href="Hi.Numerical.Xyzabc.IMachineKinematics.html">IMachineKinematics</a>)
and simultaneous 5-axis configurations.
</p>
<p>
When <a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateDef_MachineCoordinate">MachineCoordinate</a> does not exist
(e.g., rotary-only blocks like <code>G00 A30.</code> with no X/Y/Z),
the section is created with XYZ filled from lookback.
This syntax is intentionally ABC-only. When the block is rotary-only
(no <code>ProgramXyz</code>, e.g. <code>G00 A30.</code>) the section is created
with ABC but <b>without</b> X/Y/Z. <a class="xref" href="Hi.NcParsers.LogicSyntaxs.McAbcXyzFallbackSyntax.html">McAbcXyzFallbackSyntax</a>
— placed after <a class="xref" href="Hi.NcParsers.LogicSyntaxs.McXyzSyntax.html">McXyzSyntax</a> — copies X/Y/Z from the
previous block's <a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateStateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateStateDef_MachineCoordinateState">MachineCoordinateState</a>
to finish the section. Splitting the XYZ fill out lets this syntax
run <b>before</b> <a class="xref" href="Hi.NcParsers.LogicSyntaxs.McXyzSyntax.html">McXyzSyntax</a> (and before
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.G43p4RtcpSyntax.html">G43p4RtcpSyntax</a>) without accidentally filling X/Y/Z
from prev and thereby short-circuiting
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.text.json.nodes.jsonobject">DeriveMcXyz(JsonObject, Mat4d)</a>.
</p>
<p>
Missing rotary axes are filled from previous
<a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateDef_MachineCoordinate">MachineCoordinate</a> lookback,
<a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateStateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateStateDef_MachineCoordinateState">MachineCoordinateState</a> lookback,
unless the current section already has the value
(e.g., from <a class="xref" href="Hi.NcParsers.Initializers.HomeMcInitializer.html">HomeMcInitializer</a>).
Values are stored in degrees (matching <a class="xref" href="Hi.NcParsers.LogicSyntaxs.McAbcCyclicPathSyntax.html">McAbcCyclicPathSyntax</a>).
</p>
<p>
Must be placed <b>after</b> <a class="xref" href="Hi.NcParsers.LogicSyntaxs.McXyzSyntax.html">McXyzSyntax</a>
and <b>before</b> <a class="xref" href="Hi.NcParsers.LogicSyntaxs.McAbcCyclicPathSyntax.html">McAbcCyclicPathSyntax</a>
and <a class="xref" href="Hi.NcParsers.LogicSyntaxs.LinearMotionSyntax.html">LinearMotionSyntax</a> in the syntax chain.
Must be placed <b>before</b> <a class="xref" href="Hi.NcParsers.LogicSyntaxs.McXyzSyntax.html">McXyzSyntax</a> so syntaxes
that need the current-block ABC to compute transforms
(e.g. <a class="xref" href="Hi.NcParsers.LogicSyntaxs.G43p4RtcpSyntax.html">G43p4RtcpSyntax</a>) can see it; and <b>before</b>
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.McAbcCyclicPathSyntax.html">McAbcCyclicPathSyntax</a> and <a class="xref" href="Hi.NcParsers.LogicSyntaxs.LinearMotionSyntax.html">LinearMotionSyntax</a>.
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.McAbcXyzFallbackSyntax.html">McAbcXyzFallbackSyntax</a></dt>
<dd><p>Fills missing <code>X/Y/Z</code> on an ABC-only
<a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateStateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateStateDef_MachineCoordinateState">MachineCoordinateState</a> section.
Behaviour depends on whether the block is under RTCP with rotary
motion, as indicated by
<a class="xref" href="Hi.NcParsers.Syntaxs.TransformationUtil.html#Hi_NcParsers_Syntaxs_TransformationUtil_HasDynamicEntry_System_Text_Json_Nodes_JsonObject_">HasDynamicEntry(JsonObject)</a>:</p>
<ul><li>
<b>Non-dynamic</b> (no RTCP or RTCP with ABC stable) — the
programmed tool tip stays put in MC while rotary axes (if any) are
unchanged, so we simply copy X/Y/Z from the previous block's
<a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateStateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateStateDef_MachineCoordinateState">MachineCoordinateState</a>. This matches
NC modal XYZ carry-forward for rotary-only blocks such as
<code>G00 A30.</code> (non-RTCP pivoting).
</li><li>
<b>Dynamic</b> (RTCP active + ABC changing) — the programmed tool tip
must stay fixed in <i>program</i> coordinates while MC XYZ shifts to
compensate the new rotary state. Looks up the last
<a class="xref" href="Hi.NcParsers.Keywords.IProgramXyzDef.html#Hi_NcParsers_Keywords_IProgramXyzDef_ProgramXyz">ProgramXyz</a> and re-derives
<code>MC = inheritedProgramXyz × composedTransform</code>, where the
composed transform is the block's endpoint chain (now including
<a class="xref" href="Hi.NcParsers.Syntaxs.TransformationUtil.html#Hi_NcParsers_Syntaxs_TransformationUtil_PivotTransformSource">PivotTransformSource</a> as a full
rotation+translation Mat4d, so the chain already encodes the
kinematic IK). The carried <code>ProgramXyz</code> is also stamped onto
the current block so downstream consumers see a consistent
ProgramXyz + MC pair.
</li></ul>
<p>
Pair with <a class="xref" href="Hi.NcParsers.LogicSyntaxs.McAbcSyntax.html">McAbcSyntax</a>, which runs early to write ABC
but deliberately leaves X/Y/Z empty so <a class="xref" href="Hi.NcParsers.LogicSyntaxs.McXyzSyntax.html">McXyzSyntax</a> can
still derive MC XYZ from <code>ProgramXyz</code> via the transform chain
when the block carries linear motion. If <a class="xref" href="Hi.NcParsers.LogicSyntaxs.McXyzSyntax.html">McXyzSyntax</a>
has nothing to derive (no <code>ProgramXyz</code>), this syntax completes
the MC section as described above.
</p>
<p>
Does nothing when the section already carries all three of X/Y/Z
(normal linear-motion blocks), or when there is no section at all
(pure parse-only block that introduces no MC). Must be placed
<b>after</b> <a class="xref" href="Hi.NcParsers.LogicSyntaxs.McXyzSyntax.html">McXyzSyntax</a> and <b>before</b>
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.McAbcCyclicPathSyntax.html">McAbcCyclicPathSyntax</a> / <a class="xref" href="Hi.NcParsers.LogicSyntaxs.LinearMotionSyntax.html">LinearMotionSyntax</a>.
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.McXyzSyntax.html">McXyzSyntax</a></dt>
<dd><p>Derives <a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateDef_MachineCoordinate">MachineCoordinate</a> from
<dd><p>Derives <a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateStateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateStateDef_MachineCoordinateState">MachineCoordinateState</a> from
<a class="xref" href="Hi.NcParsers.Keywords.IProgramXyzDef.html#Hi_NcParsers_Keywords_IProgramXyzDef_ProgramXyz">ProgramXyz</a> by applying the composed
<a class="xref" href="Hi.NcParsers.Keywords.ITransformationDef.html#Hi_NcParsers_Keywords_ITransformationDef_ProgramToMcTransform">ProgramToMcTransform</a>.</p>
<p>
@@ -438,6 +531,13 @@ Must be placed after syntaxes that write <code>ProgramXyz</code>
and before syntaxes that read <code>MachineCoordinate</code>
(e.g., <a class="xref" href="Hi.NcParsers.LogicSyntaxs.LinearMotionSyntax.html">LinearMotionSyntax</a>).
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.PathSmoothingSyntax.html">PathSmoothingSyntax</a></dt>
<dd><p>Consumes G05.1 (high-precision contour / path smoothing) and records
its modal state. Q1 enables, Q0 disables. The simulation does not alter
the tool path — this is a controller-internal interpolation black box.</p>
</dd>
</dl>
<dl class="jumplist">
@@ -451,7 +551,7 @@ Cycle sequence (per stroke):
<p>
Retraction distance is read from <a class="xref" href="Hi.NcParsers.Dependencys.ICannedCycleConfig.html">ICannedCycleConfig</a>
(Fanuc #4002 / Syntec Pr4002, or Generic.FallbackConfig
(Fanuc #4002 / Syntec Pr4002, or <a class="xref" href="Hi.NcParsers.Dependencys.Generic.FallbackConfig.html">FallbackConfig</a>
fallback).
</p>
<p>
@@ -464,10 +564,59 @@ Must be placed after <a class="xref" href="Hi.NcParsers.LogicSyntaxs.CannedCycle
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.PositioningModeSyntax.html">PositioningModeSyntax</a></dt>
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.PivotTransformationSyntax.html">PivotTransformationSyntax</a></dt>
<dd><p>Writes the <a class="xref" href="Hi.NcParsers.Syntaxs.TransformationUtil.html#Hi_NcParsers_Syntaxs_TransformationUtil_PivotTransformSource">PivotTransformSource</a> entry
into <a class="xref" href="Hi.NcParsers.Keywords.ITransformationDef.html#Hi_NcParsers_Keywords_ITransformationDef_ProgramToMcTransform">ProgramToMcTransform</a>
on <b>every block</b>, capturing the Pn→MC kinematic rigid transform
for the block's endpoint rotary state. Mirrors legacy
<code>HardNcLine.GetProgramXyz</code>'s use of
<a class="xref" href="Hi.Numerical.Xyzabc.IMachineKinematics.html#Hi_Numerical_Xyzabc_IMachineKinematics_McToPn_Hi_Geom_DVec3d_">McToPn(DVec3d)</a> — without this entry, the
transform chain would miss the rotary rotation on any block whose
<code>MachineCoordinate.ABC</code> is non-zero, and <code>McXyzSyntax</code> (and
<code>ProgramXyzSyntax</code>'s inverse lookback) would silently drift.</p>
<p>
Scope is <b>not</b> limited to RTCP modal: as long as rotary axes are
physically at a non-zero position (e.g. after a non-RTCP <code>G00 B90</code>
plus any subsequent motion), the kinematic chain still contributes a
non-identity rigid transform that must appear in the endpoint chain.
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.G43p4RtcpSyntax.html">G43p4RtcpSyntax</a> is orthogonal and only governs the
dynamic-rotary <a class="xref" href="Hi.NcParsers.Syntaxs.TransformationUtil.html#Hi_NcParsers_Syntaxs_TransformationUtil_KindKey">KindKey</a> tagging used by
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.LinearMotionSyntax.html">LinearMotionSyntax</a> to pick the motion form.
</p>
<p>
Chain position: must run <b>after</b> all Pn-frame writers
(<a class="xref" href="Hi.NcParsers.LogicSyntaxs.IsoG68p2TiltSyntax.html">IsoG68p2TiltSyntax</a>, <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ToolHeightOffsetSyntax.html">ToolHeightOffsetSyntax</a>,
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.G43p4RtcpSyntax.html">G43p4RtcpSyntax</a>, <a class="xref" href="Hi.NcParsers.LogicSyntaxs.IsoCoordinateOffsetSyntax.html">IsoCoordinateOffsetSyntax</a>,
brand-specific coord offset syntaxes) so the <code>PivotTransform</code>
entry naturally lands as the <b>last</b> chain element. Must run
<b>before</b> <a class="xref" href="Hi.NcParsers.LogicSyntaxs.McXyzSyntax.html">McXyzSyntax</a> / <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramXyzSyntax.html">ProgramXyzSyntax</a>
so they see the completed chain.
</p>
<p>
Silently no-ops when <a class="xref" href="Hi.Numerical.Xyzabc.IMachineKinematics.html">IMachineKinematics</a> is absent
(3-axis configurations without rotary kinematics).
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.PlaneSelectSyntax.html">PlaneSelectSyntax</a></dt>
<dd><p>Consumes G17/G18/G19 plane selection from <a class="xref" href="Hi.NcParsers.Keywords.IFlagsDef.html#Hi_NcParsers_Keywords_IFlagsDef_Flags">Flags</a>
and writes <a class="xref" href="Hi.NcParsers.Keywords.IPlaneSelectDef.html">IPlaneSelectDef</a> section using conventional
axis-pair names (XY/ZX/YZ).
Modal — persists via backward lookback. Default is XY (G17).</p>
<p>
Downstream consumers (<a class="xref" href="Hi.NcParsers.LogicSyntaxs.CircularMotionSyntax.html">CircularMotionSyntax</a>,
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.IsoG68RotationSyntax.html">IsoG68RotationSyntax</a>) call
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.PlaneSelectSyntax.html#Hi_NcParsers_LogicSyntaxs_PlaneSelectSyntax_GetPlaneNormalDir_System_Text_Json_Nodes_JsonObject_">GetPlaneNormalDir(JsonObject)</a> to read the resolved plane.
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.PositioningSyntax.html">PositioningSyntax</a></dt>
<dd><p>Detects G90/G91 positioning mode from <a class="xref" href="Hi.NcParsers.Keywords.IFlagsDef.html#Hi_NcParsers_Keywords_IFlagsDef_Flags">Flags</a>
(or by modal lookback) and writes
<a class="xref" href="Hi.NcParsers.Keywords.IPositioningModeDef.html#Hi_NcParsers_Keywords_IPositioningModeDef_PositioningMode">PositioningMode</a> to the block JSON.</p>
(or by modal lookback) and writes a <a class="xref" href="Hi.NcParsers.Keywords.Positioning.html">Positioning</a> section
(<a class="xref" href="Hi.NcParsers.Keywords.IPositioningDef.html#Hi_NcParsers_Keywords_IPositioningDef_Term">Term</a>, <a class="xref" href="Hi.NcParsers.Keywords.IPositioningDef.html#Hi_NcParsers_Keywords_IPositioningDef_Mode">Mode</a>)
to the block JSON.</p>
<p>
Fanuc/ISO: reads G90/G91 from <a class="xref" href="Hi.NcParsers.Keywords.IFlagsDef.html#Hi_NcParsers_Keywords_IFlagsDef_Flags">Flags</a> (global modal).
Heidenhain: would need a separate implementation reading I-prefix per axis.
@@ -479,6 +628,66 @@ Does NOT convert incremental values — that is handled by
in the syntax chain, after canned cycle syntaxes have consumed
their parameters with cycle-specific G91 semantics.
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramEndCleanSyntax.html">ProgramEndCleanSyntax</a></dt>
<dd><p>Clears the per-block <code>Vars.Volatile</code> dictionary on blocks that
triggered program end (M02 / M30, identified by the
<a class="xref" href="Hi.NcParsers.Keywords.ProgramEnd.html">ProgramEnd</a> section written by <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramEndSyntax.html">ProgramEndSyntax</a>).</p>
<p>
Real Fanuc clears non-retained common variables (#100-#499) on program
end + reset; this syntax models that behaviour at the simulator level.
The clear happens on the same block that carried M02/M30 — the next
block's <a class="xref" href="Hi.NcParsers.LogicSyntaxs.VolatileVariableReadingSyntax.html">VolatileVariableReadingSyntax</a> carry then sees an
empty dictionary on the predecessor and starts fresh.
</p>
<p>
Pipeline placement: must run after both <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramEndSyntax.html">ProgramEndSyntax</a>
(which writes the <a class="xref" href="Hi.NcParsers.Keywords.ProgramEnd.html">ProgramEnd</a> section this syntax checks)
and <a class="xref" href="Hi.NcParsers.LogicSyntaxs.VolatileVariableReadingSyntax.html">VolatileVariableReadingSyntax</a> (so the carry has
already happened on this block; this syntax overwrites the result).
</p>
<p>
Retained common variables (<code>#500-#999</code>, owned by
<a class="xref" href="Hi.NcParsers.Dependencys.Fanuc.RetainedCommonVariableTable.html">RetainedCommonVariableTable</a>) are
untouched — they survive program end on real hardware (NV-RAM).
Local variables (<code>#1-#33</code>, scope: macro call frame) are also
untouched here; their lifecycle belongs to G65/G66/M99 push/pop, not
program end.
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramEndSyntax.html">ProgramEndSyntax</a></dt>
<dd><p>Consumes M02/M30 (program end) from <a class="xref" href="Hi.NcParsers.Keywords.IFlagsDef.html#Hi_NcParsers_Keywords_IFlagsDef_Flags">Flags</a>
and writes <a class="xref" href="Hi.NcParsers.Keywords.IProgramEndDef.html">IProgramEndDef</a> section.</p>
<p>
Downstream syntaxes that need to reset modal state on program end
(e.g. <a class="xref" href="Hi.NcParsers.LogicSyntaxs.IsoLocalCoordinateOffsetSyntax.html">IsoLocalCoordinateOffsetSyntax</a> for G52 reset)
should read the <a class="xref" href="Hi.NcParsers.Keywords.ProgramEnd.html">ProgramEnd</a> section rather than
scanning for M30 in Flags directly.
</p>
Must be placed before syntaxes that depend on the ProgramEnd section.
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramStopSyntax.html">ProgramStopSyntax</a></dt>
<dd><p>Consumes M00 (unconditional stop) and M01 (optional stop) from
<a class="xref" href="Hi.NcParsers.Keywords.IFlagsDef.html#Hi_NcParsers_Keywords_IFlagsDef_Flags">Flags</a> and writes a
<a class="xref" href="Hi.NcParsers.Keywords.IProgramStopDef.html">IProgramStopDef</a> section on the block that carried the
flag. Non-modal: the section is written only on the exact block
where the stop code appears.</p>
<p>
Siblings with <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramEndSyntax.html">ProgramEndSyntax</a> (M02/M30) which handles
end-of-program, not in-program stops.
</p>
<p>
The parsing layer only records NC intent. Whether M01 actually
pauses the run is a runtime/semantic decision gated by the operator's
"Optional Stop" switch (analogous to
<a class="xref" href="Hi.NcParsers.Dependencys.IBlockSkipConfig.html">IBlockSkipConfig</a> for block skip).
</p>
</dd>
</dl>
<dl class="jumplist">
@@ -491,16 +700,70 @@ cross-node lookback for last position.</p>
<p>
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.McXyzSyntax.html">McXyzSyntax</a> (placed after this in the chain) reads
<a class="xref" href="Hi.NcParsers.Keywords.IProgramXyzDef.html#Hi_NcParsers_Keywords_IProgramXyzDef_ProgramXyz">ProgramXyz</a> and writes
<a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateDef_MachineCoordinate">MachineCoordinate</a>.
<a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateStateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateStateDef_MachineCoordinateState">MachineCoordinateState</a>.
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramXyzUtil.html">ProgramXyzUtil</a></dt>
<dd><p>Shared utilities for <a class="xref" href="Hi.NcParsers.Keywords.IProgramXyzDef.html#Hi_NcParsers_Keywords_IProgramXyzDef_ProgramXyz">ProgramXyz</a> and
<a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateDef_MachineCoordinate">MachineCoordinate</a> lookback and resolution.
Used by <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramXyzSyntax.html">ProgramXyzSyntax</a>, <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ReferenceReturnSyntax.html">ReferenceReturnSyntax</a>,
and semantic resolvers that need position lookback.</p>
<a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateStateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateStateDef_MachineCoordinateState">MachineCoordinateState</a> lookback and
resolution. Used by <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramXyzSyntax.html">ProgramXyzSyntax</a>,
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.ReferenceReturnSyntax.html">ReferenceReturnSyntax</a>, and semantic resolvers that need
position lookback.</p>
<p>
<b>Two strategies for "what's the program coordinate at a block's
endpoint?"</b> — both invert an MC value through an
<a class="xref" href="Hi.NcParsers.Keywords.ITransformationDef.html#Hi_NcParsers_Keywords_ITransformationDef_ProgramToMcTransform">ProgramToMcTransform</a> chain,
but they pick the chain from <i>different</i> nodes:
</p>
<ul><li>
<b>By current-state transform</b>
(<a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramXyzUtil.html#Hi_NcParsers_LogicSyntaxs_ProgramXyzUtil_ComputeProgramXyzByCurrentTransform_Hi_Common_Collections_LazyLinkedListNode_Hi_NcParsers_Syntaxs_SyntaxPiece__Hi_Geom_Vec3d_">ComputeProgramXyzByCurrentTransform(LazyLinkedListNode&lt;SyntaxPiece&gt;, Vec3d)</a>) — modal anchor is
<a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateStateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateStateDef_MachineCoordinateState">MachineCoordinateState</a>. Re-expresses an
MC value (typically a predecessor's modal MC) into the <i>current</i>
block's program frame using the current block's chain. Suitable for
chain-change blocks where the spindle physically stays put while the
chain (G54 swap, G68.2 activation, G43.4 toggle, tool-height change,
...) re-anchors the program frame; mirrors legacy
<code>HardNcLine.RebuildProgramXyzByMc</code>.
</li><li>
<b>By corresponding-state transform</b>
(<a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramXyzUtil.html#Hi_NcParsers_LogicSyntaxs_ProgramXyzUtil_ComputeProgramXyzByCorrespondingTransform_Hi_Common_Collections_LazyLinkedListNode_Hi_NcParsers_Syntaxs_SyntaxPiece__">ComputeProgramXyzByCorrespondingTransform(LazyLinkedListNode&lt;SyntaxPiece&gt;)</a>) — modal
anchor is <a class="xref" href="Hi.NcParsers.Keywords.IProgramXyzDef.html#Hi_NcParsers_Keywords_IProgramXyzDef_ProgramXyz">ProgramXyz</a>. Recovers the
program coordinate that <code>nodeCarryingMc</code> was originally commanded
at, by inverting <i>that same node's</i> own transform on its own MC.
Suitable for RTCP rotary-dynamic inheritance, where the modal
invariant is "tool tip in workpiece frame stays put while rotary axes
turn" — the recovered Vec3d carries forward as the next rotary block's
modal ProgramXyz unchanged, regardless of how its
<code>PivotTransform</code> differs.
</li></ul>
<p>
Both strategies yield the same Vec3d when prev and current share the
same chain modal state; they only diverge across chain boundaries
(RTCP toggle, coord-system swap, tilt activation) and at rotary motion
(PivotTransform difference). Pick the wrong one and the result lands
in a stale frame:
</p>
<ul><li>
Non-RTCP using "corresponding" — leaves the pre-chain-change values,
so a block emitted right after <code>G43.4 H03</code> would inherit
ProgramXyz still in the G49 frame and the next motion's MC.Z drifts
by the introduced tool-height offset. (This was the 2026-04-25
SoftNc / HardNc divergence on <code>DemoPmcAirPlane/NC/02-ED6L20.NC</code>.)
</li><li>
RTCP using "current" — double-counts the rotary
<code>PivotTransform</code> difference, so the inherited workpiece anchor
rotates by the C delta on every rotary block.
</li></ul>
<p>
Direct callers of the two strategy helpers are rare — typically you
call the dispatcher <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramXyzUtil.html#Hi_NcParsers_LogicSyntaxs_ProgramXyzUtil_ResolveBlockProgramXyz_Hi_Common_Collections_LazyLinkedListNode_Hi_NcParsers_Syntaxs_SyntaxPiece__Hi_Geom_Vec3d_">ResolveBlockProgramXyz(LazyLinkedListNode&lt;SyntaxPiece&gt;, Vec3d)</a> (block's own
MC vs predecessor lookback, picks strategy from
<a class="xref" href="Hi.NcParsers.Syntaxs.TransformationUtil.html#Hi_NcParsers_Syntaxs_TransformationUtil_HasDynamicEntry_System_Text_Json_Nodes_JsonObject_">HasDynamicEntry(JsonObject)</a>) or
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramXyzUtil.html#Hi_NcParsers_LogicSyntaxs_ProgramXyzUtil_GetLastProgramXyz_Hi_Common_Collections_LazyLinkedListNode_Hi_NcParsers_Syntaxs_SyntaxPiece__">GetLastProgramXyz(LazyLinkedListNode&lt;SyntaxPiece&gt;)</a> (pure predecessor lookback).
</p>
</dd>
</dl>
<dl class="jumplist">
@@ -509,15 +772,40 @@ and semantic resolvers that need position lookback.</p>
Reads intermediate XYZ from <code>Parsing.G28</code>
(written by <a class="xref" href="Hi.NcParsers.Syntaxs.GenericSyntaxKit.html#Hi_NcParsers_Syntaxs_GenericSyntaxKit_G28Syntax">G28Syntax</a>)
and converts to machine coordinates via
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramXyzUtil.html#Hi_NcParsers_LogicSyntaxs_ProgramXyzUtil_ResolveProgramXyz_System_Text_Json_Nodes_JsonNode_Hi_Common_Collections_LazyLinkedListNode_Hi_NcParsers_Syntaxs_SyntaxPiece__Hi_Geom_Mat4d_">ResolveProgramXyz(JsonNode, LazyLinkedListNode&lt;SyntaxPiece&gt;, Mat4d)</a>.</p>
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramXyzUtil.html#Hi_NcParsers_LogicSyntaxs_ProgramXyzUtil_ResolveProgramXyz_System_Text_Json_Nodes_JsonNode_Hi_Common_Collections_LazyLinkedListNode_Hi_NcParsers_Syntaxs_SyntaxPiece__Hi_NcParsers_Sentence_Hi_NcParsers_NcDiagnosticProgress_">ResolveProgramXyz(JsonNode, LazyLinkedListNode&lt;SyntaxPiece&gt;, Sentence, NcDiagnosticProgress)</a>.</p>
<p>
Must be placed after <a class="xref" href="Hi.NcParsers.LogicSyntaxs.LinearMotionSyntax.html">LinearMotionSyntax</a> in the syntax chain.
Removes the <a class="xref" href="Hi.NcParsers.Keywords.IMotionDef.html">IMotionDef</a> section written by
Removes the <a class="xref" href="Hi.NcParsers.Keywords.IMotionEventDef.html">IMotionEventDef</a> section written by
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.LinearMotionSyntax.html">LinearMotionSyntax</a> (G28 handles its own motion).
Overwrites root <a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateDef_MachineCoordinate">MachineCoordinate</a>
Overwrites root <a class="xref" href="Hi.NcParsers.Keywords.IMachineCoordinateStateDef.html#Hi_NcParsers_Keywords_IMachineCoordinateStateDef_MachineCoordinateState">MachineCoordinateState</a>
and <a class="xref" href="Hi.NcParsers.Keywords.IProgramXyzDef.html#Hi_NcParsers_Keywords_IProgramXyzDef_ProgramXyz">ProgramXyz</a> with reference position
for subsequent block lookback.
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.RetainedCommonVariableReadingSyntax.html">RetainedCommonVariableReadingSyntax</a></dt>
<dd><p>Obtains values for Fanuc-style retained common variables (<code>#500-#999</code>)
by consuming literal numeric assignments from <code>Parsing.Assignments.#nnn</code>
and writing them straight to a registered
<a class="xref" href="Hi.NcParsers.Dependencys.Fanuc.RetainedCommonVariableTable.html">RetainedCommonVariableTable</a>.</p>
<p>
No SyntaxPiece JSON mirror is created — the table is the single source of
truth for retained values, and <a class="xref" href="Hi.NcParsers.LogicSyntaxs.VariableEvaluatorSyntax.html">VariableEvaluatorSyntax</a> reads
from the table directly. The hincproj round-trip preserves writes across
project sessions.
</p>
<p>
Only literal numeric RHS values are consumed by this syntax
(<code>#500 = 1.234</code> ✓; <code>#600 = #500 + 1</code> ✗). Non-literal RHS entries
are left untouched in <code>Parsing.Assignments</code>; <a class="xref" href="Hi.NcParsers.LogicSyntaxs.VariableEvaluatorSyntax.html">VariableEvaluatorSyntax</a>
resolves them and writes the result through the same table. The two
syntaxes are decoupled.
</p>
<p>
If no <a class="xref" href="Hi.NcParsers.Dependencys.Fanuc.RetainedCommonVariableTable.html">RetainedCommonVariableTable</a> is registered on the
runner's <code>NcDependencyList</code>, this syntax is a no-op.
</p>
</dd>
</dl>
<dl class="jumplist">
@@ -564,26 +852,109 @@ Must be placed after <a class="xref" href="Hi.NcParsers.LogicSyntaxs.CannedCycle
<dd><p>Shared utilities for all tilt transform syntaxes
(ISO, Siemens, Heidenhain). Handles section IO,
backward lookback, and <a class="xref" href="Hi.NcParsers.Keywords.ITransformationDef.html#Hi_NcParsers_Keywords_ITransformationDef_ProgramToMcTransform">ProgramToMcTransform</a> composition.</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.ToolChangeSyntax.html">ToolChangeSyntax</a></dt>
<dd><p>Consumes T (tool number) and M06 (tool change) from
<a class="xref" href="Hi.NcParsers.Keywords.IParsingDef.html#Hi_NcParsers_Keywords_IParsingDef_Parsing">Parsing</a>.
T is modal — persists across blocks. M06 triggers the change.
Writes resolved state to a <code>ToolChange</code> section:
<code>{ &ldquo;ToolId&rdquo;: 1, &ldquo;IsChange&rdquo;: true, &ldquo;Term&rdquo;: &ldquo;M06&rdquo; }</code>.
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.ToolChangeSyntax.html#Hi_NcParsers_LogicSyntaxs_ToolChangeSyntax_TermKey">TermKey</a> records the trigger command and is only written
when <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ToolChangeSyntax.html#Hi_NcParsers_LogicSyntaxs_ToolChangeSyntax_IsChangeKey">IsChangeKey</a> is true (i.e. the block actually carried
the tool-change M code); modal-only blocks omit it.</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.ToolHeightOffsetSyntax.html">ToolHeightOffsetSyntax</a></dt>
<dd><p>Resolves tool height offset ID to the effective offset value (mm)
and composes the offset as a translation into the accumulated
<dd><p>Resolves ISO tool height offset (G43/G44/G49) to the effective offset
value (mm) and composes the offset as a translation into the accumulated
<a class="xref" href="Hi.NcParsers.Keywords.ITransformationDef.html#Hi_NcParsers_Keywords_ITransformationDef_ProgramToMcTransform">ProgramToMcTransform</a> matrix.</p>
<p>
Reads parsed G43/G43.4/G44/G49 flags and H numbers from upstream parsing syntaxes,
looks up the offset value from <a class="xref" href="Hi.NcParsers.Dependencys.IToolOffsetConfig.html">IToolOffsetConfig</a> dependency,
writes the resolved state to a <a class="xref" href="Hi.NcParsers.Keywords.IToolHeightCompensationDef.html">IToolHeightCompensationDef</a>
section for debuggability, and composes
<code>ProgramToMcTransform.Trans += toolOrientation * height_mm</code>.
RTCP modes (G43.4, TRAORI, M128) are handled by separate brand-specific
syntaxes (e.g., <a class="xref" href="Hi.NcParsers.LogicSyntaxs.G43p4RtcpSyntax.html">G43p4RtcpSyntax</a>).
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.UnitModeSyntax.html">UnitModeSyntax</a></dt>
<dd><p>Detects the unit-system code (ISO Group 06: G20 inch / G21 metric)
from <a class="xref" href="Hi.NcParsers.Keywords.IFlagsDef.html#Hi_NcParsers_Keywords_IFlagsDef_Flags">Flags</a> and writes a <a class="xref" href="Hi.NcParsers.Keywords.Unit.html">Unit</a>
section (<a class="xref" href="Hi.NcParsers.Keywords.IUnitDef.html#Hi_NcParsers_Keywords_IUnitDef_Term">Term</a>, <a class="xref" href="Hi.NcParsers.Keywords.IUnitDef.html#Hi_NcParsers_Keywords_IUnitDef_System">System</a>).
Modal — absence of an explicit flag inherits the previous block's
unit, defaulting to <a class="xref" href="Hi.NcParsers.Keywords.Unit.html#Hi_NcParsers_Keywords_Unit_Metric">Metric</a> at program start.</p>
<p>
The HiNC pipeline works exclusively in millimetres. When
<a class="xref" href="Hi.NcParsers.Keywords.Generic.IsoKeywords.html#Hi_NcParsers_Keywords_Generic_IsoKeywords_G20">G20</a> is detected this syntax emits an
<code>Unit--InchNotSupported</code> Unsupported Error so upstream callers
are forced to pre-convert the NC program to metric.
<a class="xref" href="Hi.NcParsers.Keywords.Generic.IsoKeywords.html#Hi_NcParsers_Keywords_Generic_IsoKeywords_G21">G21</a> is accepted as a no-op confirmation of
the default.
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.VariableEvaluatorSyntax.html">VariableEvaluatorSyntax</a></dt>
<dd><p>Resolves Custom Macro B variable references and bracket expressions on
a single block by walking the parser-stage residue and replacing each
reference with its evaluated numeric value.</p>
<p>
Two passes per block:
</p>
<ol><li>
<code>Parsing.Assignments.#nnn</code> entries with a non-literal RHS are
evaluated in iteration order. Successful results are written to
<code>Vars.Volatile</code> for <code>#100-#499</code> or to the registered
<code>RetainedCommonVariableTable</code> for <code>#500-#999</code>, and the
entry is removed. Iteration order matters: an earlier RHS may set a
variable that a later RHS reads. Failures (vacant operand, unsupported
function, parse error) emit a <code>VariableExpression--Unevaluated</code>
error and leave the entry in place; out-of-range ids are likewise left
in place.
</li><li>
Every string-typed value reachable from <code>Parsing.&lt;tag&gt;</code>
(axis tags, canned-cycle sub-objects like <code>Parsing.G81</code>,
<code>Parsing.G54.1</code>, etc.) is parsed; on a successful evaluation the
string is replaced with a numeric <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.text.json.nodes.jsonvalue">JsonValue</a>. Failures
silently leave the original string and rely on downstream
<a class="xref" href="Hi.NcParsers.SoftNcUtil.html#Hi_NcParsers_SoftNcUtil_GetParsedDouble_System_Text_Json_Nodes_JsonObject_System_String_Hi_NcParsers_Sentence_Hi_NcParsers_NcDiagnosticProgress_">GetParsedDouble(JsonObject, string, Sentence, NcDiagnosticProgress)</a> at consumer sites to surface
<code>VariableExpression--Unevaluated</code> only if the tag is actually read.
</li></ol>
<p>
Lookup chain (first non-null wins):
</p>
<ol><li>Block-local <code>Vars.Local</code> with <a class="xref" href="Hi.Common.Collections.LazyLinkedListNode-1.html#Hi_Common_Collections_LazyLinkedListNode_1_Previous">Previous</a> traceback (<code>#1-#33</code>).</li><li>Block-local <code>Vars.Volatile</code> with traceback (<code>#100-#499</code>).</li><li>Each <a class="xref" href="Hi.NcParsers.LogicSyntaxs.Evaluation.IVariableLookup.html">IVariableLookup</a> in the runner's <code>NcDependencyList</code>, in registration order (e.g. <code>RetainedCommonVariableTable</code>, <code>FanucParameterTable</code>, <code>FanucToolOffsetTable</code>).</li><li>Each <a class="xref" href="Hi.NcParsers.LogicSyntaxs.Evaluation.IRuntimeVariableLookup.html">IRuntimeVariableLookup</a> in <a class="xref" href="Hi.NcParsers.LogicSyntaxs.VariableEvaluatorSyntax.html#Hi_NcParsers_LogicSyntaxs_VariableEvaluatorSyntax_RuntimeVariableLookups">RuntimeVariableLookups</a>, in list order (e.g. <code>FanucPositionVariableLookup</code>).</li></ol>
<p>
Each lookup is responsible for its own id-range gating — id ranges are
not hard-coded inside this syntax. Adding a new variable surface
(Heidenhain Q parameters, Siemens GUDs, modal G/F/T reads) is additive:
register an <a class="xref" href="Hi.NcParsers.LogicSyntaxs.Evaluation.IVariableLookup.html">IVariableLookup</a> on a dependency or push an
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.Evaluation.IRuntimeVariableLookup.html">IRuntimeVariableLookup</a> onto the per-preset list.
</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Hi.NcParsers.LogicSyntaxs.VolatileVariableReadingSyntax.html">VolatileVariableReadingSyntax</a></dt>
<dd><p>Obtains values for Fanuc-style non-retained common variables
(<code>#100-#499</code>). Reads literal numeric assignments from
<code>Parsing.Assignments.#nnn</code>, dict-merges them with the previous block's
volatile state, and writes the resulting per-block dictionary into
<code>Vars.Volatile</code>.</p>
<p>
Lifetime is bounded by <code>MachiningSession</code>: within one session the
dictionary carries forward block-by-block via this syntax; session restart
abandons the SyntaxPiece JSON dataflow and starts fresh. Program-end
(M02/M30) clearing is handled by <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramEndCleanSyntax.html">ProgramEndCleanSyntax</a>.
</p>
<p>
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 <a class="xref" href="Hi.NcParsers.Keywords.ITransformationDef.html#Hi_NcParsers_Keywords_ITransformationDef_ProgramToMcTransform">ProgramToMcTransform</a>'s
<a class="xref" href="Hi.Geom.Mat4d.html#Hi_Geom_Mat4d_AxialNormal">AxialNormal</a> (rotated Z). If no transformation exists yet,
defaults to <a class="xref" href="Hi.Geom.Vec3d.html#Hi_Geom_Vec3d_UnitZ">UnitZ</a>.
Only literal numeric RHS values are consumed by this syntax
(<code>#124 = 15.</code> ✓; <code>#100 = #1 + 5</code> ✗). Non-literal RHS entries
are left untouched in <code>Parsing.Assignments</code>; <a class="xref" href="Hi.NcParsers.LogicSyntaxs.VariableEvaluatorSyntax.html">VariableEvaluatorSyntax</a>
resolves them and writes the result into the same per-block dictionary.
The two syntaxes are decoupled — the evaluator's lookup tracebacks via
<code>SyntaxPiece</code> linkage so it does not depend on having run before
or after this syntax.
</p>
</dd>
</dl>