Przeglądaj źródła

测量线程更新完成,差初始化的拉直操作。

@wang_qi0307 5 lat temu
rodzic
commit
6e751adf74
1 zmienionych plików z 316 dodań i 251 usunięć
  1. 316 251
      MeasureThread/Measure.cs

+ 316 - 251
MeasureThread/Measure.cs

@@ -656,7 +656,21 @@ namespace MeasureThread
                     SendMsg("第" + i.ToString() + "个切孔开始测量");
                     //切孔操作-开始
                     SendCutHoleMsg(((int)ThreadState.InProcess).ToString(), m_cutHoles[i].HoleName);
-                    OtherHole();
+                    //其他孔的测试
+                    //成功
+                    if (OtherHole())
+                    {
+                        //保存文件,将测量状态更改
+                        m_cutHoles[i].STATE = State.Success;
+                        m_measureFile.Save();
+                    }
+                    //失败
+                    else
+                    {
+                        m_cutHoles[i].STATE = State.Failed;
+                        m_measureFile.Save();
+                    }
+                    
                     //切孔操作-完成
                     SendCutHoleMsg(((int)ThreadState.Success).ToString(), m_cutHoles[i].HoleName);
                 }
@@ -794,13 +808,10 @@ namespace MeasureThread
             {
                 if (DialogResult.Yes == MessageBox.Show("图像自动对焦已完成?", "确认消息", MessageBoxButtons.YesNo))
                 {
-                    arg.Message = "自动对焦完成";
-                    SendMsg("1-3");
+                    return true;
                 }
                 else
                 {
-                    arg.Message = "自动对焦失败";
-                    SendMsg("1-3");
                     return false;
                 }
             }
@@ -820,6 +831,8 @@ namespace MeasureThread
                 LogManager.AddHardwareLog("算法输出"+ wd.ToString(), true);
                 //设置工作距离
                 iSEM.SetWorkingDistance((float)(wd * 0.00000001));
+
+                return true;
                 //处理图片位置
                 //File.Copy(focus_path + "\\fine\\" + wd.ToString() + ".tif", data_path + "\\" + ImageName);
             }
@@ -850,11 +863,11 @@ namespace MeasureThread
             if (!iSEM.SetMagnification(m_measureFile.MParam.Location_Magnification))
             {
                 arg.Message = "放大" + m_measureFile.MParam.Location_Magnification.ToString("0.0") + "倍失败";
-                SendMsg("1-2");
+                SendMsg("1-1");
                 return false;
             }
             arg.Message = "放大" + m_measureFile.MParam.Location_Magnification.ToString("0.0") + "倍成功";
-            SendMsg("1-2");
+            SendMsg("1-1");
             //判断是否停止进程
             if (key_stop)
             {
@@ -862,7 +875,16 @@ namespace MeasureThread
             }
 
             //2.控制SEM自动对焦、亮度、对比度
-            ImageFocus();
+            if(ImageFocus())
+            {
+                arg.Message = "自动对焦完成";
+                SendMsg("1-2");
+            }
+            else
+            {
+                arg.Message = "自动对焦失败";
+                SendMsg("1-2");
+            }
             //判断是否停止进程
             if (key_stop)
             {
@@ -875,11 +897,11 @@ namespace MeasureThread
                 if (!TiltCorrection(54))
                 {
                     arg.Message = "设置SEM进行角度补偿54度失败";
-                    SendMsg("1-4");
+                    SendMsg("1-3");
                     return false;
                 }
                 arg.Message = "设置SEM进行角度补偿54度成功";
-                SendMsg("1-4");
+                SendMsg("1-3");
                 Thread.Sleep(5000);
                 //判断是否停止进程
                 if (key_stop)
@@ -899,7 +921,7 @@ namespace MeasureThread
                 return false;
             }
             arg.Message = "SEM拍照成功";
-            SendMsg("1-5");
+            SendMsg("1-4");
             Thread.Sleep(3000);
             //判断是否停止进程
             if (key_stop)
@@ -915,12 +937,12 @@ namespace MeasureThread
                 if (!iSEM.CmdFIBModeFIB())
                 {
                     arg.Message = "FIB模式切换失败";
-                    SendMsg("1-6");
+                    SendMsg("1-5");
                     return false;
                 }
                 arg.State = "FIB";
                 arg.Message = "FIB模式切换成功";
