diff --git a/Common/DemoMessageAndExceptionHandling.cs b/Common/DemoMessageAndExceptionHandling.cs
index fbbce50..b34dcd9 100644
--- a/Common/DemoMessageAndExceptionHandling.cs
+++ b/Common/DemoMessageAndExceptionHandling.cs
@@ -3,56 +3,55 @@ using System.Threading.Tasks;
using Hi.Common;
using Hi.Common.Messages;
-namespace Sample.Common
+namespace Sample.Common;
+
+///
+/// Demonstrates common message and exception handling patterns in HiAPI applications
+///
+///
+/// ### Source Code
+/// [!code-csharp[SampleCode](~/../Hi.Sample/Common/DemoMessageAndExceptionHandling.cs)]
+///
+public static class DemoMessageAndExceptionHandling
{
- ///
- /// Demonstrates common message and exception handling patterns in HiAPI applications
- ///
- ///
- /// ### Source Code
- /// [!code-csharp[SampleCode](~/../Hi.Sample/Common/DemoMessageAndExceptionHandling.cs)]
- ///
- public static class DemoMessageAndExceptionHandling
- {
- ///
- /// Demonstrates normal message handling
- ///
- internal static void DemoNormalMessages()
- {
- #region Normal_Messages
- MessageHost.ReportMessage("Operation completed successfully.");
- MessageHost.ReportWarning("Please check your input.");
- #endregion
- }
- ///
- /// Demonstrates exception handling in synchronous code
- ///
- internal static void DemoSynchronousExceptionHandling()
- {
- #region Sync_Exception
- try
- {
- // Your code here
- throw new NotImplementedException("Demo exception");
- }
- catch (Exception ex)
- {
- ExceptionUtil.ShowException(ex, null);
- }
- #endregion
- }
- ///
- /// Demonstrates exception handling in asynchronous code
- ///
- internal static async Task DemoAsynchronousExceptionHandling()
- {
- #region Async_Exception
- await Task.Run(() =>
- {
- // Your async operation here
- throw new NotImplementedException("Demo async exception");
- }).ShowIfCatched(null);
- #endregion
- }
- }
+ ///
+ /// Demonstrates normal message handling
+ ///
+ internal static void DemoNormalMessages()
+ {
+ #region Normal_Messages
+ MessageUtil.ReportMessage("Operation completed successfully.");
+ MessageUtil.ReportWarning("Please check your input.");
+ #endregion
+ }
+ ///
+ /// Demonstrates exception handling in synchronous code
+ ///
+ internal static void DemoSynchronousExceptionHandling()
+ {
+ #region Sync_Exception
+ try
+ {
+ // Your code here
+ throw new NotImplementedException("Demo exception");
+ }
+ catch (Exception ex)
+ {
+ ExceptionUtil.ShowException(ex, null);
+ }
+ #endregion
+ }
+ ///
+ /// Demonstrates exception handling in asynchronous code
+ ///
+ internal static async Task DemoAsynchronousExceptionHandling()
+ {
+ #region Async_Exception
+ await Task.Run(() =>
+ {
+ // Your async operation here
+ throw new NotImplementedException("Demo async exception");
+ }).ShowIfCatched(null);
+ #endregion
+ }
}
\ No newline at end of file
diff --git a/Common/DemoSessionMessage.cs b/Common/DemoSessionMessage.cs
index 81667f9..307b145 100644
--- a/Common/DemoSessionMessage.cs
+++ b/Common/DemoSessionMessage.cs
@@ -13,136 +13,135 @@ using Hi.Mech;
using Hi.Mech.Topo;
using Hi.Numerical;
-namespace Sample.Common
+namespace Sample.Common;
+
+///
+/// ### Source Code
+/// [!code-csharp[SampleCode](~/../Hi.Sample/Common/DemoSessionMessage.cs)]
+///
+public static class DemoSessionMessage
{
- ///
- /// ### Source Code
- /// [!code-csharp[SampleCode](~/../Hi.Sample/Common/DemoSessionMessage.cs)]
- ///
- public static class DemoSessionMessage
- {
- #region Demo_UseSessionMessageHost
- internal static void DemoUseSessionMessageHost(LocalProjectService localProjectService)
- {
- SessionMessageHost sessionMessageHost = localProjectService.SessionMessageHost;
+ #region Demo_UseSessionMessageHost
+ internal static void DemoUseSessionMessageHost(LocalProjectService localProjectService)
+ {
+ SessionProgress sessionMessageHost = localProjectService.SessionProgress;
- SessionMessageHost.FilterFlag filterFlags =
- SessionMessageHost.FilterFlag.NC |
- SessionMessageHost.FilterFlag.Progress |
- SessionMessageHost.FilterFlag.Error;
- string filterText = null;
- var filteredSessionMessageList = sessionMessageHost
- .GetFliteredList(filterFlags, filterText);
+ SessionProgress.FilterFlag filterFlags =
+ SessionProgress.FilterFlag.NC |
+ SessionProgress.FilterFlag.Progress |
+ SessionProgress.FilterFlag.Error;
+ string filterText = null;
+ var filteredSessionMessageList = sessionMessageHost
+ .GetFliteredList(filterFlags, filterText);
- foreach (var sessionMessage in filteredSessionMessageList)
- {
- //M.I.: Message Index.
- Console.Write($"M.I.: {sessionMessage.Index}; Role: {sessionMessage.MessageRoleText}");
+ foreach (var sessionMessage in filteredSessionMessageList)
+ {
+ //M.I.: Message Index.
+ Console.Write($"M.I.: {sessionMessage.Index}; Role: {sessionMessage.MessageRoleText}");
- // For SessionMessageHost.FilterFlag.NC
- var nc = sessionMessage.DirectInstantSourceCommand;
- if (nc != null)
- Console.Write($"Message/NC: {nc.Line}; File: {nc.FilePath}; LineNo: {nc.GetLineNo()}; ");
+ // For SessionMessageHost.FilterFlag.NC
+ var nc = sessionMessage.DirectInstantSourceCommand;
+ if (nc != null)
+ Console.Write($"Message/NC: {nc.Line}; File: {nc.FilePath}; LineNo: {nc.GetLineNo()}; ");
- // For SessionMessageHost.FilterFlag.Progress or Error.
- var multiTagMessage = sessionMessage.MultiTagMessage;
- if (multiTagMessage != null)
- Console.WriteLine($"Message/NC: {multiTagMessage.Message}");
- var exception = sessionMessage.Exception;
- if (exception != null)
- Console.WriteLine($"Message/NC: {exception.Message}");
- }
- File.WriteAllLines("output-session-messages.txt",
- filteredSessionMessageList.Select(m =>
- $"Msg[{m.Index}][{m.MessageRoleText}]: {m}"));
- }
- #endregion
+ // For SessionMessageHost.FilterFlag.Progress or Error.
+ var multiTagMessage = sessionMessage.MultiTagMessage;
+ if (multiTagMessage != null)
+ Console.WriteLine($"Message/NC: {multiTagMessage.Message}");
+ var exception = sessionMessage.Exception;
+ if (exception != null)
+ Console.WriteLine($"Message/NC: {exception.Message}");
+ }
+ File.WriteAllLines("output-session-messages.txt",
+ filteredSessionMessageList.Select(m =>
+ $"Msg[{m.Index}][{m.MessageRoleText}]: {m}"));
+ }
+ #endregion
- internal static void DemoUseSessionMessageHost2(LocalProjectService localProjectService)
- {
- SessionMessageHost sessionMessageHost = localProjectService.SessionMessageHost;
- IMachiningChain machiningChain = localProjectService.MachiningChain;
+ internal static void DemoUseSessionMessageHost2(LocalProjectService localProjectService)
+ {
+ SessionProgress sessionMessageHost = localProjectService.SessionProgress;
+ IMachiningChain machiningChain = localProjectService.MachiningChain;
- PresentAttribute mrrPresent = typeof(MachiningStep).GetProperty(nameof(MachiningStep.Mrr_mm3ds)).GetCustomAttribute();
- string mrrUnit = mrrPresent?.TailUnitString;
- string mrrFormat = mrrPresent?.DataFormatString;
- PresentAttribute torquePresent = typeof(MachiningStep).GetProperty(nameof(MachiningStep.AvgAbsTorque_Nm)).GetCustomAttribute();
- string torqueUnit = torquePresent?.TailUnitString;
- string torqueFormat = torquePresent?.DataFormatString;
+ PresentAttribute mrrPresent = typeof(MachiningStep).GetProperty(nameof(MachiningStep.Mrr_mm3ds)).GetCustomAttribute();
+ string mrrUnit = mrrPresent?.TailUnitString;
+ string mrrFormat = mrrPresent?.DataFormatString;
+ PresentAttribute torquePresent = typeof(MachiningStep).GetProperty(nameof(MachiningStep.AvgAbsTorque_Nm)).GetCustomAttribute();
+ string torqueUnit = torquePresent?.TailUnitString;
+ string torqueFormat = torquePresent?.DataFormatString;
- SessionMessageHost.FilterFlag filterFlags =
- SessionMessageHost.FilterFlag.Step |
- SessionMessageHost.FilterFlag.NC |
- SessionMessageHost.FilterFlag.Progress |
- SessionMessageHost.FilterFlag.Error;
- string filterText = null;
- var filteredSessionMessageList = sessionMessageHost
- .GetFliteredList(filterFlags, filterText);
+ SessionProgress.FilterFlag filterFlags =
+ SessionProgress.FilterFlag.Step |
+ SessionProgress.FilterFlag.NC |
+ SessionProgress.FilterFlag.Progress |
+ SessionProgress.FilterFlag.Error;
+ string filterText = null;
+ var filteredSessionMessageList = sessionMessageHost
+ .GetFliteredList(filterFlags, filterText);
- foreach (var sessionMessage in filteredSessionMessageList)
- {
- //M.I.: Message Index.
- Console.Write($"M.I.: {sessionMessage.Index}; Role: {sessionMessage.MessageRoleText}");
+ foreach (var sessionMessage in filteredSessionMessageList)
+ {
+ //M.I.: Message Index.
+ Console.Write($"M.I.: {sessionMessage.Index}; Role: {sessionMessage.MessageRoleText}");
- // For SessionMessageHost.FilterFlag.Step
- var step = sessionMessage.MachiningStep;
- if (step != null)
- {
- string[] machineCoordinateValueTexts = GetMachineCoordinateValueTexts(step, machiningChain);
- var machineCoordinatesText = string.Join("; ", Enumerable.Range(0, machiningChain.McCodes.Length)
- .Select(i => $"MC.{machiningChain.McCodes[i]}: {machineCoordinateValueTexts[i]}"));
- Console.Write($"Time: {step.AccumulatedTime:G}; MRR = {step.Mrr_mm3ds.ToString(mrrFormat)} {mrrUnit}; Torque = {step.AvgAbsTorque_Nm?.ToString(torqueFormat)} {torqueUnit}; {machineCoordinatesText}; ");
- var nc_ = sessionMessageHost.GetSourceCommand(sessionMessage);
- Console.WriteLine($"Message/NC: {nc_.Line}; File: {nc_.FilePath}; LineNo: {nc_.GetLineNo()}");
- }
+ // For SessionMessageHost.FilterFlag.Step
+ var step = sessionMessage.MachiningStep;
+ if (step != null)
+ {
+ string[] machineCoordinateValueTexts = GetMachineCoordinateValueTexts(step, machiningChain);
+ var machineCoordinatesText = string.Join("; ", Enumerable.Range(0, machiningChain.McCodes.Length)
+ .Select(i => $"MC.{machiningChain.McCodes[i]}: {machineCoordinateValueTexts[i]}"));
+ Console.Write($"Time: {step.AccumulatedTime:G}; MRR = {step.Mrr_mm3ds.ToString(mrrFormat)} {mrrUnit}; Torque = {step.AvgAbsTorque_Nm?.ToString(torqueFormat)} {torqueUnit}; {machineCoordinatesText}; ");
+ var nc_ = sessionMessageHost.GetSourceCommand(sessionMessage);
+ Console.WriteLine($"Message/NC: {nc_.Line}; File: {nc_.FilePath}; LineNo: {nc_.GetLineNo()}");
+ }
- // For SessionMessageHost.FilterFlag.NC
- var nc = sessionMessage.DirectInstantSourceCommand;
- if (nc != null)
- {
- Console.Write($"Message/NC: {nc.Line}; File: {nc.FilePath}; LineNo: {nc.GetLineNo()}; ");
- if (nc is HardNcLine ncLine)
- Console.WriteLine($"T: {ncLine.T}; S: {ncLine.S}; F: {ncLine.F}; NC-Flags: {ncLine.FlagsText}");
- }
+ // For SessionMessageHost.FilterFlag.NC
+ var nc = sessionMessage.DirectInstantSourceCommand;
+ if (nc != null)
+ {
+ Console.Write($"Message/NC: {nc.Line}; File: {nc.FilePath}; LineNo: {nc.GetLineNo()}; ");
+ if (nc is HardNcLine ncLine)
+ Console.WriteLine($"T: {ncLine.T}; S: {ncLine.S}; F: {ncLine.F}; NC-Flags: {ncLine.FlagsText}");
+ }
- // For SessionMessageHost.FilterFlag.Progress or Error.
- var multiTagMessage = sessionMessage.MultiTagMessage;
- if (multiTagMessage != null)
- Console.WriteLine($"Message/NC: {multiTagMessage.Message}");
- var exception = sessionMessage.Exception;
- if (exception != null)
- Console.WriteLine($"Message/NC: {exception.Message}");
- }
- }
- static string[] GetMachineCoordinateValueTexts(MachiningStep step, IMachiningChain machiningChain)
- {
- var mcTransformers = machiningChain.McTransformers;
- string[] dst = new string[mcTransformers.Length];
- if (mcTransformers != null)
- {
- for (int i = 0; i < mcTransformers.Length; i++)
- {
- if (mcTransformers[i] == null)
- continue;
- if (mcTransformers[i] is DynamicRotation)
- dst[i] = MathUtil.ToDeg(step.GetMcValue(i).Value).ToString("F4");
- else
- dst[i] = step.GetMcValue(i)?.ToString("F5");
- }
- }
- return dst;
- }
- #region ShowStepPresent
- internal static void ShowStepPresent(
- UserService userEnv, MachiningStep machiningStep)
- {
- foreach (var entry in userEnv.DisplayedStepPresentAccessList)
- {
- var present = entry.Value.Present;
- var valueText = string.Format("{0:" + present.DataFormatString + "}", entry.Value.GetValueFunc.Invoke(machiningStep));
- Console.WriteLine($"{present.ShortName}: {valueText} {present.TailUnitString} ({present.Name} [{entry.Key}])");
- }
- }
- #endregion
- }
+ // For SessionMessageHost.FilterFlag.Progress or Error.
+ var multiTagMessage = sessionMessage.MultiTagMessage;
+ if (multiTagMessage != null)
+ Console.WriteLine($"Message/NC: {multiTagMessage.Message}");
+ var exception = sessionMessage.Exception;
+ if (exception != null)
+ Console.WriteLine($"Message/NC: {exception.Message}");
+ }
+ }
+ static string[] GetMachineCoordinateValueTexts(MachiningStep step, IMachiningChain machiningChain)
+ {
+ var mcTransformers = machiningChain.McTransformers;
+ string[] dst = new string[mcTransformers.Length];
+ if (mcTransformers != null)
+ {
+ for (int i = 0; i < mcTransformers.Length; i++)
+ {
+ if (mcTransformers[i] == null)
+ continue;
+ if (mcTransformers[i] is DynamicRotation)
+ dst[i] = MathUtil.ToDeg(step.GetMcValue(i).Value).ToString("F4");
+ else
+ dst[i] = step.GetMcValue(i)?.ToString("F5");
+ }
+ }
+ return dst;
+ }
+ #region ShowStepPresent
+ internal static void ShowStepPresent(
+ UserService userEnv, MachiningStep machiningStep)
+ {
+ foreach (var entry in userEnv.DisplayedStepPresentAccessList)
+ {
+ var present = entry.Value.Present;
+ var valueText = string.Format("{0:" + present.DataFormatString + "}", entry.Value.GetValueFunc.Invoke(machiningStep));
+ Console.WriteLine($"{present.ShortName}: {valueText} {present.TailUnitString} ({present.Name} [{entry.Key}])");
+ }
+ }
+ #endregion
}
\ No newline at end of file
diff --git a/Geom/DemoBuildGeom.cs b/Geom/DemoBuildGeom.cs
index efeb65b..7822eeb 100644
--- a/Geom/DemoBuildGeom.cs
+++ b/Geom/DemoBuildGeom.cs
@@ -3,40 +3,38 @@ using System.Collections.Generic;
using Hi.Geom;
using Hi.Mech.Topo;
-namespace Sample.Geom
-{
- ///
- /// Demonstrates the creation and manipulation of geometric objects in HiAPI.
- /// Shows how to create and transform various geometry types including boxes, cylindroids, and STL files.
- ///
- ///
- /// ### Source Code
- /// [!code-csharp[SampleCode](~/../Hi.Sample/Geom/DemoBuildGeom.cs)]
- ///
- public static class DemoBuildGeom
- {
- ///
- /// Generates a collection of geometric objects for demonstration purposes.
- /// Creates various geometry types including boxes, cylindroids, STL files, and transformed geometries.
- ///
- /// A list of geometries implementing the IGetStl interface
- public static List GenGeoms()
- {
- Box3d box = new Box3d(0, 0, -50, 70, 50, 0);
- Cylindroid cylindroid = new Cylindroid([ new PairZr(0,12),new PairZr(20,12),
- new PairZr(20,16),new PairZr(30,16)]);
- Stl stl = new Stl("geom.stl");
- StlFile stlFile = new StlFile("geom.stl");
- TransformationGeom transformationGeom = new TransformationGeom()
- {
- Transformer = new GeneralTransform(1,
- new StaticRotation(new Vec3d(0, 0, 1), MathUtil.ToRad(15), new Vec3d(0, 0, 0)),
- new StaticTranslation(new Vec3d(0, 0, 0))),
- Geom = stl
- };
- GeomCombination geomCombination = new GeomCombination(stlFile, transformationGeom);
- return new List([box, cylindroid, stl, stlFile, transformationGeom]);
- }
- }
+namespace Sample.Geom;
+///
+/// Demonstrates the creation and manipulation of geometric objects in HiAPI.
+/// Shows how to create and transform various geometry types including boxes, cylindroids, and STL files.
+///
+///
+/// ### Source Code
+/// [!code-csharp[SampleCode](~/../Hi.Sample/Geom/DemoBuildGeom.cs)]
+///
+public static class DemoBuildGeom
+{
+ ///
+ /// Generates a collection of geometric objects for demonstration purposes.
+ /// Creates various geometry types including boxes, cylindroids, STL files, and transformed geometries.
+ ///
+ /// A list of geometries implementing the IGetStl interface
+ public static List GenGeoms()
+ {
+ Box3d box = new Box3d(0, 0, -50, 70, 50, 0);
+ Cylindroid cylindroid = new Cylindroid([ new PairZr(0,12),new PairZr(20,12),
+ new PairZr(20,16),new PairZr(30,16)]);
+ Stl stl = new Stl("geom.stl");
+ StlFile stlFile = new StlFile("geom.stl");
+ TransformationGeom transformationGeom = new TransformationGeom()
+ {
+ Transformer = new GeneralTransform(1,
+ new StaticRotation(new Vec3d(0, 0, 1), MathUtil.ToRad(15), new Vec3d(0, 0, 0)),
+ new StaticTranslation(new Vec3d(0, 0, 0))),
+ Geom = stl
+ };
+ GeomCombination geomCombination = new GeomCombination(stlFile, transformationGeom);
+ return new List([box, cylindroid, stl, stlFile, transformationGeom]);
+ }
}
diff --git a/Geom/DemoIExpandToBox3d.cs b/Geom/DemoIExpandToBox3d.cs
index 9720244..fc792b5 100644
--- a/Geom/DemoIExpandToBox3d.cs
+++ b/Geom/DemoIExpandToBox3d.cs
@@ -1,28 +1,27 @@
using Hi.Geom;
using System;
-namespace Sample.Geom
-{
- ///
- /// Demonstrates how to create and calculate bounding boxes for different geometric objects.
- /// Shows the use of Box3d to encompass multiple geometric elements with a single boundary.
- ///
- ///
- /// ### Source Code
- /// [!code-csharp[SampleCode](~/../Hi.Sample/Geom/DemoIExpandToBox3d.cs)]
- ///
- public static class DemoIExpandToBox3d
- {
- static void Main()
- {
- #region DocSite.CountBoundingBox
- Box3d objA = new Box3d(0, 0, 0, 1, 1, 1);
- Box3d objB = new Box3d(-1, -2, -3, 3, 2, 1);
- Vec3d objC = new Vec3d(-2, 3, -5);
+namespace Sample.Geom;
- Box3d boundingbox = new Box3d(objA, objB, objC);
- Console.WriteLine("boundingbox: " + boundingbox);
- #endregion
- }
+///
+/// Demonstrates how to create and calculate bounding boxes for different geometric objects.
+/// Shows the use of Box3d to encompass multiple geometric elements with a single boundary.
+///
+///
+/// ### Source Code
+/// [!code-csharp[SampleCode](~/../Hi.Sample/Geom/DemoIExpandToBox3d.cs)]
+///
+public static class DemoIExpandToBox3d
+{
+ static void Main()
+ {
+ #region DocSite.CountBoundingBox
+ Box3d objA = new Box3d(0, 0, 0, 1, 1, 1);
+ Box3d objB = new Box3d(-1, -2, -3, 3, 2, 1);
+ Vec3d objC = new Vec3d(-2, 3, -5);
+
+ Box3d boundingbox = new Box3d(objA, objB, objC);
+ Console.WriteLine("boundingbox: " + boundingbox);
+ #endregion
}
}
diff --git a/Hi.Sample.csproj b/Hi.Sample.csproj
index 97efec7..1d88d08 100644
--- a/Hi.Sample.csproj
+++ b/Hi.Sample.csproj
@@ -34,8 +34,5 @@
-
-
-
\ No newline at end of file
diff --git a/MachineTool/DemoBuildMachineToolWithoutGeometrys.cs b/MachineTool/DemoBuildMachineToolWithoutGeometrys.cs
index b7c9847..37adc5a 100644
--- a/MachineTool/DemoBuildMachineToolWithoutGeometrys.cs
+++ b/MachineTool/DemoBuildMachineToolWithoutGeometrys.cs
@@ -3,28 +3,27 @@ using Hi.Mech.Topo;
using Hi.NcMech.Xyzabc;
using Hi.Numerical.Xyzabc;
-namespace Sample.MachineTool
+namespace Sample.MachineTool;
+
+///
+/// Demo Build Machine Tool without gemetries setting.
+///
+///
+/// ### Source Code
+/// [!code-csharp[SampleCode](~/../Hi.Sample/MachineTool/DemoBuildMachineToolWithoutGeometrys.cs)]
+///
+public static class DemoBuildMachineToolWithoutGeometrys
{
- ///
- /// Demo Build Machine Tool without gemetries setting.
- ///
- ///
- /// ### Source Code
- /// [!code-csharp[SampleCode](~/../Hi.Sample/MachineTool/DemoBuildMachineToolWithoutGeometrys.cs)]
- ///
- public static class DemoBuildMachineToolWithoutGeometrys
- {
- ///
- /// Generates an empty machine tool with basic configuration.
- ///
- /// A configured but empty machine tool without solids.
- public static CodeXyzabcMachineTool GenEmptyMachineTool()
- {
- CodeXyzabcChain chain = new CodeXyzabcChain("[O][C][w];[O][X][Y][Z][B][S][t]");
- if (chain.ToolBuckleTransformer is StaticTranslation st)
- st.Trans = new Vec3d(-200, 200, 400);
- CodeXyzabcMachineTool xyzabcMachineTool = new CodeXyzabcMachineTool(chain);
- return xyzabcMachineTool;
- }
- }
+ ///
+ /// Generates an empty machine tool with basic configuration.
+ ///
+ /// A configured but empty machine tool without solids.
+ public static CodeXyzabcMachineTool GenEmptyMachineTool()
+ {
+ CodeXyzabcChain chain = new CodeXyzabcChain("[O][C][w];[O][X][Y][Z][B][S][t]");
+ if (chain.ToolBuckleTransformer is StaticTranslation st)
+ st.Trans = new Vec3d(-200, 200, 400);
+ CodeXyzabcMachineTool xyzabcMachineTool = new CodeXyzabcMachineTool(chain);
+ return xyzabcMachineTool;
+ }
}
diff --git a/Machining/DemoBuildGeomOnlyMachiningProject.cs b/Machining/DemoBuildGeomOnlyMachiningProject.cs
index 70beaab..9d05b29 100644
--- a/Machining/DemoBuildGeomOnlyMachiningProject.cs
+++ b/Machining/DemoBuildGeomOnlyMachiningProject.cs
@@ -15,83 +15,82 @@ using Hi.Machining;
using Hi.HiNcKits;
using Hi.Milling.MillingTools;
-namespace Sample.Machining
+namespace Sample.Machining;
+
+///
+/// ### Source Code
+/// [!code-csharp[SampleCode](~/../Hi.Sample/Machining/DemoBuildGeomOnlyMachiningProject.cs)]
+///
+public static class DemoBuildGeomOnlyMachiningProject
{
- ///
- /// ### Source Code
- /// [!code-csharp[SampleCode](~/../Hi.Sample/Machining/DemoBuildGeomOnlyMachiningProject.cs)]
- ///
- public static class DemoBuildGeomOnlyMachiningProject
- {
- internal static MillingCutter CreateGeomOnlyMillingCutter()
- {
- MillingCutter millingCutter = new MillingCutter()
- {
- UpperBeamGeom = new Cylindroid(
- [new PairZr(40,6), new PairZr(90,6)]),
- ShaperProfile = new AptProfile(
- new ColumnApt()
- {
- Diameter_mm = 12,
- FluteHeight_mm = 40
- })
- };
+ internal static MillingCutter CreateGeomOnlyMillingCutter()
+ {
+ MillingCutter millingCutter = new MillingCutter()
+ {
+ UpperBeamGeom = new Cylindroid(
+ [new PairZr(40, 6), new PairZr(90, 6)]),
+ ShaperProfile = new AptProfile(
+ new ColumnApt()
+ {
+ Diameter_mm = 12,
+ FluteHeight_mm = 40
+ })
+ };
- return millingCutter;
- }
+ return millingCutter;
+ }
- static void Main()
- {
- LocalApp.AppBegin();
- LocalProjectService localProjectService = new LocalProjectService();
+ static void Main()
+ {
+ LocalApp.AppBegin();
+ LocalProjectService localProjectService = new LocalProjectService();
- var projectPath = "C:/HiNC-Projects/NewProject/Main.hincproj";
- var projectDirectory = Path.GetDirectoryName(projectPath);
- Console.WriteLine($"Directory of the New Project: {projectDirectory}");
- localProjectService.LoadProject(projectPath);
- MachiningProject machiningProject = localProjectService.MachiningProject;
+ var projectPath = "C:/HiNC-Projects/NewProject/Main.hincproj";
+ var projectDirectory = Path.GetDirectoryName(projectPath);
+ Console.WriteLine($"Directory of the New Project: {projectDirectory}");
+ localProjectService.LoadProject(projectPath);
+ MachiningProject machiningProject = localProjectService.MachiningProject;
- CylindroidHolder cylindroidHolder = new CylindroidHolder()
- {
- Note = "BT40",
- Cylindroid = new Cylindroid([ new PairZr(0,12),new PairZr(20,12),
- new PairZr(20,16),new PairZr(30,16)])
- };
- localProjectService.MachiningToolHouse = new MachiningToolHouse()
- {
- [1] = new MillingTool()
- {
- Note = "T1",
- PreservedDistanceBetweenFluteAndSpindleNose_mm = 8,
- Holder = cylindroidHolder,
- Cutter = CreateGeomOnlyMillingCutter()
- },
- };
+ CylindroidHolder cylindroidHolder = new CylindroidHolder()
+ {
+ Note = "BT40",
+ Cylindroid = new Cylindroid([ new PairZr(0,12),new PairZr(20,12),
+ new PairZr(20,16),new PairZr(30,16)])
+ };
+ localProjectService.MachiningToolHouse = new MachiningToolHouse()
+ {
+ [1] = new MillingTool()
+ {
+ Note = "T1",
+ PreservedDistanceBetweenFluteAndSpindleNose_mm = 8,
+ Holder = cylindroidHolder,
+ Cutter = CreateGeomOnlyMillingCutter()
+ },
+ };
- localProjectService.Fixture = new Fixture()
- {
- Geom = new Box3d(new Vec3d(-40, -40, 0), new Vec3d(40, 40, 10)),
- GeomToWorkpieceTransformer = new StaticTranslation(new Vec3d(0, 0, 10)),
- };
+ localProjectService.Fixture = new Fixture()
+ {
+ Geom = new Box3d(new Vec3d(-40, -40, 0), new Vec3d(40, 40, 10)),
+ GeomToWorkpieceTransformer = new StaticTranslation(new Vec3d(0, 0, 10)),
+ };
- localProjectService.Workpiece = new Workpiece()
- {
- InitResolution = 0.25,
- InitGeom = new Box3d(0, 0, -50, 70, 50, 0),
- IdealGeom = null,
- WorkpieceGeomToFixtureBuckleTransformer = new StaticTranslation(new Vec3d(0, 0, 0)),
- };
+ localProjectService.Workpiece = new Workpiece()
+ {
+ InitResolution = 0.25,
+ InitGeom = new Box3d(0, 0, -50, 70, 50, 0),
+ IdealGeom = null,
+ WorkpieceGeomToFixtureBuckleTransformer = new StaticTranslation(new Vec3d(0, 0, 0)),
+ };
- localProjectService.MachiningChain
- = XFactory.GenByFile(
- "Resource", "MachineTool/PMC-B1/PMC-B1.mt", GenMode.Default);
- localProjectService.MachiningChainFile = "PMC-B1/PMC-B1.mt";
+ localProjectService.MachiningChain
+ = XFactory.GenByFile(
+ "Resource", "MachineTool/PMC-B1/PMC-B1.mt", GenMode.Default);
+ localProjectService.MachiningChainFile = "PMC-B1/PMC-B1.mt";
- localProjectService.SaveProject();
+ localProjectService.SaveProject();
- machiningProject.Dispose();
- LocalApp.AppEnd();
- }
+ machiningProject.Dispose();
+ LocalApp.AppEnd();
+ }
- }
}
diff --git a/Machining/DemoBuildMachiningProject.cs b/Machining/DemoBuildMachiningProject.cs
index ced2a88..c95e66d 100644
--- a/Machining/DemoBuildMachiningProject.cs
+++ b/Machining/DemoBuildMachiningProject.cs
@@ -18,199 +18,198 @@ using System.IO;
using Hi.HiNcKits;
using Hi.Milling.MillingTools;
-namespace Sample.Machining
+namespace Sample.Machining;
+
+///
+/// Demonstrates how to create and configure a programmatically.
+/// This sample shows how to set up , ,
+/// , , ,
+/// and save the project configuration to a file.
+///
+///
+/// ### Source Code
+/// [!code-csharp[SampleCode](~/../Hi.Sample/Machining/DemoBuildMachiningProject.cs)]
+///
+public static class DemoBuildMachiningProject
{
- ///
- /// Demonstrates how to create and configure a programmatically.
- /// This sample shows how to set up , ,
- /// , , ,
- /// and save the project configuration to a file.
- ///
- ///
- /// ### Source Code
- /// [!code-csharp[SampleCode](~/../Hi.Sample/Machining/DemoBuildMachiningProject.cs)]
- ///
- public static class DemoBuildMachiningProject
- {
- internal static CylindroidHolder CreateCylindroidHolder()
- {
- #region ConfigureHolder
- CylindroidHolder cylindroidHolder = new CylindroidHolder()
- {
- Note = "BT40",
- Cylindroid = new Cylindroid([ new PairZr(0,12),new PairZr(20,12),
- new PairZr(20,16),new PairZr(30,16)])
- };
- #endregion
- return cylindroidHolder;
- }
+ internal static CylindroidHolder CreateCylindroidHolder()
+ {
+ #region ConfigureHolder
+ CylindroidHolder cylindroidHolder = new CylindroidHolder()
+ {
+ Note = "BT40",
+ Cylindroid = new Cylindroid([ new PairZr(0,12),new PairZr(20,12),
+ new PairZr(20,16),new PairZr(30,16)])
+ };
+ #endregion
+ return cylindroidHolder;
+ }
- #region CreateMillingCutter1
- internal static MillingCutter CreateMillingCutter1()
- {
- double diameter_mm = 12;
- double roundRadius_mm = 0.5;
- MillingCutter millingCutter = new MillingCutter()
- {
- ShaperProfile = new AptProfile(
- new ColumnApt()
- {
- Diameter_mm = diameter_mm,
- Rc_mm = roundRadius_mm,
- FluteHeight_mm = 40
- }),
- UpperBeamGeom = new ExtendedCylinder(90),
- InnerBeamProfile = new FluteDependentRatioProfile(),
- MillingCutterOptLimit = new MillingCutterOptOption(),
- };
- //build FluteContourTray property
- double helixAngle_deg = 50;
- double radialRakeAngle_deg = 15;
- double bottomOuterRadius_mm = diameter_mm / 2 - roundRadius_mm;
- millingCutter.FluteContourTray = new UniformContourTray()
- {
- TrackNum = 3,
- BaselineOneContour = new FluteContour()
- {
- BaseSideContour = new ConstHelixSideContour(millingCutter)
- {
- Helix_deg = helixAngle_deg,
- RadialRakeAngle_deg = radialRakeAngle_deg
- },
- BaseBottomContour = new SlideBottomContour()
- {
- //In most case, helix angle from side equal to rake angle from bottom.
- AxialRakeAngle_deg = MathUtil.ToDeg(helixAngle_deg),
- DiskAngle_deg = 1.5,
- //In most case, rake angle from side equal to eccentric angle from bottom.
- EccentricAngle_deg = radialRakeAngle_deg,
- CutterLengthOnBottomProjection_mm = bottomOuterRadius_mm * 0.9,
- OuterRadius_mm = bottomOuterRadius_mm
- }
- }
- };
+ #region CreateMillingCutter1
+ internal static MillingCutter CreateMillingCutter1()
+ {
+ double diameter_mm = 12;
+ double roundRadius_mm = 0.5;
+ MillingCutter millingCutter = new MillingCutter()
+ {
+ ShaperProfile = new AptProfile(
+ new ColumnApt()
+ {
+ Diameter_mm = diameter_mm,
+ Rc_mm = roundRadius_mm,
+ FluteHeight_mm = 40
+ }),
+ UpperBeamGeom = new ExtendedCylinder(90),
+ InnerBeamProfile = new FluteDependentRatioProfile(),
+ MillingCutterOptLimit = new MillingCutterOptOption(),
+ };
+ //build FluteContourTray property
+ double helixAngle_deg = 50;
+ double radialRakeAngle_deg = 15;
+ double bottomOuterRadius_mm = diameter_mm / 2 - roundRadius_mm;
+ millingCutter.FluteContourTray = new UniformContourTray()
+ {
+ TrackNum = 3,
+ BaselineOneContour = new FluteContour()
+ {
+ BaseSideContour = new ConstHelixSideContour(millingCutter)
+ {
+ Helix_deg = helixAngle_deg,
+ RadialRakeAngle_deg = radialRakeAngle_deg
+ },
+ BaseBottomContour = new SlideBottomContour()
+ {
+ //In most case, helix angle from side equal to rake angle from bottom.
+ AxialRakeAngle_deg = MathUtil.ToDeg(helixAngle_deg),
+ DiskAngle_deg = 1.5,
+ //In most case, rake angle from side equal to eccentric angle from bottom.
+ EccentricAngle_deg = radialRakeAngle_deg,
+ CutterLengthOnBottomProjection_mm = bottomOuterRadius_mm * 0.9,
+ OuterRadius_mm = bottomOuterRadius_mm
+ }
+ }
+ };
- return millingCutter;
- }
- #endregion
+ return millingCutter;
+ }
+ #endregion
- #region CreateMillingCutter2
- internal static MillingCutter CreateMillingCutter2()
- {
- MillingCutter millingCutter = new MillingCutter()
- {
- ShaperProfile = new AptProfile(new ColumnApt()
- {
- Diameter_mm = 12,
- FluteHeight_mm = 40
- }),
- UpperBeamGeom = new Cylindroid(
- [new PairZr(40, 6), new PairZr(90, 6)]),
- InnerBeamProfile = new FluteDependentRatioProfile(),
- MillingCutterOptLimit = new MillingCutterOptOption()
- };
+ #region CreateMillingCutter2
+ internal static MillingCutter CreateMillingCutter2()
+ {
+ MillingCutter millingCutter = new MillingCutter()
+ {
+ ShaperProfile = new AptProfile(new ColumnApt()
+ {
+ Diameter_mm = 12,
+ FluteHeight_mm = 40
+ }),
+ UpperBeamGeom = new Cylindroid(
+ [new PairZr(40, 6), new PairZr(90, 6)]),
+ InnerBeamProfile = new FluteDependentRatioProfile(),
+ MillingCutterOptLimit = new MillingCutterOptOption()
+ };
- //build FluteContourTray property
- double helixAngle_deg = 50;
- double radialRakeAngle_deg = 15;
- millingCutter.FluteContourTray = new UniformContourTray()
- {
- TrackNum = 3,
- BaselineOneContour = new FluteContour()
- {
- BaseSideContour = new ConstHelixSideContour(millingCutter)
- {
- Helix_deg = helixAngle_deg,
- RadialRakeAngle_deg = radialRakeAngle_deg
- },
- //since no bottom cut, set bottom contour to null.
- BaseBottomContour = null
- }
- };
+ //build FluteContourTray property
+ double helixAngle_deg = 50;
+ double radialRakeAngle_deg = 15;
+ millingCutter.FluteContourTray = new UniformContourTray()
+ {
+ TrackNum = 3,
+ BaselineOneContour = new FluteContour()
+ {
+ BaseSideContour = new ConstHelixSideContour(millingCutter)
+ {
+ Helix_deg = helixAngle_deg,
+ RadialRakeAngle_deg = radialRakeAngle_deg
+ },
+ //since no bottom cut, set bottom contour to null.
+ BaseBottomContour = null
+ }
+ };
- return millingCutter;
- }
- #endregion
+ return millingCutter;
+ }
+ #endregion
- internal static CustomSpinningProfile CreateCustomSpinningProfile()
- {
- return new CustomSpinningProfile(
- new Cylindroid(new PairZr(0, 4), new PairZr(50, 4)));
- }
+ internal static CustomSpinningProfile CreateCustomSpinningProfile()
+ {
+ return new CustomSpinningProfile(
+ new Cylindroid(new PairZr(0, 4), new PairZr(50, 4)));
+ }
- #region TestMethod
- [STAThread]
- static void Main()
- {
- LocalApp.AppBegin();
- LocalProjectService localProjectService = new LocalProjectService();
+ #region TestMethod
+ [STAThread]
+ static void Main()
+ {
+ LocalApp.AppBegin();
+ LocalProjectService localProjectService = new LocalProjectService();
- var projectPath = "C:/HiNC-Projects/NewProject/Main.hincproj";
- var projectDirectory = Path.GetDirectoryName(projectPath);
- Console.WriteLine($"Directory of the New Project: {projectDirectory}");
- localProjectService.LoadProject(projectPath);
- MachiningProject machiningProject = localProjectService.MachiningProject;
+ var projectPath = "C:/HiNC-Projects/NewProject/Main.hincproj";
+ var projectDirectory = Path.GetDirectoryName(projectPath);
+ Console.WriteLine($"Directory of the New Project: {projectDirectory}");
+ localProjectService.LoadProject(projectPath);
+ MachiningProject machiningProject = localProjectService.MachiningProject;
- #region ConfigureMachiningToolHouse
- localProjectService.MachiningToolHouse = new MachiningToolHouse()
- {
- [1] = new MillingTool()
- {
- Note = "T1",
- PreservedDistanceBetweenFluteAndSpindleNose_mm = 8,
- Holder = CreateCylindroidHolder(),
- Cutter = CreateMillingCutter1()
- },
- [2] = new MillingTool()
- {
- Note = "T2",
- PreservedDistanceBetweenFluteAndSpindleNose_mm = 8,
- Holder = CreateCylindroidHolder(),
- Cutter = CreateMillingCutter2()
- },
- [3] = new MillingTool()
- {
- Note = "T3",
- PreservedDistanceBetweenFluteAndSpindleNose_mm = 8,
- Holder = CreateCylindroidHolder(),
- Cutter = CreateMillingCutter1()
- },
- };
- #endregion
+ #region ConfigureMachiningToolHouse
+ localProjectService.MachiningToolHouse = new MachiningToolHouse()
+ {
+ [1] = new MillingTool()
+ {
+ Note = "T1",
+ PreservedDistanceBetweenFluteAndSpindleNose_mm = 8,
+ Holder = CreateCylindroidHolder(),
+ Cutter = CreateMillingCutter1()
+ },
+ [2] = new MillingTool()
+ {
+ Note = "T2",
+ PreservedDistanceBetweenFluteAndSpindleNose_mm = 8,
+ Holder = CreateCylindroidHolder(),
+ Cutter = CreateMillingCutter2()
+ },
+ [3] = new MillingTool()
+ {
+ Note = "T3",
+ PreservedDistanceBetweenFluteAndSpindleNose_mm = 8,
+ Holder = CreateCylindroidHolder(),
+ Cutter = CreateMillingCutter1()
+ },
+ };
+ #endregion
- #region ConfigureFixture
- localProjectService.Fixture = new Fixture()
- {
- Geom = new Box3d(new Vec3d(-40, -40, 0), new Vec3d(40, 40, 10)),
- GeomToWorkpieceTransformer = new StaticTranslation(new Vec3d(0, 0, 10)),
- };
- #endregion
+ #region ConfigureFixture
+ localProjectService.Fixture = new Fixture()
+ {
+ Geom = new Box3d(new Vec3d(-40, -40, 0), new Vec3d(40, 40, 10)),
+ GeomToWorkpieceTransformer = new StaticTranslation(new Vec3d(0, 0, 10)),
+ };
+ #endregion
- #region ConfigureWorkpiece
- localProjectService.Workpiece = new Workpiece()
- {
- InitResolution = 0.25,
- InitGeom = new Box3d(0, 0, -50, 70, 50, 0),
- IdealGeom = null,
- WorkpieceGeomToFixtureBuckleTransformer = new StaticTranslation(new Vec3d(0, 0, 0)),
- CuttingPara = XFactory.GenByFile(
- "Resource/CuttingParameter", "Al6061T6.mp", GenMode.Default),
- WorkpieceMaterial = XFactory.GenByFile(
- "Resource/WorkpieceMaterial", "Al6061T6.WorkpieceMaterial", GenMode.Default),
- };
- #endregion
+ #region ConfigureWorkpiece
+ localProjectService.Workpiece = new Workpiece()
+ {
+ InitResolution = 0.25,
+ InitGeom = new Box3d(0, 0, -50, 70, 50, 0),
+ IdealGeom = null,
+ WorkpieceGeomToFixtureBuckleTransformer = new StaticTranslation(new Vec3d(0, 0, 0)),
+ CuttingPara = XFactory.GenByFile(
+ "Resource/CuttingParameter", "Al6061T6.mp", GenMode.Default),
+ WorkpieceMaterial = XFactory.GenByFile(
+ "Resource/WorkpieceMaterial", "Al6061T6.WorkpieceMaterial", GenMode.Default),
+ };
+ #endregion
- #region ConfigureMachineChain
- localProjectService.MachiningChain
- = XFactory.GenByFile(
- "Resource", "MachineTool/PMC-B1/PMC-B1.mt", GenMode.Default);
- #endregion
+ #region ConfigureMachineChain
+ localProjectService.MachiningChain
+ = XFactory.GenByFile(
+ "Resource", "MachineTool/PMC-B1/PMC-B1.mt", GenMode.Default);
+ #endregion
- machiningProject.MakeXmlSourceToFile(projectPath);
+ machiningProject.MakeXmlSourceToFile(projectPath);
- machiningProject.Dispose();
- LocalApp.AppEnd();
- }
- #endregion
- }
+ machiningProject.Dispose();
+ LocalApp.AppEnd();
+ }
+ #endregion
}
diff --git a/Machining/DemoUseMachiningProject.cs b/Machining/DemoUseMachiningProject.cs
index 0746fac..82bd88a 100644
--- a/Machining/DemoUseMachiningProject.cs
+++ b/Machining/DemoUseMachiningProject.cs
@@ -5,82 +5,82 @@ using Hi.MachiningProcs;
using System;
using System.IO;
-namespace Sample.Machining
+namespace Sample.Machining;
+
+///
+/// Demonstrates how to load and use an existing instance.
+/// This sample shows how to set up event handlers for messages and machining step objects,
+/// execute NC files, and properly manage project resources using
+/// .
+///
+///
+/// ### Source Code
+/// [!code-csharp[SampleCode](~/../Hi.Sample/Machining/DemoUseMachiningProject.cs)]
+///
+public static class DemoUseMachiningProject
{
- ///
- /// Demonstrates how to load and use an existing instance.
- /// This sample shows how to set up event handlers for messages and machining step objects,
- /// execute NC files, and properly manage project resources using
- /// .
- ///
- ///
- /// ### Source Code
- /// [!code-csharp[SampleCode](~/../Hi.Sample/Machining/DemoUseMachiningProject.cs)]
- ///
- public static class DemoUseMachiningProject
- {
- static void Main()
- {
- LocalApp.AppBegin();
- LocalProjectService localProjectService = new LocalProjectService();
+ static void Main()
+ {
+ LocalApp.AppBegin();
+ LocalProjectService localProjectService = new LocalProjectService();
- #region ProjectLoading
- var projectPath = "C:/HiNC-Projects/DemoStandardPath/Main.hincproj";
- Console.WriteLine($"Load Project: {projectPath}");
- localProjectService.LoadProject(projectPath);
- MachiningProject machiningProject = localProjectService.MachiningProject;
- #endregion
+ #region ProjectLoading
+ var projectPath = "C:/HiNC-Projects/DemoStandardPath/Main.hincproj";
+ Console.WriteLine($"Load Project: {projectPath}");
+ localProjectService.LoadProject(projectPath);
+ MachiningProject machiningProject = localProjectService.MachiningProject;
+ #endregion
- #region EventHandling
- Console.WriteLine($"Set message event.");
+ #region EventHandling
+ Console.WriteLine($"Set message event.");
- using StreamWriter writer = new StreamWriter("msg.txt");
- //show message if something abnormal.
- localProjectService.SessionMessageHost.CollectionItemAdded += pack =>
- {
- if (pack.Tags.Contains(MessageFlag.Warning.ToString()) ||
- pack.Tags.Contains(MessageFlag.Error.ToString()) ||
- pack.Tags.Contains(MessageFlag.Exception.ToString()))
- {
- var sourceCommand = pack.SourceCommand;
+ using StreamWriter writer = new StreamWriter("msg.txt");
+ //show message if something abnormal.
+ localProjectService.SessionProgress.CollectionItemAdded += pack =>
+ {
+ if (pack.Tags.Contains(MessageFlag.Warning.ToString()) ||
+ pack.Tags.Contains(MessageFlag.Error.ToString()) ||
+ pack.Tags.Contains(MessageFlag.Exception.ToString()))
+ {
+ var sourceCommand = pack.SourceCommand;
writer.WriteLine($"{pack.Message} At \"{sourceCommand?.FilePath}\" (Line {sourceCommand?.GetLineNo()}) \"{sourceCommand?.Line}\"");
- }
- };
- Console.WriteLine($"Set machining step event.");
- //show MRR.
- localProjectService.RuntimeApi.MachiningStepBuilt += (preStep, curStep) =>
- {
- var sourceCommand = curStep.SourceCommand;
- if (curStep.Mrr_mm3ds > 500) //show only the step that contains large MRR.
- Console.WriteLine($"MRR = {curStep.Mrr_mm3ds} At \"{sourceCommand?.FilePath}\" (Line {sourceCommand?.GetLineNo()}) \"{sourceCommand?.Line}\"");
- };
- #endregion
+ }
+ };
+ Console.WriteLine($"Set machining step event.");
+ //show MRR.
+ localProjectService.RuntimeApi.MachiningStepBuilt += (preStep, curStep) =>
+ {
+ var sourceCommand = curStep.SourceCommand;
+ var indexedFileLine=sourceCommand?.GetSentence()?.IndexedFileLine;
+ 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}\"");
+ };
+ #endregion
- #region MachiningExecution
- Console.WriteLine($"Reset runtime status.");
- localProjectService.ResetRuntime();
+ #region MachiningExecution
+ Console.WriteLine($"Reset runtime status.");
+ localProjectService.ResetRuntime();
- Console.WriteLine($"Session begin.");
- 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
+ Console.WriteLine($"Session begin.");
+ 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
- #region CleanupResources
- Console.WriteLine($"Close Project: {projectPath}");
- machiningProject.Dispose();
+ #region CleanupResources
+ Console.WriteLine($"Close Project: {projectPath}");
+ machiningProject.Dispose();
- LocalApp.AppEnd();
+ LocalApp.AppEnd();
- Console.WriteLine($"Program end.");
- #endregion
- }
- }
+ Console.WriteLine($"Program end.");
+ #endregion
+ }
}