コード例 #1
0
    public bool G_Check(string g_str, int row_index, ref DataStore step_compile_data, ref ModalCode_Fanuc_M modal_state)
    {
        _errorMessage = "";
        if(satisfactoryG_M.IndexOf(g_str) == -1)
        {
            _errorMessage = "(Line:" + row_index + "): " + "系统中不存在该G指令: " + g_str;
            return false;
        }
        else
        {
            try
            {
                float g_value = (float)Convert.ToDouble(g_str.Trim('G'));
                if(g_value < 10f)
                    g_str = "G0" + g_value.ToString();
            }
            catch
            {
                _errorMessage = "(Line:" + row_index + "): " + "系统中不存在该G指令: " + g_str;
                return false;
            }
            int modal_index = modal_state.ModalIndex(g_str);
            //立即执行G代码(非模态G代码)
            if(modal_index == -1)
            {
                switch(g_str)
                {
                case "G04":
                    step_compile_data.ImmediateAdd((char)ImmediateMotionType.Pause);
                    break;
                case "G28":
                    step_compile_data.ImmediateAdd((char)ImmediateMotionType.AutoReturnRP);
                    break;
                default:
                    //Todo: 有很多未完成的功能
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持该G代码: " + g_str;
                    return false;
                }
            }
            //模态代码
            else
            {//1 level
                switch(modal_index)
                {
                case 0:
                    if(g_str == "G00")
                        step_compile_data.motion_type = (int)MotionType.DryRunning;
                    else if(g_str == "G01")
                        step_compile_data.motion_type = (int)MotionType.Line;
                    else if(g_str == "G02")
                        step_compile_data.motion_type = (int)MotionType.Circular02;
                    else
                        step_compile_data.motion_type = (int)MotionType.Circular03;
                    break;
                case 1:
                    if(g_str != "G94")
                    {
                        _errorMessage = "(Line:" + row_index + "): " + "目前系统只支持G94(每分钟进给),暂不支持" + g_str;
                        return false;
                    }
                    break;
                case 2:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持09组G代码";
                    return false;
                case 3:
                    if(g_str != "G17")
                    {
                        _errorMessage = "(Line:" + row_index + "): " + "目前系统只支持G17(XY平面选择),暂不支持" + g_str;
                        return false;
                    }
                    break;
                case 4:
                    if(g_str != "G21")
                    {
                        _errorMessage = "(Line:" + row_index + "): " + "目前系统只支持G21(公制输入),暂不支持" + g_str;
                        return false;
                    }
                    break;
                case 5:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持10组固定循环G代码";
                    return false;
                case 6:
                    //G90、G91 绝对、增量
                    //Todo:
                    break;
                case 7:
                    //G40, G41, G42 刀具半径补偿
                    //Todo: 坐标会发生一些变化
                    if(g_str == "G40")
                        step_compile_data.ImmediateAdd((char)ImmediateMotionType.RadiusCompensationCancel);
                    else if(g_str == "G41")
                        step_compile_data.ImmediateAdd((char)ImmediateMotionType.RadiusCompensationLeft);
                    else
                        step_compile_data.ImmediateAdd((char)ImmediateMotionType.RadiusCompensationRight);
                    break;
                case 8:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持11组比例缩放G代码";
                    return false;
                case 9:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持04组存储形成检测功能G代码";
                    return false;
                case 10:
                    //G43, G44, G49 刀具长度补偿
                    //Todo: 坐标会发生一些变化
                    if(g_str == "G43")
                        step_compile_data.ImmediateAdd((char)ImmediateMotionType.LengthCompensationPositive);
                    else if(g_str == "G44")
                        step_compile_data.ImmediateAdd((char)ImmediateMotionType.LengthCompensationNegative);
                    else
                        step_compile_data.ImmediateAdd((char)ImmediateMotionType.LengthCompensationCancel);
                    break;
                case 11:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持12组宏模态调用G代码";
                    return false;
                case 12:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持13组周速恒定控制G代码";
                    return false;
                case 13:
                    //G54, G54.1, G55, G56, G57, G58, G59
                    //Todo: 坐标会发生一些变化
                    if(g_str == "G54.1")
                    {
                        _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持G54.1追加工件坐标系功能";
                        return false;
                    }
                    else if(g_str == "G54")
                        step_compile_data.ImmediateAdd((char)ImmediateMotionType.G54);
                    else if(g_str == "G55")
                        step_compile_data.ImmediateAdd((char)ImmediateMotionType.G55);
                    else if(g_str == "G56")
                        step_compile_data.ImmediateAdd((char)ImmediateMotionType.G56);
                    else if(g_str == "G57")
                        step_compile_data.ImmediateAdd((char)ImmediateMotionType.G57);
                    else if(g_str == "G58")
                        step_compile_data.ImmediateAdd((char)ImmediateMotionType.G58);
                    else
                        step_compile_data.ImmediateAdd((char)ImmediateMotionType.G59);
                    break;
                case 14:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持15组G代码";
                    return false;
                case 15:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持16组坐标旋转方式G代码";
                    return false;
                case 16:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持17组极坐标指令G代码";
                    return false;
                case 17:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持18组法线方向控制G代码";
                    return false;
                case 18:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持G25代码";
                    return false;
                case 19:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持20组横向进磨控制(磨床用)G代码";
                    return false;
                case 20:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持G13.1代码";
                    return false;
                case 21:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持22组可编程镜像G代码";
                    return false;
                case 22:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持G54.2代码";
                    return false;
                case 23:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持G80.5代码";
                    return false;
                default:
                    break;
                }
                //模态代码改变
                if(modal_state.Modal_Code[modal_index] != g_str)
                {
                    step_compile_data.modal_index.Add(modal_index);
                    step_compile_data.modal_string.Add(g_str);
                    modal_state.SetModalCode(g_str, modal_index);
                }
                step_compile_data.G_code.Add(g_str);
            }//1 level

            return true;
        }
    }
