add ChartRange to ClStrip.

This commit is contained in:
2025-12-22 23:35:42 +08:00
parent 901a1181e2
commit fece18d725
4 changed files with 44 additions and 38 deletions
+18 -16
View File
@@ -22,11 +22,13 @@ namespace Sample.Machining
static void Main()
{
LocalApp.AppBegin();
LocalProjectService localProjectService = new LocalProjectService();
#region ProjectLoading
var projectPath = "C:/HiNC-Projects/DemoStandardPath/Main.hincproj";
#region ProjectLoading
var projectPath = "C:/HiNC-Projects/DemoStandardPath/Main.hincproj";
Console.WriteLine($"Load Project: {projectPath}");
MachiningProject machiningProject = MachiningProject.LoadFile(projectPath);
localProjectService.LoadProject(projectPath);
MachiningProject machiningProject = localProjectService.MachiningProject;
#endregion
#region EventHandling
@@ -34,7 +36,7 @@ namespace Sample.Machining
using StreamWriter writer = new StreamWriter("msg.txt");
//show message if something abnormal.
machiningProject.SessionMessageHost.CollectionItemAdded += pack =>
localProjectService.SessionMessageHost.CollectionItemAdded += pack =>
{
if (pack.Tags.Contains(MessageFlag.Warning.ToString()) ||
pack.Tags.Contains(MessageFlag.Error.ToString()) ||
@@ -45,8 +47,8 @@ namespace Sample.Machining
}
};
Console.WriteLine($"Set machining step event.");
//show MRR.
machiningProject.RuntimeApi.MachiningStepBuilt += (preStep, curStep) =>
//show MRR.
localProjectService.RuntimeApi.MachiningStepBuilt += (preStep, curStep) =>
{
var sourceCommand = curStep.SourceCommand;
if (curStep.Mrr_mm3ds > 500) //show only the step that contains large MRR.
@@ -56,18 +58,18 @@ namespace Sample.Machining
#region MachiningExecution
Console.WriteLine($"Reset runtime status.");
machiningProject.ResetRuntime();
localProjectService.ResetRuntime();
Console.WriteLine($"Session begin.");
machiningProject.BeginSession();
machiningProject.RuntimeApi.MachiningResolution_mm = 1;
machiningProject.RuntimeApi.EnableCollisionDetection = true;
machiningProject.RuntimeApi.EnablePauseOnFailure = false;
machiningProject.RuntimeApi.EnablePhysics = false;
//the path from Shell-API is relative by project directory.
machiningProject.RuntimeApi.PlayNcFile("NC/side.ptp");
machiningProject.RuntimeApi.PlayNcFile("NC/circle.ptp");
machiningProject.EndSession();
localProjectService.BeginSession();
localProjectService.RuntimeApi.MachiningResolution_mm = 1;
localProjectService.RuntimeApi.EnableCollisionDetection = true;
localProjectService.RuntimeApi.EnablePauseOnFailure = false;
localProjectService.RuntimeApi.EnablePhysics = false;
//the path from Shell-API is relative by project directory.
localProjectService.RuntimeApi.PlayNcFile("NC/side.ptp");
localProjectService.RuntimeApi.PlayNcFile("NC/circle.ptp");
localProjectService.EndSession();
Console.WriteLine($"Session end.");
#endregion