-                SendMsg("1-6");
+                SendMsg("1-5");
                 Thread.Sleep(10000);
                 //判断是否停止进程
                 if (key_stop)
@@ -936,11 +958,11 @@ namespace MeasureThread
                 if (!GetImage(ImageMode.FIB, fileName2))
                 {
                     arg.Message = "FIB拍照失败";
-                    SendMsg("1-7");
+                    SendMsg("1-6");
                     return false;
                 }
                 arg.Message = "FIB拍照成功";
-                SendMsg("1-7");
+                SendMsg("1-6");
                 Thread.Sleep(3000);
                 //判断是否停止进程
                 if (key_stop)
@@ -952,7 +974,7 @@ namespace MeasureThread
                 if (DialogResult.Yes == MessageBox.Show("是否手动移动样品台到指定位置?\n如果点击取消则会调用Web接口。", "确认消息", MessageBoxButtons.YesNo))
                 {
                     arg.Message = "样品台移动到指定位置";
-                    SendMsg("1-8");
+                    SendMsg("1-7");
                 }
                 else
                 {
@@ -963,7 +985,7 @@ namespace MeasureThread
                         if (!iSEM.MoveStageXY(x1, y1))
                         {
                             arg.Message = "移动到新(" + x1.ToString() + "," + y1.ToString() + ")位置失败";
-                            SendMsg("1-8");
+                            SendMsg("1-7");
                             return false;
                         }
                         //判断是否移动完成
@@ -976,12 +998,12 @@ namespace MeasureThread
                             }
                         }
                         arg.Message = "移动到新(" + x1.ToString() + "," + y1.ToString() + ")位置失败";
-                        SendMsg("1-8");
+                        SendMsg("1-7");
                     }
                     else
                     {
                         arg.Message = "样品台移动失败";
-                        SendMsg("1-8");
+                        SendMsg("1-7");
                         return false;
                     }
                 }
@@ -1002,11 +1024,11 @@ namespace MeasureThread
                     if (Math.Abs(x0 - x1) > fMin && Math.Abs(y0 - y1) > fMin)
                     {
                         arg.Message = "目标位置(" + x0.ToString() + "," + y0.ToString() + ")移动失败";
-                        SendMsg("1-9");
+                        SendMsg("1-8");
                         return false;
                     }
                     arg.Message = "目标位置(" + x0.ToString() + "," + y0.ToString() + ")移动成功";
