tune
This commit is contained in:
+152
@@ -0,0 +1,152 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>DictionaryService and DictionaryHub Pattern | HiAPI-C# 2025 </title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="title" content="DictionaryService and DictionaryHub Pattern | 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="">
|
||||
<h1 id="dictionaryservice-and-dictionaryhub-pattern">DictionaryService and DictionaryHub Pattern</h1>
|
||||
|
||||
<h2 id="overview">Overview</h2>
|
||||
<p>A connection-scoped indexing pattern for referencing backend objects across hierarchical SignalR hub connections.</p>
|
||||
<h2 id="core-components">Core Components</h2>
|
||||
<p><strong><xref:HiNC_2025_webapi.Common.DictionaryService></strong>: Manages connection-scoped index dictionaries</p>
|
||||
<ul>
|
||||
<li>First layer key: Hub connectionId (auto-generated by SignalR)</li>
|
||||
<li>Second layer key: LocalId (resource name)</li>
|
||||
<li>Value: References to backend objects (functions, getters/setters)</li>
|
||||
</ul>
|
||||
<p><strong><xref:HiNC_2025_webapi.Common.DictionaryHub></strong>: Base hub that auto-cleans index entries on disconnect</p>
|
||||
<h2 id="architecture">Architecture</h2>
|
||||
<pre><code>Root-Hub
|
||||
└── Child-Hub - has parent's connectionId
|
||||
└── Grandchild-Hub - has parent's connectionId
|
||||
</code></pre>
|
||||
<p>Each hub gets a unique system-generated hub-connectionId. Child hubs receive parent's connectionId to access parent data.</p>
|
||||
<h2 id="key-patterns">Key Patterns</h2>
|
||||
<ol>
|
||||
<li><strong>Parent ConnectionId Passing</strong>: Child hubs copy parent's function references via connectionId</li>
|
||||
<li><strong>Frontend ConnectionId Chain</strong>: Components pass connectionId down the hierarchy</li>
|
||||
</ol>
|
||||
<h2 id="benefits">Benefits</h2>
|
||||
<ul>
|
||||
<li><strong>Isolation</strong>: Each component has its own connection/index space</li>
|
||||
<li><strong>Nesting Support</strong>: Same components can be nested without conflicts</li>
|
||||
<li><strong>Auto-cleanup</strong>: Index entries cleaned on disconnect</li>
|
||||
<li><strong>Data Inheritance</strong>: Access parent's backend objects via connectionId chain</li>
|
||||
</ul>
|
||||
<h2 id="best-practices">Best Practices</h2>
|
||||
<ul>
|
||||
<li>Apply or inherit from DictionaryHub for auto-cleanup</li>
|
||||
<li>Use meaningful key names (e.g., “transformer-getter”)</li>
|
||||
</ul>
|
||||
<h2 id="common-pitfalls">Common Pitfalls</h2>
|
||||
<ul>
|
||||
<li>Don't use child's connectionId to index parent's data</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>
|
||||
@@ -130,7 +130,7 @@ catch (Exception ex)
|
||||
<h2 id="gui-file-path-assignment">GUI File Path Assignment</h2>
|
||||
<p>See <a href="widget/gui-file-path-assignment.html">GUI File Path Assignment</a>.</p>
|
||||
<h2 id="numeric-inputoutput-handling">Numeric Input/Output Handling</h2>
|
||||
<p>For handling floating-point values in web forms, use the utilities in <code>numeric-utils.js</code> which properly manages special values like Infinity, -Infinity, and NaN. This ensures consistent display formatting and parsing across the application, preventing JSON serialization issues. See <a href="widget/numeric-io-utilities.html">Numeric Input/Output Utilities</a> for implementation details.</p>
|
||||
<p>Implement a <code>numeric-utils.js</code> module to handle special floating-point values in web forms. See <a href="widget/numeric-io-utilities.html">Numeric Input/Output Utilities</a> for implementation details.</p>
|
||||
<h2 id="translation-remarks">Translation Remarks</h2>
|
||||
<p>See <a href="translation-remarks.html">Translation Remarks</a>.</p>
|
||||
|
||||
|
||||
@@ -95,6 +95,10 @@
|
||||
<p>HiNC-2025-webapi apply vue.</p>
|
||||
<p>The source code of HiNC-2025-webapi project is at the git repository:</p>
|
||||
<p><a href="https://superhightech-gitea.webredirect.org/HiNC-Deploy/HiNC-2025-webapi.git">https://superhightech-gitea.webredirect.org/HiNC-Deploy/HiNC-2025-webapi.git</a></p>
|
||||
<h2 id="web-architecture-patterns">Web Architecture Patterns</h2>
|
||||
<ul>
|
||||
<li><a href="common/dictionary-service-pattern.html">DictionaryService and DictionaryHub Pattern</a> - Connection-scoped object indexing for hierarchical components</li>
|
||||
</ul>
|
||||
<h2 id="step-by-step-program-construction-check-list">Step by Step Program Construction Check List</h2>
|
||||
<div class="TIP">
|
||||
<h5>Tip</h5>
|
||||
|
||||
@@ -147,9 +147,7 @@ Fixture is assigned from the Main Panel's <a class="xref" href="../../../../api/
|
||||
</ul>
|
||||
<div class="TIP">
|
||||
<h5>Tip</h5>
|
||||
<ul>
|
||||
<li>Add a resizable splition bar between Manage Panel and Viewer Panel.</li>
|
||||
</ul>
|
||||
<p>Add a resizable splition bar between Manage Panel and Viewer Panel.</p>
|
||||
</div>
|
||||
<h2 id="behavior">Behavior</h2>
|
||||
<ul>
|
||||
|
||||
@@ -115,11 +115,19 @@ The model is <a class="xref" href="../../../../api/Hi.ShellCommands.ListCommand.
|
||||
<ul>
|
||||
<li>Content Panel: <a href="PreSettingCommand-panel.html">PreSetting Command Panel</a></li>
|
||||
</ul>
|
||||
<div class="NOTE">
|
||||
<h5>Note</h5>
|
||||
<p>This command sets up initial parameters before NC simulation which attempt to take the effect.</p>
|
||||
</div>
|
||||
</li>
|
||||
<li><a class="xref" href="../../../../api/Hi.ShellCommands.NcOptOptionCommand.html">NcOptOptionCommand</a>
|
||||
<ul>
|
||||
<li>Content Panel: <a href="NcOptOption-panel.html">NcOptOption Panel</a></li>
|
||||
</ul>
|
||||
<div class="NOTE">
|
||||
<h5>Note</h5>
|
||||
<p>This command is also a type of pre-setting that should be applied before NC simulation which attempt to take the effect.</p>
|
||||
</div>
|
||||
</li>
|
||||
<li><a class="xref" href="../../../../api/Hi.ShellCommands.NcFileCommand.html">NcFileCommand</a>
|
||||
<ul>
|
||||
|
||||
+19
-9
@@ -87,16 +87,26 @@
|
||||
<article data-uid="">
|
||||
<h1 id="numeric-inputoutput-utilities">Numeric Input/Output Utilities</h1>
|
||||
|
||||
<p>The <code>numeric-utils.js</code> module provides essential utilities for handling numeric input/output in web forms, especially for floating-point values with special cases.</p>
|
||||
<h2 id="purpose">Purpose</h2>
|
||||
<p>The utilities solve the common problem of handling special numeric values (Infinity, -Infinity, NaN) in JSON serialization and user interfaces. JavaScript's JSON.stringify converts these special values to null or strings, which can cause issues when communicating with C# backend APIs. This module provides consistent conversion between numeric values and display strings, ensuring proper handling across the full stack. It also formats regular numbers with appropriate precision for display while avoiding unnecessary trailing zeros.</p>
|
||||
<h2 id="key-features">Key Features</h2>
|
||||
<p>Handle special numeric values (Infinity, -Infinity, NaN) in web forms to prevent JSON serialization issues between JavaScript frontend and C# backend.</p>
|
||||
<h2 id="implementation-requirements">Implementation Requirements</h2>
|
||||
<p>Your <code>numeric-utils.js</code> module should:</p>
|
||||
<ul>
|
||||
<li>Converts Infinity to “INF”, -Infinity to “-INF”, and NaN to “NaN” for display</li>
|
||||
<li>Parses these special strings back to their numeric equivalents</li>
|
||||
<li>Formats regular numbers with appropriate precision (4 significant digits)</li>
|
||||
<li>Provides a Vue mixin for easy integration in components</li>
|
||||
<li>Handles both numeric and string inputs from JSON responses</li>
|
||||
<li>Convert special values for display: Infinity → “INF”, -Infinity → “-INF”, NaN → “NaN”</li>
|
||||
<li>Parse display strings back to numeric values</li>
|
||||
<li>Format regular numbers with 4 significant digits</li>
|
||||
<li>Provide Vue mixin for component integration</li>
|
||||
</ul>
|
||||
<h2 id="required-exports">Required Exports</h2>
|
||||
<ul>
|
||||
<li><code>numericToDisplay(value)</code> - Converts numeric to display string</li>
|
||||
<li><code>displayToNumeric(displayValue, defaultValue)</code> - Parses display to numeric</li>
|
||||
<li><code>NumericInputMixin</code> - Vue mixin with formatNumericDisplay and parseNumericDisplay methods</li>
|
||||
</ul>
|
||||
<h2 id="source-code-path">Source Code Path</h2>
|
||||
<p>See <a href="../index.html">this page</a> for git repository.</p>
|
||||
<h3 id="web-page-application-source-code-path">Web Page Application Source Code Path</h3>
|
||||
<ul>
|
||||
<li>wwwroot/common/numeric-utils.js</li>
|
||||
</ul>
|
||||
|
||||
</article>
|
||||
|
||||
@@ -107,6 +107,10 @@
|
||||
<h3 id="刃磨半徑">刃磨半徑</h3>
|
||||
<p>刃磨半徑(Hone Radius)表示刀具銳利程度,為刀刃鋒利處的半徑。一般在 20 ~ 50 um。</p>
|
||||
<p>用來切削易加工材料的刀具通常刃磨半徑小,如Al6061T6,可以假設為20um;用來切削難加工材料的刀具通常刃磨半徑大,如不鏽鋼,可以假設為50um。</p>
|
||||
<h3 id="刃形與刃雕-底部刃雕">刃形與刃雕-底部刃雕</h3>
|
||||
<p>底部刃雕是在底部刃為水平或反曲才需要設定。
|
||||
鑽刀不用設定底部刃雕,設定側向刃雕就好。
|
||||
通常只有牛鼻刀要設定底部刃雕。</p>
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user