refactor(Sample): adapt demos for SessionStepBuilt rename and ILogger injection

Made-with: Cursor
This commit is contained in:
iamboss 2026-04-14 17:18:05 +08:00
parent dd4c3ef28f
commit 6139c84ff9
4 changed files with 6 additions and 2 deletions

View File

@ -1,4 +1,5 @@
using Hi.HiNcKits;
using Microsoft.Extensions.Logging;
using System;
namespace Sample

View File

@ -14,6 +14,7 @@ using Hi.NcMech.Holders;
using Hi.Machining;
using Hi.HiNcKits;
using Hi.Milling.MillingTools;
using Microsoft.Extensions.Logging;
namespace Sample.Machining;

View File

@ -17,6 +17,7 @@ using Hi.MachiningProcs;
using System.IO;
using Hi.HiNcKits;
using Hi.Milling.MillingTools;
using Microsoft.Extensions.Logging;
namespace Sample.Machining;

View File

@ -2,6 +2,7 @@
using Hi.Common.Messages;
using Hi.HiNcKits;
using Hi.MachiningProcs;
using Microsoft.Extensions.Logging;
using System;
using System.IO;
@ -49,10 +50,10 @@ public static class DemoUseMachiningProject
};
Console.WriteLine($"Set machining step event.");
//show MRR.
localProjectService.RuntimeApi.MachiningStepBuilt += (preStep, curStep) =>
localProjectService.RuntimeApi.SessionStepBuilt += (preStep, curStep) =>
{
var sourceCommand = curStep.SourceCommand;
var indexedFileLine=sourceCommand?.GetSentence()?.IndexedFileLine;
var indexedFileLine=sourceCommand?.GetSentence()?.FirstIndexedFileLine;
if (curStep.Mrr_mm3ds > 500) //show only the step that contains large MRR.
Console.WriteLine($"MRR = {curStep.Mrr_mm3ds} At \"{indexedFileLine?.FilePath}\" (Line {indexedFileLine?.GetLineNo()}) \"{indexedFileLine?.Line}\"");
};