-                    SendMsg("1-9");
+                    SendMsg("1-8");
                     //判断是否停止进程
                     if (key_stop)
                     {
@@ -1017,11 +1039,11 @@ namespace MeasureThread
                     if (!PTWork())
                     {
                         arg.Message = "PT沉积失败";
-                        SendMsg("1-10");
+                        SendMsg("1-9");
                         return false;
                     }
                     arg.Message = "PT沉积成功";
-                    SendMsg("1-10");
+                    SendMsg("1-9");
                     //判断是否停止进程
                     if (key_stop)
                     {
@@ -1050,7 +1072,7 @@ namespace MeasureThread
                 + firstPosition[3].ToString() + ","
                 + firstPosition[4].ToString() + ","
                 + firstPosition[5].ToString() + ")";
-            SendMsg("1-11");
+            SendMsg("1-10");
             //判断是否停止进程
             if (key_stop)
             {
@@ -1073,11 +1095,11 @@ namespace MeasureThread
             if (!GetImage(ImageMode.FIB, fileName31))
             {
                 arg.Message = "FIB切割前拍照失败";
-                SendMsg("1-14");
+                SendMsg("1-11");
                 return false;
             }
             arg.Message = "FIB切割前拍照成功";
-            SendMsg("1-14");
+            SendMsg("1-11");
             //判断是否停止进程
             if (key_stop)
             {
@@ -1096,7 +1118,6 @@ namespace MeasureThread
             }
             arg.Message = "FIB切割成功";
             SendMsg("1-12");
-            
             Thread.Sleep(5000);
             //判断是否停止进程
             if (key_stop)
@@ -1113,11 +1134,11 @@ namespace MeasureThread
             if (!GetImage(ImageMode.FIB, fileName32))
             {
                 arg.Message = "FIB切割后拍照失败";
-                SendMsg("1-14"); 
+                SendMsg("1-13"); 
                 return false;
             }
             arg.Message = "FIB切割后拍照成功";
-            SendMsg("1-14");
+            SendMsg("1-13");
 
             Thread.Sleep(3000);
             //判断是否停止进程
@@ -1160,9 +1181,12 @@ namespace MeasureThread
             //切换到SEM模式
             if (!iSEM.CmdFIBModeSEM())
             {
-                //SendMsg("SEM模式切换失败");
+                arg.Message = "SEM模式切换失败";
+                SendMsg("1-16");
                 return false;
             }
+            arg.Message = "SEM模式切换成功";
+            SendMsg("1-16");
             arg.State = "SEM";
             Thread.Sleep(10000);
             //判断是否停止进程
@@ -1175,11 +1199,11 @@ namespace MeasureThread
             if (!iSEM.SetMagnification(m_measureFile.MParam.Location_Magnification/2))
             {
                 arg.Message = "放大" + (m_measureFile.MParam.Location_Magnification / 2).ToString("0.0") + "倍失败";
-                SendMsg("1-18");
+                SendMsg("1-17");
                 return false;
             }
             arg.Message = "放大" + (m_measureFile.MParam.Location_Magnification/2).ToString("0.0") + "倍成功";
-            SendMsg("1-18");
+            SendMsg("1-17");
             //判断是否停止进程
             if (key_stop)
             {
@@ -1187,7 +1211,16 @@ namespace MeasureThread
             }
 
             //2.控制SEM自动对焦、亮度、对比度-接口,,将自动对焦提出单独函数调用
-            ImageFocus();
+            if (ImageFocus())
+            {
+                arg.Message = "自动对焦完成";
+                SendMsg("1-18");
+            }
+            else
+            {
+                arg.Message = "自动对焦失败";
+                SendMsg("1-18");
+            }
             Thread.Sleep(5000);
             //判断是否停止进程
             if (key_stop)
@@ -1202,11 +1235,11 @@ namespace MeasureThread
             if (!GetImage(ImageMode.SEM, fileName4))
             {
                 arg.Message = "SEM拍照失败";
-                SendMsg("1-20");
+                SendMsg("1-19");
                 return false;
             }
             arg.Message = "SEM拍照成功";
-            SendMsg("1-20");
+            SendMsg("1-19");
 
             Thread.Sleep(3000);
             //判断是否停止进程
@@ -1221,7 +1254,7 @@ namespace MeasureThread
             if (DialogResult.Yes == MessageBox.Show("是否手动移动样品台到指定位置?\n如果点击取消则会调用Web接口。", "确认消息", MessageBoxButtons.YesNo))
             {
                 arg.Message = "样品台移动到指定位置";
-                SendMsg("1-21");
+                SendMsg("1-20");
             }
             else
             {
@@ -1235,7 +1268,7 @@ namespace MeasureThread
                     if (!iSEM.MoveStageXY(x2, y2))
                     {
                         arg.Message = "移动到新(" + x1.ToString() + "," + y1.ToString() + ")位置失败";
-                        SendMsg("1-21");
+                        SendMsg("1-20");
                         return false;
                     }
                     //判断是否移动完成
@@ -1248,13 +1281,13 @@ namespace MeasureThread
                         }
                     }
                     arg.Message = "移动到新(" + x2.ToString() + "," + y2.ToString() + ")位置失败";
-                    SendMsg("1-21");
+                    SendMsg("1-20");
                     
                 }
                 else
                 {
                     arg.Message = "样品台移动失败";
-                    SendMsg("1-21");
+                    SendMsg("1-20");
                     return false;
                 }
             }
@@ -1269,8 +1302,13 @@ namespace MeasureThread
             y0 = iSEM.GetStageAtY();
             if (Math.Abs(x0 - x1) > fMin && Math.Abs(y0 - y1) > fMin)
             {
+                arg.Message = "位置校验失败";
+                SendMsg("1-21");
                 return false;
             }
