fix SoftNcRunner GM code normalization.

This commit is contained in:
2026-05-06 13:21:19 +08:00
parent 0fe9497552
commit 2f57932000
1238 changed files with 69405 additions and 22511 deletions
@@ -0,0 +1,142 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Message Management | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Message Management | 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="">
<h1 id="message-management">Message Management</h1>
<p>HiNc applications use three independent message categories. Each category serves a distinct purpose and should not be mixed.</p>
<h2 id="categories">Categories</h2>
<h3 id="1-diagnostic--iprogressobject">1. Diagnostic — <code>IProgress&lt;object&gt;</code></h3>
<p>Operation-scoped progress and diagnostic messages. The caller provides an <code>IProgress&lt;object&gt;</code> to the callee, which reports progress, warnings, and errors through it.</p>
<ul>
<li><strong>Session-scoped</strong>: <a class="xref" href="../../api/Hi.MachiningProcs.LocalProjectService.html#Hi_MachiningProcs_LocalProjectService_SessionProgress">SessionProgress</a> feeds the <a href="../../app-anatomy/session-message-panel/index.html">Session Message Panel</a>.</li>
<li><strong>XML IO chain</strong>: <a class="xref" href="../../api/Hi.Common.XmlUtils.XFactory.html">XFactory</a> threads <code>IProgress&lt;object&gt;</code> through all deserialization calls so that parsing errors are reported to the caller rather than a global handler.</li>
<li><strong>Script-level</strong>: <a class="xref" href="../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_SessionProgress">SessionProgress</a> exposes the session progress to user scripts.</li>
</ul>
<p>Use <a class="xref" href="../../api/Hi.Common.Messages.MultiTagMessageUtil.html">MultiTagMessageUtil</a> extension methods (<code>ReportProgress</code>, <code>ReportMessage</code>, <code>ReportWarning</code>, <code>ReportError</code>, <code>ReportInfo</code>) to report typed messages.</p>
<h3 id="2-ui-error-notification--messageboardutil">2. UI Error Notification — <code>MessageBoardUtil</code></h3>
<p>Toast-style popups for immediate user attention (e.g., &ldquo;File saved&rdquo;, &ldquo;Load failed&rdquo;). <a class="xref" href="../../api/Hi.Common.Messages.MessageBoardUtil.html">MessageBoardUtil</a> triggers the <code>ShowMessageBoard</code> event consumed by the GUI layer.</p>
<div class="NOTE">
<h5>Note</h5>
<p><code>MessageBoardUtil</code> is not yet mature for all scenarios. In practice, <code>ILogger</code> with level-filtered treatment is often applied instead.</p>
</div>
<h3 id="3-app-log--ilogger">3. App Log — <code>ILogger</code></h3>
<p>Standard .NET <code>ILogger</code> for application-level logging. Use <a class="xref" href="../../api/Hi.Common.Messages.ActionProgress-1.html">ActionProgress&lt;T&gt;</a>.<a class="xref" href="../../api/Hi.Common.Messages.ActionProgress-1.html#Hi_Common_Messages_ActionProgress_1_FromLogger_">FromLogger</a> to bridge <code>IProgress&lt;object&gt;</code> APIs to an <code>ILogger</code> instance:</p>
<pre><code class="lang-csharp">IProgress&lt;object&gt; progress = ActionProgress&lt;object&gt;.FromLogger(logger);
</code></pre>
<p>This routes <a class="xref" href="../../api/Hi.Common.Messages.MultiTagMessage.html">MultiTagMessage</a> to the appropriate log level (<code>LogError</code>, <code>LogWarning</code>, <code>LogInformation</code>) based on message tags.</p>
<h2 id="basic-component--utility-level">Basic-Component / Utility Level</h2>
<p>Low-level utilities (e.g., in <code>Hi.Common</code>, <code>Hi.Geom</code>) cannot assume which category the caller intends. These APIs accept <code>Action&lt;Exception&gt;</code> or <code>IProgress&lt;object&gt;</code> as parameters so the caller decides how to handle messages:</p>
<pre><code class="lang-csharp">await task.CatchExceptions(ex =&gt; progress?.Report(ex));
</code></pre>
<h2 id="design-rationale">Design Rationale</h2>
<p>Static/global message sinks mix the three categories, making it unclear whether a message is diagnostic, UI notification, or app log. The current pattern threads the handler explicitly through the call chain so each caller decides the appropriate category.</p>
</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>
@@ -0,0 +1,319 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>About XML IO | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="About XML IO | 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="">
<h1 id="about-xml-io">About XML IO</h1>
<p>The XML IO design pattern in HiNc Framework is based on <a class="xref" href="../../api/Hi.Common.XmlUtils.IMakeXmlSource.html">IMakeXmlSource</a> interface and <a class="xref" href="../../api/Hi.Common.XmlUtils.XFactory.html">XFactory</a> class. This pattern provides a standardized way to serialize and deserialize objects to and from XML format.</p>
<p>Don't serialize the runtime member object like <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-1">Func&lt;TResult&gt;</a> or <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.action">Action</a> either cache object. The runtime objects can be optionally sent by the <code>res</code> part on the XFactory Registration or set by the other host or dependent object. If it is set by the other object, then there is nothing can do to it in the XML IO procedure.</p>
<h2 id="core-components">Core Components</h2>
<h3 id="imakexmlsource-interface">IMakeXmlSource Interface</h3>
<p>The <a class="xref" href="../../api/Hi.Common.XmlUtils.IMakeXmlSource.html">IMakeXmlSource</a> interface defines the contract for objects that can be serialized to XML format. It contains a single method <code>MakeXmlSource</code>.</p>
<h3 id="xfactory-registration">XFactory Registration</h3>
<p>Every class implementing IMakeXmlSource must:</p>
<ol>
<li>Define a static <code>XName</code> property matching the class name.</li>
<li>Register itself in the static constructor using <code>XFactory.Regs.Add</code></li>
<li>Implement XML serialization and deserialization logic</li>
</ol>
<p>The registration delegate signature includes an <code>IProgress&lt;object&gt;</code> parameter for <a href="message-management.html">diagnostic message routing</a>:</p>
<pre><code class="lang-csharp">XFactory.Regs.Add(XName, (xml, baseDirectory, relFile, progress, res)
=&gt; new MyClass(xml, baseDirectory, relFile, progress));
</code></pre>
<p>For example, see <a class="xref" href="../../api/Hi.Milling.Apts.BallApt.html">BallApt</a>:</p>
<pre><code class="lang-csharp" name="XmlRegistration">static BallApt()
{
// Register to the &lt;see cref=&quot;XFactory.Default&quot;/&gt;.
XFactory.Regs.Add(XName, (xml,baseDirectory, relFile, progress, res) =&gt; new BallApt(xml));
}
</code></pre><h3 id="iprogress-threading">IProgress Threading</h3>
<p>The <code>IProgress&lt;object&gt;</code> parameter is threaded through the entire deserialization chain. When a class constructor calls <a class="xref" href="../../api/Hi.Common.XmlUtils.XFactory.html">XFactory</a> to deserialize child objects, it passes the same <code>progress</code> instance:</p>
<pre><code class="lang-csharp">public MyClass(XElement src, string baseDirectory, string relFile,
IProgress&lt;object&gt; progress)
{
Child = XFactory.GenByChild&lt;IChild&gt;(
src.Element(nameof(Child)), subBaseDirectory, progress);
}
</code></pre>
<p>Parsing errors are reported to the caller-provided <code>IProgress&lt;object&gt;</code> handler.</p>
<h2 id="implementation-patterns">Implementation Patterns</h2>
<h3 id="simple-value-objects">Simple Value Objects</h3>
<p>See <a class="xref" href="../../api/Hi.Milling.Apts.BallApt.html">BallApt</a> implementation:</p>
<pre><code class="lang-csharp" name="XmlImplementation">/// &lt;summary&gt;
/// Name for XML IO.
/// &lt;/summary&gt;
public static string XName =&gt; nameof(BallApt);
/// &lt;summary&gt;
/// Ctor.
/// &lt;/summary&gt;
/// &lt;param name=&quot;src&quot;&gt;XML&lt;/param&gt;
public BallApt(XElement src)
{
Diameter_mm = double.Parse(src.Element(&quot;D&quot;).Value);
FluteHeight_mm = double.Parse(src.Element(&quot;FluteH&quot;).Value);
}
/// &lt;inheritdoc/&gt;
public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly) =&gt; ToXElement();
/// &lt;inheritdoc/&gt;
public XElement ToXElement()
{
return new XElement(XName,
new XElement(&quot;D&quot;, Diameter_mm),
new XElement(&quot;FluteH&quot;, FluteHeight_mm)
);
}
</code></pre><h3 id="complex-data-structures">Complex Data Structures</h3>
<p>See <a class="xref" href="../../api/Hi.Milling.SpindleCapability.html">SpindleCapability</a> implementation:</p>
<pre><code class="lang-csharp" name="XmlImplementation">/// &lt;summary&gt;
/// Name for XML IO.
/// &lt;/summary&gt;
public static string XName =&gt; nameof(SpindleCapability);
/// &lt;summary&gt;
/// Initializes a new instance of the &lt;see cref=&quot;SpindleCapability&quot;/&gt; class.
/// &lt;/summary&gt;
/// &lt;param name=&quot;src&quot;&gt;The XML element containing spindle data.&lt;/param&gt;
/// &lt;param name=&quot;baseDirectory&quot;&gt;The base directory for resolving relative paths.&lt;/param&gt;
/// &lt;param name=&quot;res&quot;&gt;Additional resolution parameters.&lt;/param&gt;
public SpindleCapability(XElement src, string baseDirectory, params object[] res)
{
this.SetNameNote(src);
if (src.Element(nameof(EnergyEfficiency)) != null)
EnergyEfficiency = XmlConvert.ToDouble(
src.Element(nameof(EnergyEfficiency)).Value);
src.Element(nameof(WorkingTemperatureUpperBoundary_C))?.SelfInvoke(
e =&gt; WorkingTemperatureUpperBoundary_C = XmlConvert.ToDouble(e.Value));
src.Element(nameof(GearShiftSpindleSpeed_rpm))?.Value?.SelfInvoke(
s =&gt; GearShiftSpindleSpeed_rpm = string.IsNullOrEmpty(s)
? null : XmlConvert.ToDouble(s));
if (src.Element(nameof(DryRunFrictionPowerCoefficient_mWdrpm)) != null)
DryRunFrictionPowerCoefficient_mWdrpm = XmlConvert.ToDouble(
src.Element(nameof(DryRunFrictionPowerCoefficient_mWdrpm)).Value);
if (src.Element(nameof(DryRunWindagePowerCoefficient_pWdrpm3)) != null)
DryRunWindagePowerCoefficient_pWdrpm3 = XmlConvert.ToDouble(
src.Element(nameof(DryRunWindagePowerCoefficient_pWdrpm3)).Value);
if (src.Element(&quot;SpindleSpeedToPowerContours&quot;) != null) //for legacy
WorkableDurationToSpindleSpeedPowerContoursDictionary_min_cycleDs_kW =
src.Element(&quot;SpindleSpeedToPowerContours&quot;).Elements(&quot;Contour&quot;)
.ToDictionary(
contourElem =&gt;
{
double r = XmlConvert.ToDouble(contourElem.Attribute(&quot;InsistentRatio&quot;)?.Value);
//600s=10mins
return r ==1?double.PositiveInfinity:(r * 600);
},
contourElem =&gt; contourElem.Elements(&quot;SpindleSpeedToPower&quot;).Select(
elem =&gt; new Vec2d(
XmlConvert.ToDouble(elem.Element(&quot;SpindleSpeed-RPM&quot;).Value) / 60,
XmlConvert.ToDouble(elem.Element(&quot;Power-kW&quot;).Value)))
.ToList());
src.Element(&quot;WorkableDurationToSpindleSpeedPowerContoursDictionary&quot;)
?.SelfInvoke(dicElem =&gt;
{
WorkableDurationToSpindleSpeedPowerContoursDictionary_min_cycleDs_kW
= dicElem.Elements(&quot;Contour&quot;)
.ToDictionary(
contourElem =&gt; XmlConvert.ToDouble(
contourElem.Attribute(&quot;WorkableDuration-min&quot;)?.Value),
contourElem =&gt; contourElem.Elements(&quot;SpindleSpeedToPower&quot;).Select(
elem =&gt; new Vec2d(
XmlConvert.ToDouble(elem.Element(&quot;SpindleSpeed-RPM&quot;).Value) / 60,
XmlConvert.ToDouble(elem.Element(&quot;Power-kW&quot;).Value)))
.ToList());
});
if (src.Element(&quot;SpindleSpeedToTorqueContours&quot;) != null) //for legacy
WorkableDurationToSpindleSpeedTorqueContoursDictionary_min_cycleDs_Nm =
src.Element(&quot;SpindleSpeedToTorqueContours&quot;).Elements(&quot;Contour&quot;)
.ToDictionary(
contourElem =&gt;
{
double r = XmlConvert.ToDouble(contourElem.Attribute(&quot;InsistentRatio&quot;)?.Value);
//600s=10mins
return r == 1 ? double.PositiveInfinity : (r * 600);
},
contourElem =&gt; contourElem.Elements(&quot;SpindleSpeedToTorque&quot;).Select(
elem =&gt; new Vec2d(
XmlConvert.ToDouble(elem.Element(&quot;SpindleSpeed-RPM&quot;).Value) / 60,
XmlConvert.ToDouble(elem.Element(&quot;Torque-Nm&quot;).Value)))
.ToList());
src.Element(&quot;WorkableDurationToSpindleSpeedTorqueContoursDictionary&quot;)
?.SelfInvoke(dicElem =&gt;
{
//MessageUtil.WriteLine($&quot;dicElem: {dicElem}&quot;);
WorkableDurationToSpindleSpeedTorqueContoursDictionary_min_cycleDs_Nm =
dicElem.Elements(&quot;Contour&quot;).ToDictionary(
contourElem =&gt; XmlConvert.ToDouble(
contourElem.Attribute(&quot;WorkableDuration-min&quot;)?.Value),
contourElem =&gt; contourElem.Elements(&quot;SpindleSpeedToTorque&quot;).Select(
elem =&gt; new Vec2d(
XmlConvert.ToDouble(elem.Element(&quot;SpindleSpeed-RPM&quot;).Value) / 60,
XmlConvert.ToDouble(elem.Element(&quot;Torque-Nm&quot;).Value)))
.ToList());
//MessageUtil.WriteLine($&quot;keys: {string.Join(',',WorkableDurationToSpindleSpeedTorqueContoursDictionary_min_cycleDs_Nm.Select(e=&gt;e.Key))}&quot;);
});
//for legacy compatible.
if (src.Element(&quot;SpindleSpeedToPower--RPM-to-kW&quot;) != null)
InfInsistentSpindleSpeedToPower_cycleDs_kW =
src.Element(&quot;SpindleSpeedToPower--RPM-to-kW&quot;).Elements()
.Select(elem =&gt; new Vec2d(XmlConvert.ToDouble(elem.Attribute(
&quot;SpindleSpeed-RPM&quot;).Value) / 60,
XmlConvert.ToDouble(elem.Value))).ToList();
//for legacy compatible.
if (src.Element(&quot;SpindleSpeedToTorque--RPM-to-Nm&quot;) != null)
InfInsistentSpindleSpeedToTorque_cycleDs_Nm =
src.Element(&quot;SpindleSpeedToTorque--RPM-to-Nm&quot;).Elements()
.Select(elem =&gt; new Vec2d(XmlConvert.ToDouble(elem.Attribute(
&quot;SpindleSpeed-RPM&quot;).Value) / 60,
XmlConvert.ToDouble(elem.Value))).ToList();
}
/// &lt;inheritdoc/&gt;
public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)
{
return new XElement(XName,
this.GetNameNoteXElementList(),
new XElement(nameof(EnergyEfficiency), EnergyEfficiency),
new XElement(nameof(GearShiftSpindleSpeed_rpm), GearShiftSpindleSpeed_rpm),
new XElement(nameof(DryRunFrictionPowerCoefficient_mWdrpm),
DryRunFrictionPowerCoefficient_mWdrpm),
new XElement(nameof(DryRunWindagePowerCoefficient_pWdrpm3),
DryRunWindagePowerCoefficient_pWdrpm3),
new XElement(&quot;WorkableDurationToSpindleSpeedPowerContoursDictionary&quot;,
WorkableDurationToSpindleSpeedPowerContoursDictionary_min_cycleDs_kW.OrderBy(entry =&gt; entry.Key)
.Select(entry =&gt; new XElement(&quot;Contour&quot;,
new XAttribute(&quot;WorkableDuration-min&quot;, entry.Key),
entry.Value.Select(entry
=&gt; new XElement(&quot;SpindleSpeedToPower&quot;,
new XElement(&quot;SpindleSpeed-RPM&quot;, entry.X * 60),
new XElement(&quot;Power-kW&quot;, entry.Y)))))
),
new XElement(&quot;WorkableDurationToSpindleSpeedTorqueContoursDictionary&quot;,
WorkableDurationToSpindleSpeedTorqueContoursDictionary_min_cycleDs_Nm.OrderBy(entry =&gt; entry.Key)
.Select(entry =&gt; new XElement(&quot;Contour&quot;,
new XAttribute(&quot;WorkableDuration-min&quot;, entry.Key),
entry.Value.Select(entry
=&gt; new XElement(&quot;SpindleSpeedToTorque&quot;,
new XElement(&quot;SpindleSpeed-RPM&quot;, entry.X * 60),
new XElement(&quot;Torque-Nm&quot;, entry.Y)))))
)
);
}
</code></pre><h2 id="best-practices">Best Practices</h2>
<ol>
<li><strong>XName</strong>: Always define static <code>XName</code> property matching the class name.</li>
<li><strong>Registration</strong>: Register in static constructor using <a class="xref" href="../../api/Hi.Common.XmlUtils.XFactory.html">XFactory</a>.Regs</li>
<li>Call the <code>XName</code> such like <code>_ = CalleeClass.XName;</code> in the caller class static initialization field so that the registration takes effect before calling the Callee construction by <a class="xref" href="../../api/Hi.Common.XmlUtils.XFactory.html">XFactory</a>.</li>
<li><strong>Progress Threading</strong>: Pass the <code>IProgress&lt;object&gt;</code> parameter through all nested <code>XFactory</code> calls. See <a href="message-management.html">Message Management</a> for the rationale.</li>
<li><strong>Legacy Support</strong>: Maintain backward compatibility when needed</li>
</ol>
</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>
@@ -0,0 +1,195 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>General HiNC Workflow | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="General HiNC Workflow | 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="">
<h1 id="general-hinc-workflow">General HiNC Workflow</h1>
<p>The following diagram illustrates the overall HiNC workflow:</p>
<pre><code class="lang-mermaid">graph TD
A[&quot;Create MachiningProject&quot;] --&gt; B[&quot;Setting Environment&quot;]
B --&gt; C[&quot;Setting Project Tasks&quot;]
C --&gt; D[&quot;Run Tasks&quot;]
D --&gt; E[&quot;View Analysis Results&quot;]
</code></pre>
<p>For a complete implementation example, see: <a class="xref" href="../../sample/Sample.Machining.DemoBuildMachiningProject.html">DemoBuildMachiningProject</a></p>
<h2 id="1-create-">1. Create <a class="xref" href="../../api/Hi.MachiningProcs.MachiningProject.html">MachiningProject</a></h2>
<p>Creating a machining project is the first step in the HiNC workflow, accomplished by initializing a <a class="xref" href="../../api/Hi.MachiningProcs.MachiningProject.html">MachiningProject</a> object.</p>
<h2 id="2-setting-environment-in-">2. Setting Environment In <a class="xref" href="../../api/Hi.MachiningProcs.MachiningProject.html">MachiningProject</a></h2>
<ul>
<li>Set <a class="xref" href="../../api/Hi.Machining.MachiningEquipmentUtils.MachiningEquipment.html">MachiningEquipment</a>:
<ul>
<li>Usually one-time settings:
<ul>
<li><a class="xref" href="../../api/Hi.Machining.MachiningEquipmentUtils.MachiningEquipment.html#Hi_Machining_MachiningEquipmentUtils_MachiningEquipment_MachiningChain">MachiningChain</a> - Configure the complete machine tool including geometry, kinematic chain, and coordinate transformations</li>
<li><a class="xref" href="../../api/Hi.Machining.MachiningEquipmentUtils.MachiningEquipment.html#Hi_Machining_MachiningEquipmentUtils_MachiningEquipment_SpindleCapability">SpindleCapability</a> - Configure <a class="xref" href="../../api/Hi.Milling.SpindleCapability.html">SpindleCapability</a></li>
<li><a class="xref" href="../../api/Hi.Machining.MachiningEquipmentUtils.MachiningEquipment.html#Hi_Machining_MachiningEquipmentUtils_MachiningEquipment_CoolantHeatCondition">CoolantHeatCondition</a> - Configure coolant heat conditions</li>
<li>BackgroundTemperature - Configure environment background temperature</li>
</ul>
</li>
<li>Variable settings:
<ul>
<li><a class="xref" href="../../api/Hi.NcMech.Fixtures.Fixture.html">Fixture</a> - Configure fixture</li>
<li><a class="xref" href="../../api/Hi.NcMech.Workpieces.Workpiece.html">Workpiece</a> - Configure workpiece</li>
</ul>
</li>
</ul>
</li>
<li>Set <a class="xref" href="../../api/Hi.Machining.MachiningToolHouse.html">MachiningToolHouse</a> - Configure tool house</li>
<li>Set <a class="xref" href="../../api/Hi.Numerical.HardNcEnv.html">HardNcEnv</a> (Controller) - Configure NC system environment parameters</li>
</ul>
<h2 id="3-setting-project-tasks">3. Setting Project Tasks</h2>
<p>Set sequential tasks using <a class="xref" href="../../api/Hi.MachiningProcs.MachiningProject.html#Hi_MachiningProcs_MachiningProject_PlayerCommand">PlayerCommand</a>:</p>
<ul>
<li>Set NC Files - Set the file path and customize simulation and optimization settings for each NC file</li>
<li>Configure NC optimization - Configure NC code optimization parameters</li>
<li>Set <a class="xref" href="../../api/Hi.ShellCommands.GeomDiffCommand.html">GeomDiffCommand</a> - Configure geometry comparison functionality to compare target workpiece shape with simulated shape</li>
<li>Set <a class="xref" href="../../api/Hi.MillingForces.Training.MillingTraining.html">MillingTraining</a> - Configure milling parameter training to calibrate simulation parameters based on actual machining data</li>
<li>Other task configurations&hellip;</li>
</ul>
<p>The PlayerCommand is typically a <a class="xref" href="../../api/Hi.ShellCommands.ListCommand.html">ListCommand</a> that contains a sequence of command entries to be executed during the simulation.</p>
<h2 id="4-run-the-tasks-simulation-and-optimization">4. Run the Tasks (Simulation and Optimization)</h2>
<p>Run <a class="xref" href="../../api/Hi.MachiningProcs.MachiningProject.html#Hi_MachiningProcs_MachiningProject_PlayerCommand">PlayerCommand</a> through <a class="xref" href="../../api/Hi.MachiningProcs.LocalProjectService.html#Hi_MachiningProcs_LocalProjectService_PacePlayer">PacePlayer</a>.</p>
<p>At this stage, the simulation process is similar to video playback, which can be:</p>
<ul>
<li>Started</li>
<li>Stopped</li>
<li>Paused</li>
<li>Run one line</li>
<li>Run one step</li>
<li>Reset</li>
</ul>
<p>The <a class="xref" href="../../api/Hi.MachiningProcs.LocalProjectService.html#Hi_MachiningProcs_LocalProjectService_PacePlayer">PacePlayer</a> controls the execution pace of the simulation, allowing you to observe the machining process in detail or run it at full speed.</p>
<h3 id="view-the-analysis-during-process-or-result">View the Analysis During Process or Result</h3>
<p><a class="xref" href="../../api/Hi.MachiningProcs.SessionProgress.html">SessionProgress</a> contains a sequence of simulation messages and step data, which can be used to monitor and analyze the simulation process and results.</p>
<h2 id="ui-pattern">UI Pattern</h2>
<p>The user interface navigation bar matches the workflow. Top-level navigation items include:</p>
<ul>
<li><a class="xref" href="../../api/Hi.MachiningProcs.MachiningProject.html">MachiningProject</a>
<ul>
<li>New</li>
<li>Save</li>
<li>Load</li>
</ul>
</li>
<li>Environment
<ul>
<li>...</li>
</ul>
</li>
<li>Task
<ul>
<li>...</li>
</ul>
</li>
<li>Sim (Simulation)</li>
</ul>
<p>This UI structure makes it intuitive to follow the HiNC workflow from project creation to simulation execution.</p>
</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>
@@ -0,0 +1,184 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Geometry Objects | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Geometry Objects | 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="">
<h1 id="geometry-objects">Geometry Objects</h1>
<p><strong><a class="xref" href="../../api/Hi.Geom.IGetStl.html">IGetStl</a></strong> is the base interface for all geometry objects in HiAPI, providing unified STL support.</p>
<p>Several common geometry types are available:</p>
<ul>
<li>Basic Geometrys
<ul>
<li><a class="xref" href="../../api/Hi.Geom.Box3d.html">Box3d</a></li>
<li><a class="xref" href="../../api/Hi.Geom.Cylindroid.html">Cylindroid</a></li>
<li><a class="xref" href="../../api/Hi.Geom.Stl.html">Stl</a></li>
<li><a class="xref" href="../../api/Hi.Geom.StlFile.html">StlFile</a></li>
</ul>
</li>
<li>Management Geometrys
<ul>
<li><a class="xref" href="../../api/Hi.Geom.TransformationGeom.html">TransformationGeom</a></li>
<li><a class="xref" href="../../api/Hi.Geom.GeomCombination.html">GeomCombination</a></li>
</ul>
</li>
</ul>
<p>See <a href="../mechanism/transformers/index.html">Transformations</a> for <a class="xref" href="../../api/Hi.Geom.TransformationGeom.html">TransformationGeom</a>.</p>
<ul>
<li><a class="xref" href="../../api/Hi.Mech.Topo.GeneralTransform.html">GeneralTransform</a></li>
<li><a class="xref" href="../../api/Hi.Mech.Topo.StaticRotation.html">StaticRotation</a></li>
<li><a class="xref" href="../../api/Hi.Mech.Topo.StaticTranslation.html">StaticTranslation</a></li>
</ul>
<div class="NOTE">
<h5>Note</h5>
<p>All coordinate values use standard units (millimeters, radians)</p>
</div>
<h2 id="example-usage">Example Usage</h2>
<pre><code class="lang-csharp" name="SampleCode">using System;
using System.Collections.Generic;
using Hi.Geom;
using Hi.Mech.Topo;
namespace Sample.Geom;
/// &lt;summary&gt;
/// Demonstrates the creation and manipulation of geometric objects in HiAPI.
/// Shows how to create and transform various geometry types including boxes, cylindroids, and STL files.
/// &lt;/summary&gt;
/// &lt;remarks&gt;
/// ### Source Code
/// [!code-csharp[SampleCode](~/../Hi.Sample/Geom/DemoBuildGeom.cs)]
/// &lt;/remarks&gt;
public static class DemoBuildGeom
{
/// &lt;summary&gt;
/// Generates a collection of geometric objects for demonstration purposes.
/// Creates various geometry types including boxes, cylindroids, STL files, and transformed geometries.
/// &lt;/summary&gt;
/// &lt;returns&gt;A list of geometries implementing the IGetStl interface&lt;/returns&gt;
public static List&lt;IGetStl&gt; GenGeoms()
{
Box3d box = new Box3d(0, 0, -50, 70, 50, 0);
Cylindroid cylindroid = new Cylindroid([ new PairZr(0,12),new PairZr(20,12),
new PairZr(20,16),new PairZr(30,16)]);
Stl stl = new Stl(&quot;geom.stl&quot;);
StlFile stlFile = new StlFile(&quot;geom.stl&quot;);
TransformationGeom transformationGeom = new TransformationGeom()
{
Transformer = new GeneralTransform(1,
new StaticRotation(new Vec3d(0, 0, 1), MathUtil.ToRad(15), new Vec3d(0, 0, 0)),
new StaticTranslation(new Vec3d(0, 0, 0))),
Geom = stl
};
GeomCombination geomCombination = new GeomCombination(stlFile, transformationGeom);
return new List&lt;IGetStl&gt;([box, cylindroid, stl, stlFile, transformationGeom]);
}
}
</code></pre>
</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>
@@ -0,0 +1,192 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Getting Started with HiAPI | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Getting Started with HiAPI | 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="">
<h1 id="getting-started-with-hiapi">Getting Started with HiAPI</h1>
<p>This guide will help you get started with HiAPI development.</p>
<h2 id="installation">Installation</h2>
<ol>
<li><p>Create a dotnet project.</p>
</li>
<li><p>Setting the nuget server and account.</p>
<p>The HiAPI installation is typical Nuget Package installation. You can apply global or local nuget setting.</p>
<p>Here apply the local solution for startup. Create a file and name it to <code>nuget.config</code> in the same folder of your dotnet project file. the content of the file is as the following:</p>
<pre><code class="lang-xml">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;configuration&gt;
&lt;packageSources&gt;
&lt;add key=&quot;HiAPI&quot; value=&quot;https://superhightech-gitea.webredirect.org/api/packages/HiAPI/nuget/index.json&quot; /&gt;
&lt;add key=&quot;nuget.org&quot; value=&quot;https://api.nuget.org/v3/index.json&quot; protocolVersion=&quot;3&quot; /&gt;
&lt;/packageSources&gt;
&lt;packageSourceCredentials&gt;
&lt;HiAPI&gt;
&lt;add key=&quot;Username&quot; value=&quot;xxxxxx&quot; /&gt;
&lt;add key=&quot;ClearTextPassword&quot; value=&quot;xxxxxx&quot; /&gt;
&lt;/HiAPI&gt;
&lt;/packageSourceCredentials&gt;
&lt;/configuration&gt;
</code></pre>
</li>
<li><p>In the dotnet project file, add the package reference.</p>
<pre><code class="lang-xml">&lt;ItemGroup&gt;
&lt;PackageReference Include=&quot;HiNc&quot; Version=&quot;3.1.*&quot; /&gt;
&lt;!--optional--&gt;
&lt;PackageReference Include=&quot;Hi.WpfPlus&quot; Version=&quot;*&quot; /&gt;
&lt;/ItemGroup&gt;
</code></pre>
</li>
<li><p>In the program file, setting the HiNC application initialization and finalization.</p>
<pre><code class="lang-csharp" name="SampleCode">using Hi.HiNcKits;
using Microsoft.Extensions.Logging;
using System;
namespace Sample
{
/// &lt;summary&gt;
/// A sample class demonstrating initialization and usage of the HiAPI framework.
/// Shows the basic setup of display engine, MongoDB server, licensing, and other core functionality.
/// &lt;/summary&gt;
/// &lt;remarks&gt;
/// This example serves as an entry point for those getting started with HiAPI.
/// It demonstrates proper initialization and teardown of key components.
/// ### Source Code
/// [!code-csharp[SampleCode](~/../Hi.Sample/HelloHiAPI.cs)]
/// &lt;/remarks&gt;
public static class HelloHiAPI
{
static int Main(string[] args)
{
Console.WriteLine(&quot;HiAPI starting.&quot;);
using var loggerFactory = Microsoft.Extensions.Logging.LoggerFactory.Create(b =&gt; b.AddConsole());
LocalApp.AppBegin(loggerFactory.CreateLogger(&quot;Hi.Sample&quot;));
Console.WriteLine(&quot;Hello World! HiAPI.&quot;);
LocalApp.AppEnd();
Console.WriteLine(&quot;HiAPI exited.&quot;);
return 0;
}
}
}
</code></pre></li>
</ol>
<h2 id="sample-code-to-start-a-">Sample Code to Start a <a class="xref" href="../../api/Hi.MachiningProcs.MachiningProject.html">MachiningProject</a></h2>
<p>See the following sample code to start a HiAPI application.</p>
<ul>
<li><a class="xref" href="../../sample/Sample.Machining.DemoBuildMachiningProject.html">DemoBuildMachiningProject</a>
Build a <a class="xref" href="../../api/Hi.MachiningProcs.MachiningProject.html">MachiningProject</a>.</li>
<li><a class="xref" href="../../sample/Sample.Machining.DemoUseMachiningProject.html">DemoUseMachiningProject</a>
Load a <a class="xref" href="../../api/Hi.MachiningProcs.MachiningProject.html">MachiningProject</a> and run NC simulation.</li>
<li><a class="xref" href="../../sample/Sample.Machining.DemoRenderingMachiningProcessAndStripPosSelection.html">DemoRenderingMachiningProcessAndStripPosSelection</a>
Apply <a class="xref" href="../../api/Hi.MachiningProcs.MachiningProject.html">MachiningProject</a> to 3D canvas with user-interaction in windows platform.</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>
@@ -0,0 +1,180 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HiAPI Overview | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="HiAPI Overview | 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="">
<h1 id="hiapi-overview">HiAPI Overview</h1>
<p>HiAPI is a C# software development kit for machining simulation. It provides libraries for NC motion simulation, collision detection, geometry removal simulation, milling force simulation, optimization, and more.</p>
<h2 id="nuget-packages">Nuget Packages</h2>
<p>The HiAPI is applied by the form of Nuget Packages. You have to apply <code>HiNc</code> nuget package and its dependencies. They include all the functionality of the HiNC software, but do not include the GUI components.</p>
<p>The packages can be downloaded and installed from the HiAPI NuGet Server. The server URL is:</p>
<p><a href="%5Bhttps://superhightech-gitea.webredirect.org/api/packages/HiAPI/nuget/index.json">https://superhightech-gitea.webredirect.org/api/packages/HiAPI/nuget/index.json</a></p>
<div class="NOTE">
<h5>Note</h5>
<ul>
<li>Authentication is required to access the server (username and password)</li>
<li>Direct browser access to the URL will not show meaningful content. Since the server is designed for Visual Studio NuGet package management. For more information about NuGet, visit <a href="https://www.nuget.org/">NuGet.org</a></li>
</ul>
</div>
<h3 id="package-dependencies">Package Dependencies</h3>
<p>The <code>HiNc</code> package has the following dependency chain:</p>
<pre><code class="lang-mermaid">graph LR
HiGeom --&gt; HiDisp
HiDisp --&gt; HiCbtr
HiCbtr --&gt; HiMech
HiMech --&gt; HiUniNc
HiUniNc --&gt; HiNc
HiDisp --&gt; Hi.WinForm
HiDisp --&gt; Hi.WpfPlus
style HiNc fill:#d3d,stroke:#333,stroke-width:2px
</code></pre>
<h3 id="ui-framework-support">UI Framework Support</h3>
<p>If you need to develop Windows desktop applications:</p>
<ul>
<li>For Windows Forms applications, use the <code>Hi.WinForm</code> package.</li>
<li>For WPF applications, use the <code>Hi.WpfPlus</code> package.</li>
</ul>
<div class="NOTE">
<h5>Note</h5>
<p>See <a href="rendering/rendering-canvas/custom-implementation.html">Building Your Own Rendering Canvas</a> to build the rendering canvas cross-platform.</p>
</div>
<h2 id="rendering-canvas-source-code-repositories">Rendering Canvas Source Code Repositories</h2>
<ul>
<li>Hi.WinForm
<ul>
<li><a href="https://superhightech-gitea.webredirect.org/HiNC-Deploy/Hi.WinForm.git">https://superhightech-gitea.webredirect.org/HiNC-Deploy/Hi.WinForm.git</a></li>
</ul>
</li>
<li>Hi.WpfPlus
<ul>
<li><a href="https://superhightech-gitea.webredirect.org/HiNC-Deploy/Hi.WpfPlus.git">https://superhightech-gitea.webredirect.org/HiNC-Deploy/Hi.WpfPlus.git</a></li>
</ul>
</li>
</ul>
<h2 id="hiapi-sample-code">HiAPI Sample Code</h2>
<p>See <a href="../sample/Sample.Machining.html">Sample Code</a> or download the repositories to get more samples. The following sample repository demonstrate various aspects of using HiAPI for machining simulation:</p>
<ul>
<li>Hi.Sample
<ul>
<li><a href="https://superhightech-gitea.webredirect.org/HiNC-Deploy/Hi.Sample.git">https://superhightech-gitea.webredirect.org/HiNC-Deploy/Hi.Sample.git</a></li>
<li>The repository generally contains the sample codes without using rendering canvas.</li>
</ul>
</li>
<li>Hi.Sample.Wpf
<ul>
<li><a href="https://superhightech-gitea.webredirect.org/HiNC-Deploy/Hi.Sample.Wpf.git">https://superhightech-gitea.webredirect.org/HiNC-Deploy/Hi.Sample.Wpf.git</a></li>
<li>The repository generally contains the sample code that requires rendering canvas.</li>
</ul>
</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>
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

