71 lines
2.5 KiB
C#
71 lines
2.5 KiB
C#
using Hi.Wpf.Disp;
|
|
using System;
|
|
using Hi.MongoUtils;
|
|
using Hi.Licenses;
|
|
using Hi.MachiningProcs;
|
|
using Hi.Common.FileLines;
|
|
using Hi.MillingSteps;
|
|
using System.Windows;
|
|
using Hi.Disp;
|
|
|
|
namespace Hi.Sample.Wpf.Machining
|
|
{
|
|
class DemoRenderingMachiningProcessAndStripPosSelection
|
|
{
|
|
[STAThread]
|
|
public static void Main(string[] args)
|
|
{
|
|
#region Initialize Environment
|
|
License.LogInAll();
|
|
DispEngine.Init();
|
|
MongoServer.Default = MongoServer.Run(new MongoRunnerOptions()
|
|
{
|
|
MongoPort = 28100
|
|
});
|
|
#endregion
|
|
|
|
#region Load Machining Project
|
|
var projectPath = "C:/HiNC-Projects/DemoStandardPath/Main.hincproj";
|
|
Console.WriteLine($"Load Project: {projectPath}");
|
|
MachiningProject machiningProject = MachiningProject.LoadFile(projectPath);
|
|
|
|
machiningProject.ShellApi.MillingStepSelected += (MillingStep step) =>
|
|
{
|
|
var sourceCommand = step.SourceCommand;
|
|
Console.WriteLine($"Step Selected: MRR = {step.Mrr_mm3ds} At \"{sourceCommand?.FilePath}\" (Line {sourceCommand?.GetLineNo()}) \"{sourceCommand?.Line}\"");
|
|
};
|
|
machiningProject.PacePlayer.Start();
|
|
#endregion
|
|
|
|
#region Configure Rendering Options
|
|
var projectDisplayee = new MachiningProjectDisplayee(machiningProject);
|
|
projectDisplayee.RenderingFlagBitArray[(int)RenderingFlag.Mech] = true;
|
|
projectDisplayee.RenderingFlagBitArray[(int)RenderingFlag.Fixture] = true;
|
|
projectDisplayee.RenderingFlagBitArray[(int)RenderingFlag.WorkpieceGeom] = true;
|
|
projectDisplayee.RenderingFlagBitArray[(int)RenderingFlag.ClStrip] = true;
|
|
projectDisplayee.RenderingFlagBitArray[(int)RenderingFlag.DimensionBar] = true;
|
|
#endregion
|
|
|
|
#region Create and Run WPF Application
|
|
Application app = new Application
|
|
{
|
|
ShutdownMode = ShutdownMode.OnMainWindowClose
|
|
};
|
|
app.Exit += (o, e) =>
|
|
{
|
|
machiningProject.Dispose();
|
|
MongoServer.Default.Dispose();
|
|
DispEngine.FinishDisp();
|
|
License.LogOutAll();
|
|
Console.WriteLine($"App exit.");
|
|
};
|
|
app.Run(new RenderingWindow()
|
|
{
|
|
Title = "Demo",
|
|
Displayee = projectDisplayee
|
|
});
|
|
#endregion
|
|
}
|
|
}
|
|
}
|