This repository has been archived on 2026-10-11. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
HiNC-2025-win-desktop-Deploy/App/wwwroot/HiAPI-docsite/anatomy/general-setup/machine-tool.html
T
2026-09-09 18:06:21 +08:00

288 lines
16 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Machine Tool | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Machine Tool | 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 &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="">
<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-MachineTool">
<h1 id="machine-tool">Machine Tool</h1>
<p>The machine tool is the project's kinematic chain — the linkage between the machine table and the
tool spindle. It has three surfaces:</p>
<ul>
<li>the <code>equipment/machine-tool</code> branch of the General Setup page's Control Tree
(<code>/general-setup?tree=equipment/machine-tool</code>), the first equipment child of the General Setup
group and a <strong>leaf</strong>: chain structure belongs to the
<a class="xref" href="../util/mech-builder.html">Mechanism Builder Page</a>, so the root carries no child slots;</li>
<li>the <code>/machine-tool</code> route, a standalone surface pairing a chain-only canvas with a load button
and a GUI / XML view of what is loaded. Its fields are read-only, but the route is not: its Load
installs the picked chain file onto the project. It carries no Page-menu entry and is reached by
URL.</li>
</ul>
<p>Both edit the one chain the project owns.</p>
<ul>
<li>Key Model:
<ul>
<li><a class="xref" href="../../api/Hi.Mech.IMachiningChain.html">IMachiningChain</a>
The chain is addressed by an IndexService key handed to the
<a class="xref" href="../widget/object-management-menu-button.html">Object Management Menu Button</a> and installed back onto
the project through the controller's Update.</li>
</ul>
</li>
<li>Assistant Model:
<ul>
<li><a class="xref" href="../../api/Hi.MachiningProcs.LocalProjectService.html">LocalProjectService</a> — owns the chain as the
<a class="xref" href="../../api/Hi.MachiningProcs.LocalProjectService.html#Hi_MachiningProcs_LocalProjectService_MachiningChain">MachiningChain</a> /
<a class="xref" href="../../api/Hi.MachiningProcs.LocalProjectService.html#Hi_MachiningProcs_LocalProjectService_MachiningChainFile">MachiningChainFile</a> pair.</li>
<li><a class="xref" href="../../api/Hi.MachiningProcs.MachiningProject.html">MachiningProject</a></li>
</ul>
</li>
</ul>
<h2 id="layout">Layout</h2>
<h3 id="control-tree-branch">Control Tree Branch</h3>
<p>The root panel is rendered inline by the dock's primary editor pane, so it has no title label of its
own — the wrapping expansion header carries the selection breadcrumb.</p>
<ul>
<li>Machine Tool Root Panel
<ul>
<li><a class="xref" href="../widget/object-management-menu-button.html">Object Management Menu Button</a>
<ul>
<li>New Items: one entry, <code>New ClMillingDevice</code> (&ldquo;CL-driven blank device&rdquo;). Its parameterless form
is the complete CL-driven device; any other chain type arrives by Load, Paste or XML.</li>
<li>Load / Save As / Copy / Paste / XML, over the project directory and the admin directory.</li>
<li>File extensions are <code>.MachineTool</code> and <code>.mt</code>, so the Load / Save As filter reads
<code>*.MachineTool / *.mt / *.xml</code>; the load type is <a class="xref" href="../../api/Hi.Mech.IMachiningChain.html">IMachiningChain</a>.</li>
</ul>
</li>
<li>Type Badge — the chain's runtime type name, <code>none</code> when no chain is attached.</li>
<li>Read-only caption lines, shown once a chain is attached:
<ul>
<li><code>Name:</code> — <a class="xref" href="../../api/Hi.Common.INameNote.html#Hi_Common_INameNote_Name">Name</a></li>
<li><code>Note:</code> — <a class="xref" href="../../api/Hi.Common.INameNote.html#Hi_Common_INameNote_Note">Note</a>, when non-empty</li>
<li><code>File:</code> — the chain's project-relative file, when it has one</li>
</ul>
</li>
<li>Intro caption, and an empty-state caption while no project is open.</li>
</ul>
</li>
<li>Shared slave view: the General Setup equipment canvas, whose Solid group's <strong>Machine</strong> flag draws
this chain (see <a class="xref" href="index.html">General Setup Page</a>). <strong>That flag starts cleared</strong>, so
the shared canvas shows a correctly attached chain only after it is ticked; the <code>/machine-tool</code>
route's own canvas has no such flag and always draws it.</li>
</ul>
<h3 id="machine-tool-route"><code>/machine-tool</code> Route</h3>
<p>Load and show only: no Save As, no ReLoad, no name editing.</p>
<ul>
<li>Header Row
<ul>
<li>Title Label &ldquo;Machine Tool&rdquo;</li>
<li><code>[relFile]</code> caption — the loaded chain's project-relative path, when it has one.</li>
<li>Folder-icon Load Button — opens the server-side file explorer dialog, restricted to the
<code>ProjectDirectory</code> and <code>ResourceDir</code> roots and filtered to <code>Machine Tool (.MachineTool|.mt)</code>.
Disabled until a project is open.</li>
<li>Read-only Name Field, shown once a chain is loaded.</li>
<li>GUI / XML View Toggle, disabled until a chain is loaded.</li>
</ul>
</li>
<li>Body — two columns
<ul>
<li>Left: Identity Card or XML Source
<ul>
<li>GUI mode — a read-only Name input, a read-only auto-grow Note textarea, and a Type chip.</li>
<li>XML mode — the chain serialised to XML, badged <code>read-only</code>, with a refresh button. The text is
fetched lazily on the first switch to XML and re-fetched after a load while XML mode is open.</li>
</ul>
</li>
<li>Right: Viewer Panel
<ul>
<li><a class="xref" href="../widget/renderingcanvas-tool-bar.html">RenderingCanvas Tool Bar</a> and a connection badge.</li>
<li>RenderingCanvas, cache id <code>MachineToolCanvas</code> — this route's own canvas.</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2 id="behavior">Behavior</h2>
<ul>
<li>Load / Paste / XML-Apply only swap the IndexService entry. The tree root then installs the result
onto <a class="xref" href="../../api/Hi.MachiningProcs.LocalProjectService.html#Hi_MachiningProcs_LocalProjectService_MachiningChain">MachiningChain</a> — the setter re-attaches the
fixture and workpiece buckles and wires the runtime hooks itself — re-mints the key and rebuilds
the branch. The button's XML dialog re-emits its object-loaded event on Apply, so that install and
refresh chain runs exactly once.</li>
<li>A chain the file describes wrongly is refused, and which of the two steps refuses it depends on
the file. A machine tool file asking for its collision pairs to be generated is walked from the
ground anchor to each end while it is being read, so a chain carrying no anchor named exactly <code>t</code>
or exactly <code>w</code> never reaches the IndexService at all: Object Management's Load answers
<code>Load failed: This kinematic chain has no worktable-end anchor named 'w'.</code> A file that lists its
collision pairs instead is read without that walk and does reach the index; the install that
follows builds the kinematics solver, which requires the same two anchors, so the same sentence
arrives one step later as <code>Install machine tool: …</code> and the project keeps the chain it had. The
shipped machine tool files all ask for generated pairs, so the first form is the one usually met.
The worktable end is checked before the tool end, so a chain missing both names only <code>'w'</code> until
that one is fixed. The <code>/machine-tool</code> route runs both steps inside its single call, so either
refusal reaches it as <code>Load machine tool: …</code>, and — like the no-project refusal behind the
disabled folder button — leaves the loaded chain untouched.</li>
<li>The IndexService key is minted even on a project with no chain attached, so Load and Paste stay
usable from an empty root.</li>
<li>The <code>/machine-tool</code> route's own Load takes the shorter path: one call materialises the picked file
server-side and assigns the chain to <a class="xref" href="../../api/Hi.MachiningProcs.LocalProjectService.html#Hi_MachiningProcs_LocalProjectService_MachiningChain">MachiningChain</a>
in the same request, with no IndexService swap in between. It re-points
<a class="xref" href="../../api/Hi.MachiningProcs.LocalProjectService.html#Hi_MachiningProcs_LocalProjectService_MachiningChainFile">MachiningChainFile</a> too — project-relative when the
picked file sits under the project directory, and the path relative to the chosen root otherwise.
It is refused while no project is open, which is why the folder button is disabled there.</li>
<li><code>New ClMillingDevice</code> builds and installs the blank chain in one server call and clears the
project's chain-file reference, so a later project save embeds the fresh chain inline instead of
overwriting the previous chain's file.</li>
<li>When the replacement came from a server-file Load, the install also re-points
<a class="xref" href="../../api/Hi.MachiningProcs.LocalProjectService.html#Hi_MachiningProcs_LocalProjectService_MachiningChainFile">MachiningChainFile</a>: project-relative when the file
sits under the project directory, resource-root-relative when it sits under the resource root,
absolute otherwise. An absolute path there would make every later project save rewrite the shared
resource file in place instead of copying it into the project. Paste and XML applies leave the
file reference unchanged.</li>
<li>Both canvases draw the live model, so a replacement shows on the next frame with no further calls.
The <code>/machine-tool</code> canvas snaps to the isometric view when it is bound and again after each load;
the shared equipment canvas snaps once, when its displayee is bound.</li>
</ul>
<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>
<p>HiNC-2025-webservice (Quasar CLI SPA):</p>
<ul>
<li><code>wwwroot-src/src/components/controlTree/useControlTreeHost.ts</code> — builds the
<code>equipment/machine-tool</code> node (item type <code>MachineToolRoot</code>, keyed on the IndexService chain key)
and owns the install / create / rebind handlers.</li>
<li><code>wwwroot-src/src/components/controlTree/PrimarySlavePanel.vue</code> — renders that branch inline: the
Object Management button, its <code>New ClMillingDevice</code> entry, the type badge and the read-only
Name / Note / File captions.</li>
<li><code>wwwroot-src/src/components/widgets/ObjectManagementMenuButton.vue</code> — the reused object-management
dropdown, keyed entirely on its <code>modelKey</code> (see
<a class="xref" href="../widget/object-management-menu-button.html">Object Management Menu Button</a>).</li>
<li><code>wwwroot-src/src/components/mech/EquipmentSetupPanel.vue</code> — the shared equipment canvas the tree
root's chain is drawn on.</li>
<li><code>wwwroot-src/src/pages/MachineToolPage.vue</code> — the <code>/machine-tool</code> route.</li>
<li><code>wwwroot-src/src/components/widgets/FileExplorerDialog.vue</code> — the server-side file picker that
route opens, seeded to the resource root's <code>MachineTool</code> folder when nothing is loaded and to the
current file's directory otherwise; it emits <code>&quot;{rootName}:{relativePath}&quot;</code> selection keys.</li>
<li><code>wwwroot-src/src/api/machineTool.ts</code> — typed client for <code>/api/mech/machine-tool/*</code>: snapshot,
initialize, update, create, load, XML, plus the display initialize and reset-view calls. Shared by
the route page and the tree root.</li>
<li><code>wwwroot-src/src/router/routes.ts</code> — declares the <code>machine-tool</code> route.</li>
<li><code>wwwroot-src/src/components/AppMenuBar.vue</code> — the Page menu, which lists General Setup but not
<code>/machine-tool</code>.</li>
<li><code>Mech/MachineToolController.cs</code> — REST surface at <code>/api/mech/machine-tool</code>: the snapshot DTO,
<code>initialize</code> / <code>update</code> / <code>create</code> / <code>load</code> and the XML read. Only <code>ClMillingDevice</code> is offered
for blank creation.</li>
<li><code>Mech/MachineToolDisplayController.cs</code> — <code>/api/mech/machine-tool/display</code>: binds the project's
chain onto a rendering connection's DispEngine through a delegating displayee, and serves the
isometric reset-view the route page calls after a load.</li>
</ul>
<h2 id="see-also">See Also</h2>
<ul>
<li><a class="xref" href="../util/mech-builder.html">Mechanism Builder Page</a> — the user-scoped editor for the same anchor topology</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>