239 lines
10 KiB
HTML
239 lines
10 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Glossary: Session Progress (Messages) | HiAPI-C# 2025 </title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="title" content="Glossary: Session Progress (Messages) | 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-SessionProgress">
|
|
<h1 id="glossary-session-progress-messages">Glossary: Session Progress (Messages)</h1>
|
|
|
|
<h2 id="what-is-sessionprogress">What Is SessionProgress?</h2>
|
|
<p><strong>SessionProgress</strong> (<a class="xref" href="../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_SessionProgress">SessionProgress</a>) is the message host object that manages all messages generated during a HiNC scripting session. It serves as the central hub for logging, filtering, and exporting diagnostic information.</p>
|
|
<div class="NOTE">
|
|
<h5>Note</h5>
|
|
<p>The older name <code>SessionMessageHost</code> is marked <code>[Obsolete]</code>. Use <code>SessionProgress</code> instead.</p>
|
|
</div>
|
|
<hr>
|
|
<h2 id="message-types">Message Types</h2>
|
|
<p>HiNC provides four message types, each with a distinct severity and typical display behavior:</p>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Type</th>
|
|
<th>Command</th>
|
|
<th>Description</th>
|
|
<th>Typical Display</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><strong>Message</strong></td>
|
|
<td><a class="xref" href="../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_Message_">Message</a></td>
|
|
<td>General informational message</td>
|
|
<td>Message panel</td>
|
|
</tr>
|
|
<tr>
|
|
<td><strong>ProgressMessage</strong></td>
|
|
<td><a class="xref" href="../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_ProgressMessage_">ProgressMessage</a></td>
|
|
<td>Progress-related status update</td>
|
|
<td>Progress bar / status area</td>
|
|
</tr>
|
|
<tr>
|
|
<td><strong>WarningMessage</strong></td>
|
|
<td><a class="xref" href="../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_WarningMessage_">WarningMessage</a></td>
|
|
<td>Warning (does not interrupt execution)</td>
|
|
<td>Message panel (yellow)</td>
|
|
</tr>
|
|
<tr>
|
|
<td><strong>ErrorMessage</strong></td>
|
|
<td><a class="xref" href="../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_ErrorMessage_">ErrorMessage</a></td>
|
|
<td>Error (may affect execution flow)</td>
|
|
<td>Message panel (red)</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<h3 id="usage-examples">Usage Examples</h3>
|
|
<pre><code class="lang-csharp">Message("Starting simulation");
|
|
ProgressMessage("Loading workpiece...");
|
|
WarningMessage("No cutting engagement detected in this segment");
|
|
ErrorMessage("Workpiece does not exist");
|
|
</code></pre>
|
|
<hr>
|
|
<h2 id="message-tags">Message Tags</h2>
|
|
<p>Messages can be tagged for filtering. Standard tags include <code>"Error"</code> and <code>"Warning"</code>. When exporting messages, you can filter by one or more tags.</p>
|
|
<hr>
|
|
<h2 id="displaying-messages">Displaying Messages</h2>
|
|
<p>All messages are automatically recorded in the session message host and appear in the HiNC UI <strong>message panel</strong>. Progress messages additionally update the <strong>progress bar</strong>.</p>
|
|
<h3 id="accessing-the-message-host">Accessing the Message Host</h3>
|
|
<pre><code class="lang-csharp">var messageHost = SessionProgress;
|
|
</code></pre>
|
|
<hr>
|
|
<h2 id="exporting-messages">Exporting Messages</h2>
|
|
<p><a class="xref" href="../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_AppendMessagesToFile_">AppendMessagesToFile</a> writes messages to a text file, with optional tag-based filtering:</p>
|
|
<pre><code class="lang-csharp">// Export all messages
|
|
AppendMessagesToFile("Output/messages.txt");
|
|
|
|
// Export only errors and warnings
|
|
AppendMessagesToFile("Output/errors.txt", "Error", "Warning");
|
|
</code></pre>
|
|
<div class="TIP">
|
|
<h5>Tip</h5>
|
|
<p>Export messages after simulation to create a persistent log for debugging or reporting.</p>
|
|
</div>
|
|
<hr>
|
|
<h2 id="common-patterns">Common Patterns</h2>
|
|
<h3 id="logging-simulation-progress">Logging Simulation Progress</h3>
|
|
<pre><code class="lang-csharp">Message("Simulation started");
|
|
PlayNcFile("NC/file1.nc");
|
|
Message($"Simulation complete. Total steps: {StepCount}");
|
|
AppendMessagesToFile("Output/log.txt");
|
|
</code></pre>
|
|
<h3 id="conditional-warnings">Conditional Warnings</h3>
|
|
<pre><code class="lang-csharp">if (StepCount == 0)
|
|
{
|
|
WarningMessage("No steps were executed");
|
|
}
|
|
</code></pre>
|
|
<h3 id="error-guard">Error Guard</h3>
|
|
<pre><code class="lang-csharp">if (Workpiece == null)
|
|
{
|
|
ErrorMessage("Workpiece does not exist");
|
|
return;
|
|
}
|
|
</code></pre>
|
|
<h3 id="per-step-logging-via-events">Per-Step Logging via Events</h3>
|
|
<pre><code class="lang-csharp">SessionStepBuilt += (preStep, curStep) => {
|
|
if (curStep != null)
|
|
Message($"Step {curStep.StepIndex}: ToolId={curStep.ToolId}");
|
|
};
|
|
PlayNcFile("NC/file1.nc");
|
|
</code></pre>
|
|
<h3 id="step-selection-logging">Step Selection Logging</h3>
|
|
<pre><code class="lang-csharp">MachiningStepSelected += (step) => {
|
|
if (step != null && step.ToolId == 1)
|
|
ProgressMessage($"Tool 1 step selected at line {step.LineNo}");
|
|
};
|
|
</code></pre>
|
|
<hr>
|
|
<h2 id="message-lifecycle">Message Lifecycle</h2>
|
|
<ol>
|
|
<li>Messages are generated during script execution via the four message commands</li>
|
|
<li>All messages are stored in the <code>SessionProgress</code> host object</li>
|
|
<li>Messages persist until the session ends or the runtime is reset</li>
|
|
<li><code>ResetRuntime()</code> clears event handlers but does <strong>not</strong> clear previously recorded messages</li>
|
|
<li>Messages can be exported at any point using <code>AppendMessagesToFile</code></li>
|
|
</ol>
|
|
<hr>
|
|
<h2 id="see-also">See Also</h2>
|
|
<ul>
|
|
<li><a class="xref" href="script-command.html">Glossary: Script Commands</a> — script command basics</li>
|
|
<li><a class="xref" href="runtime-api.html">Glossary: RuntimeApi Quick-Reference</a> — RuntimeApi quick-reference</li>
|
|
<li><a class="xref" href="../../workflows/basic-simulation.html">Workflow: Basic Machining Simulation</a> — using messages in a simulation workflow</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>
|