This commit is contained in:
2026-09-09 18:06:21 +08:00
parent 161af68fe3
commit 45b9f9ed5d
79 changed files with 1167 additions and 1532 deletions
@@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Class ProgramEndSyntax | HiAPI-C# 2025 ">
<meta name="description" content="Consumes M02/M30 (program end) from and writes section. Downstream syntaxes that need to reset modal state on program end (e.g. for G52 reset) should read the section rather than scanning for M30 in Flags directly. Must be placed before syntaxes that depend on the ProgramEnd section.">
<meta name="description" content="Consumes M02/M30 (program end) from and writes section. Downstream syntaxes that need to reset modal state on program end (e.g. for G52 reset) should read the section rather than scanning for M30 in Flags directly. The program-end edge. On a real controller M02/M30 ends the program and enters the reset state: the modal G codes return to their power-on defaults — tool length compensation is cancelled (G49, which also ends tool-center-point control: Fanuc TCP is cancelled by G49 or reset), the tilted work plane and coordinate rotation are cancelled (G69), cutter radius compensation is cancelled (G40), the canned cycle is cancelled (G80). A simulator that plays a file with several programs chained by M02 must keep playing, so the reset is modelled as an edge between the program-end block and its successor: the program-end block itself keeps the modal state it executed under (its own motion — G0 Z100. M30 — still sees the compensation), and the successor starts from the reset defaults. Each modal owner tests the edge with in its single-step node.Previous lookback and writes its cancel state on the successor instead of carrying: (G43/G44 → G49), (G43.4 → G49), (TRAORI → TRAFOOF, the D compensation itself stays — Siemens retains the active tool on reset), (M128 / TCPM → off, TOOL CALL compensation stays), (every tilt / rotation / frame term → G69), (G41/G42 → G40, the modal D is kept) and (→ G80). Deliberately not reset: G00/G01, G90/G91, G17–G19, G94/G95, the work offset (G54–G59) and the path-smoothing mode — their reset defaults are controller-parameter dependent and they do not enter the program→machine transform chain; G20/G21 is retained by the controller itself. G52 keeps its existing behaviour of clearing on the program-end block (HardNc parity). A block right after the edge that has no words at all (a comment line) is still the edge — every owner handles it before any &quot;no Parsing&quot; early return, or the modal carry would clone the active section across it. Must be placed before syntaxes that depend on the ProgramEnd section.">
<link rel="icon" href="../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../public/docfx.min.css">
<link rel="stylesheet" href="../public/main.css">
@@ -105,6 +105,40 @@ Downstream syntaxes that need to reset modal state on program end
should read the <a class="xref" href="Hi.NcParsers.Keywords.ProgramEnd.html">ProgramEnd</a> section rather than
scanning for M30 in Flags directly.
</p>
<p>
<b>The program-end edge.</b> On a real controller M02/M30 ends the
program and enters the reset state: the modal G codes return to their
power-on defaults — tool length compensation is cancelled (G49, which
also ends tool-center-point control: Fanuc TCP is cancelled by G49 or
reset), the tilted work plane and coordinate rotation are cancelled
(G69), cutter radius compensation is cancelled (G40), the canned cycle
is cancelled (G80). A simulator that plays a file with several
programs chained by M02 must keep playing, so the reset is modelled as
an <i>edge</i> between the program-end block and its successor: the
program-end block itself keeps the modal state it executed under (its
own motion — <code>G0 Z100. M30</code> — still sees the compensation), and
the successor starts from the reset defaults. Each modal owner tests
the edge with <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramEndSyntax.html#Hi_NcParsers_LogicSyntaxs_ProgramEndSyntax_IsResetEdge_Hi_Common_Collections_LazyLinkedListNode_Hi_NcParsers_Syntaxs_SyntaxPiece__">IsResetEdge(LazyLinkedListNode&lt;SyntaxPiece&gt;)</a> in its single-step
<code>node.Previous</code> lookback and writes its cancel state on the
successor instead of carrying: <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ToolHeightOffsetSyntax.html">ToolHeightOffsetSyntax</a>
(G43/G44 → G49), <a class="xref" href="Hi.NcParsers.LogicSyntaxs.G43p4RtcpSyntax.html">G43p4RtcpSyntax</a> (G43.4 → G49),
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.Siemens.SiemensTraoriSyntax.html">SiemensTraoriSyntax</a> (TRAORI → TRAFOOF, the
D compensation itself stays — Siemens retains the active tool on
reset), <a class="xref" href="Hi.NcParsers.LogicSyntaxs.Heidenhain.HeidenhainRtcpSyntax.html">HeidenhainRtcpSyntax</a> (M128 / TCPM
→ off, TOOL CALL compensation stays), <a class="xref" href="Hi.NcParsers.LogicSyntaxs.TiltTransformUtil.html">TiltTransformUtil</a>
(every tilt / rotation / frame term → G69),
<a class="xref" href="Hi.NcParsers.PostLogicSyntaxs.RadiusCompensationSyntax.html">RadiusCompensationSyntax</a> (G41/G42 →
G40, the modal D is kept) and <a class="xref" href="Hi.NcParsers.LogicSyntaxs.CannedCycleResolveSyntax.html">CannedCycleResolveSyntax</a>
(→ G80). Deliberately not reset: G00/G01, G90/G91, G17–G19, G94/G95,
the work offset (G54–G59) and the path-smoothing mode — their reset
defaults are controller-parameter dependent and they do not enter the
program→machine transform chain; G20/G21 is retained by the controller
itself. G52 keeps its existing behaviour of clearing on the
program-end block (HardNc parity). A block right after the edge that
has no words at all (a comment line) is still the edge — every owner
handles it before any "no Parsing" early return, or the modal carry
would clone the active section across it.
</p>
Must be placed before syntaxes that depend on the ProgramEnd section.
</div>
<div class="markdown conceptual"></div>
@@ -377,6 +411,51 @@ Must be placed before syntaxes that depend on the ProgramEnd section.
<a id="Hi_NcParsers_LogicSyntaxs_ProgramEndSyntax_IsResetEdge_" data-uid="Hi.NcParsers.LogicSyntaxs.ProgramEndSyntax.IsResetEdge*"></a>
<h3 id="Hi_NcParsers_LogicSyntaxs_ProgramEndSyntax_IsResetEdge_Hi_Common_Collections_LazyLinkedListNode_Hi_NcParsers_Syntaxs_SyntaxPiece__" data-uid="Hi.NcParsers.LogicSyntaxs.ProgramEndSyntax.IsResetEdge(Hi.Common.Collections.LazyLinkedListNode{Hi.NcParsers.Syntaxs.SyntaxPiece})">
IsResetEdge(LazyLinkedListNode&lt;SyntaxPiece&gt;)
</h3>
<div class="markdown level1 summary"><p>True when <code class="paramref">node</code> is the first block after a
program end — its predecessor carries the <a class="xref" href="Hi.NcParsers.Keywords.ProgramEnd.html">ProgramEnd</a>
section (M02 / M30, or a brand equivalent such as klartext
<code>END PGM</code>). Modal owners call this in their
<code>node.Previous</code> lookback and, when true, write their reset
(cancel) state on <code class="paramref">node</code> instead of carrying the
predecessor's modal forward — see the class summary for the set.
The section is one-shot (never carried), so the edge is exactly one
block wide.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static bool IsResetEdge(LazyLinkedListNode&lt;SyntaxPiece&gt; node)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>node</code> <a class="xref" href="Hi.Common.Collections.LazyLinkedListNode-1.html">LazyLinkedListNode</a>&lt;<a class="xref" href="Hi.NcParsers.Syntaxs.SyntaxPiece.html">SyntaxPiece</a>&gt;</dt>
<dd></dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></dt>
<dd></dd>
</dl>
<a id="Hi_NcParsers_LogicSyntaxs_ProgramEndSyntax_MakeXmlSource_" data-uid="Hi.NcParsers.LogicSyntaxs.ProgramEndSyntax.MakeXmlSource*"></a>
<h3 id="Hi_NcParsers_LogicSyntaxs_ProgramEndSyntax_MakeXmlSource_System_String_System_String_System_Boolean_" data-uid="Hi.NcParsers.LogicSyntaxs.ProgramEndSyntax.MakeXmlSource(System.String,System.String,System.Boolean)">