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.HiNcKits; using Hi.Milling.MillingTools; namespace Sample.Machining { /// /// ### Source Code /// [!code-csharp[SampleCode](~/../Hi.Sample/Machining/DemoBuildGeomOnlyMachiningProject.cs)] /// public static class DemoBuildGeomOnlyMachiningProject { internal static MillingCutter CreateGeomOnlyMillingCutter() { MillingCutter millingCutter = new MillingCutter() { UpperBeamGeom = new Cylindroid( [new PairZr(40,6), new PairZr(90,6)]), ShaperProfile = new AptProfile( new ColumnApt() { Diameter_mm = 12, FluteHeight_mm = 40 }) }; return millingCutter; } static void Main() { LocalApp.AppBegin(); LocalProjectService localProjectService = new LocalProjectService(); var projectPath = "C:/HiNC-Projects/NewProject/Main.hincproj"; var projectDirectory = Path.GetDirectoryName(projectPath); Console.WriteLine($"Directory of the New Project: {projectDirectory}"); localProjectService.LoadProject(projectPath); MachiningProject machiningProject = localProjectService.MachiningProject; CylindroidHolder cylindroidHolder = new CylindroidHolder() { Note = "BT40", Cylindroid = new Cylindroid([ new PairZr(0,12),new PairZr(20,12), new PairZr(20,16),new PairZr(30,16)]) }; localProjectService.MachiningToolHouse = new MachiningToolHouse() { [1] = new MillingTool() { Note = "T1", PreservedDistanceBetweenFluteAndSpindleNose_mm = 8, Holder = cylindroidHolder, Cutter = CreateGeomOnlyMillingCutter() }, }; localProjectService.Fixture = new Fixture() { Geom = new Box3d(new Vec3d(-40, -40, 0), new Vec3d(40, 40, 10)), GeomToWorkpieceTransformer = new StaticTranslation(new Vec3d(0, 0, 10)), }; localProjectService.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)), }; localProjectService.MachiningChain = XFactory.GenByFile( "Resource", "MachineTool/PMC-B1/PMC-B1.mt", GenMode.Default); localProjectService.MachiningChainFile = "PMC-B1/PMC-B1.mt"; localProjectService.SaveProject(); machiningProject.Dispose(); LocalApp.AppEnd(); } } }