@@ -0,0 +1,145 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Kinematic Topology | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Kinematic Topology | 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="Usage.HiMech.Topo">
<h1 id="kinematic-topology">Kinematic Topology</h1>
<p>The Kinematic Topology is composed of three elemental classes: <strong><a class="xref" href="../../../api/Hi.Mech.Topo.Anchor.html">Anchor</a></strong>, <strong><a class="xref" href="../../../api/Hi.Mech.Topo.Branch.html">Branch</a></strong> and <strong><a class="xref" href="../../../api/Hi.Mech.Topo.Asmb.html">Asmb</a></strong>.</p>
<h2 id="basic-elements">Basic Elements</h2>
<h3 id="anchors-and-branches">Anchors and Branches</h3>
<p><strong><a class="xref" href="../../../api/Hi.Mech.Topo.Anchor.html">Anchor</a></strong> object contains a cartesian coordinate. It can be a mechanical component or a flag.</p>
<p><strong><a class="xref" href="../../../api/Hi.Mech.Topo.Branch.html">Branch</a></strong> object is a directional link between two <a class="xref" href="../../../api/Hi.Mech.Topo.Anchor.html">Anchor</a> objects. It contains the <strong><a class="xref" href="../../../api/Hi.Mech.Topo.ITransformer.html">ITransformer</a></strong> object. The <a class="xref" href="../../../api/Hi.Mech.Topo.ITransformer.html">ITransformer</a> object contains a coordinate <strong>transformation matrix</strong>. As shown in the following sketch:</p>
<p><img src="chainLink.png" alt="Chain Structure"></p>
<h3 id="assembly-management">Assembly Management</h3>
<p><strong><a class="xref" href="../../../api/Hi.Mech.Topo.Asmb.html">Asmb</a></strong> (Assembly) provides organization and management of Anchors. An Assembly can contain both Anchors and other Assemblies. Key features include:</p>
<ul>
<li>Grouping related Anchors together</li>
<li>Managing coordinate transformations</li>
<li>Providing display and indexing functions</li>
<li>Supporting hierarchical structure</li>
</ul>
<h2 id="kinematic-chain-example">Kinematic Chain Example</h2>
<p>The following figure shows a kinematic chain of a non-orthogonal 5-axis machine tool:</p>
<p><img src="vmt.png" alt="VMT Structure"></p>
<p>Each <a class="xref" href="../../../api/Hi.Mech.Topo.Anchor.html">Anchor</a> represents a component:</p>
<ul>
<li>Axis components: X, Y, Z, B, C</li>
<li>Base components: O (base1), O* (base2)</li>
<li>Tool components: S (spindle), T (tool body), T* (tool flute)</li>
<li>Workpiece: W</li>
</ul>
<p>The relative transform between two Anchors is calculated by multiplying the transform matrices along the Branch. For example, the transform matrix from W to T is:</p>
<div class="math">
\[
M_{WT} = M_{CW}^{-1} \cdot M_{YC}^{-1} \cdot M_{OY}^{-1} \cdot M_{OO^*} \cdot M_{O^*X} \cdot M_{XZ} \cdot M_{ZB} \cdot M_{BS} \cdot M_{ST}
\]</div>
<p>This matrix can be obtained using <a class="xref" href="../../../api/Hi.Mech.Topo.Asmb.html#Hi_Mech_Topo_Asmb_GetMat4d_Hi_Mech_Topo_IGetAnchor_Hi_Mech_Topo_IGetAnchor_">GetMat4d(IGetAnchor, IGetAnchor)</a>.</p>
</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>
Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

