tune
This commit is contained in:
+58
-70
@@ -99,7 +99,7 @@ Class DemoBuildMachiningProject
|
||||
|
||||
<div class="markdown summary"><p>Demonstrates how to create and configure a <a class="xref" href="../../api/Hi.MachiningProcs.MachiningProject.html">MachiningProject</a> programmatically.
|
||||
This sample shows how to set up <a class="xref" href="../../api/Hi.Milling.Cutters.MillingCutter.html">MillingCutter</a>, <a class="xref" href="../../api/Hi.NcMech.Holders.CylindroidHolder.html">CylindroidHolder</a>,
|
||||
<a class="xref" href="../../api/Hi.MillingMech.MillingTools.StickMachiningTool.html">StickMachiningTool</a>, <a class="xref" href="../../api/Hi.NcMech.Fixtures.Fixture.html">Fixture</a>, <a class="xref" href="../../api/Hi.NcMech.Workpieces.Workpiece.html">Workpiece</a>,
|
||||
<a class="xref" href="../../api/Hi.Milling.MillingTools.MillingTool.html">MillingTool</a>, <a class="xref" href="../../api/Hi.NcMech.Fixtures.Fixture.html">Fixture</a>, <a class="xref" href="../../api/Hi.NcMech.Workpieces.Workpiece.html">Workpiece</a>,
|
||||
and save the project configuration to a file.</p>
|
||||
</div>
|
||||
<div class="markdown conceptual"></div>
|
||||
@@ -153,7 +153,6 @@ and save the project configuration to a file.</p>
|
||||
<h2 id="Sample_Machining_DemoBuildMachiningProject_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 System.Collections.Generic;
|
||||
using Hi.Milling.Apts;
|
||||
using Hi.Common.XmlUtils;
|
||||
using Hi.Geom;
|
||||
@@ -162,24 +161,23 @@ using Hi.Mech.Topo;
|
||||
using Hi.Milling.Cutters;
|
||||
using Hi.Milling.FluteContours;
|
||||
using Hi.MillingForces.Fittings;
|
||||
using Hi.MillingMech.MillingTools;
|
||||
using Hi.NcMech.Fixtures;
|
||||
using Hi.NcMech.Holders;
|
||||
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;
|
||||
using Hi.Milling.MillingTools;
|
||||
|
||||
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>
|
||||
@@ -188,28 +186,37 @@ namespace Sample.Machining
|
||||
/// </remarks>
|
||||
public static class DemoBuildMachiningProject
|
||||
{
|
||||
#region CreateMillingCutter1
|
||||
private static MillingCutter CreateMillingCutter1()
|
||||
internal static CylindroidHolder CreateCylindroidHolder()
|
||||
{
|
||||
MillingCutter millingCutter = new MillingCutter()
|
||||
#region ConfigureHolder
|
||||
CylindroidHolder cylindroidHolder = new CylindroidHolder()
|
||||
{
|
||||
UpperBeamGeom = new TransformationGeom(),
|
||||
MillingCutterOptLimit = new MillingCutterOptLimit()
|
||||
Note = "BT40",
|
||||
Cylindroid = new Cylindroid([ new PairZr(0,12),new PairZr(20,12),
|
||||
new PairZr(20,16),new PairZr(30,16)])
|
||||
};
|
||||
// since the following properties of MillingCutter has self-invoke,
|
||||
// they have to be seperated from the initializer syntex.
|
||||
#endregion
|
||||
return cylindroidHolder;
|
||||
}
|
||||
|
||||
//build ShaperProfile property
|
||||
#region CreateMillingCutter1
|
||||
internal static MillingCutter CreateMillingCutter1()
|
||||
{
|
||||
double diameter_mm = 12;
|
||||
double roundRadius_mm = 0.5;
|
||||
millingCutter.ShaperProfile = new AptProfile(millingCutter,
|
||||
new ColumnApt()
|
||||
{
|
||||
Diameter_mm = diameter_mm,
|
||||
Rc_mm = roundRadius_mm,
|
||||
FluteHeight_mm = 40
|
||||
});
|
||||
|
||||
MillingCutter millingCutter = new MillingCutter()
|
||||
{
|
||||
ShaperProfile = new AptProfile(
|
||||
new ColumnApt()
|
||||
{
|
||||
Diameter_mm = diameter_mm,
|
||||
Rc_mm = roundRadius_mm,
|
||||
FluteHeight_mm = 40
|
||||
}),
|
||||
UpperBeamGeom = new ExtendedCylinder(90),
|
||||
InnerBeamProfile = new FluteDependentRatioProfile(),
|
||||
MillingCutterOptLimit = new MillingCutterOptLimit(),
|
||||
};
|
||||
//build FluteContourTray property
|
||||
double helixAngle_deg = 50;
|
||||
double radialRakeAngle_deg = 15;
|
||||
@@ -237,31 +244,26 @@ namespace Sample.Machining
|
||||
}
|
||||
};
|
||||
|
||||
millingCutter.InnerBeamProfile
|
||||
= new FluteDependentRatioProfile(millingCutter);
|
||||
|
||||
return millingCutter;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region CreateMillingCutter2
|
||||
private static MillingCutter CreateMillingCutter2()
|
||||
internal static MillingCutter CreateMillingCutter2()
|
||||
{
|
||||
MillingCutter millingCutter = new MillingCutter()
|
||||
{
|
||||
UpperBeamGeom = new TransformationGeom(),
|
||||
ShaperProfile = new AptProfile(new ColumnApt()
|
||||
{
|
||||
Diameter_mm = 12,
|
||||
FluteHeight_mm = 40
|
||||
}),
|
||||
UpperBeamGeom = new Cylindroid(
|
||||
[new PairZr(40, 6), new PairZr(90, 6)]),
|
||||
InnerBeamProfile = new FluteDependentRatioProfile(),
|
||||
MillingCutterOptLimit = new MillingCutterOptLimit()
|
||||
};
|
||||
|
||||
//build ShaperProfile property
|
||||
double diameter_mm = 12;
|
||||
millingCutter.ShaperProfile = new AptProfile(millingCutter,
|
||||
new ColumnApt()
|
||||
{
|
||||
Diameter_mm = diameter_mm,
|
||||
FluteHeight_mm = 40
|
||||
});
|
||||
|
||||
//build FluteContourTray property
|
||||
double helixAngle_deg = 50;
|
||||
double radialRakeAngle_deg = 15;
|
||||
@@ -280,66 +282,49 @@ namespace Sample.Machining
|
||||
}
|
||||
};
|
||||
|
||||
millingCutter.InnerBeamProfile
|
||||
= new FluteDependentRatioProfile(millingCutter);
|
||||
|
||||
return millingCutter;
|
||||
}
|
||||
#endregion
|
||||
|
||||
internal static CustomSpinningProfile CreateCustomSpinningProfile()
|
||||
{
|
||||
return new CustomSpinningProfile(
|
||||
new Cylindroid(new PairZr(0, 4), new PairZr(50, 4)));
|
||||
}
|
||||
|
||||
#region TestMethod
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Console.WriteLine($"License Login.");
|
||||
License.LogInAll();
|
||||
|
||||
Console.WriteLine($"Start Database.");
|
||||
MongoServer.Default = MongoServer.Run(new MongoRunnerOptions()
|
||||
{
|
||||
MongoPort = 28100
|
||||
});
|
||||
LocalApp.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()
|
||||
},
|
||||
};
|
||||
@@ -349,7 +334,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
|
||||
|
||||
@@ -360,7 +345,7 @@ namespace Sample.Machining
|
||||
InitGeom = new Box3d(0, 0, -50, 70, 50, 0),
|
||||
IdealGeom = null,
|
||||
WorkpieceGeomToFixtureBuckleTransformer = new StaticTranslation(new Vec3d(0, 0, 0)),
|
||||
MillingPara = XFactory.GenByFile<ICuttingPara>(
|
||||
CuttingPara = XFactory.GenByFile<ICuttingPara>(
|
||||
"Resource/CuttingParameter", "Al6061T6.mp", GenMode.Default),
|
||||
WorkpieceMaterial = XFactory.GenByFile<WorkpieceMaterial>(
|
||||
"Resource/WorkpieceMaterial", "Al6061T6.WorkpieceMaterial", GenMode.Default),
|
||||
@@ -368,12 +353,15 @@ namespace Sample.Machining
|
||||
#endregion
|
||||
|
||||
#region ConfigureMachineChain
|
||||
machiningProject.MachiningEquipment.SolidMachiningChain
|
||||
machiningProject.MachiningEquipment.MachiningChain
|
||||
= XFactory.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();
|
||||
LocalApp.AppEnd();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user