コード例 #2
0
ファイル: Morphology.cs プロジェクト: ericjxl2013/CNCBackup
    public bool G_Check(string g_str, int row_index, ref DataStore step_compile_data, ref ModalCode_Fanuc_M modal_state)
    {
        _errorMessage = "";
        if(satisfactoryG_M.IndexOf(g_str) == -1)
        {
            _errorMessage = "(Line:" + row_index + "): " + "系统中不存在该G指令: " + g_str;
            return false;
        }
        else
        {
            try
            {
                float g_value = (float)Convert.ToDouble(g_str.Trim('G'));
                if(g_value < 10f)
                    g_str = "G0" + g_value.ToString();
            }
            catch
            {
                _errorMessage = "(Line:" + row_index + "): " + "系统中不存在该G指令: " + g_str;
                return false;
            }
            int modal_index = modal_state.ModalIndex(g_str);
            //立即执行G代码(非模态G代码)
            if(modal_index == -1)
            {
                switch(g_str)
                {
                case "G04":
                case "G28":
                    step_compile_data.immediate_execution.Add(g_str);
                    break;
                default:
                    //Todo: 有很多未完成的功能
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持该G代码: " + g_str;
                    return false;
                }
            }
            //模态代码
            else
            {//1 level
                switch(modal_index)
                {
                case 0:
                    step_compile_data.motion_string = g_str;
                    break;
                case 1:
                    if(g_str != "G94")
                    {
                        _errorMessage = "(Line:" + row_index + "): " + "目前系统只支持G94(每分钟进给),暂不支持" + g_str;
                        return false;
                    }
                    break;
                case 2:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持09组G代码";
                    return false;
                case 3:
                    if(g_str != "G17")
                    {
                        _errorMessage = "(Line:" + row_index + "): " + "目前系统只支持G17(XY平面选择),暂不支持" + g_str;
                        return false;
                    }
                    break;
                case 4:
                    if(g_str != "G21")
                    {
                        _errorMessage = "(Line:" + row_index + "): " + "目前系统只支持G21(公制输入),暂不支持" + g_str;
                        return false;
                    }
                    break;
                case 5:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持10组固定循环G代码";
                    return false;
                case 6:
                    //G90、G91 绝对、增量
                    //Todo:
                    break;
                case 7:
                    //G40, G41, G42 刀具半径补偿
                    //Todo: 坐标会发生一些变化
                    step_compile_data.immediate_execution.Add(g_str);
                    break;
                case 8:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持11组比例缩放G代码";
                    return false;
                case 9:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持04组存储形成检测功能G代码";
                    return false;
                case 10:
                    //G43, G44, G49 刀具长度补偿
                    //Todo: 坐标会发生一些变化
                    step_compile_data.immediate_execution.Add(g_str);
                    break;
                case 11:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持12组宏模态调用G代码";
                    return false;
                case 12:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持13组周速恒定控制G代码";
                    return false;
                case 13:
                    //G54, G54.1, G55, G56, G57, G58, G59
                    //Todo: 坐标会发生一些变化
                    step_compile_data.immediate_execution.Add(g_str);
                    break;
                case 14:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持15组G代码";
                    return false;
                case 15:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持16组坐标旋转方式G代码";
                    return false;
                case 16:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持17组极坐标指令G代码";
                    return false;
                case 17:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持18组法线方向控制G代码";
                    return false;
                case 18:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持G25代码";
                    return false;
                case 19:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持20组横向进磨控制(磨床用)G代码";
                    return false;
                case 20:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持G13.1代码";
                    return false;
                case 21:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持22组可编程镜像G代码";
                    return false;
                case 22:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持G54.2代码";
                    return false;
                case 23:
                    _errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持G80.5代码";
                    return false;
                default:
                    break;
                }
                //模态代码改变
                if(modal_state.Modal_Code[modal_index] != g_str)
                {
                    step_compile_data.modal_index.Add(modal_index);
                    step_compile_data.modal_string.Add(g_str);
                    modal_state.SetModalCode(g_str, modal_index);
                }
                step_compile_data.G_code.Add(g_str);
            }//1 level

            return true;
        }
    }
