This commit is contained in:
2025-12-05 16:33:37 +08:00
parent dbbe3303b3
commit 9de88d2db0
163 changed files with 5633 additions and 2293 deletions
@@ -0,0 +1,220 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>步階變數 | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="步階變數 | 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="Cmd-StepVariables">
<h1 id="步階變數">步階變數</h1>
<p><a class="xref" href="../../../../../api/Hi.MachiningProcs.RuntimeApi.html">RuntimeApi</a><small>(API)</small> 提供了多個方法來處理和存取加工步階的變數。</p>
<h2 id="預設步階輸出資訊">預設步階輸出資訊</h2>
<p>每個加工步階都包含豐富的預設輸出資訊,涵蓋來源行、運動學、載荷、力/力矩、功率、熱與磨耗等。</p>
<p>完整的預設步階輸出資訊說明,請參考 <a class="xref" href="../../output/simulation-step-output.html">仿真步輸出資訊(Simulation Step Output</a></p>
<div class="TIP">
<h5>Tip</h5>
<p><strong>存取預設步階資訊範例</strong></p>
<pre><code class="lang-csharp">PlayNcFile(&quot;NC/file1.nc&quot;);
// 取得步階並存取預設資訊
var step = GetMillingStep(100); // 見下方「存取步階資訊」
if (step != null)
{
// 存取預設的步階資訊
Message($&quot;ToolId: {step.ToolId}&quot;);
Message($&quot;Feedrate: {step.Feedrate_mmdmin} mm/min&quot;);
Message($&quot;ChipVolume: {step.ChipVolume_mm3} mm³&quot;);
Message($&quot;MaxAbsForce: {step.MaxAbsForce_N} N&quot;);
}
</code></pre>
</div>
<h2 id="註冊步階變數">註冊步階變數</h2>
<p>除了預設的步階輸出資訊外,您可以使用 <a class="xref" href="../../../../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_RegisterStepVariable_">RegisterStepVariable</a><small>(API)</small> 註冊自訂的步階變數,用於追蹤特定的計算結果或資料。</p>
<h3 id="registerstepvariable">RegisterStepVariable</h3>
<p><a class="xref" href="../../../../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_RegisterStepVariable_">RegisterStepVariable</a><small>(API)</small> 註冊一個步階變數,用於在執行過程中追蹤特定資料。</p>
<div class="NOTE">
<h5>Note</h5>
<p><strong>指令格式</strong></p>
<pre><code class="lang-csharp">RegisterStepVariable(&lt;鍵值&gt;, &lt;名稱&gt;, &lt;單位&gt;, &lt;格式字串&gt;, &lt;變數函數&gt;);
</code></pre>
</div>
<div class="TIP">
<h5>Tip</h5>
<p><strong>指令範例</strong></p>
<pre><code class="lang-csharp">// 註冊一個計算切削體積的步階變數
RegisterStepVariable(
&quot;ChipVolume&quot;,
&quot;Chip Volume&quot;,
&quot;mm3&quot;,
&quot;F2&quot;,
(step) =&gt; step.ChipVolume_mm3
);
PlayNcFile(&quot;NC/file1.nc&quot;);
</code></pre>
</div>
<h3 id="參數說明">參數說明</h3>
<ul>
<li><code>&lt;鍵值&gt;</code>: 變數的唯一識別碼</li>
<li><code>&lt;名稱&gt;</code>: 變數的顯示名稱</li>
<li><code>&lt;單位&gt;</code>: 變數的物理單位(可為 null</li>
<li><code>&lt;格式字串&gt;</code>: 數值格式化字串(可為 null</li>
<li><code>&lt;變數函數&gt;</code>: 從步階計算變數值的函數(可為 null)</li>
</ul>
<div class="NOTE">
<h5>Note</h5>
<p>註冊的步階變數可以在輸出檔案(如 <a class="xref" href="../WriteStepFiles/index.html">輸出步資料檔案</a>)中使用,並在介面中顯示。</p>
</div>
<h2 id="存取步階資訊">存取步階資訊</h2>
<h3 id="getmillingstep">GetMillingStep</h3>
<p><a class="xref" href="../../../../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_GetMillingStep_">GetMillingStep</a><small>(API)</small> 取得指定索引的加工步階。</p>
<div class="NOTE">
<h5>Note</h5>
<p><strong>指令格式</strong></p>
<pre><code class="lang-csharp">var step = GetMillingStep(&lt;步階索引&gt;);
</code></pre>
</div>
<div class="TIP">
<h5>Tip</h5>
<p><strong>指令範例</strong></p>
<pre><code class="lang-csharp">PlayNcFile(&quot;NC/file1.nc&quot;);
// 取得第100個步階
var step = GetMillingStep(100);
if (step != null)
{
Message($&quot;Step 100: ToolId={step.ToolId}, Feedrate={step.Feedrate_mmdmin}&quot;);
}
</code></pre>
</div>
<h3 id="stepcount">StepCount</h3>
<p><a class="xref" href="../../../../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_StepCount">StepCount</a><small>(API)</small> 取得總步階數量。</p>
<div class="NOTE">
<h5>Note</h5>
<p><strong>指令格式</strong></p>
<pre><code class="lang-csharp">var count = StepCount;
</code></pre>
</div>
<div class="TIP">
<h5>Tip</h5>
<p><strong>指令範例</strong></p>
<pre><code class="lang-csharp">PlayNcFile(&quot;NC/file1.nc&quot;);
// 取得總步階數
var totalSteps = StepCount;
Message($&quot;Total steps: {totalSteps}&quot;);
// 遍歷所有步階
for (int i = 0; i &lt; StepCount; i++)
{
var step = GetMillingStep(i);
// 處理步階...
}
</code></pre>
</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>