@@ -0,0 +1,139 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HiAPI Mechanics Overview | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="HiAPI Mechanics Overview | 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="HiMech.Overview">
<h1 id="mechanism-topology">Mechanism Topology</h1>
<p>HiAPI Mechanism Topology provides basic functionality for assembling mechanical structures and simulating their motions. It allows you to build kinematic models of milling machines and similar mechanical structures through a topology-based approach.</p>
<h2 id="core-concepts">Core Concepts</h2>
<h3 id="kinematic-topology">Kinematic Topology</h3>
<p>Kinematic Topology is the core concept of this module, which describes the motion relationships between mechanical components. With Kinematic Topology, you can:</p>
<ul>
<li>Define mechanical structures and motion relationships</li>
<li>Calculate forward and inverse kinematics</li>
<li>Display component positions and orientations</li>
<li>Conduct collision detection</li>
</ul>
<h3 id="main-modules">Main Modules</h3>
<ul>
<li><a href="Topo/index.html">Topology</a> - Kinematic topology structure, including assembly management and chain definition</li>
<li><a href="transformers/index.html">Transformers</a> - Coordinate transformation and motion transformation</li>
<li><a href="render-topology/index.html">Render Topology</a> - Rendering with topology structure and anchored display</li>
</ul>
<h2 id="api-references">API References</h2>
<ul>
<li><a class="xref" href="../../api/Hi.Mech.Topo.html">Hi.Mech.Topo</a> - Core topology functionality</li>
<li><a class="xref" href="../../api/Hi.Mech.Topo.Asmb.html">Asmb</a> - Assembly-related functionality</li>
<li><a class="xref" href="../../api/Hi.Mech.Topo.Branch.html">Branch</a> - Chain-related functionality</li>
</ul>
<h2 id="examples">Examples</h2>
<p>Please refer to the examples in each sub-section to learn how to use these features to build your applications.</p>
</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>
@@ -0,0 +1,228 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Render Topology | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Render Topology | 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="">
<h1 id="render-topology">Render Topology</h1>
<p>Read <a href="../Topo/index.html">Kinematic Topology</a> <a href="../../rendering/index.html">Rendering</a> for the prerequisite.</p>
<p>A <a class="xref" href="../../../api/Hi.Mech.Topo.Asmb.html">Asmb</a> is a group to render its descendent <a class="xref" href="../../../api/Hi.Mech.Topo.Anchor.html">Anchor</a>s.</p>
<p>Several ways to render with the topology:</p>
<ul>
<li>Render by Anchoring Matrix Map</li>
<li>Render by Anchored Displayee</li>
</ul>
<h2 id="render-by-anchoring-matrix-map">Render by Anchoring Matrix Map</h2>
<h2 id="render-by-anchored-displayee">Render by Anchored Displayee</h2>
<p>Inherit <a class="xref" href="../../../api/Hi.Mech.Topo.IAnchoredDisplayee.html">IAnchoredDisplayee</a> or apply <a class="xref" href="../../../api/Hi.Mech.Topo.AnchoredDisplayee.html">AnchoredDisplayee</a> to <a class="xref" href="../../../api/Hi.Mech.Topo.Asmb.html">Asmb</a>.Display().</p>
<p>Inherit <a class="xref" href="../../../api/Hi.Mech.Topo.ITopoDisplayee.html">ITopoDisplayee</a> to manage the object with <a class="xref" href="../../../api/Hi.Mech.Topo.Asmb.html">Asmb</a> and plural anchors .</p>
<p>The base logic is also by the anchoring matrix. Here is some class and function wrapping the logic.</p>
<p>The sample code shows the topology rendering for a <a class="xref" href="../../../api/Hi.Milling.MillingTools.MillingTool.html">MillingTool</a> editing helper:</p>
<pre><code class="lang-csharp" name="MillingToolEditorDisplayee">using Hi.Common;
using Hi.Common.Messages;
using Hi.Disp;
using Hi.Disp.Flag;
using Hi.Geom;
using Hi.Mech.Topo;
using Hi.Milling.Cutters;
using Hi.NcMech.Holders;
using System;
using System.Collections.Generic;
namespace Hi.Milling.MillingTools
{
/// &lt;summary&gt;
/// Display host for a milling tool composed of a cutter and a holder.
/// &lt;/summary&gt;
public class MillingToolEditorDisplayee : ITopoDisplayee, IClearCache
{
/// &lt;summary&gt;
/// Gets or sets the delegate that provides the &lt;see cref=&quot;MillingTool&quot;/&gt; instance.
/// &lt;/summary&gt;
public Func&lt;MillingTool&gt; MillingToolGetter { get; set; }
/// &lt;summary&gt;
/// Gets the current &lt;see cref=&quot;MillingTool&quot;/&gt; instance.
/// &lt;/summary&gt;
public MillingTool MillingTool =&gt; MillingToolGetter?.Invoke();
/// &lt;summary&gt;
/// Gets or sets whether to show the cutter.
/// &lt;/summary&gt;
public bool ShowCutter { get; set; } = true;
/// &lt;summary&gt;
/// Gets or sets whether to show the holder.
/// &lt;/summary&gt;
public bool ShowHolder { get; set; } = true;
/// &lt;summary&gt;
/// Gets the displayee for the milling cutter.
/// &lt;/summary&gt;
public MillingCutterEditorDisplayee MillingCutterEditorDisplayee { get; }
= new MillingCutterEditorDisplayee();
/// &lt;summary&gt;
/// Gets the displayee for the holder.
/// &lt;/summary&gt;
public HolderEditorDisplayee HolderEditorDisplayee { get; }
= new HolderEditorDisplayee();
/// &lt;inheritdoc/&gt;
public List&lt;IAnchoredDisplayee&gt; GetAnchoredDisplayeeList()
{
var dst = new List&lt;IAnchoredDisplayee&gt;();
var millingTool = MillingTool;
if (millingTool == null)
return dst;
if (ShowCutter)
{
var cutter = millingTool.Cutter;
if (cutter is MillingCutter millingCutter)
{
//MessageKit.AddMessage($&quot;MillingTool.Cutter: {MillingTool?.Cutter?.GetHashCode()}&quot;);
MillingCutterEditorDisplayee.MillingCutterSourceFunc
= () =&gt; MillingTool?.Cutter as MillingCutter;
dst.Add(MillingCutterEditorDisplayee);
}
else if(cutter!=null)
dst.Add(cutter);
}
if (ShowHolder)
{
HolderEditorDisplayee.Holder = millingTool.Holder;
dst.Add(HolderEditorDisplayee);
}
return dst;
}
/// &lt;inheritdoc/&gt;
public void Display(Bind bind)
{
bind.PushCoveringPixelMode();
DimensionBar.Display(bind, &quot;mm&quot;);
bind.ModelMatStack.Pop();
TopoDisplayeeUtil.Display(this, bind);
}
/// &lt;inheritdoc/&gt;
public void ExpandToBox3d(Box3d dst)
{
TopoDisplayeeUtil.ExpandToBox3d(this, dst);
}
/// &lt;inheritdoc/&gt;
public Asmb GetAsmb() =&gt; MillingTool?.Asmb;
/// &lt;inheritdoc/&gt;
public Anchor GetAnchor() =&gt; MillingTool?.GetAnchor();
/// &lt;inheritdoc/&gt;
public void ClearCache()
{
MillingCutterEditorDisplayee?.ClearCache();
}
}
}
</code></pre>
</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>
@@ -0,0 +1,199 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Handle Transform Matrix by ITransformer | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Handle Transform Matrix by ITransformer | 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="HiMech.Tutor.transformers">
<h1 id="handle-transform-matrix-by-itransformer">Handle Transform Matrix by ITransformer</h1>
<p><strong><a class="xref" href="../../../api/Hi.Mech.Topo.ITransformer.html">ITransformer</a></strong> contains a transform matrix and a inverse transform matrix. The matrix is 4x4 column-major matrix, which describe the orientation or movement between 3D coordinates.</p>
<p>Several common used interface and class are implemented from <a class="xref" href="../../../api/Hi.Mech.Topo.ITransformer.html">ITransformer</a>. The inheritance is shown:</p>
<ul>
<li><a class="xref" href="../../../api/Hi.Mech.Topo.IStaticTransformer.html">IStaticTransformer</a>
<ul>
<li><a class="xref" href="../../../api/Hi.Mech.Topo.NoTransform.html">NoTransform</a></li>
<li><a class="xref" href="../../../api/Hi.Mech.Topo.StaticTranslation.html">StaticTranslation</a></li>
<li><a class="xref" href="../../../api/Hi.Mech.Topo.StaticRotation.html">StaticRotation</a></li>
<li><a class="xref" href="../../../api/Hi.Mech.Topo.StaticFreeform.html">StaticFreeform</a></li>
<li><a class="xref" href="../../../api/Hi.Mech.Topo.GeneralTransform.html">GeneralTransform</a></li>
</ul>
</li>
<li><a class="xref" href="../../../api/Hi.Mech.Topo.IDynamicTransformer.html">IDynamicTransformer</a>
<ul>
<li><a class="xref" href="../../../api/Hi.Mech.Topo.IDynamicRegular.html">IDynamicRegular</a>
<ul>
<li><a class="xref" href="../../../api/Hi.Mech.Topo.DynamicTranslation.html">DynamicTranslation</a></li>
<li><a class="xref" href="../../../api/Hi.Mech.Topo.DynamicRotation.html">DynamicRotation</a></li>
</ul>
</li>
<li><a class="xref" href="../../../api/Hi.Mech.Topo.DynamicFreeform.html">DynamicFreeform</a></li>
</ul>
</li>
</ul>
<p><strong><a class="xref" href="../../../api/Hi.Mech.Topo.IStaticTransformer.html">IStaticTransformer</a></strong> is transformer with constant matrix. <strong><a class="xref" href="../../../api/Hi.Mech.Topo.NoTransform.html">NoTransform</a></strong>, <strong><a class="xref" href="../../../api/Hi.Mech.Topo.StaticTranslation.html">StaticTranslation</a></strong> and <strong><a class="xref" href="../../../api/Hi.Mech.Topo.StaticRotation.html">StaticRotation</a></strong> contains transform matrix of identity, translate and rotate respectively. <strong><a class="xref" href="../../../api/Hi.Mech.Topo.StaticFreeform.html">StaticFreeform</a></strong> contains a arbitrary constant transform matrix.</p>
<p>The transform matrix of <a class="xref" href="../../../api/Hi.Mech.Topo.StaticTranslation.html">StaticTranslation</a> is:</p>
<div class="math">
\[
M_{StaticTranslate}=
\begin{bmatrix}
1 &amp; 0 &amp; 0 &amp; 0 \\\\
0 &amp; 1 &amp; 0 &amp; 0 \\\\
0 &amp; 0 &amp; 1 &amp; 0 \\\\
Trans.x &amp; Trans.y &amp; Trans.z &amp; 1
\end{bmatrix}
\]</div>
<p>The transform matrix of <a class="xref" href="../../../api/Hi.Mech.Topo.StaticRotation.html">StaticRotation</a> and <a class="xref" href="../../../api/Hi.Mech.Topo.DynamicRotation.html">DynamicRotation</a> is:</p>
<div class="math">
\[
M_{Rotate}=
\begin{bmatrix}
1 &amp; 0 &amp; 0 &amp; 0 \\\\
0 &amp; 1 &amp; 0 &amp; 0 \\\\
0 &amp; 0 &amp; 1 &amp; 0 \\\\
-Pivot.x &amp; -Pivot.y &amp; -Pivot.z &amp; 1
\end{bmatrix}
\cdot
\\\\
\begin{bmatrix}
Rot_{00}(axis,rad) &amp; Rot_{01}(axis,rad) &amp; Rot_{02}(axis,rad) &amp; 0 \\\\
Rot_{10}(axis,rad) &amp; Rot_{11}(axis,rad) &amp; Rot_{12}(axis,rad) &amp; 0 \\\\
Rot_{20}(axis,rad) &amp; Rot_{21}(axis,rad) &amp; Rot_{22}(axis,rad) &amp; 0 \\\\
0 &amp; 0 &amp; 0 &amp; 1
\end{bmatrix}
\cdot
\\\\
\begin{bmatrix}
1 &amp; 0 &amp; 0 &amp; 0 \\\\
0 &amp; 1 &amp; 0 &amp; 0 \\\\
0 &amp; 0 &amp; 1 &amp; 0 \\\\
Pivot.x &amp; Pivot.y &amp; Pivot.z &amp; 1
\end{bmatrix}
\]</div>
<p>Where <a class="xref" href="../../../api/Hi.Mech.Topo.DynamicRotation.html#Hi_Mech_Topo_DynamicRotation_Pivot">Pivot</a> is the position of the rotation axis.</p>
<div class="TIP">
<h5>Tip</h5>
<p>Pivot is a point. However, rotation axis is a line. It means that it causes the same matrix no matter how the pivot is moving along the axis.</p>
</div>
<p><strong><a class="xref" href="../../../api/Hi.Mech.Topo.IDynamicTransformer.html">IDynamicTransformer</a></strong> is transformer with inconstant transform matrix. <strong><a class="xref" href="../../../api/Hi.Mech.Topo.IDynamicRegular.html">IDynamicRegular</a></strong> has a property <a class="xref" href="../../../api/Hi.Mech.Topo.IDynamicRegular.html#Hi_Mech_Topo_IDynamicRegular_Step">Step</a>, implied that the transform matrix is one parameter driven. <a class="xref" href="../../../api/Hi.Mech.Topo.TransformerUtil.html#Hi_Mech_Topo_TransformerUtil_GetSteps_Hi_Mech_Topo_IDynamicRegular___">GetSteps(IDynamicRegular[])</a> and <a class="xref" href="../../../api/Hi.Mech.Topo.TransformerUtil.html#Hi_Mech_Topo_TransformerUtil_SetSteps_Hi_Mech_Topo_IDynamicRegular___System_Double___">SetSteps(IDynamicRegular[], double[])</a> provide easy handle of an array of <a class="xref" href="../../../api/Hi.Mech.Topo.IDynamicRegular.html">IDynamicRegular</a> objects.</p>
<p>The transform matrix of <a class="xref" href="../../../api/Hi.Mech.Topo.DynamicTranslation.html">DynamicTranslation</a> is:</p>
<div class="math">
\[
M_{DynamicTranslate}=
\begin{bmatrix}
1 &amp; 0 &amp; 0 &amp; 0 \\\\
0 &amp; 1 &amp; 0 &amp; 0 \\\\
0 &amp; 0 &amp; 1 &amp; 0 \\\\
Trans.x \cdot Step &amp; Trans.y \cdot Step &amp; Trans.z \cdot Step &amp; 1
\end{bmatrix}
\]</div>
<div class="NOTE">
<h5>Note</h5>
<p>In convention, <a class="xref" href="../../../api/Hi.Mech.Topo.StaticTranslation.html#Hi_Mech_Topo_StaticTranslation_Trans">Trans</a> should be normalized.</p>
</div>
</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>
@@ -0,0 +1,170 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Color Guide System | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Color Guide System | 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="">
<h1 id="color-guide-system">Color Guide System</h1>
<p>The Color Guide System allows you to assign colors and rendering priorities to visual elements based on machining steps or data states.</p>
<h2 id="overview">Overview</h2>
<p>The <a class="xref" href="../../../api/Hi.Coloring.IColorGuide.html">IColorGuide</a> interface defines the core functionality for color mapping, allowing different colors and rendering priorities to be returned based on various steps or states. This system is particularly suitable for scenarios requiring visual encoding based on data states, such as CNC machining path visualization.</p>
<h2 id="core-interface">Core Interface</h2>
<h3 id="icolorguide-interface">IColorGuide Interface</h3>
<p><a class="xref" href="../../../api/Hi.Coloring.IColorGuide.html">IColorGuide</a> is the core interface of the Color Guide System, inheriting from <a class="xref" href="../../../api/Hi.Common.XmlUtils.IMakeXmlSource.html">IMakeXmlSource</a> and <a class="xref" href="../../../api/Hi.Coloring.IGetColorGuide.html">IGetColorGuide</a>.</p>
<h4 id="methods">Methods</h4>
<table>
<thead>
<tr>
<th>Method</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="../../../api/Hi.Coloring.IColorGuide.html#Hi_Coloring_IColorGuide_GetRgb_">GetRgb</a></td>
<td>Returns RGB color value based on the step object</td>
</tr>
<tr>
<td><a class="xref" href="../../../api/Hi.Coloring.IColorGuide.html#Hi_Coloring_IColorGuide_GetRgbWithPriority_">GetRgbWithPriority</a></td>
<td>Returns RGB color and rendering priority</td>
</tr>
</tbody>
</table>
<h4 id="priority-explanation">Priority Explanation</h4>
<p>The <code>attachmentPriority</code> parameter controls the overlay priority during rendering:</p>
<ul>
<li><strong>Higher values take priority</strong>: Larger priority values are displayed first</li>
<li><strong>Graph scaling for pixel consolidation</strong>: When multiple machining steps are rendered within the same pixel, higher priority colors take precedence</li>
</ul>
<h4 id="effects-on-rendering-systems">Effects on Rendering Systems</h4>
<p><strong>In CubeTree (<a class="xref" href="../../../api/Hi.Cbtr.CubeTree.html">CubeTree</a>):</strong></p>
<ul>
<li>Color priorities determine which machining state is displayed when multiple operations overlap in 3D space</li>
<li>Higher priority colors (like collision detection) will override lower priority colors (like normal cutting)</li>
</ul>
<h2 id="application-scenarios">Application Scenarios</h2>
<p>The Color Guide System is suitable for the following scenarios:</p>
<ol>
<li><strong>CNC Machining Visualization</strong>: Display different path colors based on machining states</li>
<li><strong>Data State Encoding</strong>: Convert numerical states to visual color representations</li>
<li><strong>Priority-based Graph Scaling</strong>: When zooming out or viewing dense data, higher priority colors (critical states) remain visible while lower priority colors may be consolidated</li>
<li><strong>Multi-resolution Rendering</strong>: Critical machining issues (collisions, safety violations) are always displayed regardless of zoom level or data density</li>
</ol>
<h2 id="registering-color-guide-in-project">Registering Color Guide in Project</h2>
<p>To make the Color Guide effective in a project, implement the <a class="xref" href="../../../api/Hi.Coloring.IColorGuide.html">IColorGuide</a> interface and register it in the project's color guide dictionary.</p>
<h2 id="xml-serialization">XML Serialization</h2>
<p>See <a href="../../common/xml-io.html">About XML IO</a> for details on XML serialization implementation.</p>
<h2 id="wpf-application-source-and-sample-code-path">WPF Application Source And Sample Code Path</h2>
<ul>
<li>HiMech/Coloring/IColorGuide</li>
<li>HiNC-2025-win-desktop/Demo/DemoColorGuide</li>
</ul>
<p>See <a href="../../../app-anatomy/index.html">this page</a> for Git repository information.</p>
</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>
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