コード例 #3
0
ファイル: EntranceScript.cs プロジェクト: 52115206/script
//	public void EmergencyCall()
//	{
//		motion_info_list.Clear();
//	}

    public IEnumerator MotionStart()
    {
        CooZeroPoint = CooSystem_Script.AbsoluteZero;         //获取当前绝对坐标系零点
//		Main.AutoRunning_flag = true;
        if (Main.AutoRunning_flag)
        {
            DisplayStart();
        }
        Main.CycleTimeH          = 0;
        Main.CycleTimeM          = 0;
        Main.CycleTimeS          = 0;
        Auto_Script.cycling_time = 0;
        Auto_Script.runningH     = Main.RunningTimeH;
        Auto_Script.runningM     = Main.RunningTimeM;
        for (int index = 0; index < motion_info_list.Count; index++)
        {        //1level
            Debug.Log(index + " >>> " + motion_info_list[index].index);
            //黄色光标跳转
//			Main.autoSelecedProgRow = motion_info_list[index].index;
            if (Main.AutoRunning_flag)
            {
                Main.AutoDisplayFindRows(motion_info_list[index].index, Main.autoDisplayNormal);
            }
            if (Main.MDI_RunningFlag)
            {
                Main.MDIDisplayFindRows(motion_info_list[index].index);
            }
            Main.RunningSpeed = 0;
            Main.T_Value      = Main.ToolNo;
            Main.D_value      = motion_info_list[index].D_Value;
            Main.H_value      = motion_info_list[index].H_Value;
            //判断是否内容为空
            if (motion_info_list[index].NotEmpty())
            {            //2level
                //画面变化
                if (Main.AutoRunning_flag)
                {
                    //G_Display
                    ProgramModule_Script.CurrentCodeDisplay(motion_info_list[index].G_Display, motion_info_list[index].G_Address, motion_info_list[index].Address_Value, motion_info_list[index].G_Display2, motion_info_list[index].G_Address2, motion_info_list[index].Address_Value2);
                    //ModalIndex, ModalString
                    ProgramModule_Script.SetModalState(motion_info_list[index].ModalIndex, motion_info_list[index].ModalString);
                    //运动坐标信息
                }
                //如果跳过功能启用,判断是否要跳过当前行
                if (Slash_on)
                {
                    if (motion_info_list[index].Slash > 0)
                    {
                        continue;
                    }
                }
                //立即执行的功能
                if (motion_info_list[index].Immediate_Motion != "")
                {
                    for (int i = 0; i < motion_info_list[index].Immediate_Motion.Length; i++)
                    {
                        switch ((char)motion_info_list[index].Immediate_Motion[i])
                        {
//						case (char)ImmediateMotionType.ToolChanging:
//							Main.ToolNo = motion_info_list[index].Tool_Number;
//							break;
                        case (char)ImmediateMotionType.M00:
                            Auto_Script.SetPause();
                            Main.AutoPause_flag = true;
                            break;

                        case (char)ImmediateMotionType.M01:
                            if (Main.OSP_On)
                            {
                                Auto_Script.SetPause();
                                Main.AutoPause_flag = true;
                            }
                            break;

                        case (char)ImmediateMotionType.M02:
                            Auto_Script.EmergencyCall();
                            Auto_Script.StopAllCoroutines();
                            Main.SpindleStop();
                            Main.AutoRunning_flag = false;
                            Main.RunningSpeed     = 0;
                            break;

                        case (char)ImmediateMotionType.M03:
                            CurrentModal.RotateSpeed = motion_info_list[index].SpindleSpeed;
                            Main.SpindleCW(CurrentModal.RotateSpeed);
                            Main.SpindleSpeed = (int)CurrentModal.RotateSpeed;
                            break;

                        case (char)ImmediateMotionType.M04:
                            CurrentModal.RotateSpeed = motion_info_list[index].SpindleSpeed;
                            Main.SpindleCCW(CurrentModal.RotateSpeed);
                            Main.SpindleSpeed = (int)CurrentModal.RotateSpeed;
                            break;

                        case (char)ImmediateMotionType.M05:
                            Main.SpindleStop();
                            Main.SpindleSpeed = 0;
                            break;

//						case (char)ImmediateMotionType.M06:
//							//更换刀具的过程
//							break;
                        case (char)ImmediateMotionType.M07:
                        case (char)ImmediateMotionType.M08:
                        case (char)ImmediateMotionType.M09:
                            break;

                        case (char)ImmediateMotionType.M30:
                            Auto_Script.EmergencyCall();
                            Auto_Script.StopAllCoroutines();
                            Main.SpindleStop();
                            Main.AutoRunning_flag = false;
                            Main.RunningSpeed     = 0;
                            if (Main.AutoRunning_flag)
                            {
                                Main.AutoDisplayFindRows(0, Main.autoDisplayNormal);
                            }
                            if (Main.MDI_RunningFlag)
                            {
                                Main.MDIDisplayFindRows(0);
                            }
//							Main.autoSelecedProgRow = 0;
                            break;

                        case (char)ImmediateMotionType.M98:
                        case (char)ImmediateMotionType.M99:

                            break;

                        case (char)ImmediateMotionType.G52:                          //局部坐标系变换
                            if (motion_info_list[index].CooTransformation.x == 0)
                            {
                                CooSystem_Script.AbsoluteZero.x = CooZeroPoint.x;
                            }
                            else
                            {
                                CooSystem_Script.AbsoluteZero.x = CooZeroPoint.x - motion_info_list[index].CooTransformation.x;
                            }
                            if (motion_info_list[index].CooTransformation.y == 0)
                            {
                                CooSystem_Script.AbsoluteZero.y = CooZeroPoint.y;
                            }
                            else
                            {
                                CooSystem_Script.AbsoluteZero.y = CooZeroPoint.y - motion_info_list[index].CooTransformation.y;
                            }
                            if (motion_info_list[index].CooTransformation.z == 0)
                            {
                                CooSystem_Script.AbsoluteZero.z = CooZeroPoint.z;
                            }
                            else
                            {
                                CooSystem_Script.AbsoluteZero.z = CooZeroPoint.z - motion_info_list[index].CooTransformation.z;
                            }
                            break;

                        case (char)ImmediateMotionType.G53:
                            //已经作为一种运动方式处理,这里直接跳过,去下面的流程中.
                            break;

                        case (char)ImmediateMotionType.G54:                         //工件坐标系设定
                            CooSystem_Script.workpiece_flag = (int)WorkpieceCooSys.G54;
                            CooSystem_Script.Workpiece_Change();
                            CooZeroPoint = CooSystem_Script.AbsoluteZero;
                            CurrentModal.SetModalCode("G54", 13);
                            break;

                        case (char)ImmediateMotionType.G55:
                            CooSystem_Script.workpiece_flag = (int)WorkpieceCooSys.G55;
                            CooSystem_Script.Workpiece_Change();
                            CooZeroPoint = CooSystem_Script.AbsoluteZero;
                            CurrentModal.SetModalCode("G55", 13);
                            break;

                        case (char)ImmediateMotionType.G56:
                            CooSystem_Script.workpiece_flag = (int)WorkpieceCooSys.G56;
                            CooSystem_Script.Workpiece_Change();
                            CooZeroPoint = CooSystem_Script.AbsoluteZero;
                            CurrentModal.SetModalCode("G56", 13);
                            break;

                        case (char)ImmediateMotionType.G57:
                            CooSystem_Script.workpiece_flag = (int)WorkpieceCooSys.G57;
                            CooSystem_Script.Workpiece_Change();
                            CooZeroPoint = CooSystem_Script.AbsoluteZero;
                            CurrentModal.SetModalCode("G57", 13);
                            break;

                        case (char)ImmediateMotionType.G58:
                            CooSystem_Script.workpiece_flag = (int)WorkpieceCooSys.G58;
                            CooSystem_Script.Workpiece_Change();
                            CooZeroPoint = CooSystem_Script.AbsoluteZero;
                            CurrentModal.SetModalCode("G58", 13);
                            break;

                        case (char)ImmediateMotionType.G59:
                            CooSystem_Script.workpiece_flag = (int)WorkpieceCooSys.G59;
                            CooSystem_Script.Workpiece_Change();
                            CooZeroPoint = CooSystem_Script.AbsoluteZero;
                            CurrentModal.SetModalCode("G59", 13);
                            break;

                        case (char)ImmediateMotionType.G92:
                            if (motion_info_list[index].CooState[0])
                            {
                                CooSystem_Script.AbsoluteZero.x = motion_info_list[index].CooTransformation.x - Move_Script.MachineCoo.x;
                                CooZeroPoint.x = CooSystem_Script.AbsoluteZero.x;
                                CooSystem_Script.RelativeZero.x = CooSystem_Script.AbsoluteZero.x;
                            }
                            if (motion_info_list[index].CooState[1])
                            {
                                CooSystem_Script.AbsoluteZero.y = motion_info_list[index].CooTransformation.y - Move_Script.MachineCoo.y;
                                CooZeroPoint.y = CooSystem_Script.AbsoluteZero.y;
                                CooSystem_Script.RelativeZero.y = CooSystem_Script.AbsoluteZero.y;
                            }
                            if (motion_info_list[index].CooState[2])
                            {
                                CooSystem_Script.AbsoluteZero.z = motion_info_list[index].CooTransformation.z - Move_Script.MachineCoo.z;
                                CooZeroPoint.z = CooSystem_Script.AbsoluteZero.z;
                                CooSystem_Script.RelativeZero.z = CooSystem_Script.AbsoluteZero.z;
                            }
                            break;

                        case (char)ImmediateMotionType.Pause:
                            //已经作为一种运动方式处理,这里直接跳过,去下面的流程中.
                            break;

                        case (char)ImmediateMotionType.AutoReturnRP:
                            //已经作为一种运动方式处理,这里直接跳过,去下面的流程中.
                            break;

                        case (char)ImmediateMotionType.BackFromRP:
                            //已经作为一种运动方式处理,这里直接跳过,去下面的流程中.
                            break;

                        case (char)ImmediateMotionType.RadiusCompensationCancel:
                        case (char)ImmediateMotionType.RadiusCompensationLeft:
                        case (char)ImmediateMotionType.RadiusCompensationRight:
                        case (char)ImmediateMotionType.LengthCompensationCancel:
                        case (char)ImmediateMotionType.LengthCompensationNegative:
                        case (char)ImmediateMotionType.LengthCompensationPositive:

                            break;

                        case (char)ImmediateMotionType.RotateSpeed:
                            CurrentModal.RotateSpeed = motion_info_list[index].Rotate_Speed;
                            break;

                        default:
                            break;
                        }
                    }
                }
                //常规运动
                if (motion_info_list[index].Motion_Type != -1)
                {
                    Main.RunningSpeed = (int)(motion_info_list[index].Velocity * Main.move_rate);
                    SpeedNow          = (int)motion_info_list[index].Velocity;
                    Main.M_value      = motion_info_list[index].M_Code;
                    switch (motion_info_list[index].Motion_Type)
                    {
                    case (int)MotionType.DryRunning:
//						CurrentModal.SetModalCode("G00", 0);
                        yield return(StartCoroutine(Auto_Script.LineMovement(motion_info_list[index].Direction, motion_info_list[index].Time_Value, motion_info_list[index].VirtualTarget, index, 0)));

                        break;

                    case (int)MotionType.MachineCooSys:
                        yield return(StartCoroutine(Auto_Script.LineMovement(motion_info_list[index].Direction, motion_info_list[index].Time_Value, motion_info_list[index].VirtualTarget, index, 0)));

                        break;

                    case (int)MotionType.Line:
//						CurrentModal.SetModalCode("G01", 0);
                        yield return(StartCoroutine(Auto_Script.LineMovement(motion_info_list[index].Direction, motion_info_list[index].Time_Value, motion_info_list[index].VirtualTarget, index, 0)));

                        break;

                    case (int)MotionType.Circular02:
//						CurrentModal.SetModalCode("G02", 0);
                        yield return(StartCoroutine(Auto_Script.CircularMovement(motion_info_list[index].Direction, motion_info_list[index].VirtualTarget, motion_info_list[index].DisplayTarget,
                                                                                 motion_info_list[index].DisplayStart, motion_info_list[index].Time_Value, motion_info_list[index].Center_Point, motion_info_list[index].Rotate_Speed, true, motion_info_list[index].Current_Plane, index, motion_info_list[index].Slices)));

                        break;

                    case (int)MotionType.Circular03:
//						CurrentModal.SetModalCode("G03", 0);
                        yield return(StartCoroutine(Auto_Script.CircularMovement(motion_info_list[index].Direction, motion_info_list[index].VirtualTarget, motion_info_list[index].DisplayTarget,
                                                                                 motion_info_list[index].DisplayStart, motion_info_list[index].Time_Value, motion_info_list[index].Center_Point, motion_info_list[index].Rotate_Speed, false, motion_info_list[index].Current_Plane, index, motion_info_list[index].Slices)));

                        break;

                    case (int)MotionType.AutoReturnRP:
                    case (int)MotionType.BackFromRP:
                        yield return(StartCoroutine(Auto_Script.LineMovement(motion_info_list[index].Direction, motion_info_list[index].Time_Value, motion_info_list[index].VirtualTarget, index, 1)));

                        yield return(StartCoroutine(Auto_Script.LineMovement(motion_info_list[index].Direction2, motion_info_list[index].Time_Value2, motion_info_list[index].VirtualTarget2, index, 2)));

                        break;

                    case (int)MotionType.Pause:
                        Auto_Script.SetPause();
                        yield return(StartCoroutine(Auto_Script.PauseTimer(motion_info_list[index].Time_Value)));

                        break;

                    default:
                        Debug.Log("未知常规运动!");
                        break;
                    }
                }
            }            //2level
            //Todo:解决换刀过程不能被紧急停止的功能
            for (int i = 0; i < motion_info_list[index].ToolChange_Motion.Length; i++)
            {
                switch (motion_info_list[index].ToolChange_Motion[i])
                {
                case (char)ToolChange.T:
                    yield return(StartCoroutine(AutoToolChange_Script.ChooseTool(motion_info_list[index].Tool_Number)));

                    break;

                case (char)ToolChange.M:
                    if (tool_motion_list[0].TimeValue > 0)
                    {
                        yield return(StartCoroutine(Auto_Script.LineMovement(tool_motion_list[0].Direction, tool_motion_list[0].TimeValue, tool_motion_list[0].VirtualTarget, motion_info_list.Count + tool_motion_list.Count, 0)));
                    }
                    tool_motion_list.RemoveAt(0);
                    yield return(StartCoroutine(AutoToolChange_Script.ChangeToolProcess()));

                    break;

                default:
                    break;
                }
            }

            //单步运行
            Main.RunningSpeed = 0;
            SpeedNow          = 0;
            Main.M_value      = 0;
            if (Main.SingleStep)
            {
                singleStepEnd = 100;
                yield return(StartCoroutine(SingleStepTimer()));
            }
        }                                                                          //1level
        ProgramModule_Script.SetModalState(new List <int>(), new List <string>()); //模态变化的蓝色光标清空
        if (Main.MDI_RunningFlag)
        {
            MDIStop();
        }
        Main.AutoRunning_flag = false;
        Main.Compile_flag     = false;
        Main.MDI_RunningFlag  = false;
        Main.MDI_CompileFlag  = false;
        Main.PartsNum++;         //加工零件数+1
        DisplayEnd();
        Main.SpindleSpeed = 0;
        Main.T_Value      = 0;
        Main.D_value      = 0;
        Main.H_value      = 0;
        ProgramModule_Script.CurrentCodeDisplay(new List <string>(), new List <string>(), new List <float>(), new List <string>(), new List <string>(), new List <float>());   //当前段和下一段显示清空
    }