207 lines
10 KiB
HTML
207 lines
10 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Step | HiAPI-C# 2025 </title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="title" content="Step | HiAPI-C# 2025 ">
|
|
|
|
|
|
<link rel="icon" href="../../img/HiAPI.favicon.ico">
|
|
<link rel="stylesheet" href="../../public/docfx.min.css">
|
|
<link rel="stylesheet" href="../../public/main.css">
|
|
<meta name="docfx:navrel" content="../../toc.html">
|
|
<meta name="docfx:tocrel" content="toc.html">
|
|
|
|
<meta name="docfx:rel" content="../../">
|
|
|
|
|
|
|
|
<meta name="loc:inThisArticle" content="In this article">
|
|
<meta name="loc:searchResultsCount" content="{count} results for "{query}"">
|
|
<meta name="loc:searchNoResults" content="No results for "{query}"">
|
|
<meta name="loc:tocFilter" content="Filter by title">
|
|
<meta name="loc:nextArticle" content="Next">
|
|
<meta name="loc:prevArticle" content="Previous">
|
|
<meta name="loc:themeLight" content="Light">
|
|
<meta name="loc:themeDark" content="Dark">
|
|
<meta name="loc:themeAuto" content="Auto">
|
|
<meta name="loc:changeTheme" content="Change theme">
|
|
<meta name="loc:copy" content="Copy">
|
|
<meta name="loc:downloadPdf" content="Download PDF">
|
|
|
|
<script type="module" src="./../../public/docfx.min.js"></script>
|
|
|
|
<script>
|
|
const theme = localStorage.getItem('theme') || 'auto'
|
|
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
|
|
<header class="bg-body border-bottom">
|
|
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
|
|
<div class="container-xxl flex-nowrap">
|
|
<a class="navbar-brand" href="../../index.html">
|
|
<img id="logo" class="svg" src="../../img/HiAPI.logo.png" alt="">
|
|
|
|
</a>
|
|
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
|
|
<i class="bi bi-three-dots"></i>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navpanel">
|
|
<div id="navbar">
|
|
<form class="search" role="search" id="search">
|
|
<i class="bi bi-search"></i>
|
|
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
</header>
|
|
|
|
<main class="container-xxl">
|
|
<div class="toc-offcanvas">
|
|
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
|
|
<div class="offcanvas-header">
|
|
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
|
|
</div>
|
|
<div class="offcanvas-body">
|
|
<nav class="toc" id="toc"></nav>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="content">
|
|
<div class="actionbar">
|
|
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
|
|
<i class="bi bi-list"></i>
|
|
</button>
|
|
|
|
<nav id="breadcrumb"></nav>
|
|
</div>
|
|
|
|
<article data-uid="Glossary-Step">
|
|
<h1 id="step">Step</h1>
|
|
|
|
<h2 id="what-is-a-step">What Is a Step?</h2>
|
|
<p>A <strong>MachiningStep</strong> (<a class="xref" href="../../api/Hi.MachiningSteps.MachiningStep.html">MachiningStep</a>) is a single computation unit in the HiNC simulation. By default, one step corresponds to one spindle revolution, but this interval is configurable via the <a href="../../workflows/basic-simulation.html">Basic Simulation</a> workflow.</p>
|
|
<p>Each step contains data for the <strong>time interval</strong> between two consecutive steps (from the previous step to the current step). Since this represents a period rather than an instant, many fields are simplified representations using prefixes like Average (Avg), Extremes (Min, Max), Range (Delta), and Maximum Absolute Value (MaxAbs).</p>
|
|
<hr>
|
|
<h2 id="registering-custom-step-variables">Registering Custom Step Variables</h2>
|
|
<p>Beyond default properties, you can register custom step variables using <a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_RegisterStepVariable_">RegisterStepVariable</a>:</p>
|
|
<pre><code class="lang-csharp">RegisterStepVariable(
|
|
"ChipVolume", // key
|
|
"Chip Volume", // display name
|
|
"mm3", // unit
|
|
"F2", // format string
|
|
(step) => step.ChipVolume_mm3 // value function
|
|
);
|
|
|
|
PlayNcFile("NC/file1.nc");
|
|
</code></pre>
|
|
<p>Parameters:</p>
|
|
<ul>
|
|
<li><strong>key</strong>: Unique identifier</li>
|
|
<li><strong>name</strong>: Display name (shown in UI)</li>
|
|
<li><strong>unit</strong>: Physical unit (can be null)</li>
|
|
<li><strong>formatString</strong>: .NET numeric format string (can be null)</li>
|
|
<li><strong>variableFunction</strong>: Lambda that computes the value from a step (can be null)</li>
|
|
</ul>
|
|
<p>Registered variables appear in the UI and in output files from <a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_WriteStepFiles_">WriteStepFiles</a>.</p>
|
|
<h3 id="indexer-access">Indexer Access</h3>
|
|
<p>Use the <a class="xref" href="../../api/Hi.MachiningSteps.MachiningStep.html#Hi_MachiningSteps_MachiningStep_Item_System_String_">this[string]</a> indexer to read/write custom data on a step:</p>
|
|
<pre><code class="lang-csharp">SessionStepBuilt += (preStep, curStep) => {
|
|
if (curStep != null)
|
|
curStep["MyCustomField"] = someCalculation();
|
|
};
|
|
</code></pre>
|
|
<hr>
|
|
<h2 id="accessing-step-data">Accessing Step Data</h2>
|
|
<h3 id="getmillingstep">GetMillingStep</h3>
|
|
<p><a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_GetMillingStep_">GetMillingStep</a> retrieves a step by index:</p>
|
|
<pre><code class="lang-csharp">var step = GetMillingStep(100);
|
|
if (step != null)
|
|
{
|
|
Message($"ToolId={step.ToolId}, Force={step.MaxAbsForce_N} N");
|
|
}
|
|
</code></pre>
|
|
<h3 id="stepcount">StepCount</h3>
|
|
<p><a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_StepCount">StepCount</a> returns the total number of steps:</p>
|
|
<pre><code class="lang-csharp">Message($"Total steps: {StepCount}");
|
|
</code></pre>
|
|
<h3 id="iterating-all-steps">Iterating All Steps</h3>
|
|
<pre><code class="lang-csharp">for (int i = 0; i < StepCount; i++)
|
|
{
|
|
var step = GetMillingStep(i);
|
|
// process step...
|
|
}
|
|
</code></pre>
|
|
<hr>
|
|
<h2 id="step-output-files">Step Output Files</h2>
|
|
<p>Steps can be exported to CSV using <a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_WriteStepFiles_">WriteStepFiles</a>:</p>
|
|
<pre><code class="lang-csharp">WriteStepFiles("Output/[NcName].step.csv");
|
|
</code></pre>
|
|
<p>The CSV contains all default properties plus any registered custom variables. The file can be read back with <a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_PlayCsvFile_">PlayCsvFile</a>.</p>
|
|
<p>For waveform-level data (sub-step time resolution), use <a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_WriteShotFiles_">WriteShotFiles</a>:</p>
|
|
<pre><code class="lang-csharp">WriteShotFiles("Output/[NcName].shot.csv", 1); // 1 ms time resolution
|
|
</code></pre>
|
|
<hr>
|
|
<h2 id="dynamically-registered-variables-training">Dynamically Registered Variables (Training)</h2>
|
|
<p>After executing <a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_TrainMillingPara_">TrainMillingPara</a> or <a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_ReTrainMillingPara_">ReTrainMillingPara</a>, two additional step variables are automatically registered for steps within the training region:</p>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Variable</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><code>TrainingErrRatio</code></td>
|
|
<td>Error metric between simulation and measurement for each step</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>AngleOffset</code></td>
|
|
<td>Cutter rotation phase difference between measured and simulated data</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<hr>
|
|
<h2 id="see-also">See Also</h2>
|
|
<ul>
|
|
<li><a href="step-fields.html">Step Field Reference</a> — complete field reference</li>
|
|
<li><a class="xref" href="session-shell.html">Glossary: SessionShell Quick-Reference</a> — SessionShell quick-reference</li>
|
|
<li><a class="xref" href="../../workflows/basic-simulation.html">Workflow: Basic Machining Simulation</a> — simulation workflow producing steps</li>
|
|
<li><a class="xref" href="../../workflows/force-training.html">Workflow: Milling Force Parameter Training</a> — training workflow that adds step variables</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>
|