This commit is contained in:
2025-10-01 15:57:54 +08:00
parent 627b6b2ad3
commit ef1af3544e
31 changed files with 105 additions and 146 deletions
@@ -152,11 +152,12 @@ execute NC files, and properly manage project resources using
<h2 id="Sample_Machining_DemoUseMachiningProject_remarks">Remarks</h2>
<div class="markdown level0 remarks"><h3 id="source-code">Source Code</h3>
<pre><code class="lang-csharp" name="SampleCode">using System;
<pre><code class="lang-csharp" name="SampleCode">using Hi.Common.FileLines;
using Hi.Common.Messages;
using Hi.MachiningProcs;
using Hi.Common.FileLines;
using Hi.HiNcKits;
using Hi.MachiningProcs;
using System;
using System.IO;
namespace Sample.Machining
{
@@ -184,6 +185,8 @@ namespace Sample.Machining
#region EventHandling
Console.WriteLine($&quot;Set message event.&quot;);
using StreamWriter writer = new StreamWriter(&quot;msg.txt&quot;);
//show message if something abnormal.
machiningProject.SessionMessageHost.CollectionItemAdded += pack =&gt;
{
@@ -192,7 +195,7 @@ namespace Sample.Machining
pack.Tags.Contains(MessageFlag.Exception.ToString()))
{
var sourceCommand = pack.SourceCommand;
Console.WriteLine($&quot;{pack.Message} At \&quot;{sourceCommand?.FilePath}\&quot; (Line {sourceCommand?.GetLineNo()}) \&quot;{sourceCommand?.Line}\&quot;&quot;);
writer.WriteLine($&quot;{pack.Message} At \&quot;{sourceCommand?.FilePath}\&quot; (Line {sourceCommand?.GetLineNo()}) \&quot;{sourceCommand?.Line}\&quot;&quot;);
}
};
Console.WriteLine($&quot;Set machining step event.&quot;);