224 lines
9.1 KiB
HTML
224 lines
9.1 KiB
HTML
<!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 "{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="Cmd-Messages">
|
|
<h1 id="訊息處理">訊息處理</h1>
|
|
|
|
<p><a class="xref" href="../../../../../api/Hi.MachiningProcs.RuntimeApi.html">RuntimeApi</a><small>(API)</small> 提供了多個方法來顯示和管理訊息。</p>
|
|
<h2 id="message">Message</h2>
|
|
<p><a class="xref" href="../../../../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_Message_">Message</a><small>(API)</small> 顯示一般訊息。</p>
|
|
<div class="NOTE">
|
|
<h5>Note</h5>
|
|
<p><strong>指令格式</strong></p>
|
|
<pre><code class="lang-csharp">Message(<訊息字串>);
|
|
</code></pre>
|
|
</div>
|
|
<div class="TIP">
|
|
<h5>Tip</h5>
|
|
<p><strong>指令範例</strong></p>
|
|
<pre><code class="lang-csharp">Message("開始執行NC檔案");
|
|
PlayNcFile("NC/file1.nc");
|
|
Message("NC檔案執行完成");
|
|
</code></pre>
|
|
</div>
|
|
<h2 id="progressmessage">ProgressMessage</h2>
|
|
<p><a class="xref" href="../../../../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_ProgressMessage_">ProgressMessage</a><small>(API)</small> 顯示進度訊息。</p>
|
|
<div class="NOTE">
|
|
<h5>Note</h5>
|
|
<p><strong>指令格式</strong></p>
|
|
<pre><code class="lang-csharp">ProgressMessage(<訊息字串>);
|
|
</code></pre>
|
|
</div>
|
|
<div class="TIP">
|
|
<h5>Tip</h5>
|
|
<p><strong>指令範例</strong></p>
|
|
<pre><code class="lang-csharp">ProgressMessage("正在載入工件...");
|
|
ReadRuntimeGeom("Cache/workpiece.wct");
|
|
ProgressMessage("工件載入完成");
|
|
</code></pre>
|
|
<p>相關指令:<a class="xref" href="../RuntimeGeom/index.html">程序幾何</a></p>
|
|
</div>
|
|
<h2 id="warningmessage">WarningMessage</h2>
|
|
<p><a class="xref" href="../../../../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_WarningMessage_">WarningMessage</a><small>(API)</small> 顯示警告訊息。</p>
|
|
<div class="NOTE">
|
|
<h5>Note</h5>
|
|
<p><strong>指令格式</strong></p>
|
|
<pre><code class="lang-csharp">WarningMessage(<訊息字串>);
|
|
</code></pre>
|
|
</div>
|
|
<div class="TIP">
|
|
<h5>Tip</h5>
|
|
<p><strong>指令範例</strong></p>
|
|
<pre><code class="lang-csharp">if (StepCount == 0)
|
|
{
|
|
WarningMessage("沒有執行任何步階");
|
|
}
|
|
</code></pre>
|
|
</div>
|
|
<h2 id="errormessage">ErrorMessage</h2>
|
|
<p><a class="xref" href="../../../../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_ErrorMessage_">ErrorMessage</a><small>(API)</small> 顯示錯誤訊息。</p>
|
|
<div class="NOTE">
|
|
<h5>Note</h5>
|
|
<p><strong>指令格式</strong></p>
|
|
<pre><code class="lang-csharp">ErrorMessage(<訊息字串>);
|
|
</code></pre>
|
|
</div>
|
|
<div class="TIP">
|
|
<h5>Tip</h5>
|
|
<p><strong>指令範例</strong></p>
|
|
<pre><code class="lang-csharp">if (Workpiece == null)
|
|
{
|
|
ErrorMessage("工件不存在");
|
|
return;
|
|
}
|
|
</code></pre>
|
|
</div>
|
|
<h2 id="appendmessagestofile">AppendMessagesToFile</h2>
|
|
<p><a class="xref" href="../../../../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_AppendMessagesToFile_">AppendMessagesToFile</a><small>(API)</small> 將訊息附加到檔案,可選擇性地依標籤過濾。</p>
|
|
<div class="NOTE">
|
|
<h5>Note</h5>
|
|
<p><strong>指令格式</strong></p>
|
|
<pre><code class="lang-csharp">AppendMessagesToFile(<目標檔案路徑>, <標籤1>, <標籤2>, ...);
|
|
</code></pre>
|
|
</div>
|
|
<div class="TIP">
|
|
<h5>Tip</h5>
|
|
<p><strong>指令範例</strong></p>
|
|
<pre><code class="lang-csharp">PlayNcFile("NC/file1.nc");
|
|
|
|
// 將所有訊息寫入檔案
|
|
AppendMessagesToFile("Output/messages.txt");
|
|
|
|
// 只將帶有特定標籤的訊息寫入檔案
|
|
AppendMessagesToFile("Output/errors.txt", "Error", "Warning");
|
|
</code></pre>
|
|
</div>
|
|
<h2 id="sessionmessagehost">SessionMessageHost</h2>
|
|
<p><a class="xref" href="../../../../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_SessionMessageHost">SessionMessageHost</a><small>(API)</small> 取得會話訊息主機物件,用於進階訊息操作。</p>
|
|
<div class="NOTE">
|
|
<h5>Note</h5>
|
|
<p><strong>指令格式</strong></p>
|
|
<pre><code class="lang-csharp">var messageHost = SessionMessageHost;
|
|
</code></pre>
|
|
</div>
|
|
<h2 id="訊息類型">訊息類型</h2>
|
|
<ul>
|
|
<li><strong>Message</strong>: 一般資訊訊息</li>
|
|
<li><strong>ProgressMessage</strong>: 進度相關訊息(通常顯示在進度列)</li>
|
|
<li><strong>WarningMessage</strong>: 警告訊息(不會中斷執行)</li>
|
|
<li><strong>ErrorMessage</strong>: 錯誤訊息(可能影響執行)</li>
|
|
</ul>
|
|
<div class="NOTE">
|
|
<h5>Note</h5>
|
|
<p>所有訊息都會記錄在會話訊息主機中,可以在介面中查看,也可以使用 <code>AppendMessagesToFile</code> 匯出到檔案。</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>
|