@@ -0,0 +1,300 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Using Hi.Disp.Drawing | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Using Hi.Disp.Drawing | 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="">
<h1 id="using-hidispdrawing">Using Hi.Disp.Drawing</h1>
<p>The <a class="xref" href="../../../api/Hi.Disp.Drawing.html">Drawing</a> class is the most fundamental and efficient rendering unit that allows you to draw points, lines, and surfaces within the <a class="xref" href="../../../api/Hi.Disp.DispEngine.html">DispEngine</a>.</p>
<h2 id="understanding-drawing-structure">Understanding Drawing Structure</h2>
<p>Looking at the constructor <a class="xref" href="../../../api/Hi.Disp.Drawing.html#Hi_Disp_Drawing__ctor_System_Double___Hi_Disp_Stamp_System_Int32_">Drawing(double[], Stamp, int)</a> helps explain its structure:</p>
<ul>
<li>The <code>double[]</code> array contains batch data for rendering, composed of one or more data groups of consistent length</li>
<li>Each data group's length is determined by the <a class="xref" href="../../../api/Hi.Disp.Stamp.html">Stamp</a> parameter</li>
<li>Each data group describes a single vertex</li>
</ul>
<h2 id="data-components">Data Components</h2>
<p>A data group can contain up to four types of information:</p>
<table>
<thead>
<tr>
<th>Information</th>
<th>Abbreviation</th>
<th>Description</th>
<th>Size</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Vertex</strong></td>
<td>V</td>
<td>The position of the point (x, y, z)</td>
<td>3 doubles</td>
</tr>
<tr>
<td><strong>Normal</strong></td>
<td>N</td>
<td>The normal vector affecting light reflection (Nx, Ny, Nz)</td>
<td>3 doubles</td>
</tr>
<tr>
<td><strong>Color</strong></td>
<td>C</td>
<td>RGB color values ranging from 0 to 1</td>
<td>3 doubles</td>
</tr>
<tr>
<td><strong>Pick ID</strong></td>
<td>P</td>
<td>A single double value converted from an integer for selection operations</td>
<td>1 double</td>
</tr>
</tbody>
</table>
<p>The <a class="xref" href="../../../api/Hi.Disp.Stamp.html">Stamp</a> enumeration combines these abbreviations to create these possible stamps: <code>{V, NV, CV, CNV, PV, PNV, PCV, PCNV}</code>.</p>
<h3 id="important-notes">Important Notes:</h3>
<ul>
<li>The <strong>Vertex</strong> (V) is mandatory, which is why V appears in every Stamp option</li>
<li><strong>Normal</strong> vectors (N) are typically used for 3D graphics to create a sense of depth through lighting</li>
<li><strong>Color</strong> (C) uses three double values (R, G, B) in the range of 0 to 1</li>
<li><strong>Pick ID</strong> (P) is used for graphical selection operations</li>
</ul>
<h2 id="data-structure-example">Data Structure Example</h2>
<ul>
<li>If <a class="xref" href="../../../api/Hi.Disp.Stamp.html">Stamp</a> is <code>V</code>, each data group consists of 3 double values (x, y, z)</li>
<li>If <a class="xref" href="../../../api/Hi.Disp.Stamp.html">Stamp</a> is <code>PCV</code>, each data group consists of 1(P) + 3(C) + 3(V) = 7 double values</li>
</ul>
<h2 id="rendering-mode">Rendering Mode</h2>
<p>The <code>glmode</code> parameter is an OpenGL constant that specifies the drawing mode. You can search for &ldquo;OpenGL Primitives&rdquo; online to see illustrations of these modes.</p>
<h2 id="example-usage">Example Usage</h2>
<pre><code class="lang-csharp">// Creating a simple line strip with three vertices
double[] vertices = new double[] {
0, 0, 0, // First point at origin
1, 0, 0, // Second point along X-axis
0, 0, 1 // Third point along Z-axis
};
// Create drawing object using the vertices
var drawing = new Drawing(vertices, Stamp.V, (int)OpenGL.GL_LINE_STRIP);
</code></pre>
<p>This example creates three vertices with only position information (V), so each vertex has just xyz coordinates. The drawing mode is set to LineStrip.</p>
<p><img src="easydraw_lines.png" alt="Line Strip Drawing Example"></p>
<h2 id="performance-considerations">Performance Considerations</h2>
<div class="NOTE">
<h5>Note</h5>
<p>After a <a class="xref" href="../../../api/Hi.Disp.Drawing.html">Drawing</a> object is created, its source data is stored in GPU memory. Regardless of the amount of data, the CPU processing load when calling <a class="xref" href="../../../api/Hi.Disp.IDisplayee.html#Hi_Disp_IDisplayee_Display_Hi_Disp_Bind_">Display(Bind)</a> remains consistent. This means displaying 100 points with one <a class="xref" href="../../../api/Hi.Disp.Drawing.html">Drawing</a> object is approximately 100 times faster than using 100 separate Drawing objects to display 100 individual points.</p>
</div>
<h2 id="composing-multiple-idisplayee-objects">Composing Multiple IDisplayee Objects</h2>
<p>A common pattern is to combine multiple <a class="xref" href="../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a> objects, including <a class="xref" href="../../../api/Hi.Disp.Drawing.html">Drawing</a> objects:</p>
<pre><code class="lang-csharp">public class MyCompositeDisplayee : IDisplayee
{
private readonly List&lt;IDisplayee&gt; _displayees = new List&lt;IDisplayee&gt;();
public MyCompositeDisplayee()
{
// Create a grid drawing
_displayees.Add(CreateGridDrawing());
// Create an axes drawing
_displayees.Add(CreateAxesDrawing());
// Add other custom drawings
_displayees.Add(CreateCustomDrawing());
}
private Drawing CreateGridDrawing()
{
// Code to create a grid
double[] gridVertices = new double[/* grid data */];
return new Drawing(gridVertices, Stamp.CV, (int)OpenGL.GL_LINES);
}
private Drawing CreateAxesDrawing()
{
// Create colored axes
double[] axesData = new double[] {
// Red X-axis (with color)
1, 0, 0, 0, 0, 0, // Red color, origin
1, 0, 0, 1, 0, 0, // Red color, x-axis end
// Green Y-axis (with color)
0, 1, 0, 0, 0, 0, // Green color, origin
0, 1, 0, 0, 1, 0, // Green color, y-axis end
// Blue Z-axis (with color)
0, 0, 1, 0, 0, 0, // Blue color, origin
0, 0, 1, 0, 0, 1 // Blue color, z-axis end
};
return new Drawing(axesData, Stamp.CV, (int)OpenGL.GL_LINES);
}
public void Display(Bind bind)
{
// Render all contained displayees
foreach (var displayee in _displayees)
{
displayee.Display(bind);
}
}
public void ExpandToBox3d(Box3d box)
{
// Update bounding box based on all displayees
foreach (var displayee in _displayees)
{
displayee.ExpandToBox3d(box);
}
}
}
</code></pre>
<h2 id="creating-common-shapes">Creating Common Shapes</h2>
<p>Here are some examples of creating common shapes using the <a class="xref" href="../../../api/Hi.Disp.Drawing.html">Drawing</a> class:</p>
<h3 id="creating-points">Creating Points</h3>
<pre><code class="lang-csharp">// Create an array of points
double[] pointData = new double[] {
0, 0, 0, // Point 1
1, 1, 1, // Point 2
2, 0, 0, // Point 3
0, 2, 0 // Point 4
};
// Create a Drawing for points
var pointDrawing = new Drawing(pointData, Stamp.V, (int)OpenGL.GL_POINTS);
</code></pre>
<h3 id="creating-lines">Creating Lines</h3>
<pre><code class="lang-csharp">// Create line segments (pairs of vertices)
double[] lineData = new double[] {
0, 0, 0, 1, 1, 0, // Line 1: (0,0,0) to (1,1,0)
2, 0, 0, 2, 2, 0 // Line 2: (2,0,0) to (2,2,0)
};
// Create a Drawing for lines
var lineDrawing = new Drawing(lineData, Stamp.V, (int)OpenGL.GL_LINES);
</code></pre>
<h3 id="creating-triangles">Creating Triangles</h3>
<pre><code class="lang-csharp">// Create triangles (triplets of vertices)
double[] triangleData = new double[] {
// Triangle 1
0, 0, 0, // Vertex 1
1, 0, 0, // Vertex 2
0, 1, 0 // Vertex 3
};
// Create a Drawing for triangles
var triangleDrawing = new Drawing(triangleData, Stamp.V, (int)OpenGL.GL_TRIANGLES);
</code></pre>
<h2 id="see-also">See Also</h2>
<ul>
<li><a class="xref" href="../../../api/Hi.Disp.DispEngine.html">DispEngine</a></li>
<li><a class="xref" href="../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a></li>
<li><a class="xref" href="../../../api/Hi.Disp.DispList.html">DispList</a></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>
@@ -0,0 +1,175 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Rendering with HiAPI | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Rendering with HiAPI | 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="">
<h1 id="rendering-with-hiapi">Rendering with HiAPI</h1>
<p>This section covers the rendering capabilities of HiAPI, focusing on how to create and display visual content in your applications.</p>
<h2 id="overview">Overview</h2>
<p>HiAPI provides a powerful rendering system built around the <a class="xref" href="../../api/Hi.Disp.DispEngine.html">DispEngine</a> and <a class="xref" href="../../api/Hi.Disp.IDisplayee.html">IDisplayee</a> interface. This system enables you to:</p>
<ul>
<li>Create and render 3D and 2D graphics</li>
<li>Implement interactive user interfaces</li>
<li>Achieve high-performance rendering across multiple platforms</li>
<li>Handle touch, mouse, and keyboard input uniformly</li>
</ul>
<h2 id="key-components">Key Components</h2>
<p>The HiAPI rendering system consists of several key components:</p>
<ul>
<li><strong>DispEngine</strong>: The core rendering engine that processes displayees and handles user interaction</li>
<li><strong>IDisplayee</strong>: The interface for renderable objects</li>
<li><strong>Drawing</strong>: A fundamental rendering unit for creating basic geometric elements</li>
<li><strong>RenderingCanvas</strong>: UI controls for different frameworks that host the DispEngine</li>
</ul>
<h2 id="sections">Sections</h2>
<table>
<thead>
<tr>
<th>Topic</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="rendering-canvas/index.html">Using RenderingCanvas with DispEngine</a></td>
<td>Learn how to use the RenderingCanvas component in your applications</td>
</tr>
<tr>
<td><a href="rendering-canvas/custom-implementation.html">Building Your Own Rendering Canvas</a></td>
<td>Understand how to implement custom rendering components</td>
</tr>
<tr>
<td><a href="drawing/index.html">Drawing</a></td>
<td>Learn how to use the Drawing class to create basic geometric elements</td>
</tr>
<tr>
<td><a href="color-guide/index.html">Color Guide System</a></td>
<td>Learn how to implement color mapping and rendering priority for steps</td>
</tr>
</tbody>
</table>
<h2 id="basic-rendering-workflow">Basic Rendering Workflow</h2>
<p>The typical workflow for rendering with HiAPI follows these steps:</p>
<ol>
<li><strong>Create Displayees</strong>: Implement <a class="xref" href="../../api/Hi.Disp.IDisplayee.html">IDisplayee</a> or use existing implementations like <a class="xref" href="../../api/Hi.Disp.Drawing.html">Drawing</a></li>
<li><strong>Configure DispEngine</strong>: Create and initialize a <a class="xref" href="../../api/Hi.Disp.DispEngine.html">DispEngine</a> with your displayees</li>
<li><strong>UI Integration</strong>: Use RenderingCanvas components to display the rendered content in your UI</li>
<li><strong>Handle Input</strong>: Process user interactions through the DispEngine's input handling methods</li>
</ol>
<p>This pattern works consistently across all supported UI frameworks, allowing you to develop cross-platform applications with a unified codebase.</p>
<h2 id="see-also">See Also</h2>
<ul>
<li><a class="xref" href="../../api/Hi.Disp.DispEngine.html">DispEngine</a></li>
<li><a class="xref" href="../../api/Hi.Disp.IDisplayee.html">IDisplayee</a></li>
<li><a class="xref" href="../../api/Hi.Disp.Drawing.html">Drawing</a></li>
<li><a class="xref" href="../../api/Hi.Disp.DispList.html">DispList</a></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>
@@ -0,0 +1,904 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Building Your Own Rendering Canvas | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Building Your Own Rendering Canvas | 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="">
<h1 id="building-your-own-rendering-canvas">Building Your Own Rendering Canvas</h1>
<p>This guide provides detailed implementation information for creating your own <code>RenderingCanvas</code> using the <a class="xref" href="../../../api/Hi.Disp.DispEngine.html">DispEngine</a>. By understanding these implementation details, you can customize the rendering component for specific application needs or create implementations for other UI frameworks.</p>
<div class="NOTE">
<h5>Note</h5>
<p><strong>For Windows Applications</strong>: If you are developing for Windows systems, it is recommended to directly use the existing <code>RenderingCanvas</code> implementations in the <code>Hi.WinForm</code> or <code>Hi.WpfPlus</code> packages, rather than creating your own. These implementations are fully tested, optimized, and maintained.</p>
<p>The implementation details provided in this document are primarily for educational purposes or for developers who need to port RenderingCanvas to other platforms/frameworks.</p>
</div>
<h2 id="basic-dispengine-usage">Basic DispEngine Usage</h2>
<p>The <a class="xref" href="../../../api/Hi.Disp.DispEngine.html">DispEngine</a> is designed to display objects that implement the <a class="xref" href="../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a> interface. This is the fundamental purpose of DispEngine - to render displayable objects. Assign <a class="xref" href="../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a> to <a class="xref" href="../../../api/Hi.Disp.DispEngine.html">DispEngine</a>.<a class="xref" href="../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_Displayee">Displayee</a>.</p>
<h2 id="core-implementation-pattern">Core Implementation Pattern</h2>
<p>When implementing a custom <code>RenderingCanvas</code> for a UI platform, follow these key steps:</p>
<ol>
<li><strong>Initialize UI Component</strong> - Set up the UI control properties and event handling</li>
<li><strong>Configure DispEngine</strong> - Create and properly initialize the <a class="xref" href="../../../api/Hi.Disp.DispEngine.html">DispEngine</a> instance</li>
<li><strong>Set Up Rendering Pipeline</strong> - Implement buffer swapping mechanism for visualization</li>
<li><strong>Handle User Input</strong> - Map platform-specific input events to DispEngine methods</li>
<li><strong>Manage Component Lifecycle</strong> - Ensure proper resource management and cleanup</li>
</ol>
<p>Let's examine the actual implementations in WinForm and WPF frameworks to understand these patterns in practice.</p>
<h2 id="winform-implementation-details">WinForm Implementation Details</h2>
<p>The WinForm implementation in <code>Hi.WinForm</code> combines Windows Forms controls with the <a class="xref" href="../../../api/Hi.Disp.DispEngine.html">DispEngine</a> rendering system.</p>
<h3 id="core-properties-and-fields">Core Properties and Fields</h3>
<p>Here are the essential properties and fields defined in the WinForm implementation:</p>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// &lt;see cref=&quot;DispEngine&quot;/&gt;.
/// &lt;/summary&gt;
public DispEngine DispEngine { get; }
// Constants and structures for WM_TOUCH
private const int WM_TOUCH = 0x0240;
private const int TOUCHEVENTF_MOVE = 0x0001;
private const int TOUCHEVENTF_DOWN = 0x0002;
private const int TOUCHEVENTF_UP = 0x0004;
[StructLayout(LayoutKind.Sequential)]
private struct TOUCHINPUT
{
public int x;
public int y;
public IntPtr hSource;
public int dwID;
public int dwFlags;
public int dwMask;
public int dwTime;
public IntPtr dwExtraInfo;
public int cxContact;
public int cyContact;
}
[DllImport(&quot;user32.dll&quot;)]
private static extern bool RegisterTouchWindow(IntPtr hWnd, uint ulFlags);
[DllImport(&quot;user32.dll&quot;)]
private static extern bool GetTouchInputInfo(IntPtr hTouchInput, int cInputs, [In, Out] TOUCHINPUT[] pInputs, int cbSize);
[DllImport(&quot;user32.dll&quot;)]
private static extern void CloseTouchInputHandle(IntPtr lParam);
</code></pre><h3 id="initialization">Initialization</h3>
<p>The initialization code sets up event handlers and creates the DispEngine:</p>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// Ctor.
/// &lt;/summary&gt;
/// &lt;param name=&quot;displayees&quot;&gt;displayees&lt;/param&gt;
public unsafe RenderingCanvas(params IDisplayee[] displayees)
{
// Configure the control's visual styles
SetStyle(ControlStyles.Selectable, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, false);
SetStyle(ControlStyles.ContainerControl, false);
SetStyle(ControlStyles.ResizeRedraw, false);
DoubleBuffered = true;
InitializeComponent();
Dock = DockStyle.Fill;
// Connect event handlers for user input and window events
this.Resize += RenderingCanvas_Resize;
this.VisibleChanged += RenderingCanvas_VisibleChanged;
this.MouseMove += RenderingCanvas_MouseMove;
this.MouseDown += RenderingCanvas_MouseDown;
this.MouseUp += RenderingCanvas_MouseUp;
this.MouseWheel += RenderingCanvas_MouseWheel;
this.KeyDown += RenderingCanvas_KeyDown;
this.KeyUp += RenderingCanvas_KeyUp;
// Add focus event handler
this.GotFocus += RenderingCanvas_GotFocus;
this.HandleCreated += OnHandleCreated;
// Enable touch input and click events for the control
this.SetStyle(ControlStyles.StandardClick, true);
this.SetStyle(ControlStyles.StandardDoubleClick, true);
this.TabStop = true;
// Initialize the DispEngine with provided displayees
DispEngine = new DispEngine(displayees);
DispEngine.BackgroundColor = new Vec3d(0.1, 0.1, 0.5);
DispEngine.BackgroundOpacity = 0.1;
DispEngine.SetViewToHomeView();
DispEngine.ImageRequestAfterBufferSwapped += DispEngine_ImageRequestAfterBufferSwapped;
// Set initial size and start the rendering engine
this.Size = new System.Drawing.Size(500, 300);
DispEngine.Start(this.ClientSize.Width, this.ClientSize.Height);
}
</code></pre><h3 id="rendering-pipeline">Rendering Pipeline</h3>
<p>The rendering pipeline processes images from DispEngine and displays them:</p>
<pre><code class="lang-csharp" name="RenderingCanvas">private unsafe void DispEngine_ImageRequestAfterBufferSwapped(byte* bgra_unsignedbyte_pixels, int w, int h)
{
// Create a bitmap from the raw pixel data provided by DispEngine
Bitmap bitmap;
bitmap = new Bitmap(new Bitmap(w, h, w * 4,
PixelFormat.Format32bppArgb, new IntPtr(bgra_unsignedbyte_pixels)));
// Update the background image and dispose the previous one
Image pre = this.BackgroundImage;
this.BackgroundImage = bitmap;
pre?.Dispose();
}
</code></pre><h3 id="input-handling">Input Handling</h3>
<h4 id="windows-message-handling-for-touch">Windows Message Handling for Touch</h4>
<p>WinForm implementation intercepts Windows touch messages and forwards them to DispEngine:</p>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// Processes Windows messages, handling touch input and forwarding other messages to the base class.
/// &lt;/summary&gt;
/// &lt;param name=&quot;m&quot;&gt;The Windows message to process.&lt;/param&gt;
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_TOUCH)
{
HandleTouchInput(m.WParam, m.LParam);
return;
}
base.WndProc(ref m);
}
private void OnHandleCreated(object sender, EventArgs e)
{
// Register window to receive touch messages
RegisterTouchWindow(this.Handle, 0);
}
private void HandleTouchInput(IntPtr wParam, IntPtr lParam)
{
int inputCount = wParam.ToInt32();
TOUCHINPUT[] inputs = new TOUCHINPUT[inputCount];
if (!GetTouchInputInfo(lParam, inputCount, inputs, Marshal.SizeOf(typeof(TOUCHINPUT))))
return;
try
{
for (int i = 0; i &lt; inputCount; i++)
{
TOUCHINPUT ti = inputs[i];
int touchId = ti.dwID;
// Convert touch coordinates to client coordinates
Point touchPoint = PointToClient(new Point(ti.x / 100, ti.y / 100));
if ((ti.dwFlags &amp; TOUCHEVENTF_DOWN) != 0)
{
// Touch down event
DispEngine.TouchDown(touchId, touchPoint.X, touchPoint.Y);
this.Focus();
}
else if ((ti.dwFlags &amp; TOUCHEVENTF_MOVE) != 0)
{
// Touch move event
DispEngine.TouchMove(touchId, touchPoint.X, touchPoint.Y);
}
else if ((ti.dwFlags &amp; TOUCHEVENTF_UP) != 0)
{
// Touch up event
DispEngine.TouchUp(touchId);
}
}
}
finally
{
CloseTouchInputHandle(lParam);
}
}
</code></pre>
<p>The key aspect is mapping Windows touch events to DispEngine's touch API:</p>
<pre><code class="lang-csharp">// Inside HandleTouchInput method
if ((ti.dwFlags &amp; TOUCHEVENTF_DOWN) != 0)
{
// Touch down event - delegate to DispEngine
DispEngine.TouchDown(touchId, touchPoint.X, touchPoint.Y);
this.Focus();
}
else if ((ti.dwFlags &amp; TOUCHEVENTF_MOVE) != 0)
{
// Touch move event - delegate to DispEngine
DispEngine.TouchMove(touchId, touchPoint.X, touchPoint.Y);
}
else if ((ti.dwFlags &amp; TOUCHEVENTF_UP) != 0)
{
// Touch up event - delegate to DispEngine
DispEngine.TouchUp(touchId);
}
</code></pre>
<h4 id="mouse-events">Mouse Events</h4>
<pre><code class="lang-csharp" name="RenderingCanvas">private void RenderingCanvas_MouseMove(object sender, MouseEventArgs e)
{
// Update mouse position and handle drag transforms
DispEngine.MouseMove(e.Location.X, e.Location.Y);
DispEngine.MouseDragTransform(e.Location.X, e.Location.Y,
new mouse_button_table__transform_view_by_mouse_drag_t()
{
LEFT_BUTTON = (long)MouseButtons.Left,
RIGHT_BUTTON = (long)MouseButtons.Right
});
}
private void RenderingCanvas_MouseDown(object sender, MouseEventArgs e)
{
// Handle mouse button press
DispEngine.MouseButtonDown((long)e.Button);
this.Focus();
}
private void RenderingCanvas_MouseUp(object sender, MouseEventArgs e)
{
// Handle mouse button release
DispEngine.MouseButtonUp((long)e.Button);
}
private void RenderingCanvas_MouseWheel(object sender, MouseEventArgs e)
{
// Handle mouse wheel for zoom operations
DispEngine.MouseWheel(0, e.Delta / 120);
DispEngine.MouseWheelTransform(0, e.Delta / 120);
}
</code></pre><h4 id="keyboard-events">Keyboard Events</h4>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;inheritdoc/&gt;
protected override bool IsInputKey(Keys keyData)
{
//since in default, arrow does not trigger key event(keyDown and keyUp).
return true;
}
/// &lt;summary&gt;
/// Convert WinForms Keys to W3C KeyboardEvent.key string.
/// &lt;/summary&gt;
static string WinFormsKeyToW3C(Keys key) =&gt; (key &amp; Keys.KeyCode) switch
{
Keys.Home =&gt; &quot;Home&quot;,
Keys.End =&gt; &quot;End&quot;,
Keys.PageUp =&gt; &quot;PageUp&quot;,
Keys.PageDown =&gt; &quot;PageDown&quot;,
Keys.Left =&gt; &quot;ArrowLeft&quot;,
Keys.Right =&gt; &quot;ArrowRight&quot;,
Keys.Up =&gt; &quot;ArrowUp&quot;,
Keys.Down =&gt; &quot;ArrowDown&quot;,
Keys.LShiftKey or Keys.RShiftKey or Keys.ShiftKey =&gt; &quot;Shift&quot;,
Keys.LControlKey or Keys.RControlKey or Keys.ControlKey =&gt; &quot;Control&quot;,
Keys.LMenu or Keys.RMenu or Keys.Menu =&gt; &quot;Alt&quot;,
Keys.Return =&gt; &quot;Enter&quot;,
Keys.Escape =&gt; &quot;Escape&quot;,
Keys.Back =&gt; &quot;Backspace&quot;,
Keys.Tab =&gt; &quot;Tab&quot;,
Keys.Delete =&gt; &quot;Delete&quot;,
Keys.Insert =&gt; &quot;Insert&quot;,
Keys.Space =&gt; &quot; &quot;,
Keys.F1 =&gt; &quot;F1&quot;,
Keys.F2 =&gt; &quot;F2&quot;,
Keys.F3 =&gt; &quot;F3&quot;,
Keys.F4 =&gt; &quot;F4&quot;,
Keys.F5 =&gt; &quot;F5&quot;,
Keys.F6 =&gt; &quot;F6&quot;,
Keys.F7 =&gt; &quot;F7&quot;,
Keys.F8 =&gt; &quot;F8&quot;,
Keys.F9 =&gt; &quot;F9&quot;,
Keys.F10 =&gt; &quot;F10&quot;,
Keys.F11 =&gt; &quot;F11&quot;,
Keys.F12 =&gt; &quot;F12&quot;,
&gt;= Keys.A and &lt;= Keys.Z =&gt; ((char)('a' + ((key &amp; Keys.KeyCode) - Keys.A))).ToString(),
&gt;= Keys.D0 and &lt;= Keys.D9 =&gt; ((char)('0' + ((key &amp; Keys.KeyCode) - Keys.D0))).ToString(),
_ =&gt; &quot;Unidentified&quot;
};
private void RenderingCanvas_KeyDown(object sender, KeyEventArgs e)
{
Focus();
string key = WinFormsKeyToW3C(e.KeyData);
DispEngine.KeyDown(key);
DispEngine.KeyDownTransform(key, new key_table__transform_view_by_key_pressing_t()
{
HOME = &quot;Home&quot;,
PAGE_UP = &quot;PageUp&quot;,
PAGE_DOWN = &quot;PageDown&quot;,
F1 = &quot;F1&quot;,
F2 = &quot;F2&quot;,
F3 = &quot;F3&quot;,
F4 = &quot;F4&quot;,
SHIFT = &quot;Shift&quot;,
ARROW_LEFT = &quot;ArrowLeft&quot;,
ARROW_RIGHT = &quot;ArrowRight&quot;,
ARROW_DOWN = &quot;ArrowDown&quot;,
ARROW_UP = &quot;ArrowUp&quot;
});
}
private void RenderingCanvas_KeyUp(object sender, KeyEventArgs e)
{
DispEngine.KeyUp(WinFormsKeyToW3C(e.KeyData));
}
</code></pre><h3 id="lifecycle-management">Lifecycle Management</h3>
<p>Window event handling ensures proper state management:</p>
<pre><code class="lang-csharp" name="RenderingCanvas">private void RenderingCanvas_Resize(object sender, EventArgs e)
{
// Notify DispEngine of size changes
DispEngine.Resize(this.ClientSize.Width, this.ClientSize.Height);
}
private void RenderingCanvas_VisibleChanged(object sender, EventArgs e)
{
// Update visibility state in DispEngine
DispEngine.IsVisible = this.Visible;
}
</code></pre><h3 id="resource-cleanup">Resource Cleanup</h3>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// Clean up any resources being used.
/// &lt;/summary&gt;
/// &lt;param name=&quot;disposing&quot;&gt;true if managed resources should be disposed; otherwise, false.&lt;/param&gt;
protected override void Dispose(bool disposing)
{
if (disposing &amp;&amp; (components != null))
{
// Dispose the DispEngine to free resources
DispEngine.Dispose();
components.Dispose();
}
base.Dispose(disposing);
}
</code></pre><h2 id="wpf-implementation-details">WPF Implementation Details</h2>
<p>The WPF implementation uses WPF-specific controls and mechanisms but follows the same core pattern.</p>
<h3 id="core-properties">Core Properties</h3>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// The DispEngine instance that handles rendering and user interactions
/// &lt;/summary&gt;
public DispEngine DispEngine { get; } = new DispEngine();
/// &lt;summary&gt;
/// Internal container for rendering content
/// &lt;/summary&gt;
private UserControl DisplayerPane { get; }
/// &lt;summary&gt;
/// Dictionary to store touch point information
/// &lt;/summary&gt;
private Dictionary&lt;int, Point&gt; TouchingPointsMap { get; } = new Dictionary&lt;int, Point&gt;();
/// &lt;summary&gt;
/// Dictionary to store previous positions of touch points
/// &lt;/summary&gt;
private Dictionary&lt;int, Point&gt; PreviousTouchingPointsMap { get; } = new Dictionary&lt;int, Point&gt;();
</code></pre><h3 id="initialization-1">Initialization</h3>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// Initializes a new instance of the RenderingCanvas
/// &lt;/summary&gt;
public RenderingCanvas()
{
DispEngine.BackgroundColor = new Vec3d(0.1, 0.1, 0.5);
DispEngine.BackgroundOpacity = 0.1;
// Configure the main control properties
HorizontalAlignment = HorizontalAlignment.Stretch;
VerticalAlignment = VerticalAlignment.Stretch;
Focusable = true;
KeyboardNavigation.SetDirectionalNavigation(this, KeyboardNavigationMode.Cycle);
DataContextChanged += CanvasDataContextChanged;
// Create and configure the display pane
DisplayerPane = new UserControl();
DisplayerPane.HorizontalAlignment = HorizontalAlignment.Stretch;
DisplayerPane.VerticalAlignment = VerticalAlignment.Stretch;
DisplayerPane.Focusable = true;
DisplayerPane.IsTabStop = true;
// Connect event handlers for user input and window events
DisplayerPane.SizeChanged += RenderingCanvas_SizeChanged;
DisplayerPane.MouseMove += RenderingCanvas_MouseMove;
DisplayerPane.MouseDown += RenderingCanvas_MouseDown;
DisplayerPane.MouseUp += RenderingCanvas_MouseUp;
DisplayerPane.MouseWheel += RenderingCanvas_MouseWheel;
DisplayerPane.KeyDown += RenderingCanvas_KeyDown;
DisplayerPane.KeyUp += RenderingCanvas_KeyUp;
DisplayerPane.Loaded += RenderingCanvas_Loaded;
DisplayerPane.Unloaded += RenderingCanvas_Unloaded;
DisplayerPane.IsVisibleChanged += DisplayerPane_IsVisibleChanged;
// Add touch event handlers
DisplayerPane.TouchDown += RenderingCanvas_TouchDown;
DisplayerPane.TouchMove += RenderingCanvas_TouchMove;
DisplayerPane.TouchUp += RenderingCanvas_TouchUp;
// Enable touch support
this.IsManipulationEnabled = true;
// Initialize power management
InitializePowerManagement();
// Add the display pane to this control's content
Content = DisplayerPane;
}
</code></pre><h3 id="rendering-pipeline-1">Rendering Pipeline</h3>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// Handles the buffer swapped event from DispEngine
/// &lt;/summary&gt;
private unsafe void RenderingCanvas_BufferSwapped(byte* data, int w, int h)
{
if (data == null)
return;
Span&lt;byte&gt; bgra = new Span&lt;byte&gt;(data, w * h * 4);
// Copy pixel data from DispEngine
int n = w * h * 4;
byte[] arr = new byte[n];
for (int i = 0; i &lt; n; i++)
arr[i] = data[i];
// Update UI on the UI thread
DisplayerPane.Dispatcher.InvokeAsync(() =&gt;
{
BitmapSource bitmap = BitmapSource.Create(w, h, 1, 1, PixelFormats.Bgra32, null, arr, w * 4);
DisplayerPane.Background = new ImageBrush(bitmap);
});
}
/// &lt;summary&gt;
/// Handles the size changed event
/// &lt;/summary&gt;
private void RenderingCanvas_SizeChanged(object sender, SizeChangedEventArgs e)
{
// Notify DispEngine of size changes
DispEngine.Resize((int)DisplayerPane.RenderSize.Width, (int)DisplayerPane.RenderSize.Height);
}
/// &lt;summary&gt;
/// Handles visibility changes
/// &lt;/summary&gt;
private unsafe void DisplayerPane_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
// Update visibility state in DispEngine
DispEngine.IsVisible = IsVisible;
}
</code></pre><h3 id="mouse-and-keyboard-handling">Mouse and Keyboard Handling</h3>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// Helper method to get mouse button mask
/// &lt;/summary&gt;
internal static HiMouseButtonMask GetMouseButtonMask(MouseDevice device)
{
HiMouseButtonMask mouseButtonMask = 0;
mouseButtonMask.SetLeftPressed(device.LeftButton == MouseButtonState.Pressed);
mouseButtonMask.SetMiddlePressed(device.MiddleButton == MouseButtonState.Pressed);
mouseButtonMask.SetRightPressed(device.RightButton == MouseButtonState.Pressed);
mouseButtonMask.SetXButton1Pressed(device.XButton1 == MouseButtonState.Pressed);
mouseButtonMask.SetXButton2Pressed(device.XButton2 == MouseButtonState.Pressed);
return mouseButtonMask;
}
/// &lt;summary&gt;
/// Handles the mouse wheel event
/// &lt;/summary&gt;
private void RenderingCanvas_MouseWheel(object sender, MouseWheelEventArgs e)
{
// Handle mouse wheel for zoom operations
DispEngine.MouseWheel(0, e.Delta / 120);
DispEngine.MouseWheelTransform(0, e.Delta / 120);
}
/// &lt;summary&gt;
/// Handles the mouse up event
/// &lt;/summary&gt;
private void RenderingCanvas_MouseUp(object sender, MouseButtonEventArgs e)
{
// Handle mouse button release
DispEngine.MouseButtonUp((long)e.ChangedButton);
(sender as UIElement)?.ReleaseMouseCapture();
}
/// &lt;summary&gt;
/// Handles the mouse down event
/// &lt;/summary&gt;
private void RenderingCanvas_MouseDown(object sender, MouseButtonEventArgs e)
{
// Handle mouse button press
DispEngine.MouseButtonDown((long)e.ChangedButton);
DisplayerPane.Focus();
(sender as UIElement)?.CaptureMouse();
}
/// &lt;summary&gt;
/// Handles the mouse move event
/// &lt;/summary&gt;
private void RenderingCanvas_MouseMove(object sender, MouseEventArgs e)
{
// Update mouse position and handle drag transforms
Point p = e.GetPosition(DisplayerPane);
DispEngine.MouseMove((int)p.X, (int)p.Y);
DispEngine.MouseDragTransform((int)p.X, (int)p.Y,
new mouse_button_table__transform_view_by_mouse_drag_t()
{
LEFT_BUTTON = (long)MouseButton.Left,
RIGHT_BUTTON = (long)MouseButton.Right
});
}
</code></pre><pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// Convert WPF Key to W3C KeyboardEvent.key string.
/// &lt;/summary&gt;
static string WpfKeyToW3C(Key key) =&gt; key switch
{
Key.Home =&gt; &quot;Home&quot;,
Key.End =&gt; &quot;End&quot;,
Key.PageUp =&gt; &quot;PageUp&quot;,
Key.PageDown =&gt; &quot;PageDown&quot;,
Key.Left =&gt; &quot;ArrowLeft&quot;,
Key.Right =&gt; &quot;ArrowRight&quot;,
Key.Up =&gt; &quot;ArrowUp&quot;,
Key.Down =&gt; &quot;ArrowDown&quot;,
Key.LeftShift or Key.RightShift =&gt; &quot;Shift&quot;,
Key.LeftCtrl or Key.RightCtrl =&gt; &quot;Control&quot;,
Key.LeftAlt or Key.RightAlt =&gt; &quot;Alt&quot;,
Key.Return =&gt; &quot;Enter&quot;,
Key.Escape =&gt; &quot;Escape&quot;,
Key.Back =&gt; &quot;Backspace&quot;,
Key.Tab =&gt; &quot;Tab&quot;,
Key.Delete =&gt; &quot;Delete&quot;,
Key.Insert =&gt; &quot;Insert&quot;,
Key.Space =&gt; &quot; &quot;,
Key.F1 =&gt; &quot;F1&quot;,
Key.F2 =&gt; &quot;F2&quot;,
Key.F3 =&gt; &quot;F3&quot;,
Key.F4 =&gt; &quot;F4&quot;,
Key.F5 =&gt; &quot;F5&quot;,
Key.F6 =&gt; &quot;F6&quot;,
Key.F7 =&gt; &quot;F7&quot;,
Key.F8 =&gt; &quot;F8&quot;,
Key.F9 =&gt; &quot;F9&quot;,
Key.F10 =&gt; &quot;F10&quot;,
Key.F11 =&gt; &quot;F11&quot;,
Key.F12 =&gt; &quot;F12&quot;,
&gt;= Key.A and &lt;= Key.Z =&gt; ((char)('a' + (key - Key.A))).ToString(),
&gt;= Key.D0 and &lt;= Key.D9 =&gt; ((char)('0' + (key - Key.D0))).ToString(),
_ =&gt; &quot;Unidentified&quot;
};
/// &lt;summary&gt;
/// Handles the key up event
/// &lt;/summary&gt;
private void RenderingCanvas_KeyUp(object sender, KeyEventArgs e)
{
DispEngine.KeyUp(WpfKeyToW3C(e.Key));
}
/// &lt;summary&gt;
/// Handles the key down event
/// &lt;/summary&gt;
private void RenderingCanvas_KeyDown(object sender, KeyEventArgs e)
{
string key = WpfKeyToW3C(e.Key);
DispEngine.KeyDown(key);
DispEngine.KeyDownTransform(key, new key_table__transform_view_by_key_pressing_t()
{
HOME = &quot;Home&quot;,
PAGE_UP = &quot;PageUp&quot;,
PAGE_DOWN = &quot;PageDown&quot;,
F1 = &quot;F1&quot;,
F2 = &quot;F2&quot;,
F3 = &quot;F3&quot;,
F4 = &quot;F4&quot;,
SHIFT = &quot;Shift&quot;,
ARROW_LEFT = &quot;ArrowLeft&quot;,
ARROW_RIGHT = &quot;ArrowRight&quot;,
ARROW_DOWN = &quot;ArrowDown&quot;,
ARROW_UP = &quot;ArrowUp&quot;
});
}
</code></pre><h3 id="lifecycle-management-1">Lifecycle Management</h3>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// Handles window state changes (maximize, minimize, etc.)
/// &lt;/summary&gt;
private unsafe void RenderingCanvas_StateChanged(object sender, EventArgs e)
{
switch ((sender as Window).WindowState)
{
case WindowState.Maximized:
DispEngine.IsVisible = true;
break;
case WindowState.Minimized:
DispEngine.IsVisible = false;
break;
case WindowState.Normal:
DispEngine.IsVisible = true;
break;
}
}
/// &lt;summary&gt;
/// Handles data context changes
/// &lt;/summary&gt;
private unsafe void CanvasDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
{
DispEngine pre = e.OldValue as DispEngine;
DispEngine cur = e.NewValue as DispEngine;
//child's binding event is triggered after IsVisible event and Load event.
if (pre != null) //this section will never occur if the datacontext not set twice.
{
pre.Terminate();
pre.ImageRequestAfterBufferSwapped -= RenderingCanvas_BufferSwapped;
}
if (cur != null)
{
cur.ImageRequestAfterBufferSwapped += RenderingCanvas_BufferSwapped;
cur.Start((int)DisplayerPane.RenderSize.Width, (int)DisplayerPane.RenderSize.Height);
cur.IsVisible = IsVisible;
}
}
/// &lt;summary&gt;
/// Reference to the current window containing this control
/// &lt;/summary&gt;
private Window currentWindow;
/// &lt;summary&gt;
/// Gets or sets the current window, connecting or disconnecting state change events
/// &lt;/summary&gt;
Window CurrentWindow
{
get =&gt; currentWindow; set
{
if (currentWindow != null)
currentWindow.StateChanged -= RenderingCanvas_StateChanged;
currentWindow = value;
if (currentWindow != null)
currentWindow.StateChanged += RenderingCanvas_StateChanged;
}
}
/// &lt;summary&gt;
/// Handles the loaded event
/// &lt;/summary&gt;
private unsafe void RenderingCanvas_Loaded(object sender, RoutedEventArgs e)
{
// Get the window containing this control
CurrentWindow = Window.GetWindow(this);
// Set up DispEngine rendering
DispEngine.ImageRequestAfterBufferSwapped -= RenderingCanvas_BufferSwapped;
DispEngine.ImageRequestAfterBufferSwapped += RenderingCanvas_BufferSwapped;
DispEngine.Start((int)DisplayerPane.RenderSize.Width, (int)DisplayerPane.RenderSize.Height);
DispEngine.IsVisible = IsVisible;
}
/// &lt;summary&gt;
/// Handles the unloaded event
/// &lt;/summary&gt;
private unsafe void RenderingCanvas_Unloaded(object sender, RoutedEventArgs e)
{
DispEngine.IsVisible = IsVisible;
DispEngine.ImageRequestAfterBufferSwapped -= RenderingCanvas_BufferSwapped;
CurrentWindow = null;
}
</code></pre><h3 id="resource-cleanup-1">Resource Cleanup</h3>
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// Flag to track disposed state
/// &lt;/summary&gt;
private bool disposedValue;
/// &lt;summary&gt;
/// Disposes managed resources
/// &lt;/summary&gt;
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
if (disposing)
{
// Unsubscribe from power events
SystemEvents.PowerModeChanged -= SystemEvents_PowerModeChanged;
// Dispose the DispEngine to free resources
DispEngine.Dispose();
}
disposedValue = true;
}
}
/// &lt;summary&gt;
/// Public dispose method to free resources
/// &lt;/summary&gt;
public void Dispose()
{
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
</code></pre><h2 id="core-dispengine-integration-patterns">Core DispEngine Integration Patterns</h2>
<h3 id="1-initialization-sequence">1. Initialization Sequence</h3>
<pre><code class="lang-csharp">// Create DispEngine (optionally with displayees)
var engine = new DispEngine(displayees);
// Set up image buffer callback
engine.ImageRequestAfterBufferSwapped += OnBufferSwapped;
// Initialize with canvas size
engine.Start(width, height);
// Set initial view (optional)
engine.SetViewToHomeView();
</code></pre>
<h3 id="2-render-loop">2. Render Loop</h3>
<p>The rendering process follows this pattern:</p>
<ol>
<li><a class="xref" href="../../../api/Hi.Disp.DispEngine.html">DispEngine</a> processes <a class="xref" href="../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a> objects</li>
<li>Buffer is swapped and callback is triggered</li>
<li>UI framework renders the buffer to screen</li>
<li>User input triggers view updates</li>
<li>Process repeats</li>
</ol>
<h3 id="3-complete-user-input-mapping">3. Complete User Input Mapping</h3>
<p>All user interactions must be mapped to <a class="xref" href="../../../api/Hi.Disp.DispEngine.html">DispEngine</a> methods:</p>
<table>
<thead>
<tr>
<th>User Action</th>
<th>DispEngine Method</th>
</tr>
</thead>
<tbody>
<tr>
<td>Mouse move</td>
<td><a class="xref" href="../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_MouseMove_System_Int32_System_Int32_">MouseMove(int, int)</a></td>
</tr>
<tr>
<td>Mouse drag</td>
<td><a class="xref" href="../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_MouseDragTransform_System_Int32_System_Int32_Hi_Native_mouse_button_table__transform_view_by_mouse_drag_t_">MouseDragTransform(int, int, mouse_button_table__transform_view_by_mouse_drag_t)</a></td>
</tr>
<tr>
<td>Mouse button</td>
<td><a class="xref" href="../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_MouseButtonDown_System_Int64_">MouseButtonDown(long)</a> / <a class="xref" href="../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_MouseButtonUp_System_Int64_">MouseButtonUp(long)</a></td>
</tr>
<tr>
<td>Mouse wheel</td>
<td><a class="xref" href="../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_MouseWheel_System_Int32_System_Int32_">MouseWheel(int, int)</a> and <a class="xref" href="../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_MouseWheelTransform_System_Int32_System_Int32_System_Double_">MouseWheelTransform(int, int, double)</a></td>
</tr>
<tr>
<td>Key press</td>
<td><a class="xref" href="../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_KeyDown_System_String_">KeyDown(string)</a> / <a class="xref" href="../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_KeyUp_System_String_">KeyUp(string)</a> and <a class="xref" href="../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_KeyDownTransform_System_String_Hi_Native_key_table__transform_view_by_key_pressing_t_">KeyDownTransform(string, key_table__transform_view_by_key_pressing_t)</a></td>
</tr>
<tr>
<td>Touch events</td>
<td><a class="xref" href="../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_TouchDown_System_Int32_System_Int32_System_Int32_">TouchDown(int, int, int)</a> / <a class="xref" href="../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_TouchMove_System_Int32_System_Int32_System_Int32_">TouchMove(int, int, int)</a> / <a class="xref" href="../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_TouchUp_System_Int32_">TouchUp(int)</a></td>
</tr>
</tbody>
</table>
<h3 id="4-proper-resource-cleanup">4. Proper Resource Cleanup</h3>
<p>Resource management is critical for proper operation:</p>
<pre><code class="lang-csharp">// In dispose method
DispEngine.ImageRequestAfterBufferSwapped -= OnBufferSwapped;
DispEngine.Terminate();
DispEngine.Dispose();
</code></pre>
<h2 id="advanced-implementation-considerations">Advanced Implementation Considerations</h2>
<p>When creating custom implementations, consider these aspects:</p>
<h3 id="view-manipulation">View Manipulation</h3>
<p>Use <a class="xref" href="../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_SketchView">SketchView</a> to directly access or modify the view matrix:</p>
<pre><code class="lang-csharp">// Get current view matrix
Mat4d currentView = engine.SketchView;
// Apply custom rotation
Mat4d rotation = Mat4d.RotateX(Math.PI/4);
engine.SketchView = currentView * rotation;
</code></pre>
<h2 id="see-also">See Also</h2>
<ul>
<li><a class="xref" href="../../../api/Hi.Disp.DispEngine.html">DispEngine</a></li>
<li><a class="xref" href="../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a></li>
<li><a class="xref" href="../../../api/Hi.Geom.Vec2d.html">Vec2d</a></li>
<li><a class="xref" href="../../../api/Hi.Geom.Mat4d.html">Mat4d</a></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>
@@ -0,0 +1,265 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Using RenderingCanvas with DispEngine | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Using RenderingCanvas with DispEngine | 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="">
<h1 id="using-renderingcanvas-with-dispengine">Using RenderingCanvas with DispEngine</h1>
<p>The <code>RenderingCanvas</code> is the primary UI component for displaying and interacting with 3D content across different platforms. This section explains how to use it with the <a class="xref" href="../../../api/Hi.Disp.DispEngine.html">DispEngine</a> to create cross-platform applications.</p>
<h2 id="overview">Overview</h2>
<p>The <code>RenderingCanvas</code> class is available in frameworks:</p>
<ul>
<li><code>Hi.WinForm</code> for Windows Forms applications</li>
<li><code>Hi.WpfPlus</code> for WPF applications</li>
</ul>
<p>All implementations share a common architecture centered around the <a class="xref" href="../../../api/Hi.Disp.DispEngine.html">DispEngine</a> class, enabling consistent rendering and interaction across platforms.</p>
<h2 id="core-concept-dispengine-and-idisplayee">Core Concept: DispEngine and IDisplayee</h2>
<p>At the heart of the rendering system is the relationship between <a class="xref" href="../../../api/Hi.Disp.DispEngine.html">DispEngine</a> and <a class="xref" href="../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a>:</p>
<ul>
<li><a class="xref" href="../../../api/Hi.Disp.DispEngine.html">DispEngine</a>: The rendering engine that manages the OpenGL context and handles user interaction</li>
<li><a class="xref" href="../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a>: The interface that defines objects that can be rendered by the DispEngine</li>
</ul>
<p>This relationship is fundamental - <strong>the purpose of <a class="xref" href="../../../api/Hi.Disp.DispEngine.html">DispEngine</a> is to render <a class="xref" href="../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a> objects</strong>.</p>
<pre><code class="lang-mermaid">graph TD
A[IDisplayee Objects] --&gt;|Rendered by| B
B[DispEngine] &lt;--&gt; C[RenderingCanvas UI Component]
</code></pre>
<h3 id="working-with-idisplayee">Working with IDisplayee</h3>
<p>Objects implementing <a class="xref" href="../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a> define what gets rendered. Typically, you'll use <a class="xref" href="../../../api/Hi.Disp.Drawing.html">Drawing</a> objects or compose multiple IDisplayee objects together:</p>
<pre><code class="lang-csharp">// Create a composite displayee
public class MyCompositeDisplayee : IDisplayee
{
private List&lt;IDisplayee&gt; _displayees = new List&lt;IDisplayee&gt;();
public MyCompositeDisplayee()
{
// Add various displayees
_displayees.Add(new AxesDisplayee());
_displayees.Add(new ModelDisplayee());
}
public void Display(Bind bind)
{
// Render all contained displayees
foreach (var displayee in _displayees)
{
displayee.Display(bind);
}
}
public void ExpandToBox3d(Box3d box)
{
// Update bounding box based on all displayees
foreach (var displayee in _displayees)
{
displayee.ExpandToBox3d(box);
}
}
}
</code></pre>
<p>For more detailed information on creating displayees with <a class="xref" href="../../../api/Hi.Disp.Drawing.html">Drawing</a>, see the <a href="../drawing/index.html">Drawing</a> section.</p>
<h2 id="basic-usage">Basic Usage</h2>
<h3 id="apply-hiwinform">Apply Hi.WinForm</h3>
<pre><code class="lang-csharp">// Create a new instance with displayee objects
using Hi.WinForm.Disp;
// Create displayee object
var displayee = new MyCompositeDisplayee();
// Initialize canvas with the displayee
var canvas = new RenderingCanvas(displayee);
// Access the DispEngine for direct manipulation
DispEngine engine = canvas.DispEngine;
// Add to a form
myForm.Controls.Add(canvas);
</code></pre>
<h3 id="apply-hiwpf">Apply Hi.WPF</h3>
<pre><code class="lang-csharp">// Create a new instance
using Hi.WpfPlus.Disp;
// Create displayee object
var displayee = new MyCompositeDisplayee();
// Initialize the canvas
var canvas = new RenderingCanvas();
// Set displayee objects through the DispEngine
canvas.DispEngine.Displayee = displayee;
// Add to a container
myGrid.Children.Add(canvas);
</code></pre>
<h2 id="switching-displayees-at-runtime">Switching Displayees at Runtime</h2>
<p>You can dynamically change what's being displayed:</p>
<pre><code class="lang-csharp">// Switch to a different displayee
renderingCanvas.DispEngine.Displayee = alternativeDisplayee;
// Or update a DispList
var displayList = new DispList();
if (showModel) displayList.Add(modelDisplayee);
if (showGrid) displayList.Add(gridDisplayee);
renderingCanvas.DispEngine.Displayee = displayList;
</code></pre>
<h2 id="key-features-of-dispengine">Key Features of DispEngine</h2>
<p>The <a class="xref" href="../../../api/Hi.Disp.DispEngine.html">DispEngine</a> provides cross-platform support for:</p>
<ul>
<li>Handles buffer swapping and image generation</li>
<li>Mouse/pointer events</li>
<li>Keyboard navigation</li>
<li>Touch gestures</li>
<li>Zoom, pan, and rotate operations</li>
<li>Resize and Visibility changed.</li>
<li>Camera positioning and orientation</li>
<li>Standard views (front, top, isometric, etc.)</li>
<li>Renders <a class="xref" href="../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a> implementations</li>
</ul>
<h2 id="touch-and-gesture-support">Touch and Gesture Support</h2>
<p>The <a class="xref" href="../../../api/Hi.Disp.DispEngine.html">DispEngine</a> centralizes touch handling across all platforms with a unified API that supports:</p>
<ul>
<li>Single-finger pan</li>
<li>Two-finger rotate and scale</li>
<li>Multi-finger specialized operations</li>
</ul>
<p>The touch API is designed to be simple for UI implementations to use. Platform-specific UI components only need to capture touch events and forward them to the DispEngine.</p>
<h2 id="common-operations">Common Operations</h2>
<pre><code class="lang-csharp">// Accessing DispEngine (works on all platforms)
var engine = renderingCanvas.DispEngine;
// Set to standard views
engine.SetViewToHomeView();
engine.SetViewToFrontView();
// Manual camera manipulation
engine.Translate(dx, dy);
engine.Rotate(deltaX, deltaY);
// Resize handling
engine.Resize(width, height);
</code></pre>
<h2 id="implementation-details">Implementation Details</h2>
<p>For detailed implementation information, including:</p>
<ul>
<li>Full source code examples</li>
<li>Implementation details for each platform</li>
<li>Advanced touch handling</li>
<li>Custom implementation guidance</li>
</ul>
<p>See the <a href="custom-implementation.html">Building Your Own RenderingCanvas</a> guide.</p>
<h2 id="see-also">See Also</h2>
<ul>
<li><a class="xref" href="../../../api/Hi.Disp.DispEngine.html">DispEngine</a></li>
<li><a class="xref" href="../../../api/Hi.Disp.IDisplayee.html">IDisplayee</a></li>
<li><a class="xref" href="../../../api/Hi.Disp.DispList.html">DispList</a></li>
<li><a class="xref" href="../../../api/Hi.Disp.Drawing.html">Drawing</a></li>
<li><a href="custom-implementation.html">Building Your Own RenderingCanvas</a></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>
@@ -0,0 +1,155 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>System Requirements | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="System Requirements | 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="">
<h1 id="system-requirements">System Requirements</h1>
<ul>
<li><strong>Operating System</strong>:
<ul>
<li>Windows 10 or later</li>
<li>Ubuntu 22.04 LTS</li>
</ul>
</li>
<li><strong>CPU Architecture</strong>: x64 (ARM not yet supported)</li>
<li><strong>Runtime</strong>: .NET 9.0 or later</li>
<li><strong>Memory (RAM)</strong>:
<ul>
<li>Minimum: 8GB RAM (suitable for low-resolution models)</li>
<li>Recommended: 128GB RAM or higher (for large and detailed models)</li>
</ul>
</li>
<li><strong>Graphics</strong>:
<ul>
<li>OpenGL 4.4 compatible graphics card or integrated graphics</li>
<li>Most computers manufactured within the last 15 years meet this requirement</li>
</ul>
</li>
</ul>
<h2 id="performance-guidelines-for-high-resolution-simulation">Performance Guidelines for High-Resolution Simulation</h2>
<p>Based on internal testing and practical experience:</p>
<h3 id="cpu-considerations">CPU Considerations</h3>
<ul>
<li>High clock speed is prioritized over multiple cores</li>
<li>Single-thread performance is more important than multi-core parallelization</li>
<li>For small NC programs: 16GB RAM is workable</li>
</ul>
<h3 id="graphics-and-gpu">Graphics and GPU</h3>
<ul>
<li>GPU is used only for 3D rendering/visualization, not for computation acceleration</li>
<li>Always verify OpenGL 4.4 compatibility when using cloud computing resources. Since cloud-hosted virtual machines often lack proper OpenGL support.</li>
</ul>
<h3 id="storage-performance">Storage Performance</h3>
<ul>
<li>SSD (Solid State Drive) recommended for optimal simulation efficiency</li>
<li>Traditional HDD may cause significant performance degradation.</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>
@@ -0,0 +1,78 @@
<div id="sidetoggle">
<div>
<div class="sidefilter">
<form class="toc-filter">
<span class="glyphicon glyphicon-filter filter-icon"></span>
<span class="glyphicon glyphicon-remove clear-icon" id="toc_filter_clear"></span>
<input type="text" id="toc_filter_input" placeholder="Filter by title" onkeypress="if(event.keyCode==13) {return false;}">
</form>
</div>
<div class="sidetoc">
<div class="toc" id="toc">
<ul class="nav level1">
<li>
<a href="index.html" name="" title="Overview">Overview</a>
</li>
<li>
<a href="system-requirements.html" name="" title="System Requirements">System Requirements</a>
</li>
<li>
<a href="getting-started/index.html" name="" title="Getting Started">Getting Started</a>
</li>
<li>
<a href="general-hinc-workflow/index.html" name="" title="General HiNC Workflow">General HiNC Workflow</a>
</li>
<li>
<a href="geom/basic-geometry.html" name="" title="Basic Geometry">Basic Geometry</a>
</li>
<li>
<span class="expand-stub"></span>
<a href="rendering/index.html" name="" title="Rendering">Rendering</a>
<ul class="nav level2">
<li>
<a href="rendering/rendering-canvas/index.html" name="" title="Using RenderingCanvas with DispEngine">Using RenderingCanvas with DispEngine</a>
</li>
<li>
<a href="rendering/rendering-canvas/custom-implementation.html" name="" title="Building Your Own Rendering Canvas">Building Your Own Rendering Canvas</a>
</li>
<li>
<a href="rendering/drawing/index.html" name="" title="Drawing">Drawing</a>
</li>
<li>
<a href="rendering/color-guide/index.html" name="" title="Color Guide System">Color Guide System</a>
</li>
</ul>
</li>
<li>
<span class="expand-stub"></span>
<a>Mechanism Topology</a>
<ul class="nav level2">
<li>
<a href="mechanism/index.html" name="" title="Overview">Overview</a>
</li>
<li>
<a href="mechanism/Topo/index.html" name="" title="Topology Structure">Topology Structure</a>
</li>
<li>
<a href="mechanism/transformers/index.html" name="" title="Transformers">Transformers</a>
</li>
<li>
<a href="mechanism/render-topology/index.html" name="" title="Render Topology">Render Topology</a>
</li>
</ul>
</li>
<li>
<a href="common/message-management.html" name="" title="Message Management">Message Management</a>
</li>
<li>
<a href="common/xml-io.html" name="" title="XML IO">XML IO</a>
</li>
</ul>
</div>
</div>
</div>
</div>
@@ -0,0 +1,2 @@
{"items":[{"name":"Overview","href":"index.html","topicHref":"index.html"},{"name":"System Requirements","href":"system-requirements.html","topicHref":"system-requirements.html"},{"name":"Getting Started","href":"getting-started/index.html","topicHref":"getting-started/index.html"},{"name":"General HiNC Workflow","href":"general-hinc-workflow/index.html","topicHref":"general-hinc-workflow/index.html"},{"name":"Basic Geometry","href":"geom/basic-geometry.html","topicHref":"geom/basic-geometry.html"},{"name":"Rendering","href":"rendering/index.html","topicHref":"rendering/index.html","items":[{"name":"Using RenderingCanvas with DispEngine","href":"rendering/rendering-canvas/index.html","topicHref":"rendering/rendering-canvas/index.html"},{"name":"Building Your Own Rendering Canvas","href":"rendering/rendering-canvas/custom-implementation.html","topicHref":"rendering/rendering-canvas/custom-implementation.html"},{"name":"Drawing","href":"rendering/drawing/index.html","topicHref":"rendering/drawing/index.html"},{"name":"Color Guide System","href":"rendering/color-guide/index.html","topicHref":"rendering/color-guide/index.html"}]},{"name":"Mechanism Topology","items":[{"name":"Overview","href":"mechanism/index.html","topicHref":"mechanism/index.html"},{"name":"Topology Structure","href":"mechanism/Topo/index.html","topicHref":"mechanism/Topo/index.html"},{"name":"Transformers","href":"mechanism/transformers/index.html","topicHref":"mechanism/transformers/index.html"},{"name":"Render Topology","href":"mechanism/render-topology/index.html","topicHref":"mechanism/render-topology/index.html"}]},{"name":"Message Management","href":"common/message-management.html","topicHref":"common/message-management.html"},{"name":"XML IO","href":"common/xml-io.html","topicHref":"common/xml-io.html"}]}