add geom GUI to HiNC-2025-win-desktop.
This commit is contained in:
parent
784184d6ce
commit
953711bf01
58
Common/DemoMessageAndExceptionHandling.cs
Normal file
58
Common/DemoMessageAndExceptionHandling.cs
Normal file
@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Hi.Common;
|
||||
using Hi.Common.Messages;
|
||||
|
||||
namespace Sample.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Demonstrates common message and exception handling patterns in HiAPI applications
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// ### Source Code
|
||||
/// [!code-csharp[SampleCode](~/../Hi.Sample/Common/DemoMessageAndExceptionHandling.cs)]
|
||||
/// </remarks>
|
||||
public static class DemoMessageAndExceptionHandling
|
||||
{
|
||||
/// <summary>
|
||||
/// Demonstrates normal message handling
|
||||
/// </summary>
|
||||
internal static void DemoNormalMessages()
|
||||
{
|
||||
#region Normal_Messages
|
||||
MessageKit.AddMessage("Operation completed successfully.");
|
||||
MessageKit.AddWarning("Please check your input.");
|
||||
#endregion
|
||||
}
|
||||
/// <summary>
|
||||
/// Demonstrates exception handling in synchronous code
|
||||
/// </summary>
|
||||
internal static void DemoSynchronousExceptionHandling()
|
||||
{
|
||||
#region Sync_Exception
|
||||
try
|
||||
{
|
||||
// Your code here
|
||||
throw new NotImplementedException("Demo exception");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ExceptionUtil.ShowException(ex, null);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
/// <summary>
|
||||
/// Demonstrates exception handling in asynchronous code
|
||||
/// </summary>
|
||||
internal static async Task DemoAsynchronousExceptionHandling()
|
||||
{
|
||||
#region Async_Exception
|
||||
await Task.Run(() =>
|
||||
{
|
||||
// Your async operation here
|
||||
throw new NotImplementedException("Demo async exception");
|
||||
}).ShowIfCatched(null);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
148
Common/DemoSessionMessage.cs
Normal file
148
Common/DemoSessionMessage.cs
Normal file
@ -0,0 +1,148 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Hi.Common;
|
||||
using Hi.Common.FileLines;
|
||||
using Hi.Geom;
|
||||
using Hi.HiNcKits;
|
||||
using Hi.MachiningProcs;
|
||||
using Hi.MachiningSteps;
|
||||
using Hi.Mech;
|
||||
using Hi.Mech.Topo;
|
||||
using Hi.Numerical;
|
||||
|
||||
namespace Sample.Common
|
||||
{
|
||||
/// <remarks>
|
||||
/// ### Source Code
|
||||
/// [!code-csharp[SampleCode](~/../Hi.Sample/Common/DemoSessionMessage.cs)]
|
||||
/// </remarks>
|
||||
public static class DemoSessionMessage
|
||||
{
|
||||
#region Demo_UseSessionMessageHost
|
||||
internal static void DemoUseSessionMessageHost(MachiningProject project)
|
||||
{
|
||||
SessionMessageHost sessionMessageHost = project.SessionMessageHost;
|
||||
|
||||
SessionMessageHost.FilterFlag filterFlags =
|
||||
SessionMessageHost.FilterFlag.NC |
|
||||
SessionMessageHost.FilterFlag.Progress |
|
||||
SessionMessageHost.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}");
|
||||
|
||||
// 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
|
||||
|
||||
internal static void DemoUseSessionMessageHost2(MachiningProject project)
|
||||
{
|
||||
SessionMessageHost sessionMessageHost = project.SessionMessageHost;
|
||||
IMachiningChain machiningChain = project.MachiningEquipment?.MachiningChain;
|
||||
|
||||
PresentAttribute mrrPresent = typeof(MachiningStep).GetProperty(nameof(MachiningStep.Mrr_mm3ds)).GetCustomAttribute<PresentAttribute>();
|
||||
string mrrUnit = mrrPresent?.TailUnitString;
|
||||
string mrrFormat = mrrPresent?.DataFormatString;
|
||||
PresentAttribute torquePresent = typeof(MachiningStep).GetProperty(nameof(MachiningStep.AvgAbsTorque_Nm)).GetCustomAttribute<PresentAttribute>();
|
||||
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);
|
||||
|
||||
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.NC
|
||||
var nc = sessionMessage.DirectInstantSourceCommand;
|
||||
if (nc != null)
|
||||
{
|
||||
Console.Write($"Message/NC: {nc.Line}; File: {nc.FilePath}; LineNo: {nc.GetLineNo()}; ");
|
||||
if (nc is NcLine 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(
|
||||
UserEnv 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
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Hi.Geom;
|
||||
using Hi.Mech.Topo;
|
||||
|
||||
@ -29,6 +30,7 @@ namespace Sample.Geom
|
||||
LongitudeNum = 30
|
||||
};
|
||||
Stl stl = new Stl("geom.stl");
|
||||
StlFile stlFile = new StlFile("geom.stl");
|
||||
TransformationGeom transformationGeom = new TransformationGeom()
|
||||
{
|
||||
Transformer = new GeneralTransform(1,
|
||||
@ -36,7 +38,9 @@ namespace Sample.Geom
|
||||
new StaticTranslation(new Vec3d(0, 0, 0))),
|
||||
Geom = stl
|
||||
};
|
||||
return new List<IGetStl>([box, cylindroid, stl, transformationGeom]);
|
||||
GeomCombination geomCombination = new GeomCombination(stlFile, transformationGeom);
|
||||
return new List<IGetStl>([box, cylindroid, stl, stlFile, transformationGeom]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Hi.Disp;
|
||||
using Hi.HiNcKits;
|
||||
using Hi.Licenses;
|
||||
using Hi.MongoUtils;
|
||||
using System;
|
||||
@ -20,18 +21,11 @@ namespace Sample
|
||||
static int Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("HiAPI starting.");
|
||||
License.LogInAll();
|
||||
DispEngine.Init();
|
||||
MongoServer.Default = MongoServer.Run(new MongoRunnerOptions()
|
||||
{
|
||||
MongoPort = 28100
|
||||
});
|
||||
SingleUserApp.AppBegin();
|
||||
|
||||
Console.WriteLine("Hello World! HiAPI.");
|
||||
|
||||
MongoServer.Default.Dispose();
|
||||
DispEngine.FinishDisp();
|
||||
License.LogOutAll();
|
||||
SingleUserApp.AppEnd();
|
||||
Console.WriteLine("HiAPI exited.");
|
||||
|
||||
return 0;
|
||||
|
@ -80,7 +80,5 @@ namespace Sample.MachineTool
|
||||
public CodeXyzabcMachineTool GetXyzabcMachineTool() => MachineTool;
|
||||
/// <inheritdoc/>
|
||||
public IMachiningChain GetMachiningChain() => MachineTool;
|
||||
/// <inheritdoc/>
|
||||
public ISolidMachiningChain GetSolidMachiningChain() => MachineTool;
|
||||
}
|
||||
}
|
||||
|
98
Machining/DemoBuildGeomOnlyMachiningProject.cs
Normal file
98
Machining/DemoBuildGeomOnlyMachiningProject.cs
Normal file
@ -0,0 +1,98 @@
|
||||
using Hi.Common.XmlUtils;
|
||||
using Hi.Geom;
|
||||
using Hi.MachiningProcs;
|
||||
using Hi.Mech.Topo;
|
||||
using Hi.Milling.Apts;
|
||||
using Hi.Milling.Cutters;
|
||||
using Hi.MongoUtils;
|
||||
using Hi.NcMech.Fixtures;
|
||||
using Hi.NcMech.Workpieces;
|
||||
using Hi.NcMech.Xyzabc;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System;
|
||||
using Hi.NcMech.Holders;
|
||||
using Hi.Licenses;
|
||||
using Hi.Machining;
|
||||
using Hi.MillingMech.MillingTools;
|
||||
using Hi.HiNcKits;
|
||||
|
||||
namespace Sample.Machining
|
||||
{
|
||||
public static class DemoBuildGeomOnlyMachiningProject
|
||||
{
|
||||
internal static MillingCutter CreateGeomOnlyMillingCutter()
|
||||
{
|
||||
MillingCutter millingCutter = new MillingCutter()
|
||||
{
|
||||
UpperBeamGeom = new TransformationGeom()
|
||||
};
|
||||
|
||||
double diameter_mm = 12;
|
||||
millingCutter.ShaperProfile = new AptProfile(millingCutter,
|
||||
new ColumnApt()
|
||||
{
|
||||
Diameter_mm = diameter_mm,
|
||||
FluteHeight_mm = 40
|
||||
});
|
||||
|
||||
return millingCutter;
|
||||
}
|
||||
|
||||
static void Main()
|
||||
{
|
||||
SingleUserApp.AppBegin();
|
||||
|
||||
var projectPath = "C:/HiNC-Projects/NewProject/Main.hincproj";
|
||||
var projectDirectory = Path.GetDirectoryName(projectPath);
|
||||
Console.WriteLine($"Directory of the New Project: {projectDirectory}");
|
||||
MachiningProject machiningProject = new MachiningProject(projectDirectory);
|
||||
|
||||
CylindroidHolder cylindroidHolder = new CylindroidHolder()
|
||||
{
|
||||
Note = "BT40",
|
||||
Cylindroid = new Cylindroid()
|
||||
{
|
||||
PairZrs = new List<PairZr>([ new PairZr(0,12),new PairZr(20,12),
|
||||
new PairZr(20,16),new PairZr(30,16)]),
|
||||
LongitudeNum = 30
|
||||
}
|
||||
};
|
||||
machiningProject.MachiningToolHouse = new MachiningToolHouse()
|
||||
{
|
||||
[1] = new MillingTool()
|
||||
{
|
||||
Note = "T1",
|
||||
PreservedDistanceBetweenFluteAndSpindleNose_mm = 8,
|
||||
Holder = cylindroidHolder,
|
||||
Cutter = CreateGeomOnlyMillingCutter()
|
||||
},
|
||||
};
|
||||
|
||||
machiningProject.MachiningEquipment.Fixture = new Fixture()
|
||||
{
|
||||
Geom = new Box3d(new Vec3d(-40, -40, 0), new Vec3d(40, 40, 10)),
|
||||
GeomToWorkpieceTransformer = new StaticTranslation(new Vec3d(0, 0, 10)),
|
||||
};
|
||||
|
||||
machiningProject.MachiningEquipment.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)),
|
||||
};
|
||||
|
||||
machiningProject.MachiningEquipment.MachiningChain
|
||||
= XFactory.Default.GenByFile<CodeXyzabcMachineTool>(
|
||||
"Resource", "MachineTool/PMC-B1/PMC-B1.mt", GenMode.Default);
|
||||
machiningProject.MachiningEquipment.MachiningChainFile = "PMC-B1/PMC-B1.mt";
|
||||
|
||||
machiningProject.MakeXmlSourceFile(projectPath);
|
||||
|
||||
machiningProject.Dispose();
|
||||
SingleUserApp.AppEnd();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -15,17 +15,16 @@ using Hi.NcMech.Workpieces;
|
||||
using Hi.NcMech.Xyzabc;
|
||||
using Hi.NcOpt;
|
||||
using Hi.Physics;
|
||||
using Hi.MongoUtils;
|
||||
using Hi.Licenses;
|
||||
using Hi.MachiningProcs;
|
||||
using System.IO;
|
||||
using Hi.HiNcKits;
|
||||
|
||||
namespace Sample.Machining
|
||||
{
|
||||
/// <summary>
|
||||
/// Demonstrates how to create and configure a <see cref="MachiningProject"/> programmatically.
|
||||
/// This sample shows how to set up <see cref="MillingCutter"/>, <see cref="CylindroidHolder"/>,
|
||||
/// <see cref="StickMachiningTool"/>, <see cref="Fixture"/>, <see cref="Workpiece"/>,
|
||||
/// <see cref="MillingTool"/>, <see cref="Fixture"/>, <see cref="Workpiece"/>,
|
||||
/// and save the project configuration to a file.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
@ -34,8 +33,26 @@ namespace Sample.Machining
|
||||
/// </remarks>
|
||||
public static class DemoBuildMachiningProject
|
||||
{
|
||||
internal static CylindroidHolder CreateCylindroidHolder()
|
||||
{
|
||||
#region ConfigureHolder
|
||||
CylindroidHolder cylindroidHolder = new CylindroidHolder()
|
||||
{
|
||||
Note = "BT40",
|
||||
Cylindroid = new Cylindroid()
|
||||
{
|
||||
PairZrs = new List<PairZr>([ new PairZr(0,12),new PairZr(20,12),
|
||||
new PairZr(20,16),new PairZr(30,16)]),
|
||||
LongitudeNum = 30
|
||||
}
|
||||
};
|
||||
#endregion
|
||||
return cylindroidHolder;
|
||||
}
|
||||
|
||||
|
||||
#region CreateMillingCutter1
|
||||
private static MillingCutter CreateMillingCutter1()
|
||||
internal static MillingCutter CreateMillingCutter1()
|
||||
{
|
||||
MillingCutter millingCutter = new MillingCutter()
|
||||
{
|
||||
@ -91,7 +108,7 @@ namespace Sample.Machining
|
||||
#endregion
|
||||
|
||||
#region CreateMillingCutter2
|
||||
private static MillingCutter CreateMillingCutter2()
|
||||
internal static MillingCutter CreateMillingCutter2()
|
||||
{
|
||||
MillingCutter millingCutter = new MillingCutter()
|
||||
{
|
||||
@ -137,55 +154,35 @@ namespace Sample.Machining
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Console.WriteLine($"License Login.");
|
||||
License.LogInAll();
|
||||
|
||||
Console.WriteLine($"Start Database.");
|
||||
MongoServer.Default = MongoServer.Run(new MongoRunnerOptions()
|
||||
{
|
||||
MongoPort = 28100
|
||||
});
|
||||
SingleUserApp.AppBegin();
|
||||
|
||||
var projectPath = "C:/HiNC-Projects/NewProject/Main.hincproj";
|
||||
var projectDirectory = Path.GetDirectoryName(projectPath);
|
||||
Console.WriteLine($"Directory of the New Project: {projectDirectory}");
|
||||
MachiningProject machiningProject = new MachiningProject(projectDirectory);
|
||||
|
||||
#region ConfigureHolder
|
||||
CylindroidHolder cylindroidHolder = new CylindroidHolder()
|
||||
{
|
||||
Note = "BT40",
|
||||
Cylindroid = new Cylindroid()
|
||||
{
|
||||
PairZrs = new List<PairZr>([ new PairZr(0,12),new PairZr(20,12),
|
||||
new PairZr(20,16),new PairZr(30,16)]),
|
||||
LongitudeNum = 30
|
||||
}
|
||||
};
|
||||
#endregion
|
||||
|
||||
#region ConfigureMachiningToolHouse
|
||||
machiningProject.MachiningToolHouse = new MachiningToolHouse()
|
||||
{
|
||||
[1] = new StickMachiningTool()
|
||||
[1] = new MillingTool()
|
||||
{
|
||||
Note = "T1",
|
||||
PreservedDistanceBetweenFluteAndSpindleNose_mm = 8,
|
||||
Holder = cylindroidHolder,
|
||||
Holder = CreateCylindroidHolder(),
|
||||
Cutter = CreateMillingCutter1()
|
||||
},
|
||||
[2] = new StickMachiningTool()
|
||||
[2] = new MillingTool()
|
||||
{
|
||||
Note = "T2",
|
||||
PreservedDistanceBetweenFluteAndSpindleNose_mm = 8,
|
||||
Holder = cylindroidHolder,
|
||||
Holder = CreateCylindroidHolder(),
|
||||
Cutter = CreateMillingCutter2()
|
||||
},
|
||||
[3] = new StickMachiningTool()
|
||||
[3] = new MillingTool()
|
||||
{
|
||||
Note = "T3",
|
||||
PreservedDistanceBetweenFluteAndSpindleNose_mm = 8,
|
||||
Holder = cylindroidHolder,
|
||||
Holder = CreateCylindroidHolder(),
|
||||
Cutter = CreateMillingCutter1()
|
||||
},
|
||||
};
|
||||
@ -195,7 +192,7 @@ namespace Sample.Machining
|
||||
machiningProject.MachiningEquipment.Fixture = new Fixture()
|
||||
{
|
||||
Geom = new Box3d(new Vec3d(-40, -40, 0), new Vec3d(40, 40, 10)),
|
||||
TableToWorkpieceTransformer = new StaticTranslation(new Vec3d(0, 0, 10)),
|
||||
GeomToWorkpieceTransformer = new StaticTranslation(new Vec3d(0, 0, 10)),
|
||||
};
|
||||
#endregion
|
||||
|
||||
@ -214,12 +211,15 @@ namespace Sample.Machining
|
||||
#endregion
|
||||
|
||||
#region ConfigureMachineChain
|
||||
machiningProject.MachiningEquipment.SolidMachiningChain
|
||||
machiningProject.MachiningEquipment.MachiningChain
|
||||
= XFactory.Default.GenByFile<CodeXyzabcMachineTool>(
|
||||
"Resource/MachineTool", "PMC-B1/PMC-B1.mt", GenMode.Default);
|
||||
"Resource", "MachineTool/PMC-B1/PMC-B1.mt", GenMode.Default);
|
||||
#endregion
|
||||
|
||||
machiningProject.MakeXmlSourceFile(projectPath);
|
||||
|
||||
machiningProject.Dispose();
|
||||
SingleUserApp.AppEnd();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
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
|
||||
{
|
||||
@ -21,16 +20,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
|
||||
SingleUserApp.AppBegin();
|
||||
|
||||
#region ProjectLoading
|
||||
var projectPath = "C:/HiNC-Projects/DemoStandardPath/Main.hincproj";
|
||||
@ -45,7 +35,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}\"");
|
||||
@ -82,11 +72,7 @@ namespace Sample.Machining
|
||||
Console.WriteLine($"Close Project: {projectPath}");
|
||||
machiningProject.Dispose();
|
||||
|
||||
Console.WriteLine($"Close Database.");
|
||||
MongoServer.Default.Dispose();
|
||||
|
||||
Console.WriteLine($"License Logout.");
|
||||
License.LogOutAll();
|
||||
SingleUserApp.AppEnd();
|
||||
|
||||
Console.WriteLine($"Program end.");
|
||||
#endregion
|
||||
|
Loading…
x
Reference in New Issue
Block a user