This commit is contained in:
2026-09-13 19:45:24 +08:00
parent 397a7a8cc4
commit 2db889ad89
58 changed files with 3526 additions and 213 deletions
@@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Class CannedCycleResolveSyntax | HiAPI-C# 2025 ">
<meta name="description" content="Resolves the canned-cycle Group-09 state for the current block and writes the result to the section. Active cycle (direct G81..G89 or modal repeat): merges Parsing overrides with previous-cycle stored params, applies G91 incremental-to-absolute conversion and missing-axis fallback, writes with , , and . The resolved cycle sub-section is left in Parsing under the cycle code for downstream cycle syntaxes (, etc.) to read.Explicit cancel (G80 flag present on a non-cycle block): consumes the G80 flag and writes = { Term: &quot;G80&quot; }, acting as a hard sentinel for modal lookback.No Group-09 activity: leaves the block untouched. Must be placed after and before the individual cycle syntaxes in the chain.">
<meta name="description" content="Resolves the canned-cycle Group-09 state for the current block and writes the result to the section. Active cycle (direct G81..G89 or modal repeat): merges Parsing overrides with previous-cycle stored params, applies G91 incremental-to-absolute conversion and missing-axis fallback, writes with , , and . The resolved cycle sub-section is left in Parsing under the cycle code for downstream cycle syntaxes (, etc.) to read.Explicit cancel (G80 flag present on a non-cycle block): consumes the G80 flag and writes = { Term: &quot;G80&quot; }, acting as a hard sentinel for modal lookback.No Group-09 activity: leaves the block untouched. A rotary-only block (C40.) reaches this syntax without a Parsing node — consumed the word into MachineCoordinateState and dropped the emptied node — but its one-shot record marks it as a block that spoke an axis word, so under an active cycle it is a modal repeat like any X/Y block (Fanuc&#39;s any-axis-word rule; HardNc indexes the table and drills again). The cycle&#39;s pre-positioning item then carries the block&#39;s ABC (). Must be placed after and before the individual cycle syntaxes in the chain.">
<link rel="icon" href="../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../public/docfx.min.css">
<link rel="stylesheet" href="../public/main.css">
@@ -111,6 +111,16 @@ 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>
A rotary-only block (<code>C40.</code>) reaches this syntax without a
<code>Parsing</code> node — <a class="xref" href="Hi.NcParsers.LogicSyntaxs.McAbcSyntax.html">McAbcSyntax</a> consumed the word into
<code>MachineCoordinateState</code> and dropped the emptied node — but its
one-shot <a class="xref" href="Hi.NcParsers.Keywords.RotaryWords.html">RotaryWords</a> record marks it as a block that
spoke an axis word, so under an active cycle it is a modal repeat like
any X/Y block (Fanuc's any-axis-word rule; HardNc indexes the table and
drills again). The cycle's pre-positioning item then carries the
block's ABC (<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.text.json.nodes.jsonobject">WriteCompoundMotion(JsonObject, string, JsonArray, Vec3d)</a>).
</p>
<p>
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>
@@ -218,7 +228,7 @@ neither the current block nor a previous block declares G98/G99:
}</code></pre>
<p>Modal repeat: the current block carries only an X override and no
cycle code, but <code>#Previous:</code> has an active G81 with stored
params. <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.text.json.nodes.jsonobject">MergeModalCycleSection(JsonObject, JsonObject, ISentenceCarrier, NcDiagnosticProgress)</a>
params. <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.text.json.nodes.jsonobject">MergeModalCycleSection(JsonObject, JsonObject, ISentenceCarrier, NcDiagnosticProgress, out HashSet&lt;string&gt;)</a>
merges X=60 (override) with Y/Z/R from stored params, removes the
consumed X from <code>Parsing</code> root, and writes the merged section
back to <code>Parsing.G81</code>. <code>ReturnMode</code> inherits &ldquo;G98&rdquo; from
@@ -278,6 +288,100 @@ default applies after reset:
"Parsing": { "X": 60 },
"CannedCycle": { "Term": "G80" }
}</code></pre>
<p>Rotary-only modal repeat: the block carries no <code>Parsing</code> at all
(<a class="xref" href="Hi.NcParsers.LogicSyntaxs.McAbcSyntax.html">McAbcSyntax</a> consumed <code>C40.</code> into
<code>MachineCoordinateState</code> and dropped the emptied node) but its
one-shot <a class="xref" href="Hi.NcParsers.Keywords.RotaryWords.html">RotaryWords</a> record says it spoke an axis word,
so the active G81 from <code>#Previous:</code> repeats with every stored
parameter (no override to merge). The <code>Parsing</code> node is
re-created to host the resolved cycle sub-section for the downstream
cycle syntax:
#Previous:</p>
<pre><code class="lang-csharp">{
"CannedCycle": {
"Term": "G81",
"ReturnMode": "G98",
"Params": { "X": 50, "Y": 30, "Z": -10, "R": 2 }
},
"ProgramXyz": { "X": 50, "Y": 30, "Z": 0 }
}</code></pre>
<p>#BeforeBuild:</p>
<pre><code class="lang-csharp">{
"MachineCoordinateState": { "C": 40 },
"RotaryWords": { "C": 40 }
}</code></pre>
<p>#AfterBuild:</p>
<pre><code class="lang-csharp">{
"MachineCoordinateState": { "C": 40 },
"RotaryWords": { "C": 40 },
"Parsing": { "G81": { "X": 50, "Y": 30, "Z": -10, "R": 2 } },
"CannedCycle": {
"Term": "G81",
"ReturnMode": "G98",
"Params": { "X": 50, "Y": 30, "Z": -10, "R": 2 }
}
}</code></pre>
<p>Modal repeat under G91 (<code>X10.</code> pitch): only the block's own X
word is an increment (50 + 10 = 60, from the previous block's
machine position read back through this block's identity chain);
the stored Y / Z / R are the previous cycle's <b>absolute</b>
results and are reused verbatim instead of being added onto the
anchors again (which would have moved Y to 60 and lifted Z to
R + Z):
#Previous:</p>
<pre><code class="lang-csharp">{
"CannedCycle": {
"Term": "G81",
"ReturnMode": "G98",
"Params": { "X": 50, "Y": 30, "Z": -10, "R": 2 }
},
"ProgramXyz": { "X": 50, "Y": 30, "Z": 0 },
"MachineCoordinateState": { "X": 50, "Y": 30, "Z": 0 }
}</code></pre>
<p>#BeforeBuild:</p>
<pre><code class="lang-csharp">{
"Positioning": { "Term": "G91", "Mode": "Incremental" },
"Parsing": { "X": 10 }
}</code></pre>
<p>#AfterBuild:</p>
<pre><code class="lang-csharp">{
"Positioning": { "Term": "G91", "Mode": "Incremental" },
"Parsing": { "G81": { "X": 60, "Y": 30, "Z": -10, "R": 2 } },
"CannedCycle": {
"Term": "G81",
"ReturnMode": "G98",
"Params": { "X": 60, "Y": 30, "Z": -10, "R": 2 }
}
}</code></pre>
<p>A block whose Group-09 state a brand syntax already authored (the
shape <code>SiemensModalCycleSyntax</code> writes for a bare <code>MCALL</code>
cancel or an <code>MCALL CYCLE8x(…)</code> arm) is left alone even though
<code>#Previous:</code> still carries an active G81 and the block spoke a
rotary word: the authoring syntax owns the block, nothing repeats,
and the sentinel survives for the blocks after it. (The Siemens
parser only accepts <code>MCALL</code> alone on its block, so today this is
the contract's guard rather than a reachable program line.)
#Previous:</p>
<pre><code class="lang-csharp">{
"CannedCycle": {
"Term": "G81",
"ReturnMode": "G98",
"Params": { "X": 50, "Y": 30, "Z": -10, "R": 2 }
},
"ProgramXyz": { "X": 50, "Y": 30, "Z": 0 }
}</code></pre>
<p>#BeforeBuild:</p>
<pre><code class="lang-csharp">{
"MachineCoordinateState": { "C": 40 },
"RotaryWords": { "C": 40 },
"CannedCycle": { "Term": "G80" }
}</code></pre>
<p>#AfterBuild:</p>
<pre><code class="lang-csharp">{
"MachineCoordinateState": { "C": 40 },
"RotaryWords": { "C": 40 },
"CannedCycle": { "Term": "G80" }
}</code></pre>