Archived
212 lines
11 KiB
HTML
212 lines
11 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>NcCodeCommand Panel | HiAPI-C# 2025 </title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="title" content="NcCodeCommand Panel | HiAPI-C# 2025 ">
|
|
|
|
|
|
<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 "{query}"">
|
|
<meta name="loc:searchNoResults" content="No results for "{query}"">
|
|
<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="">
|
|
<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="Anatomy-NcCodeCommandPanel">
|
|
<h1 id="nccodecommand-panel">NcCodeCommand Panel</h1>
|
|
|
|
<p>The key model is <a class="xref" href="../../../api/Hi.SessionCommands.NcCodeCommand.html">NcCodeCommand</a>.</p>
|
|
<p>The command carries two values: <a class="xref" href="../../../api/Hi.SessionCommands.NcCodeCommand.html#Hi_SessionCommands_NcCodeCommand_NcText">NcText</a>, the NC program
|
|
itself, and <a class="xref" href="../../../api/Hi.SessionCommands.NcCodeCommand.html#Hi_SessionCommands_NcCodeCommand_Title">Title</a>, the name that program runs under. Both
|
|
are written into the project file — the command emits a title element and an NC-text element, and
|
|
the project nests the whole command list into its own XML — so the program travels with the project
|
|
instead of existing as a file beside it. That is the whole difference from
|
|
<a class="xref" href="NcFileCommand-panel.html">Program File</a>, which stores a path and leaves the program on disk.
|
|
A mission can therefore carry a short program without producing an artifact of its own.</p>
|
|
<p>Title is not decoration. <code>Run</code> passes it to <a class="xref" href="../../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_RunNc_">RunNc</a> as the
|
|
program name the run log shows, which is why the model defaults it to the command's own name,
|
|
<code>NC Code</code>, rather than to an empty string. It is also the detail the mission row brackets: the row
|
|
reads <code>NC Code</code> while the title is empty or still that default, and <code>NC Code [title]</code> once it says
|
|
something else.</p>
|
|
<p>The panel renders on the command's own node in the Mission branch of the Execution page's Control
|
|
Tree, below the move / duplicate / delete control bar. A single-purpose kind like this one embeds
|
|
its whole editor on that node rather than growing section child nodes.</p>
|
|
<h2 id="layout">Layout</h2>
|
|
<ul>
|
|
<li>NcCodeCommand Panel
|
|
<ul>
|
|
<li>Title Field
|
|
<ul>
|
|
<li>The model is <a class="xref" href="../../../api/Hi.SessionCommands.NcCodeCommand.html#Hi_SessionCommands_NcCodeCommand_Title">Title</a>.</li>
|
|
<li>Labelled "Title (optional)". A newly added command arrives with the model's default name,
|
|
<code>NC Code</code>, already in the field; renaming it renames the program in the run log and in the
|
|
mission row.</li>
|
|
</ul>
|
|
</li>
|
|
<li>NC Code Editor Area
|
|
<ul>
|
|
<li>The model is <a class="xref" href="../../../api/Hi.SessionCommands.NcCodeCommand.html#Hi_SessionCommands_NcCodeCommand_NcText">NcText</a>.</li>
|
|
<li>A plain monospace text area: an 18-row field with a 360 px floor.</li>
|
|
<li>No line-number gutter and no syntax highlighting. The rich editor in this
|
|
folder is the <a class="xref" href="script-command-panel.html">Script command</a>'s — that command ships
|
|
CodeMirror with a C# grammar, this one ships a text area.</li>
|
|
</ul>
|
|
</li>
|
|
<li>Stats and Actions Row (web)
|
|
<ul>
|
|
<li>Line count and character count, both recomputed as the text changes.</li>
|
|
<li>Trim Blank Lines Button — trims every line and drops the ones left empty, then saves at once.</li>
|
|
<li>Clear Button — confirms in a dialog before emptying the NC text.</li>
|
|
<li>Both buttons stay disabled while the code is empty.</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<h2 id="saving">Saving</h2>
|
|
<p>Typing in either field schedules one save 400 ms after the last keystroke, so a burst of typing
|
|
costs one request instead of one per character. Trim Blank Lines and Clear save immediately rather
|
|
than through that timer.</p>
|
|
<p>The write is a single patch endpoint carrying the NC text and the title. Each field is applied only
|
|
when the body actually carries it, which is why the client sends the field it changed and a null for
|
|
the one it did not.</p>
|
|
<p>NC text is not validated while it is edited: there is no parse at edit time and no error surface on
|
|
the panel — the server stores whatever string arrives. Errors surface when the mission plays the
|
|
text.</p>
|
|
<h2 id="source-code-path">Source Code Path</h2>
|
|
<p>See <a class="xref" href="../../index.html">HiNC App Anatomy</a> for git repository links.</p>
|
|
<h3 id="web-application">Web Application</h3>
|
|
<p>HiNC-2025-webservice (Quasar CLI SPA):</p>
|
|
<ul>
|
|
<li><code>wwwroot-src/src/components/mission/NcCodeCommandPanel.vue</code> — this panel: the Title input, the
|
|
18-row monospace text area, the 400 ms debounced saves, the live line and character stats, Trim
|
|
Blank Lines, and Clear behind a confirm dialog.</li>
|
|
<li><code>wwwroot-src/src/components/controlTree/missionItemTypes.ts</code> — maps the <code>nccode</code> kind to this
|
|
panel, and states the rule it belongs to: a single-purpose kind embeds its whole editor on the
|
|
command node.</li>
|
|
<li><code>wwwroot-src/src/api/mission.ts</code> — <code>loadNcCode</code> and <code>setNcCode</code>, and the command shape the panel
|
|
edits (NC code plus title).</li>
|
|
<li><code>wwwroot-src/src/i18n/en/mission.ts</code> — the panel's wording: the NC Code label, the character
|
|
count, Trim Blank Lines, and the line count it shares with the other panels.</li>
|
|
<li><code>wwwroot-src/src/i18n/en/dialog.ts</code> — the Clear confirmation's title and message.</li>
|
|
<li><code>Missions/MissionController.cs</code> — the single patch PUT for this command, whose NC-code and title
|
|
fields are each applied when the body carries them, and the command-snapshot arm that returns both
|
|
back to the panel.</li>
|
|
</ul>
|
|
<h3 id="hiapi-engine">HiAPI Engine</h3>
|
|
<ul>
|
|
<li><code>HiNc/SessionCommands/NcCodeCommand.cs</code> — the model: <code>NcText</code>, <code>Title</code> defaulting to the command's
|
|
own display name, the Program-category catalog registration, the XML round-trip that puts the NC
|
|
text into the project file, <code>Run</code> handing text and title to the session shell, and the row-label
|
|
rule that shows the bare name while the title is unset or still the default.</li>
|
|
<li><code>HiNc/MachiningProcs/SessionShell.cs</code> — <code>RunNc</code> takes the NC text plus an alternative file name,
|
|
and that name is the title this command supplies for the log.</li>
|
|
<li><code>HiNc/MachiningProcs/MachiningProject.cs</code> — nests the command list into the project XML, which is
|
|
how this command's NC text persists with the project.</li>
|
|
</ul>
|
|
<h2 id="see-also">See Also</h2>
|
|
<ul>
|
|
<li><a class="xref" href="NcFileCommand-panel.html">NcFileCommand Panel</a> — the other Program command: a path to a file instead of text stored in the project</li>
|
|
<li><a class="xref" href="script-command-panel.html">Script Command Panel</a> — the rich editor this folder does have, and why this command ships a plain text area instead</li>
|
|
<li><a href="../../../manual/run/playing-a-program.html">Playing a Program</a> — the task these two commands serve</li>
|
|
<li><a href="index.html">Mission</a> — the rest of the command panels</li>
|
|
</ul>
|
|
|
|
</article>
|
|
|
|
<div class="contribution d-print-none">
|
|
</div>
|
|
|
|
<div class="next-article d-print-none border-top" id="nextArticle"></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>
|