HiNC-2025-win-desktop-Deploy/App/wwwroot/HiAPI-docsite/api/Hi.NcParsers.LogicSyntaxs.BareG28Behavior.html

388 lines
18 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Enum BareG28Behavior | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Enum BareG28Behavior | HiAPI-C# 2025 ">
<meta name="description" content="Writes section for G28 reference point return. Reads intermediate XYZ from Parsing.G28 (written by ) and converts to machine coordinates via . Must be placed after in the syntax chain. Removes the section written by (G28 handles its own motion). Overwrites root and with reference position for subsequent block lookback.">
<link rel="icon" href="../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../public/docfx.min.css">
<link rel="stylesheet" href="../public/main.css">
<meta name="docfx:navrel" content="../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="Hi.NcParsers.LogicSyntaxs.BareG28Behavior">
<h1 id="Hi_NcParsers_LogicSyntaxs_BareG28Behavior" data-uid="Hi.NcParsers.LogicSyntaxs.BareG28Behavior" class="text-break">
Enum BareG28Behavior
</h1>
<div class="facts text-secondary">
<dl><dt>Namespace</dt><dd><a class="xref" href="Hi.html">Hi</a>.<a class="xref" href="Hi.NcParsers.html">NcParsers</a>.<a class="xref" href="Hi.NcParsers.LogicSyntaxs.html">LogicSyntaxs</a></dd></dl>
<dl><dt>Assembly</dt><dd>HiMech.dll</dd></dl>
</div>
<div class="markdown summary"><p>Writes <a class="xref" href="Hi.NcParsers.Keywords.ICompoundMotionDef.html">ICompoundMotionDef</a> section for G28 reference point return.
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_NcParsers_ISentenceCarrier_Hi_NcParsers_NcDiagnosticProgress_">ResolveProgramXyz(JsonNode, LazyLinkedListNode&lt;SyntaxPiece&gt;, ISentenceCarrier, 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.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.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>
</div>
<div class="markdown conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public enum BareG28Behavior</code></pre>
</div>
<dl class="typelist extensionMethods">
<dt>Extension Methods</dt>
<dd>
<div>
<a class="xref" href="Hi.Common.InvokeUtil.html#Hi_Common_InvokeUtil_SelfInvoke__1___0_System_Action___0__">InvokeUtil.SelfInvoke&lt;TSrc&gt;(TSrc, Action&lt;TSrc&gt;)</a>
</div>
<div>
<a class="xref" href="Hi.Common.InvokeUtil.html#Hi_Common_InvokeUtil_SelfInvoke__2___0_System_Func___0___1__">InvokeUtil.SelfInvoke&lt;TSrc, TDst&gt;(TSrc, Func&lt;TSrc, TDst&gt;)</a>
</div>
<div>
<a class="xref" href="Hi.Common.MaskUtil.html#Hi_Common_MaskUtil_GetMaskedValue__1___0___0_System_Boolean_">MaskUtil.GetMaskedValue&lt;T&gt;(T, T, bool)</a>
</div>
<div>
<a class="xref" href="Hi.Common.MaskUtil.html#Hi_Common_MaskUtil_SetMask__1___0____0_System_Boolean_">MaskUtil.SetMask&lt;T&gt;(ref T, T, bool)</a>
</div>
<div>
<a class="xref" href="Hi.Coloring.ColorUtil.html#Hi_Coloring_ColorUtil_GetGloomyColor_System_Object_System_Double_System_Double_">ColorUtil.GetGloomyColor(object, double, double)</a>
</div>
<div>
<a class="xref" href="Hi.Common.NameUtil.html#Hi_Common_NameUtil_GetSelectionName_System_Object_">NameUtil.GetSelectionName(object)</a>
</div>
<div>
<a class="xref" href="Hi.Common.StringUtil.html#Hi_Common_StringUtil_GetPropertyStringIfToStringNotOverloaded_System_Object_System_Boolean_System_Boolean_">StringUtil.GetPropertyStringIfToStringNotOverloaded(object, bool, bool)</a>
</div>
<div>
<a class="xref" href="Hi.Parallels.LockUtil.html#Hi_Parallels_LockUtil_Lock_System_Object_">LockUtil.Lock(object)</a>
</div>
</dd></dl>
<h2 id="fields">Fields
</h2>
<dl class="parameters">
<dt id="Hi_NcParsers_LogicSyntaxs_BareG28Behavior_Alarm"><code>Alarm = 0</code></dt>
<dd><p>Emit <code>Coord-RefReturn&ndash;003</code> validation error and
consume the bare G28 without emitting motion.</p>
</dd>
<dt id="Hi_NcParsers_LogicSyntaxs_BareG28Behavior_AllAxesHome"><code>AllAxesHome = 1</code></dt>
<dd><p>Interpret bare G28 as if every configured axis were
listed at its current modal value, so item 0 (intermediate) is
a no-op and item 1 sends each configured axis to its home.
Requires an <a class="xref" href="Hi.NcParsers.Dependencys.IMachineAxisConfig.html">IMachineAxisConfig</a> dep; without one
the syntax falls back to <a class="xref" href="Hi.NcParsers.LogicSyntaxs.BareG28Behavior.html#Hi_NcParsers_LogicSyntaxs_BareG28Behavior_Alarm">Alarm</a>.</p>
</dd>
</dl>
<h2 id="Hi_NcParsers_LogicSyntaxs_BareG28Behavior_examples">Examples</h2>
<p>All cases hardcode a <code>TestDeps.HomeMc</code> with X/Y home at 0 and Z
home at 100 (typical mill where Z-home is above the table) and leave
the <code>ProgramToMcTransform</code> chain at identity so the final
<code>ProgramXyz</code> equals <code>MachineCoordinateState</code>. The G28
pattern emits a 2-item <code>CompoundMotion</code>: item 0 is the
intermediate point in <code>ProgramXyz</code>, item 1 is the final position
in <code>MachineCoordinateState</code>. Axes not present in the G28 block
keep the previous-block MC value rather than going home.</p>
<p>
<code>G91 G28 X0 Y0 Z0</code> with a <code>#Previous:</code> block carrying
<code>MachineCoordinateState=(50,60,70)</code> — all three axes go home,
so the final MC is the configured home <code>(0,0,100)</code>:
</p>
#Previous:
<pre><code class="lang-csharp">{ "MachineCoordinateState": { "X": 50, "Y": 60, "Z": 70 } }</code></pre>
#BeforeBuild:
<pre><code class="lang-csharp">{ "Parsing": { "G28": { "X": 0, "Y": 0, "Z": 0 } } }</code></pre>
#AfterBuild:
<pre><code class="lang-csharp">{
"CompoundMotion": {
"Term": "G28",
"Items": [
{
"MotionEvent": { "Form": "McLinear", "IsRapid": true },
"ProgramXyz": { "X": 0, "Y": 0, "Z": 0 }
},
{
"MotionEvent": { "Form": "McLinear", "IsRapid": true },
"MachineCoordinateState": { "X": 0, "Y": 0, "Z": 100 }
}
]
},
"ProgramXyz": { "X": 0, "Y": 0, "Z": 100 }
}</code></pre>
<code>G91 G28 Z0</code> — only Z goes to its home; X/Y inherit from the
previous block's MC. Item 0's intermediate <code>ProgramXyz</code> takes
X/Y from the inherited program XYZ (= previous MC under identity
transform) and Z from the literal 0 in the G28 block:
#Previous:
<pre><code class="lang-csharp">{ "MachineCoordinateState": { "X": 50, "Y": 60, "Z": 70 } }</code></pre>
#BeforeBuild:
<pre><code class="lang-csharp">{ "Parsing": { "G28": { "Z": 0 } } }</code></pre>
#AfterBuild:
<pre><code class="lang-csharp">{
"CompoundMotion": {
"Term": "G28",
"Items": [
{
"MotionEvent": { "Form": "McLinear", "IsRapid": true },
"ProgramXyz": { "X": 50, "Y": 60, "Z": 0 }
},
{
"MotionEvent": { "Form": "McLinear", "IsRapid": true },
"MachineCoordinateState": { "X": 50, "Y": 60, "Z": 100 }
}
]
},
"ProgramXyz": { "X": 50, "Y": 60, "Z": 100 }
}</code></pre>
No <a class="xref" href="Hi.NcParsers.Dependencys.IHomeMcConfig.html">IHomeMcConfig</a> dep on the dependency list — the
syntax early-returns and the G28 sub-section stays in <code>Parsing</code>
for an upstream consumer or downstream syntax to handle:
#BeforeBuild:
<pre><code class="lang-csharp">{ "Parsing": { "G28": { "X": 0, "Y": 0, "Z": 0 } } }</code></pre>
#AfterBuild:
<pre><code class="lang-csharp">{ "Parsing": { "G28": { "X": 0, "Y": 0, "Z": 0 } } }</code></pre>
<p>
Rotary cases below add <code>TestDeps.AxisConfig</code> declaring B as
rotary and extend <code>HomeMc</code> with the conventional B home at 0°.
Each rotary block uses literal B = 45° so item 0's intermediate
(45°), item 1's home (0°), and <code>#Previous:</code> modal B (30°) are
pairwise distinct — a test that swaps any two values for any other
is caught by the assertion. The wrap pass
(<a class="xref" href="Hi.NcParsers.LogicSyntaxs.McAbcCyclicPathSyntax.html">McAbcCyclicPathSyntax</a>) is a different syntax, so
these per-SUT conformance assertions show only the raw literal /
canonical-home values written by this syntax, before any cyclic
normalization runs.
</p>
<code>G91 G28 B45.</code> — pure rotary G28. Emits a 2-item
<code>CompoundMotion</code> whose items carry only ABC keys in MC; no XYZ
<code>ProgramXyz</code> and no XYZ MC because the block doesn't reference
X/Y/Z (and the conformance harness doesn't run
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.McXyzSyntax.html">McXyzSyntax</a> downstream — in the full pipeline that
syntax fills root <code>MachineCoordinateState</code>'s XYZ from root
<code>ProgramXyz</code>, but with no XYZ in the block there's nothing to
fill anyway). Root MC.B holds the canonical home for modal
carry-forward; root <code>ProgramXyz</code> is not written:
#BeforeBuild:
<pre><code class="lang-csharp">{ "Parsing": { "G28": { "B": 45 } } }</code></pre>
#AfterBuild:
<pre><code class="lang-csharp">{
"MachineCoordinateState": { "B": 0 },
"CompoundMotion": {
"Term": "G28",
"Items": [
{
"MotionEvent": { "Form": "McLinear", "IsRapid": true },
"MachineCoordinateState": { "B": 45 }
},
{
"MotionEvent": { "Form": "McLinear", "IsRapid": true },
"MachineCoordinateState": { "B": 0 }
}
]
}
}</code></pre>
<code>G28 X0. B45.</code> mixed XYZ + rotary. Both axis kinds occupy the
same two items: item 0 carries the XYZ intermediate
<code>ProgramXyz</code> alongside the rotary literal in MC; item 1
carries the final XYZ MC alongside the rotary home in MC. Root
<code>MachineCoordinateState</code> here holds only the rotary modal value
(B = 0, the home); the XYZ portion of root MC would be filled by
the downstream <a class="xref" href="Hi.NcParsers.LogicSyntaxs.McXyzSyntax.html">McXyzSyntax</a> in the full pipeline
(out of scope for this per-SUT conformance). Root
<code>MachineCoordinateState</code> appears first because the
rotary-home write happens before <code>CompoundMotion</code> /
<code>ProgramXyz</code> are inserted. <code>#Previous:</code> carries B = 30 so
the prev rotary modal is distinct from both the literal (45) and
the home (0):
#Previous:
<pre><code class="lang-csharp">{ "MachineCoordinateState": { "X": 50, "Y": 60, "Z": 70, "B": 30 } }</code></pre>
#BeforeBuild:
<pre><code class="lang-csharp">{ "Parsing": { "G28": { "X": 0, "B": 45 } } }</code></pre>
#AfterBuild:
<pre><code class="lang-csharp">{
"MachineCoordinateState": { "B": 0 },
"CompoundMotion": {
"Term": "G28",
"Items": [
{
"MotionEvent": { "Form": "McLinear", "IsRapid": true },
"ProgramXyz": { "X": 0, "Y": 60, "Z": 70 },
"MachineCoordinateState": { "B": 45 }
},
{
"MotionEvent": { "Form": "McLinear", "IsRapid": true },
"MachineCoordinateState": { "X": 0, "Y": 60, "Z": 70, "B": 0 }
}
]
},
"ProgramXyz": { "X": 0, "Y": 60, "Z": 70 }
}</code></pre>
<p>
Bare <code>G28</code> — no axis specifiers — exercises the configurable
BareG28 policy. Default <a class="xref" href="Hi.NcParsers.LogicSyntaxs.BareG28Behavior.html#Hi_NcParsers_LogicSyntaxs_BareG28Behavior_Alarm">Alarm</a>
emits <code>Coord-RefReturn--003</code> and consumes the G28 without
motion (the diagnostic surfaces through the
<a class="xref" href="Hi.NcParsers.NcDiagnosticProgress.html">NcDiagnosticProgress</a> sink, not the block JSON, so the
canonical <code>#AfterBuild</code> is just an empty object):
</p>
#BeforeBuild:
<pre><code class="lang-csharp">{ "Parsing": { "G28": {} } }</code></pre>
#AfterBuild:
<pre><code class="lang-csharp">{}</code></pre>
Bare <code>G28</code> with BareG28 set to
<a class="xref" href="Hi.NcParsers.LogicSyntaxs.BareG28Behavior.html#Hi_NcParsers_LogicSyntaxs_BareG28Behavior_AllAxesHome">AllAxesHome</a>: the syntax synthesises a
literal at the inherited program position for every configured
linear axis and the previous modal angle for every configured
rotary axis (here X/Y/Z taken from the <code>#Previous:</code> MC under
the identity <code>ProgramToMcTransform</code>, B taken from the prev
modal). Item 0's intermediate therefore equals current (no motion
in stage 1) and item 1 sends each axis to its home:
#Previous:
<pre><code class="lang-csharp">{ "MachineCoordinateState": { "X": 10, "Y": 20, "Z": 30, "B": 45 } }</code></pre>
#BeforeBuild:
<pre><code class="lang-csharp">{ "Parsing": { "G28": {} } }</code></pre>
#AfterBuild:
<pre><code class="lang-csharp">{
"MachineCoordinateState": { "B": 0 },
"CompoundMotion": {
"Term": "G28",
"Items": [
{
"MotionEvent": { "Form": "McLinear", "IsRapid": true },
"ProgramXyz": { "X": 10, "Y": 20, "Z": 30 },
"MachineCoordinateState": { "B": 45 }
},
{
"MotionEvent": { "Form": "McLinear", "IsRapid": true },
"MachineCoordinateState": { "X": 0, "Y": 0, "Z": 100, "B": 0 }
}
]
},
"ProgramXyz": { "X": 0, "Y": 0, "Z": 100 }
}</code></pre>
</article>
<div class="contribution d-print-none">
</div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>