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/tool-house/holder/freeform-holder-panel.html
T
2026-09-09 18:06:21 +08:00

171 lines
14 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Freeform Holder Panel | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Freeform Holder 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 &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-FreeformHolderPanel">
<h1 id="freeform-holder-panel">Freeform Holder Panel</h1>
<p>The key model is <a class="xref" href="../../../api/Hi.NcMech.Holders.FreeformHolder.html">FreeformHolder</a>: a holder whose shape comes from a referenced geometry, typically an STL, positioned by two anchor transformers — one to the spindle, one to the cutter.</p>
<p>The holder occupies four child sections of the Holder node under the selected tool — Geometry, Geom To Spindle, Geom To Cutter and Resolution, the nodes whose role paths end in <code>.../holder/geometry</code>, <code>.../holder/geom-to-spindle</code>, <code>.../holder/geom-to-cutter</code> and <code>.../holder/resolution</code>, reached at <code>/tool-house/:toolId/holder/:subtab</code>. Its Name, readonly Abstract Note and Note are edited one level up, on the <a class="xref" href="holder-panel.html">Holder Panel</a> itself, under the Metadata-on-container convention.</p>
<p>The three shape sections are not holder-specific editors. They are the same generic Geometry and Transformer slots the <a class="xref" href="../../general-setup/fixture.html">Fixture</a> branch of the General Setup page is built from: a kind picker on the section node, and the chosen kind's own editor on the child node below it. So an STL holder is picked as <code>StlFile</code> and its source file set through the shared StlFile editor, a <code>TransformationGeom</code> holder grows Inner Geometry and Inner Transformer nodes, a <code>GeomCombination</code> holder grows one node per item, and each placement grows the chosen transformer kind's editor — Static Translation for the usual <code>(0, 0, h)</code> offset.</p>
<h2 id="layout">Layout</h2>
<h3 id="web-layout">Web Layout</h3>
<ul>
<li>Geometry Section
<ul>
<li>Geometry Type Selector — None / Box3d / Cylindroid / StlFile / TransformationGeom / GeomCombination</li>
<li>The chosen kind's editor, on the child node the kind grows</li>
</ul>
</li>
<li>Geom To Spindle Section — where the holder sits relative to the spindle
<ul>
<li>Transformer Type Selector — Static Translation / Static Rotation / Static Freeform / Dynamic Translation / Dynamic Rotation / General Transform / No Transform</li>
<li>The chosen kind's editor, on the child node the kind grows</li>
</ul>
</li>
<li>Geom To Cutter Section — where the cutter sits relative to the holder
<ul>
<li>Transformer Type Selector and the chosen kind's editor, as above</li>
</ul>
</li>
<li>Resolution Section
<ul>
<li>Resolution Hint Caption — names the STL tessellation resolution used for display and collision meshing</li>
<li>Linear Resolution (mm) Input Field</li>
<li>Angle Resolution (deg) Input Field</li>
</ul>
</li>
</ul>
<h2 id="feature">Feature</h2>
<p>The generic editors reach the holder's own members, and that is what makes the split work. When the Holder node's children are built, the page calls <code>FreeformHolderController</code>'s <code>Get</code> with its session key; the server publishes the holder's <a class="xref" href="../../../api/Hi.NcMech.Holders.FreeformHolder.html#Hi_NcMech_Holders_FreeformHolder_Geom">Geom</a>, <a class="xref" href="../../../api/Hi.NcMech.Holders.FreeformHolder.html#Hi_NcMech_Holders_FreeformHolder_GeomToSpindleTransformer">GeomToSpindleTransformer</a> and <a class="xref" href="../../../api/Hi.NcMech.Holders.FreeformHolder.html#Hi_NcMech_Holders_FreeformHolder_GeomToCutterTransformer">GeomToCutterTransformer</a> in the index service under three per-session keys (<code>-HolderGeom</code>, <code>-HolderGeomToSpindle</code>, <code>-HolderGeomToCutter</code>) and hands the keys back. The keys name the very objects the holder holds, so an edit through a kind editor lands on the holder directly. The keys are returned even when a member is empty — nothing is published then, the section's picker reads an empty slot, and picking a kind fills that same key — which is how a freshly switched-to Freeform holder, whose geometry starts empty, gets its first shape.</p>
<p>Picking a kind is a container-aware create, not a bare <code>New</code>. The Geometry picker calls <code>CreateGeometry</code>, which builds the geometry, sets it as the holder's <code>Geom</code> and publishes it under the section's key (None clears the geometry). A placement picker first creates the transformer through the kind's own <code>New</code> endpoint and then attaches it with <code>UpdateGeomToSpindleTransformer</code> or <code>UpdateGeomToCutterTransformer</code>. Without the attach, only the index-service entry would change and the holder would keep pointing at its old transformer.</p>
<p>Because the generic editors hold no reference back to the holder, every edit at or below a section ends in the holder resync the page wires onto the section: a geometry edit calls <code>UpdateGeometryContent</code>, a placement edit re-attaches the transformer under its key. Both run <code>UpdateByGeom()</code> to regenerate the solid, <code>ClearCache()</code>, and <code>AlignAnchorByExposedCutterHeight()</code> to re-place the cutter under the holder — clearing the cache alone would leave the cutter where it was. The page then refreshes the tool list and the canvas.</p>
<p>The Resolution section writes the polar resolution straight onto the holder: <code>SetPolarResolution</code> assigns a fresh <a class="xref" href="../../../api/Hi.Geom.Resolution.PolarResolution2d.html">PolarResolution2d</a> and the holder swaps its solid for one born with the new value, keeping the geometry. <code>Get</code> also returns the current pair, which is how the two fields are seeded.</p>
<p>Guards sit on both sides. Every action on the controller answers Not Found for an unknown tool id and Bad Request when the tool's holder is not a <code>FreeformHolder</code>; <code>SetPolarResolution</code> rejects a linear or angle value that is not greater than zero, and the Resolution section refuses to send one. Fields commit on blur or Enter.</p>
<p>Switching a tool to Freeform is a committing choice. <code>SetHolderType</code> assigns a new <a class="xref" href="../../../api/Hi.NcMech.Holders.FreeformHolder.html">FreeformHolder</a> only when the tool does not already carry one, so a holder authored elsewhere — through HiNcRcl, say — survives a round trip through this page with its geometry, anchors and resolution intact.</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>
<p>HiNC-2025-webservice (Quasar CLI SPA):</p>
<ul>
<li><code>wwwroot-src/src/components/controlTree/toolHouseItemTypes.ts</code> — grows the four child sections for a <code>FreeformHolder</code>: reads <code>Get</code> to publish the three members, binds the Geometry section to the generic <code>Geometry</code> item type and the two placements to the generic <code>Transformer</code> item type (with the create hooks and the resync chain), and routes Resolution to the <code>HolderSection</code> item type.</li>
<li><code>wwwroot-src/src/components/controlTree/GeometrySlotPanel.vue</code> / <code>TransformerSlotPanel.vue</code> — the kind pickers on the three shape sections; the chosen kind's editor lives on the child node (<code>wwwroot-src/src/components/geom/geometryEditors.ts</code>, <code>wwwroot-src/src/components/topo/transformerEditors.ts</code>).</li>
<li><code>wwwroot-src/src/components/controlTree/toolhouse/HolderSectionPanel.vue</code> — the Resolution section, dispatching on the holder type to <code>FreeformHolderController</code> for a Freeform holder.</li>
<li><code>wwwroot-src/src/components/controlTree/toolhouse/ToolHolderPanel.vue</code> — the parent Holder node's panel, which hosts this holder's Name, readonly Abstract Note and Note and commits them through <code>setFreeformHolderName</code> / <code>setFreeformHolderNote</code>.</li>
<li><code>wwwroot-src/src/api/freeformHolder.ts</code> — the typed wrapper over <code>/api/FreeformHolder</code>: <code>getFreeformHolder</code>, <code>createFreeformHolderGeometry</code>, <code>updateFreeformHolderGeometry</code>, <code>resyncFreeformHolder</code>, <code>updateFreeformHolderGeomToSpindle</code>, <code>updateFreeformHolderGeomToCutter</code>, <code>setFreeformHolderName</code>, <code>setFreeformHolderNote</code>, <code>setFreeformHolderResolution</code>.</li>
<li><code>wwwroot-src/src/i18n/en/toolhouse.ts</code> — the two placement section labels (<code>toolhouse.node.geomToSpindle</code> / <code>geomToCutter</code>) and the Freeform sections hint; the zh-Hans and zh-Hant files carry the same keys.</li>
<li><code>Mech/FreeformHolderController.cs</code> — <code>GET Get</code> (name / note / abstract note, the polar resolution, and — with a session key — the three member keys) plus <code>POST CreateGeometry | UpdateGeometry | IndexCurrentGeometry | UpdateGeometryContent | UpdateGeomToSpindleTransformer | UpdateGeomToCutterTransformer | SetName | SetNote | SetPolarResolution</code>.</li>
</ul>
<h2 id="see-also">See Also</h2>
<ul>
<li><a class="xref" href="../../widget/polar-resolution-2d-panel.html">Polar Resolution 2D Panel</a> — the resolution editor this panel embeds</li>
<li><a class="xref" href="../../general-setup/fixture.html">Fixture Page</a> — the other user of the generic Geometry and Transformer slots this holder's shape sections are made of</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>