tune
This commit is contained in:
+11
-25
@@ -153,11 +153,10 @@ 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;
|
||||
using Hi.Licenses;
|
||||
using Hi.Common.Messages;
|
||||
using Hi.MachiningProcs;
|
||||
using Hi.Common.FileLines;
|
||||
using Hi.MongoUtils;
|
||||
using Hi.HiNcKits;
|
||||
|
||||
namespace Sample.Machining
|
||||
{
|
||||
@@ -175,16 +174,7 @@ namespace Sample.Machining
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
#region LicenseAndDatabaseSetup
|
||||
Console.WriteLine($"License Login.");
|
||||
License.LogInAll();
|
||||
|
||||
Console.WriteLine($"Start Database.");
|
||||
MongoServer.Default = MongoServer.Run(new MongoRunnerOptions()
|
||||
{
|
||||
MongoPort = 28100
|
||||
});
|
||||
#endregion
|
||||
LocalApp.AppBegin();
|
||||
|
||||
#region ProjectLoading
|
||||
var projectPath = "C:/HiNC-Projects/DemoStandardPath/Main.hincproj";
|
||||
@@ -199,7 +189,7 @@ namespace Sample.Machining
|
||||
{
|
||||
if (pack.Tags.Contains(MessageFlag.Warning.ToString()) ||
|
||||
pack.Tags.Contains(MessageFlag.Error.ToString()) ||
|
||||
pack.Tags.Contains(MessageFlag.SysErr.ToString()))
|
||||
pack.Tags.Contains(MessageFlag.Exception.ToString()))
|
||||
{
|
||||
var sourceCommand = pack.SourceCommand;
|
||||
Console.WriteLine($"{pack.Message} At \"{sourceCommand?.FilePath}\" (Line {sourceCommand?.GetLineNo()}) \"{sourceCommand?.Line}\"");
|
||||
@@ -207,7 +197,7 @@ namespace Sample.Machining
|
||||
};
|
||||
Console.WriteLine($"Set machining step event.");
|
||||
//show MRR.
|
||||
machiningProject.ShellApi.MachiningStepBuilt += (preStep, curStep) =>
|
||||
machiningProject.RuntimeController.MachiningStepBuilt += (preStep, curStep) =>
|
||||
{
|
||||
var sourceCommand = curStep.SourceCommand;
|
||||
if (curStep.Mrr_mm3ds > 500) //show only the step that contains large MRR.
|
||||
@@ -221,13 +211,13 @@ namespace Sample.Machining
|
||||
|
||||
Console.WriteLine($"Session begin.");
|
||||
machiningProject.BeginSession();
|
||||
machiningProject.ShellApi.MachiningResolution_mm = 1;
|
||||
machiningProject.ShellApi.EnableCollisionDetection = true;
|
||||
machiningProject.ShellApi.EnablePauseOnCollision = false;
|
||||
machiningProject.ShellApi.EnableMillingForceEvaluation = false;
|
||||
machiningProject.RuntimeController.MachiningResolution_mm = 1;
|
||||
machiningProject.RuntimeController.EnableCollisionDetection = true;
|
||||
machiningProject.RuntimeController.EnablePauseOnFailure = false;
|
||||
machiningProject.RuntimeController.EnablePhysics = false;
|
||||
//the path from Shell-API is relative by project directory.
|
||||
machiningProject.ShellApi.PlayNcFile("NC/side.ptp");
|
||||
machiningProject.ShellApi.PlayNcFile("NC/circle.ptp");
|
||||
machiningProject.RuntimeController.PlayNcFile("NC/side.ptp");
|
||||
machiningProject.RuntimeController.PlayNcFile("NC/circle.ptp");
|
||||
machiningProject.EndSession();
|
||||
Console.WriteLine($"Session end.");
|
||||
#endregion
|
||||
@@ -236,11 +226,7 @@ namespace Sample.Machining
|
||||
Console.WriteLine($"Close Project: {projectPath}");
|
||||
machiningProject.Dispose();
|
||||
|
||||
Console.WriteLine($"Close Database.");
|
||||
MongoServer.Default.Dispose();
|
||||
|
||||
Console.WriteLine($"License Logout.");
|
||||
License.LogOutAll();
|
||||
LocalApp.AppEnd();
|
||||
|
||||
Console.WriteLine($"Program end.");
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user