private static MDT.Tool ToData(this MMT.Tool tool)
        {
            switch (tool.ToolType)
            {
            case MME.ToolType.Simple:
                return(ToSimple(tool));

            case MME.ToolType.TwoSection:
                return(ToTwoSection(tool));

            case MME.ToolType.Pointed:
                return(ToPointed(tool));

            case MME.ToolType.Disk:
                return(ToDisk(tool));

            case MME.ToolType.Countersink:
                return(ToCountersink(tool));

            case MME.ToolType.DiskOnCone:
                return(ToDiskOnCone(tool));

            case MME.ToolType.AngularTransmission:
                return(ToAnguralTransmission(tool));

            default:
                throw new NotImplementedException();
            }
        }
 private static void UpdateBaseData(MDT.Tool dest, MMT.Tool source)
 {
     dest.Name          = source.Name;
     dest.Description   = source.Description;
     dest.ConeModelFile = source.ConeModelFile;
     dest.ToolLinkType  = ConvertLinkType(source.ToolLinkType);
 }
        private static MDT.Tool ToSimple(MMT.Tool tool)
        {
            var t          = new MDT.SimpleTool();
            var simpleTool = tool as MMT.SimpleTool;

            t.Diameter     = simpleTool.Diameter;
            t.Length       = simpleTool.Length;
            t.UsefulLength = simpleTool.UsefulLength;

            UpdateBaseData(t, tool);

            return(t);
        }
        private static MDT.Tool ToPointed(MMT.Tool tool)
        {
            var t  = new MDT.PointedTool();
            var pt = tool as MMT.PointedTool;

            t.ConeHeight     = pt.ConeHeight;
            t.Diameter       = pt.Diameter;
            t.StraightLength = pt.StraightLength;
            t.UsefulLength   = pt.UsefulLength;

            UpdateBaseData(t, tool);

            return(t);
        }
        private static MDT.Tool ToTwoSection(MMT.Tool tool)
        {
            var t   = new MDT.TwoSectionTool();
            var tst = tool as MMT.TwoSectionTool;

            t.Diameter1 = tst.Diameter1;
            t.Diameter2 = tst.Diameter2;
            t.Length1   = tst.Length1;
            t.Length2   = tst.Length2;

            UpdateBaseData(t, tool);

            return(t);
        }
        private static MDT.Tool ToDisk(MMT.Tool tool)
        {
            var t  = new MDT.DiskTool();
            var dt = tool as MMT.DiskTool;

            t.Diameter = dt.Diameter;
            t.CuttingRadialThickness = dt.CuttingRadialThickness;
            t.BodyThickness          = dt.BodyThickness;
            t.CuttingThickness       = dt.CuttingThickness;
            t.RadialUsefulLength     = dt.RadialUsefulLength;

            UpdateBaseData(t, tool);

            return(t);
        }
        private static MDT.Tool ToCountersink(MMT.Tool tool)
        {
            var t   = new MDT.CountersinkTool();
            var cst = tool as MMT.CountersinkTool;

            t.Diameter1    = cst.Diameter1;
            t.Diameter2    = cst.Diameter2;
            t.Length1      = cst.Length1;
            t.Length2      = cst.Length2;
            t.Length3      = cst.Length3;
            t.UsefulLength = cst.UsefulLength;

            UpdateBaseData(t, tool);

            return(t);
        }
示例#8
0
        private static IntTools.Tool ToInternal(ExTools.Tool item)
        {
            IntTools.Tool t = null;

            switch (item.ToolType)
            {
            case MachineModels.Enums.ToolType.Simple:
                t = ToInternal((ExTools.SimpleTool)item);
                break;

            case MachineModels.Enums.ToolType.TwoSection:
                t = ToInternal((ExTools.TwoSectionTool)item);
                break;

            case MachineModels.Enums.ToolType.Pointed:
                t = ToInternal((ExTools.PointedTool)item);
                break;

            case MachineModels.Enums.ToolType.Disk:
                t = ToInternal((ExTools.DiskTool)item);
                break;

            case MachineModels.Enums.ToolType.Countersink:
                t = ToInternal((ExTools.CountersinkTool)item);
                break;

            case MachineModels.Enums.ToolType.DiskOnCone:
                t = ToInternal((ExTools.DiskOnConeTool)item);
                break;

            //case MachineModels.Enums.ToolType.Base:
            //case MachineModels.Enums.ToolType.None:
            //case MachineModels.Enums.ToolType.BullNoseConcave:
            //case MachineModels.Enums.ToolType.BullNoseConvex:
            //case MachineModels.Enums.ToolType.Composed:
            default:
                throw new NotImplementedException();
            }

            return(t);
        }
        private static MDT.Tool ToAnguralTransmission(MMT.Tool tool)
        {
            var t  = new MDT.AngularTransmission();
            var at = tool as MMT.AngolarTransmission;

            t.BodyModelFile = at.BodyModelFile;

            foreach (var item in at.Subspindles)
            {
                t.Subspindles.Add(new MDT.Subspindle()
                {
                    ToolName  = item.ToolName,
                    Position  = item.Position.ToMachineDataPoint(),
                    Direction = item.Direction.ToMachineDataVector()
                });
            }

            UpdateBaseData(t, at);

            return(t);
        }