add geom GUI to HiNC-2025-win-desktop.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user