+            arg.Message = "位置校验成功";
+            SendMsg("1-21");
+
             //判断是否停止进程
             if (key_stop)
             {
@@ -1294,11 +1332,11 @@ namespace MeasureThread
             if (!iSEM.SetMagnification(m_MsParam.Photograph_Magnification))
             {
                 arg.Message = "放大倍数调整失败";
-                SendMsg("1-25");
+                SendMsg("1-22");
                 return false;
             }
             arg.Message = "放大倍数调整成功";
-            SendMsg("1-25");
+            SendMsg("1-22");
             //判断是否停止进程
             if (key_stop)
             {
@@ -1306,7 +1344,16 @@ namespace MeasureThread
             }
 
             //2.控制SEM自动对焦、亮度、对比度-接口
-            ImageFocus();
+            if (ImageFocus())
+            {
+                arg.Message = "自动对焦完成";
+                SendMsg("1-23");
+            }
+            else
+            {
+                arg.Message = "自动对焦失败";
+                SendMsg("1-23");
+            }
             //判断是否停止进程
             if (key_stop)
             {
@@ -1317,11 +1364,11 @@ namespace MeasureThread
             if (!TiltCorrection(m_measureFile.MParam.Correction_Angle))
             {
                 arg.Message = "设置SEM进行角度补偿" + m_measureFile.MParam.Correction_Angle.ToString("0") + "度失败";
-                SendMsg("1-27");
+                SendMsg("1-24");
                 return false;
             }
             arg.Message = "设置SEM进行角度补偿" + m_measureFile.MParam.Correction_Angle.ToString("0") + "度成功";
-            SendMsg("1-27");
+            SendMsg("1-24");
             Thread.Sleep(5000);
             //判断是否停止进程
             if (key_stop)
@@ -1336,11 +1383,11 @@ namespace MeasureThread
             if (!GetImage(ImageMode.SEM, fileName5))
             {
                 arg.Message = "SEM拍照失败";
-                SendMsg("1-28");
+                SendMsg("1-25");
                 return false;
             }
             arg.Message = "SEM拍照成功";
-            SendMsg("1-28");
+            SendMsg("1-25");
             Thread.Sleep(3000);
             //判断是否停止进程
             if (key_stop)
@@ -1352,21 +1399,20 @@ namespace MeasureThread
             if (DialogResult.Yes == MessageBox.Show("是否手动移动样品台到指定位置?\n如果点击取消则会调用Web接口。", "确认消息", MessageBoxButtons.YesNo))
             {
                 arg.Message = "样品台移动到指定位置";
-                SendMsg("1-29");
+                SendMsg("1-26");
             }
             else
             {
                 //8,图像T形
                 wr.Img_Trapezoid_Top_Center_Position(fileName5, out x1, out y1, out state);
                 //接口返回像素,*pixelsize,得到坐标点。判断移动方式
-
                 if (state == 1)
                 {
                     //1. 根据客户PT沉积坐标控制FIB调整到中心位置???????
                     if (!iSEM.MoveStageXY(x1, y1))
                     {
                         arg.Message = "移动到新(" + x1.ToString() + "," + y1.ToString() + ")位置失败";
-                        SendMsg("1-29");
+                        SendMsg("1-26");
                         return false;
                     }
                     //判断是否移动完成
@@ -1379,12 +1425,12 @@ namespace MeasureThread
                         }
                     }
                     arg.Message = "移动到新(" + x1.ToString() + "," + y1.ToString() + ")位置失败";
-                    SendMsg("1-29");
+                    SendMsg("1-26");
                 }
                 else
                 {
                     arg.Message = "样品台移动失败";
-                    SendMsg("1-8");
+                    SendMsg("1-26");
                     return false;
                 }
             }
@@ -1399,8 +1445,12 @@ namespace MeasureThread
             y0 = iSEM.GetStageAtY();
             if (Math.Abs(x0 - x1) > fMin && Math.Abs(y0 - y1) > fMin)
             {
+                arg.Message = "位置校验失败";
+                SendMsg("1-27");
                 return false;
             }
