add ChartRange to ClStrip.
This commit is contained in:
parent
901a1181e2
commit
fece18d725
@ -22,9 +22,9 @@ namespace Sample.Common
|
|||||||
public static class DemoSessionMessage
|
public static class DemoSessionMessage
|
||||||
{
|
{
|
||||||
#region Demo_UseSessionMessageHost
|
#region Demo_UseSessionMessageHost
|
||||||
internal static void DemoUseSessionMessageHost(MachiningProject project)
|
internal static void DemoUseSessionMessageHost(LocalProjectService localProjectService)
|
||||||
{
|
{
|
||||||
SessionMessageHost sessionMessageHost = project.SessionMessageHost;
|
SessionMessageHost sessionMessageHost = localProjectService.SessionMessageHost;
|
||||||
|
|
||||||
SessionMessageHost.FilterFlag filterFlags =
|
SessionMessageHost.FilterFlag filterFlags =
|
||||||
SessionMessageHost.FilterFlag.NC |
|
SessionMessageHost.FilterFlag.NC |
|
||||||
@ -58,10 +58,10 @@ namespace Sample.Common
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
internal static void DemoUseSessionMessageHost2(MachiningProject project)
|
internal static void DemoUseSessionMessageHost2(LocalProjectService localProjectService)
|
||||||
{
|
{
|
||||||
SessionMessageHost sessionMessageHost = project.SessionMessageHost;
|
SessionMessageHost sessionMessageHost = localProjectService.SessionMessageHost;
|
||||||
IMachiningChain machiningChain = project.MachiningEquipment?.MachiningChain;
|
IMachiningChain machiningChain = localProjectService.MachiningChain;
|
||||||
|
|
||||||
PresentAttribute mrrPresent = typeof(MachiningStep).GetProperty(nameof(MachiningStep.Mrr_mm3ds)).GetCustomAttribute<PresentAttribute>();
|
PresentAttribute mrrPresent = typeof(MachiningStep).GetProperty(nameof(MachiningStep.Mrr_mm3ds)).GetCustomAttribute<PresentAttribute>();
|
||||||
string mrrUnit = mrrPresent?.TailUnitString;
|
string mrrUnit = mrrPresent?.TailUnitString;
|
||||||
|
|||||||
@ -43,11 +43,13 @@ namespace Sample.Machining
|
|||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
LocalApp.AppBegin();
|
LocalApp.AppBegin();
|
||||||
|
LocalProjectService localProjectService = new LocalProjectService();
|
||||||
|
|
||||||
var projectPath = "C:/HiNC-Projects/NewProject/Main.hincproj";
|
var projectPath = "C:/HiNC-Projects/NewProject/Main.hincproj";
|
||||||
var projectDirectory = Path.GetDirectoryName(projectPath);
|
var projectDirectory = Path.GetDirectoryName(projectPath);
|
||||||
Console.WriteLine($"Directory of the New Project: {projectDirectory}");
|
Console.WriteLine($"Directory of the New Project: {projectDirectory}");
|
||||||
MachiningProject machiningProject = new MachiningProject(projectDirectory);
|
localProjectService.LoadProject(projectPath);
|
||||||
|
MachiningProject machiningProject = localProjectService.MachiningProject;
|
||||||
|
|
||||||
CylindroidHolder cylindroidHolder = new CylindroidHolder()
|
CylindroidHolder cylindroidHolder = new CylindroidHolder()
|
||||||
{
|
{
|
||||||
@ -55,7 +57,7 @@ namespace Sample.Machining
|
|||||||
Cylindroid = new Cylindroid([ new PairZr(0,12),new PairZr(20,12),
|
Cylindroid = new Cylindroid([ new PairZr(0,12),new PairZr(20,12),
|
||||||
new PairZr(20,16),new PairZr(30,16)])
|
new PairZr(20,16),new PairZr(30,16)])
|
||||||
};
|
};
|
||||||
machiningProject.MachiningToolHouse = new MachiningToolHouse()
|
localProjectService.MachiningToolHouse = new MachiningToolHouse()
|
||||||
{
|
{
|
||||||
[1] = new MillingTool()
|
[1] = new MillingTool()
|
||||||
{
|
{
|
||||||
@ -66,13 +68,13 @@ namespace Sample.Machining
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
machiningProject.MachiningEquipment.Fixture = new Fixture()
|
localProjectService.Fixture = new Fixture()
|
||||||
{
|
{
|
||||||
Geom = new Box3d(new Vec3d(-40, -40, 0), new Vec3d(40, 40, 10)),
|
Geom = new Box3d(new Vec3d(-40, -40, 0), new Vec3d(40, 40, 10)),
|
||||||
GeomToWorkpieceTransformer = new StaticTranslation(new Vec3d(0, 0, 10)),
|
GeomToWorkpieceTransformer = new StaticTranslation(new Vec3d(0, 0, 10)),
|
||||||
};
|
};
|
||||||
|
|
||||||
machiningProject.MachiningEquipment.Workpiece = new Workpiece()
|
localProjectService.Workpiece = new Workpiece()
|
||||||
{
|
{
|
||||||
InitResolution = 0.25,
|
InitResolution = 0.25,
|
||||||
InitGeom = new Box3d(0, 0, -50, 70, 50, 0),
|
InitGeom = new Box3d(0, 0, -50, 70, 50, 0),
|
||||||
@ -80,12 +82,12 @@ namespace Sample.Machining
|
|||||||
WorkpieceGeomToFixtureBuckleTransformer = new StaticTranslation(new Vec3d(0, 0, 0)),
|
WorkpieceGeomToFixtureBuckleTransformer = new StaticTranslation(new Vec3d(0, 0, 0)),
|
||||||
};
|
};
|
||||||
|
|
||||||
machiningProject.MachiningEquipment.MachiningChain
|
localProjectService.MachiningChain
|
||||||
= XFactory.GenByFile<CodeXyzabcMachineTool>(
|
= XFactory.GenByFile<CodeXyzabcMachineTool>(
|
||||||
"Resource", "MachineTool/PMC-B1/PMC-B1.mt", GenMode.Default);
|
"Resource", "MachineTool/PMC-B1/PMC-B1.mt", GenMode.Default);
|
||||||
machiningProject.MachiningEquipment.MachiningChainFile = "PMC-B1/PMC-B1.mt";
|
localProjectService.MachiningChainFile = "PMC-B1/PMC-B1.mt";
|
||||||
|
|
||||||
machiningProject.MakeXmlSourceFile(projectPath);
|
localProjectService.SaveProject();
|
||||||
|
|
||||||
machiningProject.Dispose();
|
machiningProject.Dispose();
|
||||||
LocalApp.AppEnd();
|
LocalApp.AppEnd();
|
||||||
|
|||||||
@ -143,14 +143,16 @@ namespace Sample.Machining
|
|||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
LocalApp.AppBegin();
|
LocalApp.AppBegin();
|
||||||
|
LocalProjectService localProjectService = new LocalProjectService();
|
||||||
|
|
||||||
var projectPath = "C:/HiNC-Projects/NewProject/Main.hincproj";
|
var projectPath = "C:/HiNC-Projects/NewProject/Main.hincproj";
|
||||||
var projectDirectory = Path.GetDirectoryName(projectPath);
|
var projectDirectory = Path.GetDirectoryName(projectPath);
|
||||||
Console.WriteLine($"Directory of the New Project: {projectDirectory}");
|
Console.WriteLine($"Directory of the New Project: {projectDirectory}");
|
||||||
MachiningProject machiningProject = new MachiningProject(projectDirectory);
|
localProjectService.LoadProject(projectPath);
|
||||||
|
MachiningProject machiningProject = localProjectService.MachiningProject;
|
||||||
|
|
||||||
#region ConfigureMachiningToolHouse
|
#region ConfigureMachiningToolHouse
|
||||||
machiningProject.MachiningToolHouse = new MachiningToolHouse()
|
localProjectService.MachiningToolHouse = new MachiningToolHouse()
|
||||||
{
|
{
|
||||||
[1] = new MillingTool()
|
[1] = new MillingTool()
|
||||||
{
|
{
|
||||||
@ -177,7 +179,7 @@ namespace Sample.Machining
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ConfigureFixture
|
#region ConfigureFixture
|
||||||
machiningProject.MachiningEquipment.Fixture = new Fixture()
|
localProjectService.Fixture = new Fixture()
|
||||||
{
|
{
|
||||||
Geom = new Box3d(new Vec3d(-40, -40, 0), new Vec3d(40, 40, 10)),
|
Geom = new Box3d(new Vec3d(-40, -40, 0), new Vec3d(40, 40, 10)),
|
||||||
GeomToWorkpieceTransformer = new StaticTranslation(new Vec3d(0, 0, 10)),
|
GeomToWorkpieceTransformer = new StaticTranslation(new Vec3d(0, 0, 10)),
|
||||||
@ -185,7 +187,7 @@ namespace Sample.Machining
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ConfigureWorkpiece
|
#region ConfigureWorkpiece
|
||||||
machiningProject.MachiningEquipment.Workpiece = new Workpiece()
|
localProjectService.Workpiece = new Workpiece()
|
||||||
{
|
{
|
||||||
InitResolution = 0.25,
|
InitResolution = 0.25,
|
||||||
InitGeom = new Box3d(0, 0, -50, 70, 50, 0),
|
InitGeom = new Box3d(0, 0, -50, 70, 50, 0),
|
||||||
@ -199,7 +201,7 @@ namespace Sample.Machining
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ConfigureMachineChain
|
#region ConfigureMachineChain
|
||||||
machiningProject.MachiningEquipment.MachiningChain
|
localProjectService.MachiningChain
|
||||||
= XFactory.GenByFile<CodeXyzabcMachineTool>(
|
= XFactory.GenByFile<CodeXyzabcMachineTool>(
|
||||||
"Resource", "MachineTool/PMC-B1/PMC-B1.mt", GenMode.Default);
|
"Resource", "MachineTool/PMC-B1/PMC-B1.mt", GenMode.Default);
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -22,11 +22,13 @@ namespace Sample.Machining
|
|||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
LocalApp.AppBegin();
|
LocalApp.AppBegin();
|
||||||
|
LocalProjectService localProjectService = new LocalProjectService();
|
||||||
|
|
||||||
#region ProjectLoading
|
#region ProjectLoading
|
||||||
var projectPath = "C:/HiNC-Projects/DemoStandardPath/Main.hincproj";
|
var projectPath = "C:/HiNC-Projects/DemoStandardPath/Main.hincproj";
|
||||||
Console.WriteLine($"Load Project: {projectPath}");
|
Console.WriteLine($"Load Project: {projectPath}");
|
||||||
MachiningProject machiningProject = MachiningProject.LoadFile(projectPath);
|
localProjectService.LoadProject(projectPath);
|
||||||
|
MachiningProject machiningProject = localProjectService.MachiningProject;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region EventHandling
|
#region EventHandling
|
||||||
@ -34,7 +36,7 @@ namespace Sample.Machining
|
|||||||
|
|
||||||
using StreamWriter writer = new StreamWriter("msg.txt");
|
using StreamWriter writer = new StreamWriter("msg.txt");
|
||||||
//show message if something abnormal.
|
//show message if something abnormal.
|
||||||
machiningProject.SessionMessageHost.CollectionItemAdded += pack =>
|
localProjectService.SessionMessageHost.CollectionItemAdded += pack =>
|
||||||
{
|
{
|
||||||
if (pack.Tags.Contains(MessageFlag.Warning.ToString()) ||
|
if (pack.Tags.Contains(MessageFlag.Warning.ToString()) ||
|
||||||
pack.Tags.Contains(MessageFlag.Error.ToString()) ||
|
pack.Tags.Contains(MessageFlag.Error.ToString()) ||
|
||||||
@ -46,7 +48,7 @@ namespace Sample.Machining
|
|||||||
};
|
};
|
||||||
Console.WriteLine($"Set machining step event.");
|
Console.WriteLine($"Set machining step event.");
|
||||||
//show MRR.
|
//show MRR.
|
||||||
machiningProject.RuntimeApi.MachiningStepBuilt += (preStep, curStep) =>
|
localProjectService.RuntimeApi.MachiningStepBuilt += (preStep, curStep) =>
|
||||||
{
|
{
|
||||||
var sourceCommand = curStep.SourceCommand;
|
var sourceCommand = curStep.SourceCommand;
|
||||||
if (curStep.Mrr_mm3ds > 500) //show only the step that contains large MRR.
|
if (curStep.Mrr_mm3ds > 500) //show only the step that contains large MRR.
|
||||||
@ -56,18 +58,18 @@ namespace Sample.Machining
|
|||||||
|
|
||||||
#region MachiningExecution
|
#region MachiningExecution
|
||||||
Console.WriteLine($"Reset runtime status.");
|
Console.WriteLine($"Reset runtime status.");
|
||||||
machiningProject.ResetRuntime();
|
localProjectService.ResetRuntime();
|
||||||
|
|
||||||
Console.WriteLine($"Session begin.");
|
Console.WriteLine($"Session begin.");
|
||||||
machiningProject.BeginSession();
|
localProjectService.BeginSession();
|
||||||
machiningProject.RuntimeApi.MachiningResolution_mm = 1;
|
localProjectService.RuntimeApi.MachiningResolution_mm = 1;
|
||||||
machiningProject.RuntimeApi.EnableCollisionDetection = true;
|
localProjectService.RuntimeApi.EnableCollisionDetection = true;
|
||||||
machiningProject.RuntimeApi.EnablePauseOnFailure = false;
|
localProjectService.RuntimeApi.EnablePauseOnFailure = false;
|
||||||
machiningProject.RuntimeApi.EnablePhysics = false;
|
localProjectService.RuntimeApi.EnablePhysics = false;
|
||||||
//the path from Shell-API is relative by project directory.
|
//the path from Shell-API is relative by project directory.
|
||||||
machiningProject.RuntimeApi.PlayNcFile("NC/side.ptp");
|
localProjectService.RuntimeApi.PlayNcFile("NC/side.ptp");
|
||||||
machiningProject.RuntimeApi.PlayNcFile("NC/circle.ptp");
|
localProjectService.RuntimeApi.PlayNcFile("NC/circle.ptp");
|
||||||
machiningProject.EndSession();
|
localProjectService.EndSession();
|
||||||
Console.WriteLine($"Session end.");
|
Console.WriteLine($"Session end.");
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user