101 lines
3.4 KiB
C#
101 lines
3.4 KiB
C#
using Hi.Common.XmlUtils;
|
|
using Hi.Geom;
|
|
using Hi.MachiningProcs;
|
|
using Hi.Mech.Topo;
|
|
using Hi.Milling.Apts;
|
|
using Hi.Milling.Cutters;
|
|
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.Machining;
|
|
using Hi.MillingMech.MillingTools;
|
|
using Hi.HiNcKits;
|
|
|
|
namespace Sample.Machining
|
|
{
|
|
/// <remarks>
|
|
/// ### Source Code
|
|
/// [!code-csharp[SampleCode](~/../Hi.Sample/Machining/DemoBuildGeomOnlyMachiningProject.cs)]
|
|
/// </remarks>
|
|
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.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();
|
|
}
|
|
|
|
}
|
|
}
|