This commit is contained in:
2025-12-18 11:09:45 +08:00
parent 5e28ac1fa7
commit 32ff8b45e3
62 changed files with 2436 additions and 1551 deletions
@@ -2,9 +2,9 @@
<html>
<head>
<meta charset="utf-8">
<title>變數 | HiAPI-C# 2025 </title>
<title>加工步變數 | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="步變數 | HiAPI-C# 2025 ">
<meta name="title" content="加工步變數 | HiAPI-C# 2025 ">
<link rel="icon" href="../../../../../img/HiAPI.favicon.ico">
@@ -85,22 +85,22 @@
</div>
<article data-uid="Cmd-StepVariables">
<h1 id="步變數">變數</h1>
<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>
<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>
<p><strong>存取預設步資訊範例</strong></p>
<pre><code class="lang-csharp">PlayNcFile(&quot;NC/file1.nc&quot;);
// 取得步並存取預設資訊
var step = GetMillingStep(100); // 見下方「存取步資訊」
// 取得步並存取預設資訊
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;);
@@ -108,10 +108,15 @@ if (step != null)
}
</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>
<h2 id="註冊步變數">註冊步變數</h2>
<p>除了預設的步輸出資訊外,您可以使用 <a class="xref" href="../../../../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_RegisterStepVariable_">RegisterStepVariable</a><small>(API)</small> 註冊自訂的步變數,用於追蹤特定的計算結果或資料。</p>
<p>註冊的步變數主要用於人類檢視,可透過工件幾何體上的顏色顯示數值分布。搭配 <a class="xref" href="../../../../../api/Hi.MachiningSteps.MachiningStep.html#Hi_MachiningSteps_MachiningStep_Item_System_String_">this[string]</a><small>(API)</small> 索引器可實現完整的資料檢查功能:</p>
<ul>
<li><code>RegisterStepVariable</code>:註冊變數供介面顯示及輸出</li>
<li><code>MachiningStep[key]</code>:在腳本中讀寫步的自訂資料</li>
</ul>
<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>
<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>
@@ -121,7 +126,7 @@ if (step != null)
<div class="TIP">
<h5>Tip</h5>
<p><strong>指令範例</strong></p>
<pre><code class="lang-csharp">// 註冊一個計算切削體積的步變數
<pre><code class="lang-csharp">// 註冊一個計算切削體積的步變數
RegisterStepVariable(
&quot;ChipVolume&quot;,
&quot;Chip Volume&quot;,
@@ -139,19 +144,19 @@ PlayNcFile(&quot;NC/file1.nc&quot;);
<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>
<li><code>&lt;變數函數&gt;</code>: 從步計算變數值的函數(可為 null)</li>
</ul>
<div class="NOTE">
<h5>Note</h5>
<p>註冊的步變數可以在輸出檔案(如 <a class="xref" href="../WriteStepFiles/index.html">輸出步資料檔案</a>)中使用,並在介面中顯示。</p>
<p>註冊的步變數可以在輸出檔案(如 <a class="xref" href="../WriteStepFiles/index.html">輸出步資料檔案</a>)中使用,並在介面中顯示。</p>
</div>
<h2 id="存取步資訊">存取步資訊</h2>
<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>
<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;);
<pre><code class="lang-csharp">var step = GetMillingStep(&lt;步索引&gt;);
</code></pre>
</div>
<div class="TIP">
@@ -159,7 +164,7 @@ PlayNcFile(&quot;NC/file1.nc&quot;);
<p><strong>指令範例</strong></p>
<pre><code class="lang-csharp">PlayNcFile(&quot;NC/file1.nc&quot;);
// 取得第100個步
// 取得第100個步
var step = GetMillingStep(100);
if (step != null)
{
@@ -168,7 +173,7 @@ if (step != null)
</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>
<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>
@@ -180,15 +185,15 @@ if (step != null)
<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>