rename XFactory.Regs to XFactory.Generators.
This commit is contained in:
@@ -195,6 +195,161 @@ writes a <a class="xref" href="Hi.NcParsers.Keywords.MotionEvent.html">MotionEve
|
||||
</dd></dl>
|
||||
|
||||
|
||||
<h2 id="Hi_NcParsers_LogicSyntaxs_CircularMotionSyntax_examples">Examples</h2>
|
||||
<p>All cases below have the current block's <code>ProgramXyz</code> already
|
||||
set (as a prior <a class="xref" href="Hi.NcParsers.LogicSyntaxs.ProgramXyzSyntax.html">ProgramXyzSyntax</a> would have produced)
|
||||
and run with no <code>#Previous:</code>, so <code>GetLastProgramXyz</code>
|
||||
returns <code>Vec3d.Zero</code>. The G17 XY plane is implicit
|
||||
(no <code>PlaneSelect</code> section means <code>PlaneNormalDir = 2</code>).</p>
|
||||
<p>
|
||||
G02 with I/J — quarter arc from <code>(0,0,0)</code> to <code>(10,0,0)</code>
|
||||
around <code>(5,0,0)</code>; I=5 J=0 are incremental offsets from start
|
||||
to center. The <code>G02</code> flag is consumed (<code>Parsing</code> removed
|
||||
once empty); <code>MotionState</code> + <code>MotionEvent</code> are written:
|
||||
</p>
|
||||
#BeforeBuild:
|
||||
<pre><code class="lang-csharp">{
|
||||
"Parsing": { "Flags": ["G02"], "I": 5, "J": 0 },
|
||||
"ProgramXyz": { "X": 10, "Y": 0, "Z": 0 }
|
||||
}</code></pre>
|
||||
#AfterBuild:
|
||||
<pre><code class="lang-csharp">{
|
||||
"ProgramXyz": { "X": 10, "Y": 0, "Z": 0 },
|
||||
"MotionState": { "Term": "G02" },
|
||||
"MotionEvent": {
|
||||
"Form": "McArc",
|
||||
"ArcCenter": { "X": 5, "Y": 0, "Z": 0 },
|
||||
"PlaneNormalDir": 2,
|
||||
"IsCcw": false,
|
||||
"AdditionalCircleNum": 0
|
||||
}
|
||||
}</code></pre>
|
||||
Modal carry of G02: no motion flag on the current block but a
|
||||
<code>#Previous:</code> <code>MotionState.Term = "G02"</code> tells us we are
|
||||
still in circular mode. I/J on the current block describe the arc
|
||||
the same way:
|
||||
#Previous:
|
||||
<pre><code class="lang-csharp">{ "MotionState": { "Term": "G02" } }</code></pre>
|
||||
#BeforeBuild:
|
||||
<pre><code class="lang-csharp">{
|
||||
"Parsing": { "I": 5, "J": 0 },
|
||||
"ProgramXyz": { "X": 10, "Y": 0, "Z": 0 }
|
||||
}</code></pre>
|
||||
#AfterBuild:
|
||||
<pre><code class="lang-csharp">{
|
||||
"ProgramXyz": { "X": 10, "Y": 0, "Z": 0 },
|
||||
"MotionState": { "Term": "G02" },
|
||||
"MotionEvent": {
|
||||
"Form": "McArc",
|
||||
"ArcCenter": { "X": 5, "Y": 0, "Z": 0 },
|
||||
"PlaneNormalDir": 2,
|
||||
"IsCcw": false,
|
||||
"AdditionalCircleNum": 0
|
||||
}
|
||||
}</code></pre>
|
||||
No I/J/K/R on the block — the per-block arc data is missing, so
|
||||
the syntax bails out early; the <code>G02</code> flag stays in
|
||||
<code>Parsing.Flags</code> for some other syntax to act on (or to surface
|
||||
as residue if no one does):
|
||||
#BeforeBuild:
|
||||
<pre><code class="lang-csharp">{
|
||||
"Parsing": { "Flags": ["G02"] },
|
||||
"ProgramXyz": { "X": 10, "Y": 0, "Z": 0 }
|
||||
}</code></pre>
|
||||
#AfterBuild:
|
||||
<pre><code class="lang-csharp">{
|
||||
"Parsing": { "Flags": ["G02"] },
|
||||
"ProgramXyz": { "X": 10, "Y": 0, "Z": 0 }
|
||||
}</code></pre>
|
||||
R-format degenerate (chord = 2R, semicircle): start <code>(0,0,0)</code>
|
||||
→ end <code>(10,0,0)</code>, R=5. <code>perpDistSq</code> resolves to 0 so the
|
||||
computed center collapses to the chord midpoint <code>(5,0,0)</code>; no
|
||||
sqrt drift on this branch:
|
||||
#BeforeBuild:
|
||||
<pre><code class="lang-csharp">{
|
||||
"Parsing": { "Flags": ["G02"], "R": 5 },
|
||||
"ProgramXyz": { "X": 10, "Y": 0, "Z": 0 }
|
||||
}</code></pre>
|
||||
#AfterBuild:
|
||||
<pre><code class="lang-csharp">{
|
||||
"ProgramXyz": { "X": 10, "Y": 0, "Z": 0 },
|
||||
"MotionState": { "Term": "G02" },
|
||||
"MotionEvent": {
|
||||
"Form": "McArc",
|
||||
"ArcCenter": { "X": 5, "Y": 0, "Z": 0 },
|
||||
"PlaneNormalDir": 2,
|
||||
"IsCcw": false,
|
||||
"AdditionalCircleNum": 0
|
||||
}
|
||||
}</code></pre>
|
||||
R-format non-trivial: G02 90° arc from <code>(0,0,0)</code> to
|
||||
<code>(10,10,0)</code> with R=10. The center comes from the cross-product
|
||||
+ sqrt + normalize path inside <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">ResolveCenterFromR(Vec3d, Vec3d, int, bool, double)</a>,
|
||||
but for this particular axis-aligned chord the rounding errors
|
||||
cancel and the center lands at exactly <code>(10, 0, 0)</code> — i.e.
|
||||
no ULP drift here, in contrast to e.g.
|
||||
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.McAbcCyclicPathSyntax.html">McAbcCyclicPathSyntax</a>'s rad/deg round-trip:
|
||||
#BeforeBuild:
|
||||
<pre><code class="lang-csharp">{
|
||||
"Parsing": { "Flags": ["G02"], "R": 10 },
|
||||
"ProgramXyz": { "X": 10, "Y": 10, "Z": 0 }
|
||||
}</code></pre>
|
||||
#AfterBuild:
|
||||
<pre><code class="lang-csharp">{
|
||||
"ProgramXyz": { "X": 10, "Y": 10, "Z": 0 },
|
||||
"MotionState": { "Term": "G02" },
|
||||
"MotionEvent": {
|
||||
"Form": "McArc",
|
||||
"ArcCenter": { "X": 10, "Y": 0, "Z": 0 },
|
||||
"PlaneNormalDir": 2,
|
||||
"IsCcw": false,
|
||||
"AdditionalCircleNum": 0
|
||||
}
|
||||
}</code></pre>
|
||||
G03 CCW with I/J — same geometry as case 0 (start <code>(0,0,0)</code>,
|
||||
end <code>(10,0,0)</code>, I=5 J=0 → center <code>(5,0,0)</code>) but the G03
|
||||
flag flips <code>IsCcw</code> to <code>true</code>. Direction is the only
|
||||
differentiating output; arc-center math is unchanged:
|
||||
#BeforeBuild:
|
||||
<pre><code class="lang-csharp">{
|
||||
"Parsing": { "Flags": ["G03"], "I": 5, "J": 0 },
|
||||
"ProgramXyz": { "X": 10, "Y": 0, "Z": 0 }
|
||||
}</code></pre>
|
||||
#AfterBuild:
|
||||
<pre><code class="lang-csharp">{
|
||||
"ProgramXyz": { "X": 10, "Y": 0, "Z": 0 },
|
||||
"MotionState": { "Term": "G03" },
|
||||
"MotionEvent": {
|
||||
"Form": "McArc",
|
||||
"ArcCenter": { "X": 5, "Y": 0, "Z": 0 },
|
||||
"PlaneNormalDir": 2,
|
||||
"IsCcw": true,
|
||||
"AdditionalCircleNum": 0
|
||||
}
|
||||
}</code></pre>
|
||||
Full circle G02 — start == end (both <code>(0,0,0)</code>), I=5 J=0
|
||||
places center off-start at <code>(5,0,0)</code>. The
|
||||
<code>isFullCircle</code> guard (chord length < 1e-6 and
|
||||
center-to-start > 1e-6) flips <code>AdditionalCircleNum</code> to 1
|
||||
so a downstream motion semantic knows to draw the closed loop:
|
||||
#BeforeBuild:
|
||||
<pre><code class="lang-csharp">{
|
||||
"Parsing": { "Flags": ["G02"], "I": 5, "J": 0 },
|
||||
"ProgramXyz": { "X": 0, "Y": 0, "Z": 0 }
|
||||
}</code></pre>
|
||||
#AfterBuild:
|
||||
<pre><code class="lang-csharp">{
|
||||
"ProgramXyz": { "X": 0, "Y": 0, "Z": 0 },
|
||||
"MotionState": { "Term": "G02" },
|
||||
"MotionEvent": {
|
||||
"Form": "McArc",
|
||||
"ArcCenter": { "X": 5, "Y": 0, "Z": 0 },
|
||||
"PlaneNormalDir": 2,
|
||||
"IsCcw": false,
|
||||
"AdditionalCircleNum": 1
|
||||
}
|
||||
}</code></pre>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user