+            arg.Message = "位置校验成功";
+            SendMsg("1-27");
             //判断是否停止进程
             if (key_stop)
             {
@@ -1409,7 +1459,16 @@ namespace MeasureThread
 
             //9、-10不操作
             //11、自动对焦。与之前操作相同
-            ImageFocus();
+            if (ImageFocus())
+            {
+                arg.Message = "自动对焦完成";
+                SendMsg("1-28");
+            }
+            else
+            {
+                arg.Message = "自动对焦失败";
+                SendMsg("1-28");
+            }
             //判断是否停止进程
             if (key_stop)
             {
@@ -1423,12 +1482,12 @@ namespace MeasureThread
             if (!GetImage(ImageMode.SEM, fileName6))
             {
                 arg.Message = "SEM拍照失败";
-                SendMsg("1-28");
+                SendMsg("1-29");
                 return false;
             }
             image18 = fileName6;
             arg.Message = "SEM拍照成功";
-            SendMsg("1-28");
+            SendMsg("1-29");
             Thread.Sleep(3000);
             //判断是否停止进程
             if (key_stop)
@@ -1438,6 +1497,9 @@ namespace MeasureThread
             //14光束复位
             iSEM.SetBeamShiftX(0);
             iSEM.SetBeamShiftY(0);
+            Thread.Sleep(3000);
+            arg.Message = "光束复位成功";
+            SendMsg("1-30");
             //判断是否停止进程
             if (key_stop)
             {
@@ -1446,158 +1508,13 @@ namespace MeasureThread
             return true;
         }
 
-        public bool CommonWork()
-        {
-            SendMsg("插入PT针");
-            //12.根据样品类型参数确定是否需要PT沉积,控制PT针插入
-            //if (firstHole.PT == true)
-            {
-                if (!InsertPT())
-                {
-                    SendMsg("插入PT针失败");
-                    return false;
-                }
-            }
-
-            //13. 自动 定位功能
-            SendMsg("自动定位切割位置");
-            if (!GetPoistion(false))
-            {
-                SendMsg("自动定位切割位置失败");
-                return false;
-            }
-
-            //14.自动控制FIB切割
-            SendMsg("FIB切割");
-            if (!FIBCross())
-            {
-                SendMsg("FIB切割失败");
-                return false;
-            }
-            //{
-            //    //1.根据参数设置FIB草率时间(使图清晰),设置梯形上下边及深度、设置束流
-            //    //2.控制FIB进行切割
-
-            //    //3.控制FIB拍照600X
-            //    //4.保存图片
-            //    {
-            //        //1.设置图片名称
-            //        //2.保存图片3
-            //        String fileName3 = WorkingFolder + ImageName3;
-            //        if (!GetImage(ImageMode.FIB, fileName3))
-            //        {
-            //            return false;
-            //        }
-            //    }
-            //    //5.验证切割准确性:与切割前对比,如果对比误差大,则停止自动执行,进行报警
-
-            //    //6.设置FIB解冻:先读取状态,如果冻结状态则进行解冻
-            //}
-            //15.根据样品类型决定是否撤出PT针
-            SendMsg("撤出PT针");
-            //if (firstHole.PT == false)
-            //{
-            if (!RetractPT())
-            {
-                SendMsg("撤出PT针失败");
-                return false;
-            }
-            //}
-
-            // 16.找到切割位置
-            SendMsg("找到切割位置");
-
-            //17.自动控制SEM拍截面照
-            SendMsg("观测层高");
-
-            SendMsg("切换SEM控制");
-            if (!iSEM.CmdFIBModeSEM())
-            {
-                SendMsg("SEM模式切换失败");
-                return false;
-            }
-
-            Thread.Sleep(10000);
-
-            SendMsg("放大6000倍");
-            if (!iSEM.SetMagnification(6000))
-            {
-                SendMsg("放大倍数调整失败");
-                return false;
-            }
-
-            if (DialogResult.Yes == MessageBox.Show("图像拍摄已完成?", "确认消息", MessageBoxButtons.YesNo))
-            {
-                SendMsg("拍摄照片完成");
-                //return true;
-            }
-            else
-            {
-                SendMsg("拍摄照片失败");
-                return false;
-            }
-
-            SendMsg("图像校正36度");
-            //3.设置SEM角度补偿cos36度
-            if (!TiltCorrection(36))
-            {
-                return false;
-            }
-
-            Thread.Sleep(3000);
-
-            string fn;
-            //用宏抓一般图
-
-            Thread.Sleep(5000);
-            fn = m_ProgramFolder + "\\Macro\\" + MacoScanPic;
-            SendMsg("用宏抓一般图" + fn);
-            iSEM.CMDMCFFilename(fn);
-            //延时1s??
-            Thread.Sleep(5000);
-
-            //用宏抓好图
-            fn = m_ProgramFolder + "\\Macro\\" + MacoGoodPic;
-            SendMsg("用宏抓好图" + fn);
-            iSEM.CMDMCFFilename(fn);
-            //延时1s??
-            Thread.Sleep(30000);
-
-            Thread.Sleep(10000);
-
-            WorkingFolder = m_measureFile.FilePath;
-            String fileName6 = WorkingFolder + "\\" + m_nWorkHoleNo.ToString() + "Hole" + ImageName6;
-            SendMsg("SEM拍照存储到" + fileName6);
-            if (!GetImage(ImageMode.SEM, fileName6))
-            {
-                SendMsg("SEM拍照失败");
-                return false;
-            }
-
-
-            //用宏抓标志图
-            fn = m_ProgramFolder + "\\Macro\\" + MacoExportTif;
-            SendMsg("用宏抓标志图" + fn);
-            iSEM.CMDMCFFilename(fn);
-            //延时1s??
-            Thread.Sleep(30000);
-
-            //恢复简单抓图
-            Thread.Sleep(5000);
-            fn = m_ProgramFolder + "\\Macro\\" + MacoScanPic;
-            SendMsg("用宏抓一般图" + fn);
-            iSEM.CMDMCFFilename(fn);
-
-
-            SendMsg("所有图结束");
-            return true;
-        }
-
         //第一个孔的测试过程
         public bool FirstHole()
         {
-            MeasureData.CutHole firstHole = m_cutHoles[0];            
-            
+            MeasureData.CutHole firstHole = m_cutHoles[0];
+
+            //首先默认为SEM模式
+            arg.State = "SEM";
             //12.根据样品类型参数确定是否需要PT沉积,控制PT针插入
             if (m_MsParam.Is_Photograph == false && m_MsParam.PT == true)
             {
@@ -1620,12 +1537,8 @@ namespace MeasureThread
             //13. 自动 定位功能
             if (!GetPoistion(true))
             {
-                arg.Message = "自动定位切割位置失败";
-                SendMsg("1-1");
                 return false;
             }
-            arg.Message = "自动定位切割位置成功";
-            SendMsg("1-1");
             //判断是否停止进程
             if (key_stop)
             {
@@ -1637,12 +1550,8 @@ namespace MeasureThread
             {
                 if (!FIBCross())
                 {
-                    arg.Message = "FIB切割失败";
-                    SendMsg("1-16");
                     return false;
                 }
-                arg.Message = "FIB切割成功";
-                SendMsg("1-16");
             }
             //判断是否停止进程
             if (key_stop)
@@ -1656,11 +1565,11 @@ namespace MeasureThread
                 if (!RetractPT())
                 {
                     arg.Message = "撤出PT针失败";
-                    SendMsg("1-17");
+                    SendMsg("1-15");
                     return false;
                 }
                 arg.Message = "撤出PT针成功";
-                SendMsg("1-17");
+                SendMsg("1-15");
             }
             //判断是否停止进程
             if (key_stop)
@@ -1669,16 +1578,9 @@ namespace MeasureThread
             }
 
             // 16.找到切割位置
-            if (m_MsParam.Is_Photograph == false)
+            if (!FindCross())
             {
-                if (!FindCross())
-                {
-                    arg.Message = "找到切割位置失败";
-                    SendMsg("1-24");
-                    return false;
-                }
-                arg.Message = "找到切割位置成功";
-                SendMsg("1-24");
+                return false;
             }
             //判断是否停止进程
             if (key_stop)
@@ -1715,11 +1617,11 @@ namespace MeasureThread
             if(state==0)
             {
                 arg.Message = "测量尺寸失败";
-                SendMsg("1-35");
+                SendMsg("1-31");
                 return false;
             }
             arg.Message = "测量尺寸成功";
-            SendMsg("1-35");
+            SendMsg("1-31");
 
             #region 测试程序
             //最后保存测量数据-测量文件、测量状态,m_cutHoles[i].STATE!=MeasureData.CutHole.State.Success.
@@ -1904,7 +1806,169 @@ namespace MeasureThread
         }
 
         //非第一个孔的测试过程
-        public void OtherHole()
+        public bool CommonWork()
+        {
+            //首先默认为SEM模式
+            arg.State = "SEM";
+            //12.根据样品类型参数确定是否需要PT沉积,控制PT针插入
+            if (m_MsParam.Is_Photograph == false && m_MsParam.PT == true)
+            {
+                if (!InsertPT())
+                {
+                    arg.Message = "插入PT针失败";
+                    SendMsg("1-0");
+                    return false;
+                }
+                arg.Message = "插入PT针成功";
+                SendMsg("1-0");
+            }
+            //判断是否停止进程
+            if (key_stop)
+            {
+                return false;
+            }
+
+            //13. 自动 定位功能
+            if (!GetPoistion(false))
+            {
+                return false;
+            }
+            //判断是否停止进程
+            if (key_stop)
+            {
+                return false;
+            }
+
+            //14.自动控制FIB切割
+            if (m_MsParam.Is_Photograph == false && m_MsParam.PT == true)
+            {
+                if (!FIBCross())
+                {
+                    return false;
+                }
+            }
+            //判断是否停止进程
+            if (key_stop)
+            {
+                return false;
+            }
+
+            //15.根据样品类型决定是否撤出PT针
+            if (m_MsParam.Is_Photograph == false && m_MsParam.PT == true)
+            {
+                if (!RetractPT())
+                {
+                    arg.Message = "撤出PT针失败";
+                    SendMsg("1-15");
+                    return false;
+                }
+                arg.Message = "撤出PT针成功";
+                SendMsg("1-15");
+            }
+            //判断是否停止进程
+            if (key_stop)
+            {
+                return false;
+            }
+
+            // 16.找到切割位置
+            if (!FindCross())
+            {
+                return false;
+            }
+            //判断是否停止进程
+            if (key_stop)
+            {
+                return false;
+            }
+
+            //将过程17最后的拍照图片提出给18步进行调用
+            String img18 = "";
+            //17.自动控制SEM拍截面照
+            if (m_MsParam.Is_Photograph == false)
+            {
+
+                if (!ShotSection(ref img18))
+                {
+                    arg.Message = "自动控制SEM拍截面照失败";
+                    SendMsg("1-33");
+                    return false;
+                }
+                arg.Message = "自动控制SEM拍截面照成功";
+                SendMsg("1-33");
+            }
+            //判断是否停止进程
+            if (key_stop)
+            {
+                return false;
+            }
+
+            //18.自动层高分析
+            float size = iSEM.GetPixelSize();
+            float mag = iSEM.GetMagnification();
+            int state = 0;
+            wr.Img_Measure_Size(img18, mag, size, out state);
+            if (state == 0)
+            {
+                arg.Message = "测量尺寸失败";
+                SendMsg("1-31");
+                return false;
+            }
+            arg.Message = "测量尺寸成功";
+            SendMsg("1-31");
+
+            #region 测试程序
+            //string fn;
+            //用宏抓一般图
+
+            //Thread.Sleep(5000);
+            //fn = m_ProgramFolder + "\\Macro\\" + MacoScanPic;
+            //SendMsg("用宏抓一般图" + fn);
+            //iSEM.CMDMCFFilename(fn);
+            ////延时1s??
+            //Thread.Sleep(5000);
+
+            ////用宏抓好图
+            //fn = m_ProgramFolder + "\\Macro\\" + MacoGoodPic;
+            //SendMsg("用宏抓好图" + fn);
+            //iSEM.CMDMCFFilename(fn);
+            ////延时1s??
+            //Thread.Sleep(30000);
+
+            //Thread.Sleep(10000);
+
+            //WorkingFolder = m_measureFile.FilePath;
+            //String fileName6 = WorkingFolder + "\\" + m_nWorkHoleNo.ToString() + "Hole" + ImageName6;
+            //SendMsg("SEM拍照存储到" + fileName6);
+            //if (!GetImage(ImageMode.SEM, fileName6))
+            //{
+            //    SendMsg("SEM拍照失败");
+            //    return false;
+            //}
+
+
+            ////用宏抓标志图
+            //fn = m_ProgramFolder + "\\Macro\\" + MacoExportTif;
+            //SendMsg("用宏抓标志图" + fn);
+            //iSEM.CMDMCFFilename(fn);
+            ////延时1s??
+            //Thread.Sleep(30000);
+
+            ////恢复简单抓图
+            //Thread.Sleep(5000);
+            //fn = m_ProgramFolder + "\\Macro\\" + MacoScanPic;
+            //SendMsg("用宏抓一般图" + fn);
+            //iSEM.CMDMCFFilename(fn);
+
+
+            //SendMsg("所有图结束");
+            #endregion
+            return true;
+        }
+
+        //测试完第一个孔后的样品台初始化操作。
+        //再调用CommonWork执行非第一个孔的测试过程
+        public bool OtherHole()
         {
             //SendMsg("当前切孔号为"+ m_nWorkHoleNo.ToString());
             CutHole currentHole = m_cutHoles[m_nWorkHoleNo];
@@ -1915,7 +1979,7 @@ namespace MeasureThread
             float ffrozen = iSEM.GetImageFrozen();
             if (ffrozen == float.NaN)
             {
-                return;
+                return false;
             }
 
             if (DialogResult.Yes == MessageBox.Show("样品台可以旋转恢复到水平吗?", "确认消息", MessageBoxButtons.YesNo))
@@ -1926,7 +1990,7 @@ namespace MeasureThread
             else
             {
                 //SendMsg("禁止样品台恢复到水平");
-                return;
+                return false;
             }
 
             //2. 调节样品1号孔的样品台6轴坐标
@@ -1934,7 +1998,7 @@ namespace MeasureThread
             //4. 控制样品台T轴归0,R轴变为坐标1、Z/M轴作为坐标2保存不变
             if (!iSEM.SetStageGotoT(0))
             {
-                return;
+                return false;
             }
 
             while (true)
@@ -1948,12 +2012,13 @@ namespace MeasureThread
             }
 
             //5. 获取光镜2号孔XY坐标
-            SendMsg("移动到"+m_nWorkHoleNo+"号孔位置:(" + currentHole.Position.X.ToString()+","+currentHole.Position.Y.ToString()+")");
+            //SendMsg("移动到"+m_nWorkHoleNo+"号孔位置:(" + currentHole.Position.X.ToString()+","+currentHole.Position.Y.ToString()+")");
                     
             //6. 根据光镜坐标控制样品台移动
             if (!iSEM.MoveStageXY(currentHole.Position.X, currentHole.Position.Y))
             {
-                SendMsg("移动失败");
+                //SendMsg("移动失败");
+                return false;
             }
 
             while (true)
@@ -1969,18 +2034,18 @@ namespace MeasureThread
             //7. 控制样品台,调整T轴54度、M/Z/R轴不变
             if (DialogResult.Yes == MessageBox.Show("样品台可以旋转吗?", "确认消息", MessageBoxButtons.YesNo))
             {
-                SendMsg("样品台旋转");
+                //SendMsg("样品台旋转");
                 //return true;
             }
             else
             {
-                SendMsg("禁止样品台旋转");
-                return;
+                //SendMsg("禁止样品台旋转");
+                return false;
             }
 
             if (!iSEM.SetStageGotoT(54))
             {
-                return;
+                return false;
             }
 
             while (true)
@@ -1992,27 +2057,27 @@ namespace MeasureThread
                     break;
                 }
             }
-            #endregion
 
-            SendMsg("拉直操作");
+            //SendMsg("拉直操作");
 
-                SendMsg("其他操作与1号孔操作一致");
-                if (!CommonWork())
-                {
-                    return;
-                }
-                //2. 定位切割
+            #endregion
+
+            //其他操作与第一个孔相同
+            if (!CommonWork())
+            {
+                return false;
+            }
+            //2. 定位切割
+            {
+                //1. 拉直操作
                 {
-                    //1. 拉直操作
-                    {
-                        //1.1 控制SEM进行拍照
-                        //1.2 图片传给客户,返回偏移角度
-                        //1.3 根据返回角度,控制样品台转动
-                    }
-                    //2. 与1号孔13步相同
+                    //1.1 控制SEM进行拍照
+                    //1.2 图片传给客户,返回偏移角度
+                    //1.3 根据返回角度,控制样品台转动
                 }
-                //3. 以后步骤与1号孔以后步骤一致
-            //}
+                //2. 与1号孔13步相同
+            }
+            return true;
         }
 
         //角度补偿