Browse Source

Merge branch 'master' of http://192.168.1.123:10080/SDD1/HOZ

wb_han 5 years ago
parent
commit
bd351c1886

+ 10 - 10
AutoDo/FormAutoDo.cs

@@ -48,12 +48,12 @@ namespace AutoDo
             int x = 0;
             int x = 0;
 
 
             double smax = LoGMean(files[0]);
             double smax = LoGMean(files[0]);
-            int wdmax = int.Parse(files[0].Substring(files[0].Length - 8, 4));
+            int wdmax = int.Parse(System.IO.Path.GetFileNameWithoutExtension(files[0]));
 
 
             foreach (var file in files)
             foreach (var file in files)
             {
             {
                
                
-                int wd = int.Parse(file.Substring(file.Length - 8, 4));
+                int wd = int.Parse(System.IO.Path.GetFileNameWithoutExtension(file));
                 double svalue = LoGMean(file);
                 double svalue = LoGMean(file);
 
 
                 if (smax < svalue)
                 if (smax < svalue)
@@ -191,14 +191,14 @@ namespace AutoDo
 
 
 
 
             double smax = Tenengrad(files[0]);
             double smax = Tenengrad(files[0]);
-            int wdmax = int.Parse(files[0].Substring(files[0].Length - 8, 4));
+            int wdmax = int.Parse(System.IO.Path.GetFileNameWithoutExtension(files[0]));
 
 
 
 
             int x = 0;
             int x = 0;
             foreach (var file in files)
             foreach (var file in files)
             {
             {
                 
                 
-                int wd = int.Parse(file.Substring(file.Length - 8, 4));
+                int wd = int.Parse(System.IO.Path.GetFileNameWithoutExtension(file));
                 double svalue = Tenengrad(file);
                 double svalue = Tenengrad(file);
 
 
 
 
@@ -241,13 +241,13 @@ namespace AutoDo
 
 
  
  
             double smax1 = LoGMean(files[0]);
             double smax1 = LoGMean(files[0]);
-            int wdmax1 = int.Parse(files[0].Substring(files[0].Length - 8, 4));
+            int wdmax1 = int.Parse(System.IO.Path.GetFileNameWithoutExtension(files[0]));
 
 
             double smax2 = Tenengrad(files[0]);
             double smax2 = Tenengrad(files[0]);
-            int wdmax2 = int.Parse(files[0].Substring(files[0].Length - 8, 4));
+            int wdmax2 = wdmax1;
 
 
             double smax3 = TTgrad(files[0]);
             double smax3 = TTgrad(files[0]);
-            int wdmax3 = int.Parse(files[0].Substring(files[0].Length - 8, 4));
+            int wdmax3 = wdmax1;
 
 
 
 
 
 
@@ -255,7 +255,7 @@ namespace AutoDo
             foreach (var file in files)
             foreach (var file in files)
             {
             {
 
 
-                int wd = int.Parse(file.Substring(file.Length - 8, 4));
+                int wd = int.Parse(System.IO.Path.GetFileNameWithoutExtension(file));
                 double svalue1 = LoGMean(file);
                 double svalue1 = LoGMean(file);
                 double svalue2 = Tenengrad(file);
                 double svalue2 = Tenengrad(file);
                 double svalue3 = TTgrad(file);
                 double svalue3 = TTgrad(file);
@@ -324,12 +324,12 @@ namespace AutoDo
             int x = 0;
             int x = 0;
 
 
             double smax = TTgrad(files[0]);
             double smax = TTgrad(files[0]);
-            int wdmax = int.Parse(files[0].Substring(files[0].Length - 8, 4));
+            int wdmax = int.Parse(System.IO.Path.GetFileNameWithoutExtension(files[0]));
 
 
             foreach (var file in files)
             foreach (var file in files)
             {
             {
 
 
-                int wd = int.Parse(file.Substring(file.Length - 8, 4));
+                int wd = int.Parse(System.IO.Path.GetFileNameWithoutExtension(file));
                 double svalue = TTgrad(file);
                 double svalue = TTgrad(file);
 
 
                 if (smax < svalue)
                 if (smax < svalue)

+ 4 - 0
AutoDo/packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="OpenCvSharp3-AnyCPU" version="4.0.0.20181129" targetFramework="net461" />
+</packages>

+ 7 - 0
HOZProject/App.config

@@ -53,5 +53,12 @@
       <add key="WebServerPort" value="12345"/>
       <add key="WebServerPort" value="12345"/>
       <!--远程算法地址-->
       <!--远程算法地址-->
       <add key="WebServerUrl" value="FIB_degree_recognize,test2,FIB_verify,test4,test5,test6,test7,test8"/>
       <add key="WebServerUrl" value="FIB_degree_recognize,test2,FIB_verify,test4,test5,test6,test7,test8"/>
+
+      <add key="" value=""/>
+      <add key="" value=""/>
+      <add key="" value=""/>
+      <add key="" value=""/>
+      <add key="" value=""/>
+      <add key="" value=""/>
     </appSettings>
     </appSettings>
 </configuration>
 </configuration>

+ 44 - 0
HOZProject/FormUnitControl.cs

@@ -1597,6 +1597,50 @@ namespace HOZProject
             }
             }
         }
         }
 
 
+        public void AnalysisPosition(Double centerX,Double centerY,Double firstX,Double firstY,Double distance,int rag,ref List<Double> ptsx,ref List<Double> ptsy)
+        {
+            //求样品1的水平角度
+            double angle = 0;
+
+            //清空所有点信息
+            ptsx.Clear();
+            ptsy.Clear();
+            //将第一个点加入到点信息中
+            ptsx.Add(firstX);
+            ptsy.Add(firstY);
+
+            //计算第一个点与X轴的交角度数
+            angle = Math.Atan2(ptsy[0] - centerY, centerX - ptsx[0]) * 180 / Math.PI;
+
+            //这里是求与第一个点横向排列的其他点的移动角度
+            //就是按45度向左向右移动的度
+            angle = 45 - angle;
+            angle = angle * Math.PI / 180;
+
+            double tx = 0;
+            double ty = 0;
+            for (int j = 0; j < rag; j++)
+            {
+                //计算每行第一个点的坐标
+                if (j > 0)
+                {
+                    tx = distance * j * Math.Sin(angle);
+                    ty = distance * j * Math.Cos(angle);
+                    ptsx.Add(tx + ptsx[0]);
+                    ptsy.Add(ptsy[0] - ty);
+                }
+                //计算每行其他点的坐标
+                for (int i = 1; i < rag; i++)
+                {
+                    tx = distance * i * Math.Cos(angle);
+                    ty = distance * i * Math.Sin(angle);
+                    ptsx.Add(tx + ptsx[j * rag]);
+                    ptsy.Add(ty + ptsy[j * rag]);
+                }
+            }
+        }
+
+
         private void btn30_Click(object sender, EventArgs e)
         private void btn30_Click(object sender, EventArgs e)
         {
         {
             txtsample1x.Text = "21.7";
             txtsample1x.Text = "21.7";

+ 29 - 33
HOZProject/MeasureXML/MeasureStructXml.xml

@@ -1,44 +1,40 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <?xml version="1.0" encoding="utf-8" ?>
 <MeasureList>
 <MeasureList>
   <MeasureFlow Name="测量流程">
   <MeasureFlow Name="测量流程">
-      <Step Index="0" Name="" Code="1-0" IsData="False" Type="Pt" Title="PT沉积" Details="自动根据样品类型参数确定是否需要PT沉积"></Step>
-      <Step Index="1" Name="" Code="1-1" IsData="False" Type="Photo" Title="移动至切割位置" Details="自动定位切割位置"></Step>
+      <Step Index="0" Name="" Code="1-0" IsData="False" Type="Pt" IsShow="True" Title="PT沉积" Details="自动根据样品类型参数确定是否需要PT沉积"></Step>
+      <Step Index="1" Name="" Code="1-1" IsData="False" Type="State" IsShow="False" Title="移动至切割位置" Details="自动定位切割位置"></Step>
       <Step Index="2" Name="" Code="1-2" IsData="False" Type="Photo" Title="设置放大倍数" Details="控制SEM放大倍数"></Step>
       <Step Index="2" Name="" Code="1-2" IsData="False" Type="Photo" Title="设置放大倍数" Details="控制SEM放大倍数"></Step>
       <Step Index="3" Name="" Code="1-3" IsData="True" Type="Photo" Title="自动对焦" Details="控制SEM自动对焦、亮度、对比度"></Step>
       <Step Index="3" Name="" Code="1-3" IsData="True" Type="Photo" Title="自动对焦" Details="控制SEM自动对焦、亮度、对比度"></Step>
       <Step Index="4" Name="" Code="1-4" IsData="False" Type="Photo" Title="角度补偿" Details="设置SEM进行角度补偿"></Step>
       <Step Index="4" Name="" Code="1-4" IsData="False" Type="Photo" Title="角度补偿" Details="设置SEM进行角度补偿"></Step>
-      <Step Index="5" Name="" Code="1-5" IsData="True" Type="Photo" Title="拍照" Details="控制SEM对分析位置拍照"></Step>
-      <Step Index="6" Name="" Code="1-6" IsData="False" Type="Photo" Title="保存照片" Details="保存照片"></Step>
-      <Step Index="7" Name="" Code="1-7" IsData="False" Type="FIB" Title="FIB拍照参数" Details="设置FIB拍照参数-扫描时间、束流等"></Step>
-      <Step Index="8" Name="" Code="1-8" IsData="False" Type="FIB" Title="FIB设置参数" Details="控制FIB自动亮度、对比度"></Step>
-      <Step Index="9" Name="" Code="1-9" IsData="False" Type="FIB" Title="FIB拍照" Details=""></Step>
-      <Step Index="10" Name="" Code="1-10" IsData="False" Type="Photo" Title="保存照片" Details="保存照片"></Step>
-      <Step Index="11" Name="" Code="1-11" IsData="True" Type="Photo" Title="显示照片" Details="将照片传给客户,返回梯形位置坐标,及样品类型参数"></Step>
-      <Step Index="12" Name="" Code="1-12" IsData="False" Type="Pt" Title="PT沉积" Details="自动根据样品类型参数确定是否需要PT沉积"></Step>
-      <Step Index="13" Name="" Code="1-13" IsData="False" Type="FIB" Title="FIB调整到中心位置" Details="根据梯形坐标控制FIB调整到中心位置"></Step>
-      <Step Index="14" Name="" Code="1-14" IsData="False" Type="Photo" Title="验证移动准确性" Details="验证移动准确性:获取当前FIB中心位置坐标,与客户返回坐标对比,验证是否移动正确"></Step>
-      <Step Index="15" Name="" Code="1-15" IsData="False" Type="Photo" Title="保存信息" Details="保存切孔位置坐标,保存客户返回值信息"></Step>
+      <Step Index="5" Name="" Code="1-5" IsData="True" Type="Photo" Title="拍照保存照片" Details="控制SEM对分析位置拍照保存照片"></Step>
+      <Step Index="6" Name="" Code="1-6" IsData="False" Type="FIB" Title="切换到FIB模式" Details="切换到FIB模式"></Step>
+      <Step Index="7" Name="" Code="1-7" IsData="True" Type="FIB" Title="FIB拍照保存照片" Details="FIB拍照保存照片"></Step>
+      <Step Index="8" Name="" Code="1-8" IsData="True" Type="Stage" Title="样品台移动到指定位置" Details="将照片传给客户,返回梯形位置坐标,及样品类型参数"></Step>
+      <Step Index="9" Name="" Code="1-9" IsData="False" Type="Stage" Title="验证移动位置" Details="验证移动准确性:获取当前FIB中心位置坐标,与客户返回坐标对比,验证是否移动正确"></Step>
+      <Step Index="10" Name="" Code="1-10" IsData="False" Type="Photo" Title="PT沉积" Details="根据配置文件进行PT沉积"></Step>
+      <Step Index="11" Name="" Code="1-11" IsData="True" Type="Position" Title="保存六轴坐标" Details="将六轴坐标保存到数据库中"></Step>
 
 
-      <Step Index="16" Name="" Code="1-16" IsData="True" Type="FIB" Title="设置FIB参数" Details="根据参数设置FIB扫描时间(使图清晰),设置梯形上下边及深度、设置束流等"></Step>
-      <Step Index="17" Name="" Code="1-17" IsData="False" Type="FIB" Title="FIB进行切割" Details="控制FIB进行切割"></Step>
-      <Step Index="18" Name="" Code="1-18" IsData="False" Type="FIB" Title="设置FIB放大倍数" Details="控制SEM放大倍数"></Step>
-      <Step Index="19" Name="" Code="1-19" IsData="False" Type="Photo" Title="保存照片" Details="保存照片"></Step>
-      <Step Index="20" Name="" Code="1-20" IsData="False" Type="Photo" Title="验证移动准确性" Details="验证移动准确性:获取当前FIB中心位置坐标,与客户返回坐标对比"></Step>
-      <Step Index="21" Name="" Code="1-21" IsData="False" Type="Photo" Title="设置放大倍数" Details="控制SEM放大倍数"></Step>
-      <Step Index="22" Name="" Code="1-22" IsData="False" Type="FIB" Title="设置FIB解冻" Details="设置FIB解冻:先读取状态,如果冻结状态则进行解冻"></Step>
-      <Step Index="23" Name="" Code="1-23" IsData="False" Type="Pt" Title="拔出PT针" Details="根据样品类型决定是否撤出PT针"></Step>
+      <Step Index="12" Name="" Code="1-12" IsData="False" Type="FIB" Title="FIB进行切割" Details="控制FIB进行切割"></Step>
+      <Step Index="13" Name="" Code="1-13" IsData="False" Type="FIB" Title="设置FIB放大倍数" Details="控制SEM放大倍数"></Step>
+      <Step Index="14" Name="" Code="1-14" IsData="False" Type="Photo" Title="保存照片" Details="保存照片"></Step>
+      <Step Index="15" Name="" Code="1-15" IsData="False" Type="Photo" Title="验证移动准确性" Details="验证移动准确性:获取当前FIB中心位置坐标,与客户返回坐标对比"></Step>
+      <Step Index="16" Name="" Code="1-16" IsData="False" Type="State" Title="FIB切割状态" Details="FIB切割成功或失败"></Step>
+    
+      <Step Index="17" Name="" Code="1-17" IsData="False" Type="Pt" Title="拔出PT针" Details="根据样品类型决定是否撤出PT针"></Step>
 
 
-      <Step Index="24" Name="" Code="1-24" IsData="False" Type="Photo" Title="设置放大倍数" Details="控制SEM放大倍数"></Step>
-      <Step Index="25" Name="" Code="1-25" IsData="True" Type="Photo" Title="自动对焦" Details="控制SEM自动对焦、亮度、对比度"></Step>
-      <Step Index="26" Name="" Code="1-26" IsData="True" Type="Photo" Title="拍照" Details="控制SEM对分析位置拍照"></Step>
-      <Step Index="27" Name="" Code="1-27" IsData="True" Type="Photo" Title="显示照片" Details="获取偏移坐标,以及偏移角度"></Step>
-      <Step Index="28" Name="" Code="1-28" IsData="False" Type="Photo" Title="移动到切孔位置" Details="根据坐标控制SEM移动到切孔位置,居中"></Step>
-      <Step Index="29" Name="" Code="1-29" IsData="False" Type="Photo" Title="验证移动准确性" Details="验证移动准确性:获取当前SEM中心位置坐标,与客户返回坐标对比,验证是否移动正确"></Step>
-
-      <Step Index="30" Name="" Code="1-30" IsData="False" Type="Photo" Title="设置放大倍数" Details="控制SEM放大到指定参数大小范围"></Step>
-      <Step Index="31" Name="" Code="1-31" IsData="True" Type="Photo" Title="自动对焦" Details="控制SEM自动对焦、消像散、亮度、对比度"></Step>
-      <Step Index="32" Name="" Code="1-32" IsData="False" Type="Photo" Title="角度补偿" Details="设置SEM角度补偿"></Step>
-      <Step Index="33" Name="" Code="1-33" IsData="True" Type="Photo" Title="保存照片" Details="设置图片名称、保存图片"></Step>
-      <Step Index="34" Name="" Code="1-34" IsData="True" Type="Photo" Title="显示照片" Details="获取偏移坐标"></Step>
+      <Step Index="18" Name="" Code="1-18" IsData="False" Type="Photo" Title="设置放大倍数" Details="控制SEM放大倍数"></Step>
+      <Step Index="19" Name="" Code="1-19" IsData="True" Type="Photo" Title="自动对焦" Details="控制SEM自动对焦、亮度、对比度"></Step>
+      <Step Index="20" Name="" Code="1-20" IsData="True" Type="Photo" Title="拍照显示照片" Details="控制SEM对分析位置拍照"></Step>
+      <Step Index="21" Name="" Code="1-21" IsData="False" Type="Photo" Title="移动到切孔位置" Details="根据坐标控制SEM移动到切孔位置,居中"></Step>
+      <Step Index="22" Name="" Code="1-22" IsData="False" Type="Photo" Title="调整角度" Details="调整角度"></Step>
+      <Step Index="23" Name="" Code="1-23" IsData="False" Type="Photo" Title="验证移动准确性" Details="验证移动准确性:获取当前SEM中心位置坐标,与客户返回坐标对比,验证是否移动正确"></Step>
+      <Step Index="24" Name="" Code="1-24" IsData="False" Type="State" Title="自动调整SEM找切割位置" Details="自动调整SEM找切割位置"></Step>
+    
+      <Step Index="25" Name="" Code="1-25" IsData="False" Type="Photo" Title="设置放大倍数" Details="控制SEM放大到指定参数大小范围"></Step>
+      <Step Index="26" Name="" Code="1-26" IsData="True" Type="Photo" Title="自动对焦" Details="控制SEM自动对焦、消像散、亮度、对比度"></Step>
+      <Step Index="27" Name="" Code="1-27" IsData="False" Type="Photo" Title="角度补偿" Details="设置SEM角度补偿"></Step>
+      <Step Index="28" Name="" Code="1-28" IsData="True" Type="Photo" Title="保存照片" Details="设置图片名称、保存图片"></Step>
+      <Step Index="29" Name="" Code="1-29" IsData="True" Type="Photo" Title="获取坐标并移动到对应位置" Details="获取坐标并移动到对应位置"></Step>
       <Step Index="35" Name="" Code="1-35" IsData="False" Type="Photo" Title="移动到分析位置" Details="根据坐标控制SEM移动到分析位置"></Step>
       <Step Index="35" Name="" Code="1-35" IsData="False" Type="Photo" Title="移动到分析位置" Details="根据坐标控制SEM移动到分析位置"></Step>
       <Step Index="36" Name="" Code="1-36" IsData="False" Type="Photo" Title="验证移动准确性" Details="验证移动准确性:获取当前SEM中心位置坐标,与客户返回坐标对比,验证是否移动正确"></Step>
       <Step Index="36" Name="" Code="1-36" IsData="False" Type="Photo" Title="验证移动准确性" Details="验证移动准确性:获取当前SEM中心位置坐标,与客户返回坐标对比,验证是否移动正确"></Step>
 
 

+ 196 - 175
ManulDo/MainForm.Designer.cs

@@ -28,7 +28,7 @@
         /// </summary>
         /// </summary>
         private void InitializeComponent()
         private void InitializeComponent()
         {
         {
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
             this.groupBox1 = new System.Windows.Forms.GroupBox();
             this.groupBox1 = new System.Windows.Forms.GroupBox();
             this.btnOpenFile = new System.Windows.Forms.Button();
             this.btnOpenFile = new System.Windows.Forms.Button();
             this.btnSaveFile = new System.Windows.Forms.Button();
             this.btnSaveFile = new System.Windows.Forms.Button();
@@ -61,26 +61,27 @@
             this.listmsg = new System.Windows.Forms.ListBox();
             this.listmsg = new System.Windows.Forms.ListBox();
             this.tbAutoFocus = new System.Windows.Forms.Button();
             this.tbAutoFocus = new System.Windows.Forms.Button();
             this.groupBox5 = new System.Windows.Forms.GroupBox();
             this.groupBox5 = new System.Windows.Forms.GroupBox();
-            this.btImgPath = new System.Windows.Forms.Button();
-            this.tBImgPath = new System.Windows.Forms.TextBox();
-            this.label3 = new System.Windows.Forms.Label();
-            this.label4 = new System.Windows.Forms.Label();
-            this.label5 = new System.Windows.Forms.Label();
-            this.label6 = new System.Windows.Forms.Label();
-            this.label7 = new System.Windows.Forms.Label();
-            this.label8 = new System.Windows.Forms.Label();
-            this.tB = new System.Windows.Forms.TextBox();
-            this.textBox2 = new System.Windows.Forms.TextBox();
-            this.textBox3 = new System.Windows.Forms.TextBox();
-            this.textBox4 = new System.Windows.Forms.TextBox();
-            this.textBox5 = new System.Windows.Forms.TextBox();
-            this.textBox6 = new System.Windows.Forms.TextBox();
-            this.label9 = new System.Windows.Forms.Label();
-            this.label10 = new System.Windows.Forms.Label();
-            this.label11 = new System.Windows.Forms.Label();
-            this.label12 = new System.Windows.Forms.Label();
-            this.label13 = new System.Windows.Forms.Label();
+            this.button2 = new System.Windows.Forms.Button();
             this.label14 = new System.Windows.Forms.Label();
             this.label14 = new System.Windows.Forms.Label();
+            this.label13 = new System.Windows.Forms.Label();
+            this.label12 = new System.Windows.Forms.Label();
+            this.label11 = new System.Windows.Forms.Label();
+            this.label10 = new System.Windows.Forms.Label();
+            this.label9 = new System.Windows.Forms.Label();
+            this.tB_WD = new System.Windows.Forms.TextBox();
+            this.tB_fStep = new System.Windows.Forms.TextBox();
+            this.tB_fRange = new System.Windows.Forms.TextBox();
+            this.tB_Step = new System.Windows.Forms.TextBox();
+            this.tB_Down = new System.Windows.Forms.TextBox();
+            this.tB_Up = new System.Windows.Forms.TextBox();
+            this.label8 = new System.Windows.Forms.Label();
+            this.label7 = new System.Windows.Forms.Label();
+            this.label6 = new System.Windows.Forms.Label();
+            this.label5 = new System.Windows.Forms.Label();
+            this.label4 = new System.Windows.Forms.Label();
+            this.label3 = new System.Windows.Forms.Label();
+            this.tBImgPath = new System.Windows.Forms.TextBox();
+            this.btImgPath = new System.Windows.Forms.Button();
             this.groupBox1.SuspendLayout();
             this.groupBox1.SuspendLayout();
             this.groupBox2.SuspendLayout();
             this.groupBox2.SuspendLayout();
             this.groupBox3.SuspendLayout();
             this.groupBox3.SuspendLayout();
@@ -244,14 +245,14 @@
             this.groupBox3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.groupBox3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.groupBox3.Name = "groupBox3";
             this.groupBox3.Name = "groupBox3";
             this.groupBox3.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.groupBox3.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.groupBox3.Size = new System.Drawing.Size(454, 109);
+            this.groupBox3.Size = new System.Drawing.Size(774, 76);
             this.groupBox3.TabIndex = 3;
             this.groupBox3.TabIndex = 3;
             this.groupBox3.TabStop = false;
             this.groupBox3.TabStop = false;
             this.groupBox3.Text = "测量参数";
             this.groupBox3.Text = "测量参数";
             // 
             // 
             // btParamOK
             // btParamOK
             // 
             // 
-            this.btParamOK.Location = new System.Drawing.Point(342, 67);
+            this.btParamOK.Location = new System.Drawing.Point(653, 20);
             this.btParamOK.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btParamOK.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btParamOK.Name = "btParamOK";
             this.btParamOK.Name = "btParamOK";
             this.btParamOK.Size = new System.Drawing.Size(102, 37);
             this.btParamOK.Size = new System.Drawing.Size(102, 37);
@@ -262,7 +263,7 @@
             // 
             // 
             // btFIB
             // btFIB
             // 
             // 
-            this.btFIB.Location = new System.Drawing.Point(184, 60);
+            this.btFIB.Location = new System.Drawing.Point(575, 23);
             this.btFIB.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btFIB.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btFIB.Name = "btFIB";
             this.btFIB.Name = "btFIB";
             this.btFIB.Size = new System.Drawing.Size(43, 26);
             this.btFIB.Size = new System.Drawing.Size(43, 26);
@@ -273,7 +274,7 @@
             // 
             // 
             // tBFIBTemp
             // tBFIBTemp
             // 
             // 
-            this.tBFIBTemp.Location = new System.Drawing.Point(86, 59);
+            this.tBFIBTemp.Location = new System.Drawing.Point(477, 22);
             this.tBFIBTemp.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.tBFIBTemp.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.tBFIBTemp.Name = "tBFIBTemp";
             this.tBFIBTemp.Name = "tBFIBTemp";
             this.tBFIBTemp.ReadOnly = true;
             this.tBFIBTemp.ReadOnly = true;
@@ -283,7 +284,7 @@
             // label2
             // label2
             // 
             // 
             this.label2.AutoSize = true;
             this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(17, 68);
+            this.label2.Location = new System.Drawing.Point(408, 31);
             this.label2.Name = "label2";
             this.label2.Name = "label2";
             this.label2.Size = new System.Drawing.Size(71, 18);
             this.label2.Size = new System.Drawing.Size(71, 18);
             this.label2.TabIndex = 4;
             this.label2.TabIndex = 4;
@@ -330,9 +331,9 @@
             // 
             // 
             // CutHoleGridView
             // CutHoleGridView
             // 
             // 
-            dataGridViewCellStyle2.BackColor = System.Drawing.Color.Beige;
-            dataGridViewCellStyle2.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Bold);
-            this.CutHoleGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
+            dataGridViewCellStyle1.BackColor = System.Drawing.Color.Beige;
+            dataGridViewCellStyle1.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Bold);
+            this.CutHoleGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
             this.CutHoleGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.CutHoleGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.CutHoleGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.CutHoleGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.Name,
             this.Name,
@@ -342,7 +343,7 @@
             this.M,
             this.M,
             this.R,
             this.R,
             this.T});
             this.T});
-            this.CutHoleGridView.Location = new System.Drawing.Point(12, 350);
+            this.CutHoleGridView.Location = new System.Drawing.Point(15, 326);
             this.CutHoleGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.CutHoleGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.CutHoleGridView.Name = "CutHoleGridView";
             this.CutHoleGridView.Name = "CutHoleGridView";
             this.CutHoleGridView.ReadOnly = true;
             this.CutHoleGridView.ReadOnly = true;
@@ -389,35 +390,37 @@
             // 
             // 
             this.listmsg.FormattingEnabled = true;
             this.listmsg.FormattingEnabled = true;
             this.listmsg.ItemHeight = 18;
             this.listmsg.ItemHeight = 18;
-            this.listmsg.Location = new System.Drawing.Point(802, 12);
+            this.listmsg.Location = new System.Drawing.Point(802, 18);
             this.listmsg.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.listmsg.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.listmsg.Name = "listmsg";
             this.listmsg.Name = "listmsg";
-            this.listmsg.Size = new System.Drawing.Size(784, 832);
+            this.listmsg.Size = new System.Drawing.Size(784, 796);
             this.listmsg.TabIndex = 17;
             this.listmsg.TabIndex = 17;
             // 
             // 
             // tbAutoFocus
             // tbAutoFocus
             // 
             // 
             this.tbAutoFocus.Location = new System.Drawing.Point(630, 158);
             this.tbAutoFocus.Location = new System.Drawing.Point(630, 158);
             this.tbAutoFocus.Name = "tbAutoFocus";
             this.tbAutoFocus.Name = "tbAutoFocus";
-            this.tbAutoFocus.Size = new System.Drawing.Size(114, 32);
+            this.tbAutoFocus.Size = new System.Drawing.Size(102, 37);
             this.tbAutoFocus.TabIndex = 18;
             this.tbAutoFocus.TabIndex = 18;
             this.tbAutoFocus.Text = "对焦";
             this.tbAutoFocus.Text = "对焦";
             this.tbAutoFocus.UseVisualStyleBackColor = true;
             this.tbAutoFocus.UseVisualStyleBackColor = true;
+            this.tbAutoFocus.Click += new System.EventHandler(this.tbAutoFocus_Click);
             // 
             // 
             // groupBox5
             // groupBox5
             // 
             // 
+            this.groupBox5.Controls.Add(this.button2);
             this.groupBox5.Controls.Add(this.label14);
             this.groupBox5.Controls.Add(this.label14);
             this.groupBox5.Controls.Add(this.label13);
             this.groupBox5.Controls.Add(this.label13);
             this.groupBox5.Controls.Add(this.label12);
             this.groupBox5.Controls.Add(this.label12);
             this.groupBox5.Controls.Add(this.label11);
             this.groupBox5.Controls.Add(this.label11);
             this.groupBox5.Controls.Add(this.label10);
             this.groupBox5.Controls.Add(this.label10);
             this.groupBox5.Controls.Add(this.label9);
             this.groupBox5.Controls.Add(this.label9);
-            this.groupBox5.Controls.Add(this.textBox6);
-            this.groupBox5.Controls.Add(this.textBox5);
-            this.groupBox5.Controls.Add(this.textBox4);
-            this.groupBox5.Controls.Add(this.textBox3);
-            this.groupBox5.Controls.Add(this.textBox2);
-            this.groupBox5.Controls.Add(this.tB);
+            this.groupBox5.Controls.Add(this.tB_WD);
+            this.groupBox5.Controls.Add(this.tB_fStep);
+            this.groupBox5.Controls.Add(this.tB_fRange);
+            this.groupBox5.Controls.Add(this.tB_Step);
+            this.groupBox5.Controls.Add(this.tB_Down);
+            this.groupBox5.Controls.Add(this.tB_Up);
             this.groupBox5.Controls.Add(this.label8);
             this.groupBox5.Controls.Add(this.label8);
             this.groupBox5.Controls.Add(this.label7);
             this.groupBox5.Controls.Add(this.label7);
             this.groupBox5.Controls.Add(this.label6);
             this.groupBox5.Controls.Add(this.label6);
@@ -427,187 +430,204 @@
             this.groupBox5.Controls.Add(this.tBImgPath);
             this.groupBox5.Controls.Add(this.tBImgPath);
             this.groupBox5.Controls.Add(this.btImgPath);
             this.groupBox5.Controls.Add(this.btImgPath);
             this.groupBox5.Controls.Add(this.tbAutoFocus);
             this.groupBox5.Controls.Add(this.tbAutoFocus);
-            this.groupBox5.Location = new System.Drawing.Point(17, 636);
+            this.groupBox5.Location = new System.Drawing.Point(17, 609);
             this.groupBox5.Name = "groupBox5";
             this.groupBox5.Name = "groupBox5";
             this.groupBox5.Size = new System.Drawing.Size(771, 207);
             this.groupBox5.Size = new System.Drawing.Size(771, 207);
             this.groupBox5.TabIndex = 19;
             this.groupBox5.TabIndex = 19;
             this.groupBox5.TabStop = false;
             this.groupBox5.TabStop = false;
             this.groupBox5.Text = "自动对焦";
             this.groupBox5.Text = "自动对焦";
             // 
             // 
-            // btImgPath
+            // button2
             // 
             // 
-            this.btImgPath.Location = new System.Drawing.Point(17, 25);
-            this.btImgPath.Name = "btImgPath";
-            this.btImgPath.Size = new System.Drawing.Size(266, 35);
-            this.btImgPath.TabIndex = 20;
-            this.btImgPath.Text = "选择图像存储路径";
-            this.btImgPath.UseVisualStyleBackColor = true;
-            this.btImgPath.Click += new System.EventHandler(this.btImgPath_Click);
+            this.button2.Location = new System.Drawing.Point(508, 158);
+            this.button2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.button2.Name = "button2";
+            this.button2.Size = new System.Drawing.Size(102, 37);
+            this.button2.TabIndex = 39;
+            this.button2.Text = "确定";
+            this.button2.UseVisualStyleBackColor = true;
+            this.button2.Click += new System.EventHandler(this.button2_Click);
             // 
             // 
-            // tBImgPath
+            // label14
             // 
             // 
-            this.tBImgPath.Location = new System.Drawing.Point(302, 27);
-            this.tBImgPath.Name = "tBImgPath";
-            this.tBImgPath.ReadOnly = true;
-            this.tBImgPath.Size = new System.Drawing.Size(450, 28);
-            this.tBImgPath.TabIndex = 21;
+            this.label14.AutoSize = true;
+            this.label14.Location = new System.Drawing.Point(718, 122);
+            this.label14.Name = "label14";
+            this.label14.Size = new System.Drawing.Size(26, 18);
+            this.label14.TabIndex = 38;
+            this.label14.Text = "um";
             // 
             // 
-            // label3
+            // label13
             // 
             // 
-            this.label3.AutoSize = true;
-            this.label3.Location = new System.Drawing.Point(33, 83);
-            this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(80, 18);
-            this.label3.TabIndex = 8;
-            this.label3.Text = "调节上限";
+            this.label13.AutoSize = true;
+            this.label13.Location = new System.Drawing.Point(487, 126);
+            this.label13.Name = "label13";
+            this.label13.Size = new System.Drawing.Size(26, 18);
+            this.label13.TabIndex = 37;
+            this.label13.Text = "um";
             // 
             // 
-            // label4
+            // label12
             // 
             // 
-            this.label4.AutoSize = true;
-            this.label4.Location = new System.Drawing.Point(299, 83);
-            this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(80, 18);
-            this.label4.TabIndex = 22;
-            this.label4.Text = "调节下限";
+            this.label12.AutoSize = true;
+            this.label12.Location = new System.Drawing.Point(222, 121);
+            this.label12.Name = "label12";
+            this.label12.Size = new System.Drawing.Size(26, 18);
+            this.label12.TabIndex = 36;
+            this.label12.Text = "um";
             // 
             // 
-            // label5
+            // label11
             // 
             // 
-            this.label5.AutoSize = true;
-            this.label5.Location = new System.Drawing.Point(530, 83);
-            this.label5.Name = "label5";
-            this.label5.Size = new System.Drawing.Size(80, 18);
-            this.label5.TabIndex = 23;
-            this.label5.Text = "调节步长";
+            this.label11.AutoSize = true;
+            this.label11.Location = new System.Drawing.Point(718, 84);
+            this.label11.Name = "label11";
+            this.label11.Size = new System.Drawing.Size(26, 18);
+            this.label11.TabIndex = 35;
+            this.label11.Text = "um";
             // 
             // 
-            // label6
+            // label10
             // 
             // 
-            this.label6.AutoSize = true;
-            this.label6.Location = new System.Drawing.Point(36, 119);
-            this.label6.Name = "label6";
-            this.label6.Size = new System.Drawing.Size(80, 18);
-            this.label6.TabIndex = 24;
-            this.label6.Text = "精调范围";
+            this.label10.AutoSize = true;
+            this.label10.Location = new System.Drawing.Point(487, 84);
+            this.label10.Name = "label10";
+            this.label10.Size = new System.Drawing.Size(26, 18);
+            this.label10.TabIndex = 34;
+            this.label10.Text = "um";
             // 
             // 
-            // label7
+            // label9
             // 
             // 
-            this.label7.AutoSize = true;
-            this.label7.Location = new System.Drawing.Point(305, 119);
-            this.label7.Name = "label7";
-            this.label7.Size = new System.Drawing.Size(80, 18);
-            this.label7.TabIndex = 25;
-            this.label7.Text = "精调步长";
+            this.label9.AutoSize = true;
+            this.label9.Location = new System.Drawing.Point(218, 84);
+            this.label9.Name = "label9";
+            this.label9.Size = new System.Drawing.Size(26, 18);
+            this.label9.TabIndex = 33;
+            this.label9.Text = "um";
             // 
             // 
-            // label8
+            // tB_WD
             // 
             // 
-            this.label8.AutoSize = true;
-            this.label8.Location = new System.Drawing.Point(530, 119);
-            this.label8.Name = "label8";
-            this.label8.Size = new System.Drawing.Size(44, 18);
-            this.label8.TabIndex = 26;
-            this.label8.Text = "焦距";
+            this.tB_WD.Location = new System.Drawing.Point(616, 118);
+            this.tB_WD.Name = "tB_WD";
+            this.tB_WD.ReadOnly = true;
+            this.tB_WD.Size = new System.Drawing.Size(96, 28);
+            this.tB_WD.TabIndex = 32;
             // 
             // 
-            // tB
+            // tB_fStep
             // 
             // 
-            this.tB.Location = new System.Drawing.Point(119, 78);
-            this.tB.Name = "tB";
-            this.tB.Size = new System.Drawing.Size(96, 28);
-            this.tB.TabIndex = 27;
+            this.tB_fStep.Location = new System.Drawing.Point(385, 119);
+            this.tB_fStep.Name = "tB_fStep";
+            this.tB_fStep.Size = new System.Drawing.Size(96, 28);
+            this.tB_fStep.TabIndex = 31;
+            this.tB_fStep.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tB_fStep_KeyPress);
             // 
             // 
-            // textBox2
+            // tB_fRange
             // 
             // 
-            this.textBox2.Location = new System.Drawing.Point(385, 80);
-            this.textBox2.Name = "textBox2";
-            this.textBox2.Size = new System.Drawing.Size(96, 28);
-            this.textBox2.TabIndex = 28;
+            this.tB_fRange.Location = new System.Drawing.Point(120, 116);
+            this.tB_fRange.Name = "tB_fRange";
+            this.tB_fRange.Size = new System.Drawing.Size(96, 28);
+            this.tB_fRange.TabIndex = 30;
+            this.tB_fRange.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tB_fRange_KeyPress);
             // 
             // 
-            // textBox3
+            // tB_Step
             // 
             // 
-            this.textBox3.Location = new System.Drawing.Point(616, 78);
-            this.textBox3.Name = "textBox3";
-            this.textBox3.Size = new System.Drawing.Size(96, 28);
-            this.textBox3.TabIndex = 29;
+            this.tB_Step.Location = new System.Drawing.Point(616, 78);
+            this.tB_Step.Name = "tB_Step";
+            this.tB_Step.Size = new System.Drawing.Size(96, 28);
+            this.tB_Step.TabIndex = 29;
+            this.tB_Step.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tB_Step_KeyPress);
             // 
             // 
-            // textBox4
+            // tB_Down
             // 
             // 
-            this.textBox4.Location = new System.Drawing.Point(120, 116);
-            this.textBox4.Name = "textBox4";
-            this.textBox4.Size = new System.Drawing.Size(96, 28);
-            this.textBox4.TabIndex = 30;
+            this.tB_Down.Location = new System.Drawing.Point(385, 80);
+            this.tB_Down.Name = "tB_Down";
+            this.tB_Down.Size = new System.Drawing.Size(96, 28);
+            this.tB_Down.TabIndex = 28;
+            this.tB_Down.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tB_Down_KeyPress);
             // 
             // 
-            // textBox5
+            // tB_Up
             // 
             // 
-            this.textBox5.Location = new System.Drawing.Point(385, 119);
-            this.textBox5.Name = "textBox5";
-            this.textBox5.Size = new System.Drawing.Size(96, 28);
-            this.textBox5.TabIndex = 31;
+            this.tB_Up.Location = new System.Drawing.Point(119, 78);
+            this.tB_Up.Name = "tB_Up";
+            this.tB_Up.Size = new System.Drawing.Size(96, 28);
+            this.tB_Up.TabIndex = 27;
+            this.tB_Up.TextChanged += new System.EventHandler(this.tB_TextChanged);
+            this.tB_Up.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tB_Up_KeyPress);
             // 
             // 
-            // textBox6
+            // label8
             // 
             // 
-            this.textBox6.Location = new System.Drawing.Point(616, 118);
-            this.textBox6.Name = "textBox6";
-            this.textBox6.ReadOnly = true;
-            this.textBox6.Size = new System.Drawing.Size(96, 28);
-            this.textBox6.TabIndex = 32;
+            this.label8.AutoSize = true;
+            this.label8.Location = new System.Drawing.Point(530, 119);
+            this.label8.Name = "label8";
+            this.label8.Size = new System.Drawing.Size(44, 18);
+            this.label8.TabIndex = 26;
+            this.label8.Text = "焦距";
             // 
             // 
-            // label9
+            // label7
             // 
             // 
-            this.label9.AutoSize = true;
-            this.label9.Location = new System.Drawing.Point(218, 84);
-            this.label9.Name = "label9";
-            this.label9.Size = new System.Drawing.Size(26, 18);
-            this.label9.TabIndex = 33;
-            this.label9.Text = "um";
+            this.label7.AutoSize = true;
+            this.label7.Location = new System.Drawing.Point(305, 119);
+            this.label7.Name = "label7";
+            this.label7.Size = new System.Drawing.Size(80, 18);
+            this.label7.TabIndex = 25;
+            this.label7.Text = "精调步长";
             // 
             // 
-            // label10
+            // label6
             // 
             // 
-            this.label10.AutoSize = true;
-            this.label10.Location = new System.Drawing.Point(487, 84);
-            this.label10.Name = "label10";
-            this.label10.Size = new System.Drawing.Size(26, 18);
-            this.label10.TabIndex = 34;
-            this.label10.Text = "um";
+            this.label6.AutoSize = true;
+            this.label6.Location = new System.Drawing.Point(36, 119);
+            this.label6.Name = "label6";
+            this.label6.Size = new System.Drawing.Size(80, 18);
+            this.label6.TabIndex = 24;
+            this.label6.Text = "精调范围";
             // 
             // 
-            // label11
+            // label5
             // 
             // 
-            this.label11.AutoSize = true;
-            this.label11.Location = new System.Drawing.Point(718, 84);
-            this.label11.Name = "label11";
-            this.label11.Size = new System.Drawing.Size(26, 18);
-            this.label11.TabIndex = 35;
-            this.label11.Text = "um";
+            this.label5.AutoSize = true;
+            this.label5.Location = new System.Drawing.Point(530, 83);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(80, 18);
+            this.label5.TabIndex = 23;
+            this.label5.Text = "调节步长";
             // 
             // 
-            // label12
+            // label4
             // 
             // 
-            this.label12.AutoSize = true;
-            this.label12.Location = new System.Drawing.Point(222, 121);
-            this.label12.Name = "label12";
-            this.label12.Size = new System.Drawing.Size(26, 18);
-            this.label12.TabIndex = 36;
-            this.label12.Text = "um";
+            this.label4.AutoSize = true;
+            this.label4.Location = new System.Drawing.Point(299, 83);
+            this.label4.Name = "label4";
+            this.label4.Size = new System.Drawing.Size(80, 18);
+            this.label4.TabIndex = 22;
+            this.label4.Text = "调节下限";
             // 
             // 
-            // label13
+            // label3
             // 
             // 
-            this.label13.AutoSize = true;
-            this.label13.Location = new System.Drawing.Point(487, 126);
-            this.label13.Name = "label13";
-            this.label13.Size = new System.Drawing.Size(26, 18);
-            this.label13.TabIndex = 37;
-            this.label13.Text = "um";
+            this.label3.AutoSize = true;
+            this.label3.Location = new System.Drawing.Point(33, 83);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(80, 18);
+            this.label3.TabIndex = 8;
+            this.label3.Text = "调节上限";
             // 
             // 
-            // label14
+            // tBImgPath
             // 
             // 
-            this.label14.AutoSize = true;
-            this.label14.Location = new System.Drawing.Point(718, 122);
-            this.label14.Name = "label14";
-            this.label14.Size = new System.Drawing.Size(26, 18);
-            this.label14.TabIndex = 38;
-            this.label14.Text = "um";
+            this.tBImgPath.Location = new System.Drawing.Point(302, 27);
+            this.tBImgPath.Name = "tBImgPath";
+            this.tBImgPath.ReadOnly = true;
+            this.tBImgPath.Size = new System.Drawing.Size(450, 28);
+            this.tBImgPath.TabIndex = 21;
+            // 
+            // btImgPath
+            // 
+            this.btImgPath.Location = new System.Drawing.Point(17, 25);
+            this.btImgPath.Name = "btImgPath";
+            this.btImgPath.Size = new System.Drawing.Size(266, 35);
+            this.btImgPath.TabIndex = 20;
+            this.btImgPath.Text = "选择图像存储路径";
+            this.btImgPath.UseVisualStyleBackColor = true;
+            this.btImgPath.Click += new System.EventHandler(this.btImgPath_Click);
             // 
             // 
             // MainForm
             // MainForm
             // 
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1600, 854);
+            this.ClientSize = new System.Drawing.Size(1600, 825);
             this.Controls.Add(this.groupBox5);
             this.Controls.Add(this.groupBox5);
             this.Controls.Add(this.listmsg);
             this.Controls.Add(this.listmsg);
             this.Controls.Add(this.CutHoleGridView);
             this.Controls.Add(this.CutHoleGridView);
@@ -664,12 +684,12 @@
         private System.Windows.Forms.Button btImgPath;
         private System.Windows.Forms.Button btImgPath;
         private System.Windows.Forms.TextBox tBImgPath;
         private System.Windows.Forms.TextBox tBImgPath;
         private System.Windows.Forms.Label label9;
         private System.Windows.Forms.Label label9;
-        private System.Windows.Forms.TextBox textBox6;
-        private System.Windows.Forms.TextBox textBox5;
-        private System.Windows.Forms.TextBox textBox4;
-        private System.Windows.Forms.TextBox textBox3;
-        private System.Windows.Forms.TextBox textBox2;
-        private System.Windows.Forms.TextBox tB;
+        private System.Windows.Forms.TextBox tB_WD;
+        private System.Windows.Forms.TextBox tB_fStep;
+        private System.Windows.Forms.TextBox tB_fRange;
+        private System.Windows.Forms.TextBox tB_Step;
+        private System.Windows.Forms.TextBox tB_Down;
+        private System.Windows.Forms.TextBox tB_Up;
         private System.Windows.Forms.Label label8;
         private System.Windows.Forms.Label label8;
         private System.Windows.Forms.Label label7;
         private System.Windows.Forms.Label label7;
         private System.Windows.Forms.Label label6;
         private System.Windows.Forms.Label label6;
@@ -681,6 +701,7 @@
         private System.Windows.Forms.Label label12;
         private System.Windows.Forms.Label label12;
         private System.Windows.Forms.Label label11;
         private System.Windows.Forms.Label label11;
         private System.Windows.Forms.Label label10;
         private System.Windows.Forms.Label label10;
+        private System.Windows.Forms.Button button2;
     }
     }
 }
 }
 
 

+ 159 - 7
ManulDo/MainForm.cs

@@ -26,8 +26,16 @@ namespace WindowsFormsApp1
         /// 测量线程  
         /// 测量线程  
         public Measure m_Ms;
         public Measure m_Ms;
 
 
-        //图像文件夹
-        public string m_strImgPath;
+        //自动对焦函数
+        public FocusParam m_focusParam;
+
+        enum WorkType
+        {
+            AutoFocus =  1,
+            AllThing = 2
+        };
+
+        WorkType m_work;
 
 
         #endregion
         #endregion
         #region 构造函数
         #region 构造函数
@@ -43,8 +51,9 @@ namespace WindowsFormsApp1
             m_BackgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(CompletedWork);
             m_BackgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(CompletedWork);
 
 
             LogManager.InitManulLog();
             LogManager.InitManulLog();
-           
 
 
+            m_focusParam = new FocusParam();
+            m_work = new WorkType();
         }
         }
         #endregion
         #endregion
         #region 测量线程
         #region 测量线程
@@ -54,8 +63,20 @@ namespace WindowsFormsApp1
             m_Ms.InitMeas(m_MeasureFile);
             m_Ms.InitMeas(m_MeasureFile);
             m_Ms.SendThreadStatus += new ThreadStatusHandler(displayMessage); //注册事件
             m_Ms.SendThreadStatus += new ThreadStatusHandler(displayMessage); //注册事件
 
 
-            //自动测量的全过程
-            m_Ms.DoMeasure();
+            if (m_work == WorkType.AutoFocus)
+            {
+                //自动对焦
+                int nWd;
+                m_Ms.AutoFocus(m_focusParam, out nWd);
+                double wd = (double)nWd / 100.0;
+                tB_WD.Text = wd.ToString();
+            }
+            else
+            {
+                //自动测量的全过程
+                m_Ms.DoMeasure();
+            }
+            
             //定位
             //定位
             //切割
             //切割
             //分析位置
             //分析位置
@@ -237,7 +258,7 @@ namespace WindowsFormsApp1
                 m_MeasureFile.MParam.PT = this.cBIsPT.Checked;
                 m_MeasureFile.MParam.PT = this.cBIsPT.Checked;
                 m_MeasureFile.MParam.SampleName = this.tBSampleName.Text;
                 m_MeasureFile.MParam.SampleName = this.tBSampleName.Text;
                 m_MeasureFile.MParam.FIBTemp = this.tBFIBTemp.Text;
                 m_MeasureFile.MParam.FIBTemp = this.tBFIBTemp.Text;
-                m_MeasureFile.MParam.FocusMode = this.cBIsManul.Checked;
+                //m_MeasureFile.MParam.FocusMode = this.cBIsManul.Checked;
 
 
                 MessageBox.Show("参数设置成功");
                 MessageBox.Show("参数设置成功");
             }
             }
@@ -281,10 +302,141 @@ namespace WindowsFormsApp1
                     return;
                     return;
                 }
                 }
 
 
-                m_strImgPath = dialog.SelectedPath;
+                m_focusParam.Path = dialog.SelectedPath;
                 tBImgPath.Text = dialog.SelectedPath;
                 tBImgPath.Text = dialog.SelectedPath;
 
 
             }
             }
         }
         }
+
+        private void button2_Click(object sender, EventArgs e)
+        {
+            if (tBImgPath.Text == "" ||
+               tB_Up.Text == "" ||
+               tB_Down.Text == "" ||
+               tB_Step.Text == "" ||
+               tB_fRange.Text == "" ||
+               tB_fStep.Text == "")
+            {
+                MessageBox.Show("请输入完整的参数");
+                return;
+            }
+            //保存自动对焦函数
+            m_focusParam.Path = tBImgPath.Text;            
+            m_focusParam.Step = float.Parse(tB_Step.Text);
+            m_focusParam.Range = float.Parse(tB_fRange.Text);
+            m_focusParam.fStep = float.Parse(tB_fStep.Text);
+
+            float fUP = float.Parse(tB_Up.Text);
+            float fDown = float.Parse(tB_Down.Text);
+
+            if (fDown <= fUP)
+            {
+                MessageBox.Show("请输入下限大于上限的值");
+                return;
+            }
+           
+            m_focusParam.UP = float.Parse(tB_Up.Text);
+            m_focusParam.Down = float.Parse(tB_Down.Text);            
+        }
+
+        private void tB_TextChanged(object sender, EventArgs e)
+        {
+
+        }
+
+        //输入限制只能是数字
+        private void textBox_KeyPress(string text, object sender, KeyPressEventArgs e)
+        {
+
+            //允许输入数字、小数点、删除键和负号  
+            if ((e.KeyChar < 48 || e.KeyChar > 57) && e.KeyChar != 8 && e.KeyChar != (char)('.') && e.KeyChar != (char)('-'))
+            {
+                MessageBox.Show("请输入正确的数字");
+                text = "";
+                e.Handled = true;
+            }
+            if (e.KeyChar == (char)('-'))
+            {
+                if (text != "")
+                {
+                    MessageBox.Show("请输入正确的数字");
+                    text = "";
+                    e.Handled = true;
+                }
+            }
+            //小数点只能输入一次  
+            if (e.KeyChar == (char)('.') && ((TextBox)sender).Text.IndexOf('.') != -1)
+            {
+                MessageBox.Show("请输入正确的数字");
+                text = "";
+                e.Handled = true;
+            }
+            //第一位不能为小数点  
+            if (e.KeyChar == (char)('.') && ((TextBox)sender).Text == "")
+            {
+                MessageBox.Show("请输入正确的数字");
+                text = "";
+                e.Handled = true;
+            }
+            //第一位是0,第二位必须为小数点  
+            if (e.KeyChar != (char)('.') && ((TextBox)sender).Text == "0")
+            {
+                MessageBox.Show("请输入正确的数字");
+                text = "";
+                e.Handled = true;
+            }
+            //第一位是负号,第二位不能为小数点  
+            if (((TextBox)sender).Text == "-" && e.KeyChar == (char)('.'))
+            {
+                MessageBox.Show("请输入正确的数字");
+                text = "";
+                e.Handled = true;
+            }
+        }
+
+        private void tB_Up_KeyPress(object sender, KeyPressEventArgs e)
+        {
+            textBox_KeyPress(tB_Up.Text, sender, e);
+        }
+
+        private void tB_Down_KeyPress(object sender, KeyPressEventArgs e)
+        {
+            textBox_KeyPress(tB_Down.Text, sender, e);
+        }
+
+        private void tB_Step_KeyPress(object sender, KeyPressEventArgs e)
+        {
+            textBox_KeyPress(tB_Step.Text, sender, e);
+        }
+
+        private void tB_fRange_KeyPress(object sender, KeyPressEventArgs e)
+        {
+            textBox_KeyPress(tB_fRange.Text, sender, e);
+        }
+
+        private void tB_fStep_KeyPress(object sender, KeyPressEventArgs e)
+        {
+            textBox_KeyPress(tB_fStep.Text, sender, e);
+        }
+
+        private void tbAutoFocus_Click(object sender, EventArgs e)
+        {
+            m_work = WorkType.AutoFocus;
+            // 调用对焦线程
+            if (m_MeasureFile == null)
+            {
+                MessageBox.Show("请新建一个测量文件");
+                listmsg.Items.Clear();
+            }
+            else
+            {
+                if (m_BackgroundWorker.IsBusy)
+                {
+                    MessageBox.Show("线程已经运行");
+                    return;
+                }
+                m_BackgroundWorker.RunWorkerAsync(this);
+            }
+        }
     }
     }
 }
 }

+ 22 - 0
ManulDo/ManulDo.csproj

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU.props" Condition="Exists('..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU.props')" />
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
   <PropertyGroup>
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -13,6 +14,8 @@
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
     <Deterministic>true</Deterministic>
     <Deterministic>true</Deterministic>
     <TargetFrameworkProfile />
     <TargetFrameworkProfile />
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -34,6 +37,18 @@
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   </PropertyGroup>
   <ItemGroup>
   <ItemGroup>
+    <Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
+      <HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net461\OpenCvSharp.dll</HintPath>
+    </Reference>
+    <Reference Include="OpenCvSharp.Blob, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
+      <HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net461\OpenCvSharp.Blob.dll</HintPath>
+    </Reference>
+    <Reference Include="OpenCvSharp.Extensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
+      <HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net461\OpenCvSharp.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="OpenCvSharp.UserInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
+      <HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net461\OpenCvSharp.UserInterface.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Core" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Xml.Linq" />
@@ -68,6 +83,7 @@
       <DependentUpon>Resources.resx</DependentUpon>
       <DependentUpon>Resources.resx</DependentUpon>
       <DesignTime>True</DesignTime>
       <DesignTime>True</DesignTime>
     </Compile>
     </Compile>
+    <None Include="packages.config" />
     <None Include="Properties\Settings.settings">
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>
       <Generator>SettingsSingleFileGenerator</Generator>
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -100,4 +116,10 @@
     </ProjectReference>
     </ProjectReference>
   </ItemGroup>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU.props'))" />
+  </Target>
 </Project>
 </Project>

+ 4 - 0
ManulDo/packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="OpenCvSharp3-AnyCPU" version="4.0.0.20181129" targetFramework="net461" />
+</packages>

+ 82 - 1
MeasureData/FocusParam.cs

@@ -15,11 +15,92 @@ namespace MeasureData
 {
 {
     public class FocusParam : ISlo
     public class FocusParam : ISlo
     {
     {
+        #region 内容
+        //图像存储路径
+        private string m_sPath;
+        public string Path
+        {
+            get { return this.m_sPath; }
+            set { this.m_sPath = value; }
+        }
+
+        //调节上限
+        private float m_fUp;
+        public float UP
+        {
+            get { return this.m_fUp; }
+            set { this.m_fUp = value; }
+        }
+        //调节下限
+        private float m_fDown;
+        public float Down
+        {
+            get { return this.m_fDown; }
+            set { this.m_fDown = value; }
+        }
+        //调节步长
+        private float m_fStep;
+        public float Step
+        {
+            get { return this.m_fStep; }
+            set { this.m_fStep = value; }
+        }
+        //精调范围
+        private float m_ffRange;
+        public float Range
+        {
+            get { return this.m_ffRange; }
+            set { this.m_ffRange = value; }
+        }
+        //精调步长
+        private float m_ffStep;
+        public float fStep
+        {
+            get { return this.m_ffStep; }
+            set { this.m_ffStep = value; }
+        }
+        #endregion
+
+        public FocusParam()
+        {
+            Init();
+        }
+
+        public void Init()
+        {
+            this.UP = 0;
+            this.Down = 0;
+            this.Step = 0;
+            this.Range = 0;
+            this.fStep = 0;
+        }
+
         //XML文件保存测量参数
         //XML文件保存测量参数
         public override void Serialize(bool isStoring, XmlDocument xml, XmlNode rootNode)
         public override void Serialize(bool isStoring, XmlDocument xml, XmlNode rootNode)
         {
         {
-            Slo slo_msparam = new Slo();
+            Slo slo_fcsparam = new Slo();
+
+            xDouble dUp = new xDouble();
+            xDouble dDown = new xDouble();
+            xDouble dStep = new xDouble();
+            xDouble dRange = new xDouble();
+            xDouble dfStep = new xDouble();
+
+            if (isStoring)
+            {
+                slo_fcsparam.Serialize(true, xml, rootNode);
+            }
+            else
+            {
+                slo_fcsparam.Serialize(false, xml, rootNode);
+
+                this.UP = (float)dUp.value();
+                this.Down = (float)dDown.value();
+                this.Step = (float)dStep.value();
+                this.Range = (float)dRange.value();
+                this.fStep = (float)dfStep.value();
 
 
+            }
         }
         }
     }
     }
 }
 }

+ 756 - 231
MeasureThread/Measure.cs

@@ -16,6 +16,8 @@ using MeasureData;
 using FileManager;
 using FileManager;
 using WebManager;
 using WebManager;
 
 
+using OpenCvSharp;
+
 namespace MeasureThread
 namespace MeasureThread
 {
 {
     //图片模式
     //图片模式
@@ -433,6 +435,8 @@ namespace MeasureThread
 
 
         const float fMin = (float)0.0000002; //单位是米
         const float fMin = (float)0.0000002; //单位是米
 
 
+        Boolean comm_state = false;
+
         int m_nWorkHoleNo = -1;
         int m_nWorkHoleNo = -1;
 
 
         //测量文件
         //测量文件
@@ -511,19 +515,24 @@ namespace MeasureThread
         }
         }
 
 
         public void SendMsg(string step_code)
         public void SendMsg(string step_code)
+        {
+            arg.State = step_code;
+            SendThreadStatus(this, arg);
+        }
+
+        public void SendMsg1(string step_code)
         {
         {
             arg.Step_Code = step_code;
             arg.Step_Code = step_code;
             arg.Time = DateTime.Now;
             arg.Time = DateTime.Now;
             switch(step_code)
             switch(step_code)
             {
             {
                 //拍照
                 //拍照
-                case "1-3":
-                case "1-9":
+                case "1-5":
+                case "1-7":
                 case "1-16":
                 case "1-16":
                 case "1-24":
                 case "1-24":
                     //电压、放大倍数、工作距离、位置信息、图片路径
                     //电压、放大倍数、工作距离、位置信息、图片路径
                     arg.Picture_Information.Work_Voltage = iSEM.GetSEMVoltage();
                     arg.Picture_Information.Work_Voltage = iSEM.GetSEMVoltage();
-                    arg.Picture_Information.Work_Status = "SEM";
                     arg.Picture_Information.Work_Distance = iSEM.GetWorkingDistance();
                     arg.Picture_Information.Work_Distance = iSEM.GetWorkingDistance();
                     arg.Picture_Information.Magnification = iSEM.GetMagnification();
                     arg.Picture_Information.Magnification = iSEM.GetMagnification();
                     break;
                     break;
@@ -589,7 +598,14 @@ namespace MeasureThread
             for (int i = 0; i < m_cutHoles.Count; i++)
             for (int i = 0; i < m_cutHoles.Count; i++)
             {
             {
                 m_nWorkHoleNo = i;
                 m_nWorkHoleNo = i;
-                arg.HoleName = cutHoles[m_nWorkHoleNo].HoleName;
+                arg.HoleName = m_cutHoles[i].HoleName;
+                //创建文件夹,孔名文件夹结构 
+
+                //判断孔状态
+                if(m_cutHoles[i].STATE != State.Unmeasured)
+                {
+                    continue;
+                }
                 if (i == 0)
                 if (i == 0)
                 {
                 {
                     SendMsg("第一个切孔开始测量");
                     SendMsg("第一个切孔开始测量");
@@ -634,7 +650,7 @@ namespace MeasureThread
         public bool InsertPT()
         public bool InsertPT()
         {
         {
             string fn = m_ProgramFolder + "\\Macro\\" + MacoInsertPt;
             string fn = m_ProgramFolder + "\\Macro\\" + MacoInsertPt;
-            SendMsg("调用宏插入PT针宏文件" + fn);
+            //SendMsg("调用宏插入PT针宏文件" + fn);
             iSEM.CMDMCFFilename(fn);
             iSEM.CMDMCFFilename(fn);
             //延时1s??
             //延时1s??
             Thread.Sleep(1000);
             Thread.Sleep(1000);
@@ -645,7 +661,7 @@ namespace MeasureThread
         public bool RetractPT()
         public bool RetractPT()
         {
         {
             string fn = m_ProgramFolder + "\\Macro\\" + MacoRetractPt;
             string fn = m_ProgramFolder + "\\Macro\\" + MacoRetractPt;
-            SendMsg("调用宏撤出PT针宏文件" + fn);
+            //SendMsg("调用宏撤出PT针宏文件" + fn);
             iSEM.CMDMCFFilename(fn);
             iSEM.CMDMCFFilename(fn);
             //延时1s??
             //延时1s??
             Thread.Sleep(1000);
             Thread.Sleep(1000);
@@ -657,7 +673,7 @@ namespace MeasureThread
         {
         {
             //执行PT沉积的ELY文件
             //执行PT沉积的ELY文件
             string fn = m_ProgramFolder + "\\Macro\\" + ElyDeposition;
             string fn = m_ProgramFolder + "\\Macro\\" + ElyDeposition;
-            SendMsg("执行PT沉积Ely文件:" + fn);
+            //SendMsg("执行PT沉积Ely文件:" + fn);
             if (!ExcuteEly(fn))
             if (!ExcuteEly(fn))
             {
             {
                 return false;
                 return false;
@@ -680,7 +696,7 @@ namespace MeasureThread
         {
         {
             //执行PT沉积的ELY文件
             //执行PT沉积的ELY文件
             string fn = m_ProgramFolder + "\\Macro\\" + ElyCrossSection;
             string fn = m_ProgramFolder + "\\Macro\\" + ElyCrossSection;
-            SendMsg("执行FIB切割Ely文件:" + fn);
+            //SendMsg("执行FIB切割Ely文件:" + fn);
             if (!ExcuteEly(fn))
             if (!ExcuteEly(fn))
             {
             {
                 return false;
                 return false;
@@ -699,30 +715,31 @@ namespace MeasureThread
             return true;
             return true;
         }
         }
 
 
+        //执行ELY文件的步骤
         public bool ExcuteEly(string a_filename)
         public bool ExcuteEly(string a_filename)
         {
         {
             //执行ELy文件有三个动作
             //执行ELy文件有三个动作
             //1. 选择ELY文件
             //1. 选择ELY文件
-            SendMsg("选择ELY文件");
+            //SendMsg("选择ELY文件");
             if (!iSEM.CmdFIBLoadELY(a_filename))
             if (!iSEM.CmdFIBLoadELY(a_filename))
             {
             {
-                SendMsg("选择ELY文件失败");
+                //SendMsg("选择ELY文件失败");
                 return false;
                 return false;
             }
             }
             Thread.Sleep(1000);
             Thread.Sleep(1000);
             //2. 确认ELY文件
             //2. 确认ELY文件
-            SendMsg("确认ELY文件");
+            //SendMsg("确认ELY文件");
             if (!iSEM.CmdFIBEXPOSUREELY())
             if (!iSEM.CmdFIBEXPOSUREELY())
             {
             {
-                SendMsg("确认ELY文件失败");
+                //SendMsg("确认ELY文件失败");
                 return false;
                 return false;
             }
             }
             Thread.Sleep(1000);
             Thread.Sleep(1000);
             //3. 执行ELY文件
             //3. 执行ELY文件
-            SendMsg("执行ELY文件");
+            //SendMsg("执行ELY文件");
             if (!iSEM.CmdFIBSTARTELY())
             if (!iSEM.CmdFIBSTARTELY())
             {
             {
-                SendMsg("执行ELY文件失败");
+                //SendMsg("执行ELY文件失败");
                 return false;
                 return false;
             }
             }
             Thread.Sleep(1000);
             Thread.Sleep(1000);
@@ -731,23 +748,26 @@ namespace MeasureThread
         }
         }
 
 
         /// <summary>
         /// <summary>
-        ///13. 自动 定位功能
+        ///13. 自动 定位功能,沉积
         /// </summary>
         /// </summary>
         /// <returns></returns>
         /// <returns></returns>
         public bool GetPoistion(Boolean isFirst)
         public bool GetPoistion(Boolean isFirst)
         {
         {
+            float x0 = 0, y0 = 0, x1 = 0, y1 = 0, x2 = 0, y2 = 0;
+            int state = 0;
             //SendMsg("自动定位");
             //SendMsg("自动定位");
             //13.自动定位切割
             //13.自动定位切割
             {
             {
                 //1.控制SEM放大600X
                 //1.控制SEM放大600X
-                if (!iSEM.SetMagnification(m_measureFile.MParam.Photograph_Magnification))
+                arg.State = "SEM";
+                if (!iSEM.SetMagnification(m_measureFile.MParam.Location_Magnification))
                 {
                 {
-                    arg.Message = "放大" + m_measureFile.MParam.Photograph_Magnification.ToString("0.0") + "倍失败";
-                    SendMsg("1-1");
+                    arg.Message = "放大" + m_measureFile.MParam.Location_Magnification.ToString("0.0") + "倍失败";
+                    SendMsg("1-2");
                     return false;
                     return false;
                 }
                 }
-                arg.Message = "放大" + m_measureFile.MParam.Photograph_Magnification.ToString("0.0") + "倍成功";
-                SendMsg("1-1");
+                arg.Message = "放大" + m_measureFile.MParam.Location_Magnification.ToString("0.0") + "倍成功";
+                SendMsg("1-2");
 
 
                 //2.控制SEM自动对焦、亮度、对比度
                 //2.控制SEM自动对焦、亮度、对比度
                 if (m_measureFile.MParam.FocusMode==1)//手动
                 if (m_measureFile.MParam.FocusMode==1)//手动
@@ -755,152 +775,181 @@ namespace MeasureThread
                     if (DialogResult.Yes == MessageBox.Show("图像自动对焦已完成?", "确认消息", MessageBoxButtons.YesNo))
                     if (DialogResult.Yes == MessageBox.Show("图像自动对焦已完成?", "确认消息", MessageBoxButtons.YesNo))
                     {
                     {
                         arg.Message = "自动对焦完成";
                         arg.Message = "自动对焦完成";
-                        SendMsg("1-2");
+                        SendMsg("1-3");
                         //return true;
                         //return true;
                     }
                     }
                     else
                     else
                     {
                     {
                         arg.Message = "自动对焦失败";
                         arg.Message = "自动对焦失败";
-                        SendMsg("1-2");
+                        SendMsg("1-3");
                         return false;
                         return false;
                     }
                     }
                 }
                 }
                 else if (m_measureFile.MParam.FocusMode == 2)//自有自动
                 else if (m_measureFile.MParam.FocusMode == 2)//自有自动
                 {
                 {
                     //郝工增加自动对焦算法
                     //郝工增加自动对焦算法
+                    //1、对焦参数类,2、输出工作距离
+                    //AutoFocus()
+                    //获取焦距,设置工作距离
                 }
                 }
-                else     //客户自动
+                else if(m_MsParam.FocusMode==3)     //客户自动
                 {
                 {
                     //后期和客户对接接口
                     //后期和客户对接接口
-                    
+                    List<string> filenames = new List<string>();
+                    String retfilename = wr.Img_Auto_Focus(filenames);
+                }
+                else        //蔡司自动对焦
+                {
+
                 }
                 }
 
 
                 //3.第一次不需要进行角度补偿,其他需要设置SEM进行角度补偿54度
                 //3.第一次不需要进行角度补偿,其他需要设置SEM进行角度补偿54度
                 if (!isFirst)
                 if (!isFirst)
                 {
                 {
-                    if (!TiltCorrection(m_measureFile.MParam.Correction_Angle))
+                    if (!TiltCorrection(54))
                     {
                     {
-                        arg.Message = "设置SEM进行角度补偿" + m_measureFile.MParam.Correction_Angle.ToString("0") + "度失败";
-                        SendMsg("1-15");
+                        arg.Message = "设置SEM进行角度补偿54度失败";
+                        SendMsg("1-4");
                         return false;
                         return false;
                     }
                     }
-                    arg.Message = "设置SEM进行角度补偿" + m_measureFile.MParam.Correction_Angle.ToString("0") + "度成功";
-                    SendMsg("1-15");
+                    arg.Message = "设置SEM进行角度补偿54度成功";
+                    SendMsg("1-4");
                     Thread.Sleep(5000);
                     Thread.Sleep(5000);
                 }
                 }
 
 
-                //4.控制SEM拍照
-                //5.保存照片
+                //4.控制SEM拍照,5保存照片=====需要更改路径
+                String fileName1 = WorkingFolder + "\\" + m_nWorkHoleNo.ToString() + "Hole" + ImageName1;
+                arg.Picture_Information.Picture_FullPath = fileName1;
+                arg.Picture_Information.Work_Status = "SEM";
+                if (!GetImage(ImageMode.SEM, fileName1))
                 {
                 {
-                    //1. 创建目录,已经完成
-                    //2. 设置图片名称
-                    //3. 保存图片1
-                    String fileName1 = WorkingFolder + "\\" + m_nWorkHoleNo.ToString() + "Hole" + ImageName1;
-                    arg.Picture_Information.Picture_FullPath = fileName1;
-                    if (!GetImage(ImageMode.SEM, fileName1))
-                    {
-                        arg.Message = "SEM拍照失败";
-                        SendMsg("1-3");
-                        return false;
-                    }
-                    arg.Message = "SEM拍照成功";
-                    SendMsg("1-3");
-                    Thread.Sleep(3000);
-                }
-                
-                //6.设置FIB拍照参数——扫描时间、束流等
-                //7.控制FIB自动亮度、对比度
-                SendMsg("切换FIB控制");
-                if (!iSEM.CmdFIBModeFIB())
-                {
-                    SendMsg("FIB模式切换失败");
+                    arg.Message = "SEM拍照失败";
+                    SendMsg("1-5");
                     return false;
                     return false;
                 }
                 }
+                arg.Message = "SEM拍照成功";
+                SendMsg("1-5");
+                Thread.Sleep(3000);
 
 
-                Thread.Sleep(10000);
-
-                //8.控制FIB拍照
-                //9.保存照片
-                SendMsg("FIB拍照");
+                //判断是否为仅拍照,不是则执行FIB操作
+                if (!m_MsParam.Is_Photograph)
                 {
                 {
-                    //1. 设置图片名称
-                    //2. 保存图片2
+                    //6.设置FIB拍照参数——扫描时间、束流等
+                    //7.控制FIB自动亮度、对比度
+                    if (!iSEM.CmdFIBModeFIB())
+                    {
+                        arg.Message = "FIB模式切换失败";
+                        SendMsg("1-6");
+                        return false;
+                    }
+                    arg.Message = "FIB模式切换成功";
+                    SendMsg("1-6");
+                    Thread.Sleep(10000);
+
+                    //8.控制FIB拍照
+                    //9.保存照片======更改路径
                     String fileName2 = WorkingFolder + "\\" + m_nWorkHoleNo.ToString() + "Hole" + ImageName2;
                     String fileName2 = WorkingFolder + "\\" + m_nWorkHoleNo.ToString() + "Hole" + ImageName2;
+                    arg.Picture_Information.Picture_FullPath = fileName1;
+                    arg.Picture_Information.Work_Status = "FIB";
                     if (!GetImage(ImageMode.FIB, fileName2))
                     if (!GetImage(ImageMode.FIB, fileName2))
                     {
                     {
-                        SendMsg("FIB拍照失败");
+                        arg.Message = "FIB拍照失败";
+                        SendMsg("1-7");
                         return false;
                         return false;
                     }
                     }
-
+                    arg.Message = "FIB拍照成功";
+                    SendMsg("1-7");
                     Thread.Sleep(3000);
                     Thread.Sleep(3000);
-                }
-
-                //10.将照片传给客户,返回梯形位置坐标,及样品类型参数(是否需要PT沉积,PT坐标位置,PT宽度、PT高度、梯形上、下边及深度、扫描时间、束流、样品放大倍数1、样品放大倍数2等切割参数)
-                SendMsg("调用识别位置");
 
 
-                if (DialogResult.Yes == MessageBox.Show("移动已完成?", "确认消息", MessageBoxButtons.YesNo))
-                {
-                    SendMsg("移动已完成");
-                    //return true;
-                }
-                else
-                {
-                    SendMsg("移动已失败");
-                    return false;
-                }
-
-
-                SendMsg("进行PT沉积");
-                //11.自动工具样品类型参数确定是否需要PT沉积
-                {
-                    //1. 根据客户PT沉积坐标控制FIB调整到中心位置
-                    //2. 验证移动准确性:获取当前FIB中心位置坐标,与客户返回坐标对比,验证是否一定正确
-                    //3. 根据坐标进行PT沉积   
-                    if (!PTWork())
+                    //10.将照片传给客户,返回梯形位置坐标,及样品类型参数(是否需要PT沉积,PT坐标位置,PT宽度、PT高度、梯形上、下边及深度、扫描时间、束流、样品放大倍数1、样品放大倍数2等切割参数)
+                    if (DialogResult.Yes == MessageBox.Show("是否手动移动样品台到指定位置?\n如果点击取消则会调用Web接口。", "确认消息", MessageBoxButtons.YesNo))
                     {
                     {
-                        SendMsg("PT沉积失败");
-                        return false;
+                        arg.Message = "样品台移动到指定位置";
+                        SendMsg("1-8");
+                    }
+                    else
+                    {
+                        wr.Img_Cut_Position(fileName2, m_MsParam.SampleName, m_MsParam.Firm, out x1, out y1, out x2, out y2, out state);
+                        if (state == 1)
+                        {
+                            //1. 根据客户PT沉积坐标控制FIB调整到中心位置???????
+                            if (!iSEM.MoveStageXY(x1, y1))
+                            {
+                                arg.Message = "移动到新(" + x1.ToString() + "," + y1.ToString() + ")位置失败";
+                                SendMsg("1-8");
+                                return false;
+                            }
+                            //判断是否移动完成
+                            while (true)
+                            {
+                                Thread.Sleep(5000);
+                                if (iSEM.GetStageIs() == 0)
+                                {
+                                    break;
+                                }
+                            }
+                            arg.Message = "移动到新(" + x1.ToString() + "," + y1.ToString() + ")位置失败";
+                            SendMsg("1-8");
+                        }
+                        else
+                        {
+                            arg.Message = "样品台移动失败";
+                            SendMsg("1-8");
+                            return false;
+                        }
                     }
                     }
 
 
-
+                    //11.自动工具样品类型参数确定是否需要PT沉积
+                    if (m_MsParam.PT)
+                    {
+                        //1. 根据客户PT沉积坐标控制FIB调整到中心位置???????
+                        //第10步已经移动好位置
+                        //2. 验证移动准确性:获取当前FIB中心位置坐标,与客户返回坐标对比,验证是否一定正确
+                        x0 = iSEM.GetStageAtX();
+                        y0 = iSEM.GetStageAtY();
+                        if (Math.Abs(x0 - x1) > fMin && Math.Abs(y0 - y1) > fMin)
+                        {
+                            arg.Message = "目标位置(" + x0.ToString() + "," + y0.ToString() + ")移动失败";
+                            SendMsg("1-9");
+                            return false;
+                        }
+                        arg.Message = "目标位置(" + x0.ToString() + "," + y0.ToString() + ")移动成功";
+                        SendMsg("1-9");
+                        //3. 根据坐标进行PT沉积   
+                        if (!PTWork())
+                        {
+                            arg.Message = "PT沉积失败";
+                            SendMsg("1-10");
+                            return false;
+                        }
+                        arg.Message = "PT沉积成功";
+                        SendMsg("1-10");
+                    }
                 }
                 }
 
 
-
-                return true;
-                //模拟为客户返回的坐标值
-                float x0 = 0, y0 = 0;
-                SendMsg("移动到新(" + x0.ToString() + "," + y0.ToString() + ")位置失败");
-
                 //12.根据梯形坐标控制FIB调整到中心位置
                 //12.根据梯形坐标控制FIB调整到中心位置
-                if (!iSEM.MoveStageXY(x0, y0))
-                {
-                    SendMsg("移动到新(" + x0.ToString() + "," + y0.ToString() + ")位置失败");
-                    return false;
-                }
-
-                //电镜移动是有一个延时的操作的?
-
                 //13.验证移动准确性:获取当前FIB中心位置坐标,与客户返回坐标对比,验证是否移动正确
                 //13.验证移动准确性:获取当前FIB中心位置坐标,与客户返回坐标对比,验证是否移动正确
-                float x1 = iSEM.GetStageAtX();
-                float y1 = iSEM.GetStageAtY();
-                if (Math.Abs(x0 - x1) > fMin && Math.Abs(y0 - y1) > fMin)
-                {
-                    SendMsg("目标位置(" + x0.ToString() + "," + y0.ToString() + ")移动失败");
-                    return false;
-                }
+                //以上两步已经将程序移动到11内部去做
 
 
                 //14.保存样品1第1号孔中心位置6轴坐标1 XYZMRT到数据库,保存客户返回值信息到数据库
                 //14.保存样品1第1号孔中心位置6轴坐标1 XYZMRT到数据库,保存客户返回值信息到数据库
                 float[] firstPosition = iSEM.GetStagePosition();
                 float[] firstPosition = iSEM.GetStagePosition();
+                m_cutHoles[0].Position.X = firstPosition[0];
+                m_cutHoles[0].Position.Y = firstPosition[1];
+                m_cutHoles[0].Position.Z = firstPosition[2];
+                m_cutHoles[0].Position.T = firstPosition[3];
+                m_cutHoles[0].Position.R = firstPosition[4];
+                m_cutHoles[0].Position.M = firstPosition[5];
                 //这里要调用文件保存功能
                 //这里要调用文件保存功能
-                SendMsg("坐标1(" + firstPosition[0].ToString() + ","
+                arg.Message = "坐标1(" + firstPosition[0].ToString() + ","
                     + firstPosition[1].ToString() + ","
                     + firstPosition[1].ToString() + ","
                     + firstPosition[2].ToString() + ","
                     + firstPosition[2].ToString() + ","
                     + firstPosition[3].ToString() + ","
                     + firstPosition[3].ToString() + ","
                     + firstPosition[4].ToString() + ","
                     + firstPosition[4].ToString() + ","
-                    + firstPosition[5].ToString() + ")");
+                    + firstPosition[5].ToString() + ")";
+                SendMsg("1-11");
             }
             }
 
 
-            return false;
+            return true;
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -909,101 +958,306 @@ namespace MeasureThread
         /// <returns></returns>
         /// <returns></returns>
         public bool FIBCross()
         public bool FIBCross()
         {
         {
+            //切之前拍照保存,,
+
             //14.自动控制FIB切割
             //14.自动控制FIB切割
+            //1.根据参数设置FIB草率时间(使图清晰),设置梯形上下边及深度、设置束流
+            //2.控制FIB进行切割
+            //以上1、2步全部用ELY文件代替
+            if (!FIBWork())
             {
             {
-                //1.根据参数设置FIB草率时间(使图清晰),设置梯形上下边及深度、设置束流
-                //2.控制FIB进行切割
-                SendMsg("FIB切割");
-                if (!FIBWork())
+                arg.Message = "FIB切割失败";
+                SendMsg("1-12");
+                return false;
+            }
+            arg.Message = "FIB切割成功";
+            SendMsg("1-12");
+            
+            Thread.Sleep(5000);
+
+            //3.控制FIB拍照600X
+            //底层没有控制方法。
+            //4.保存图片
+            String fileName3 = WorkingFolder + "\\" + m_nWorkHoleNo.ToString() + "Hole" + ImageName3;
+            arg.Picture_Information.Picture_FullPath = fileName3;
+            arg.Picture_Information.Work_Status = "FIB";
+            if (!GetImage(ImageMode.FIB, fileName3))
+            {
+                arg.Message = "FIB拍照失败";
+                SendMsg("1-14"); 
+                return false;
+            }
+            arg.Message = "FIB拍照成功";
+            SendMsg("1-14");
+
+            Thread.Sleep(3000);
+            //5.验证切割准确性:与切割前对比,如果对比误差大,则停止自动执行,进行报警
+            //和华为对接接口
+            //6.设置FIB解冻:先读取状态,如果冻结状态则进行解冻
+            //拍完照自动解冻,这里不做处理。
+            return true;
+        }
+
+        /// <summary>
+        /// 16.自动调整SEM找到切割位置,这里不是简单的拉直旋转
+        /// </summary>
+        /// <returns></returns>
+        public bool FindCross()
+        {
+            float x0 = 0, y0 = 0, x1 = 0, y1 = 0, x2 = 0, y2 = 0;
+            float angle = 0;
+            int direction = 0;
+            int state = 0;
+            //切换到SEM模式
+            if (!iSEM.CmdFIBModeSEM())
+            {
+                //SendMsg("SEM模式切换失败");
+                return false;
+            }
+            arg.State = "SEM";
+            Thread.Sleep(10000);
+
+            //1.控制SEM放大到300倍
+            arg.State = "SEM";
+            if (!iSEM.SetMagnification(m_measureFile.MParam.Location_Magnification/2))
+            {
+                arg.Message = "放大" + (m_measureFile.MParam.Location_Magnification / 2).ToString("0.0") + "倍失败";
+                SendMsg("1-18");
+                return false;
+            }
+            arg.Message = "放大" + (m_measureFile.MParam.Location_Magnification/2).ToString("0.0") + "倍成功";
+            SendMsg("1-18");
+
+            //2.控制SEM自动对焦、亮度、对比度-接口,,将自动对焦提出单独函数调用
+            //对焦前,先清理文件夹focus
+            if (m_measureFile.MParam.FocusMode == 1)//手动
+            {
+                if (DialogResult.Yes == MessageBox.Show("图像自动对焦已完成?", "确认消息", MessageBoxButtons.YesNo))
                 {
                 {
-                    SendMsg("FIB切割失败");
+                    arg.Message = "自动对焦完成";
+                    SendMsg("1-19");
+                    //return true;
+                }
+                else
+                {
+                    arg.Message = "自动对焦失败";
+                    SendMsg("1-19");
                     return false;
                     return false;
                 }
                 }
+            }
+            else if (m_measureFile.MParam.FocusMode == 2)//自有自动
+            {
+                //郝工增加自动对焦算法
+            }
+            else     //客户自动
+            {
+                //后期和客户对接接口
+                List<string> filenames = new List<string>();
+                String retfilename = wr.Img_Auto_Focus(filenames);
+            }
 
 
-                Thread.Sleep(5000);
+            Thread.Sleep(5000);
+
+            //3.控制SEM拍照
+            String fileName4 = WorkingFolder + "\\" + m_nWorkHoleNo.ToString() + "Hole" + ImageName4;
+            arg.Picture_Information.Picture_FullPath = fileName4;
+            arg.Picture_Information.Work_Status = "SEM";
+            if (!GetImage(ImageMode.SEM, fileName4))
+            {
+                arg.Message = "SEM拍照失败";
+                SendMsg("1-20");
+                return false;
+            }
+            arg.Message = "SEM拍照成功";
+            SendMsg("1-20");
 
 
-                //3.控制FIB拍照600X
-                //4.保存图片
+            Thread.Sleep(3000);
+            //4.将照片传给客户,获取偏移坐标,以及偏移角度
+            //5.根据坐标控制SEM移动到切孔位置,居中
+            //这里是否用到拉直操作,我没有加
+            if (DialogResult.Yes == MessageBox.Show("是否手动移动样品台到指定位置?\n如果点击取消则会调用Web接口。", "确认消息", MessageBoxButtons.YesNo))
+            {
+                arg.Message = "样品台移动到指定位置";
+                SendMsg("1-21");
+            }
+            else
+            {
+                wr.Img_Center_Position_OffsetAngle_Direction(fileName4, m_MsParam.SampleName, m_MsParam.Firm, out x1, out y1, out angle, out direction, out state);
+                if (state == 1)
                 {
                 {
-                    //1.设置图片名称
-                    //2.保存图片3
-                    WorkingFolder = m_measureFile.FilePath;
-                    String fileName3 = WorkingFolder + "\\" + m_nWorkHoleNo.ToString() + "Hole" + ImageName3;
-                    SendMsg("SEM拍照存储到" + fileName3);
-                    if (!GetImage(ImageMode.FIB, fileName3))
+                    //1. 根据客户PT沉积坐标控制FIB调整到中心位置???????
+                    if (!iSEM.MoveStageXY(x1, y1))
                     {
                     {
-                        SendMsg("FIB拍照失败");
+                        arg.Message = "移动到新(" + x1.ToString() + "," + y1.ToString() + ")位置失败";
+                        SendMsg("1-21");
                         return false;
                         return false;
                     }
                     }
-
-                    Thread.Sleep(3000);
+                    //判断是否移动完成
+                    while (true)
+                    {
+                        Thread.Sleep(5000);
+                        if (iSEM.GetStageIs() == 0)
+                        {
+                            break;
+                        }
+                    }
+                    arg.Message = "移动到新(" + x1.ToString() + "," + y1.ToString() + ")位置失败";
+                    SendMsg("1-21");
+                    //拉直操作
                 }
                 }
-                //5.验证切割准确性:与切割前对比,如果对比误差大,则停止自动执行,进行报警
+                else
+                {
+                    arg.Message = "样品台移动失败";
+                    SendMsg("1-21");
+                    return false;
+                }
+            }
 
 
-                //6.设置FIB解冻:先读取状态,如果冻结状态则进行解冻
+            if (!iSEM.SetScanRotation(angle))
+            {
+                arg.Message = "调整角度失败";
+                SendMsg("1-22");
+                return false;
             }
             }
+            arg.Message = "调整角度成功";
+            SendMsg("1-22");
+
+
+            ////6.验证移动准确性:获取当前SEM中心位置坐标,与客户返回坐标对比,验证是否移动正确
+            //float x5 = iSEM.GetStageAtX();
+            //float y5 = iSEM.GetStageAtY();
+            //if (Math.Abs(x5 - x4) > fMin && Math.Abs(y5 - y4) > fMin)
+            //{
+            //    return false;
+            //}
+
             return true;
             return true;
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 16.自动调整SEM找到切割位置,这里不是简单的拉直旋转
+        /// 17.自动控制SEM拍截面照
         /// </summary>
         /// </summary>
         /// <returns></returns>
         /// <returns></returns>
-        public bool FindCross()
+        public bool ShotSection()
         {
         {
-            //16.自动调整SEM找到切割位置
+            float x0 = 0, y0 = 0, x1 = 0, y1 = 0, x2 = 0, y2 = 0;
+            int state = 0;
+            
+
+            //1、放大6000倍,放大倍数参数photograph_
+            if (!iSEM.SetMagnification(6000))
             {
             {
-                //1.控制SEM放大到300倍
-                if (!iSEM.SetMagnification(300))
-                {
-                    return false;
-                }
-                //2.控制SEM自动对焦、亮度、对比度-接口
-                if (MeasParam.FocusMode==1)
+                arg.Message = "放大倍数调整失败";
+                SendMsg("1-25");
+                return false;
+            }
+            arg.Message = "放大倍数调整成功";
+            SendMsg("1-25");
+
+            //2.控制SEM自动对焦、亮度、对比度-接口
+            if (m_measureFile.MParam.FocusMode == 1)//手动
+            {
+                if (DialogResult.Yes == MessageBox.Show("图像自动对焦已完成?", "确认消息", MessageBoxButtons.YesNo))
                 {
                 {
-                    //弹出手动对焦的窗口
+                    arg.Message = "自动对焦完成";
+                    SendMsg("1-26");
+                    //return true;
                 }
                 }
                 else
                 else
                 {
                 {
-                    //调用自动对焦模块
+                    arg.Message = "自动对焦失败";
+                    SendMsg("1-26");
+                    return false;
                 }
                 }
+            }
+            else if (m_measureFile.MParam.FocusMode == 2)//自有自动
+            {
+                //郝工增加自动对焦算法
+            }
+            else     //客户自动
+            {
+                //后期和客户对接接口
+                List<string> filenames = new List<string>();
+                String retfilename = wr.Img_Auto_Focus(filenames);
+            }
 
 
-                Thread.Sleep(5000);
+            //3、设置SEM补偿角度
+            if (!TiltCorrection(m_measureFile.MParam.Correction_Angle))
+            {
+                arg.Message = "设置SEM进行角度补偿" + m_measureFile.MParam.Correction_Angle.ToString("0") + "度失败";
+                SendMsg("1-27");
+                return false;
+            }
+            arg.Message = "设置SEM进行角度补偿" + m_measureFile.MParam.Correction_Angle.ToString("0") + "度成功";
+            SendMsg("1-27");
+            Thread.Sleep(5000);
 
 
-                //3.控制SEM拍照
-                String fileName4 = WorkingFolder + ImageName4;
-                if (!GetImage(ImageMode.SEM, fileName4))
-                {
-                    return false;
-                }
+            //4、拍照,5、保存照片
+            String fileName5 = WorkingFolder + "\\" + m_nWorkHoleNo.ToString() + "Hole" + ImageName5;
+            arg.Picture_Information.Picture_FullPath = fileName5;
+            arg.Picture_Information.Work_Status = "SEM";
+            if (!GetImage(ImageMode.SEM, fileName5))
+            {
+                arg.Message = "SEM拍照失败";
+                SendMsg("1-28");
+                return false;
+            }
+            arg.Message = "SEM拍照成功";
+            SendMsg("1-28");
+            Thread.Sleep(3000);
 
 
-                Thread.Sleep(3000);
-                //4.将照片传给客户,获取偏移坐标,以及偏移角度
-                float x4 = 0, y4 = 0;
-                float angle = 0;
+            //6、获取偏移坐标,7、移动到位
+            if (DialogResult.Yes == MessageBox.Show("是否手动移动样品台到指定位置?\n如果点击取消则会调用Web接口。", "确认消息", MessageBoxButtons.YesNo))
+            {
+                arg.Message = "样品台移动到指定位置";
+                SendMsg("1-29");
+            }
+            else
+            {
+                //8,图像T形
+                // wr.Img_Cut_Position(fileName5, m_MsParam.SampleName, m_MsParam.Firm, out x1, out y1, out x2, out y2, out state);
+                //接口返回像素,*pixelsize,得到坐标点。判断移动方式
 
 
-                //5.根据坐标控制SEM移动到切孔位置,居中
-                if (!iSEM.MoveStageXY(x4, y4))
+                if (state == 1)
                 {
                 {
-                    return false;
+                    //1. 根据客户PT沉积坐标控制FIB调整到中心位置???????
+                    if (!iSEM.MoveStageXY(x1, y1))
+                    {
+                        arg.Message = "移动到新(" + x1.ToString() + "," + y1.ToString() + ")位置失败";
+                        SendMsg("1-29");
+                        return false;
+                    }
+                    //判断是否移动完成
+                    while (true)
+                    {
+                        Thread.Sleep(5000);
+                        if (iSEM.GetStageIs() == 0)
+                        {
+                            break;
+                        }
+                    }
+                    arg.Message = "移动到新(" + x1.ToString() + "," + y1.ToString() + ")位置失败";
+                    SendMsg("1-29");
                 }
                 }
-
-                if (!iSEM.SetScanRotation(angle))
+                else
                 {
                 {
+                    arg.Message = "样品台移动失败";
+                    SendMsg("1-8");
                     return false;
                     return false;
                 }
                 }
-
-                ////6.验证移动准确性:获取当前SEM中心位置坐标,与客户返回坐标对比,验证是否移动正确
-                //float x5 = iSEM.GetStageAtX();
-                //float y5 = iSEM.GetStageAtY();
-                //if (Math.Abs(x5 - x4) > fMin && Math.Abs(y5 - y4) > fMin)
-                //{
-                //    return false;
-                //}
             }
             }
+
+            //8、验证移动准确性
+            //与之前验证相同
+            //9、-10不操作
+            //11、自动对焦。与之前操作相同
+            //12拍照
+
+            //14光束复位
             return true;
             return true;
         }
         }
 
 
+
         public bool CommonWork()
         public bool CommonWork()
         {
         {
             SendMsg("插入PT针");
             SendMsg("插入PT针");
@@ -1155,103 +1409,107 @@ namespace MeasureThread
         public bool FirstHole()
         public bool FirstHole()
         {
         {
             MeasureData.CutHole firstHole = m_cutHoles[0];            
             MeasureData.CutHole firstHole = m_cutHoles[0];            
-            SendMsg("插入PT针");
+            
             //12.根据样品类型参数确定是否需要PT沉积,控制PT针插入
             //12.根据样品类型参数确定是否需要PT沉积,控制PT针插入
-            //if (firstHole.PT == true)
+            if (m_MsParam.Is_Photograph == false && m_MsParam.PT == true)
             {
             {
                 if (!InsertPT())
                 if (!InsertPT())
                 {
                 {
-                    SendMsg("插入PT针失败");
+                    arg.Message = "插入PT针失败";
+                    SendMsg("1-0");
                     return false;
                     return false;
                 }
                 }
+                arg.Message = "插入PT针成功";
+                SendMsg("1-0");
             }
             }
 
 
             //13. 自动 定位功能
             //13. 自动 定位功能
-            SendMsg("自动定位切割位置");
             if (!GetPoistion(true))
             if (!GetPoistion(true))
             {
             {
-                SendMsg("自动定位切割位置失败");
+                arg.Message = "自动定位切割位置失败";
+                SendMsg("1-1");
                 return false;
                 return false;
             }
             }
+            arg.Message = "自动定位切割位置成功";
+            SendMsg("1-1");
 
 
             //14.自动控制FIB切割
             //14.自动控制FIB切割
-            SendMsg("FIB切割");
-            if (!FIBCross())
+            if (m_MsParam.Is_Photograph == false && m_MsParam.PT == true)
             {
             {
-                SendMsg("FIB切割失败");
-                return false;
+                if (!FIBCross())
+                {
+                    arg.Message = "FIB切割失败";
+                    SendMsg("1-16");
+                    return false;
+                }
+                arg.Message = "FIB切割成功";
+                SendMsg("1-16");
             }
             }
-            //{
-            //    //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针
             //15.根据样品类型决定是否撤出PT针
-            SendMsg("撤出PT针");
-            //if (firstHole.PT == false)
-            //{
+            if(m_MsParam.Is_Photograph == false && m_MsParam.PT == true)
+            {
                 if (!RetractPT())
                 if (!RetractPT())
                 {
                 {
-                    SendMsg("撤出PT针失败");
+                    arg.Message = "撤出PT针失败";
+                    SendMsg("1-17");
                     return false;
                     return false;
                 }
                 }
-            //}
+                arg.Message = "撤出PT针成功";
+                SendMsg("1-17");
+            }
 
 
             // 16.找到切割位置
             // 16.找到切割位置
-            SendMsg("找到切割位置");
+            if(m_MsParam.Is_Photograph == false)
+            {
+                if (!FindCross())
+                {
+                    arg.Message = "找到切割位置失败";
+                    SendMsg("1-24");
+                    return false;
+                }
+                arg.Message = "找到切割位置成功";
+                SendMsg("1-24");
+            }
 
 
             //17.自动控制SEM拍截面照
             //17.自动控制SEM拍截面照
-            SendMsg("观测层高");
-
-            SendMsg("切换SEM控制");
-            if (!iSEM.CmdFIBModeSEM())
+            if(m_MsParam.Is_Photograph == false)
             {
             {
-                SendMsg("SEM模式切换失败");
-                return false;
+                if (!ShotSection())
+                {
+                    arg.Message = "自动控制SEM拍截面照失败";
+                    SendMsg("1-33");
+                    return false;
+                }
+                arg.Message = "自动控制SEM拍截面照成功";
+                SendMsg("1-33");
             }
             }
 
 
-            Thread.Sleep(10000);
+            //18.自动层高分析
+            //将17图片传给华为
 
 
-            SendMsg("放大6000倍");
-            if (!iSEM.SetMagnification(6000))
-            {
-                SendMsg("放大倍数调整失败");
-                return false;
-            }
+            //最后保存测量数据-测量文件、测量状态,m_cutHoles[i].STATE!=MeasureData.CutHole.State.Success.
+            //中间停止更新状态为Unmeasured,过程中return false时,更新状态为failed,保存测量文件
 
 
-            if (DialogResult.Yes == MessageBox.Show("图像拍摄已完成?", "确认消息", MessageBoxButtons.YesNo))
-            {
-                SendMsg("拍摄照片完成");
-                //return true;
-            }
-            else
-            {
-                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;
-            }
+            //SendMsg("图像校正36度");
+            ////3.设置SEM角度补偿cos36度
+            //if (!TiltCorrection(36))
+            //{
+            //    return false;
+            //}
 
 
-            Thread.Sleep(3000);
+            //Thread.Sleep(3000);
 
 
             string fn;
             string fn;
             //用宏抓一般图
             //用宏抓一般图
@@ -1654,13 +1912,280 @@ namespace MeasureThread
         }
         }
 
 
         //自动聚焦
         //自动聚焦
-        public bool AutoFocus(string a_strPath, out int a_nWd)
+        public bool AutoFocus(FocusParam a_param, out int a_nWd)
         {
         {
             a_nWd = 0;
             a_nWd = 0;
             a_nWd = (int)Math.Ceiling(iSEM.GetWorkingDistance() * 100000000 + 0.5);//获取当前的工作距离
             a_nWd = (int)Math.Ceiling(iSEM.GetWorkingDistance() * 100000000 + 0.5);//获取当前的工作距离
 
 
+            if (a_param == null)
+            {
+                return false;
+            }
+
+            string path = a_param.Path;
+            if (!Directory.Exists(path))
+            {
+                return false;
+            }
+            string path_coarse = a_param.Path + "\\Coarse";
+            if (!Directory.Exists(path_coarse))
+            {
+                Directory.CreateDirectory(path_coarse);
+            }
+            string path_fine = a_param.Path + "\\Fine";
+            if (!Directory.Exists(path_fine))
+            {
+                Directory.CreateDirectory(path_fine);
+            }
+
+
+            //1. 拍照
+            //1.1, 粗拍照
+            //1.1.1, 根据参数计算拍照次数
+            double nUp = a_param.UP * 100.0 ;
+            double nDown = a_param.Down * 100.0;
+            double nStep = a_param.Step * 100.0;
+            double nTimes = Math.Ceiling((nDown - nUp) / nStep + 0.5);
+
+            SendMsg("粗对焦:最小值" + nUp.ToString() + ",最大值" + nDown.ToString() + ",步长" + nStep.ToString() + "拍照张数" + nTimes.ToString());
+
+            //粗拍照
+            for (int i = 0; i < nTimes; i++)
+            {
+
+                int cWd =(int) Math.Ceiling(nUp + i * nStep + 0.5);
+                iSEM.SetWorkingDistance((float)(cWd * 0.00000001));
+                Thread.Sleep(3000);
+
+                int swd = cWd / 100;
+                SendMsg("wd = " + swd.ToString() +"um");
+
+                String fileName = path_coarse + "\\" + cWd.ToString() + ".tif";
+                if (!GetImage(ImageMode.SEM, fileName))
+                {
+                    return false;
+                }
+
+                Thread.Sleep(5000);
+            }
+
+            //1.2, 选定细拍照的工作距离
+            int CorWd;
+            ChooseBest(path_coarse,out CorWd);
+
+            a_nWd = CorWd;
+
+            SendMsg("粗选工作距离wd = " + a_nWd.ToString() );
+            
+
+            //1.3, 细拍照
+            if ( (CorWd - a_param.Range * 100.0) <=0)
+            {
+                return false;
+            }
+
+            double nfUp = CorWd - a_param.Range * 100.0;
+            double nfStep = a_param.fStep * 100.0;
+            double nfTimes = Math.Ceiling((a_param.Range * 100.0 * 2) / nfStep + 0.5);
+
+
+            SendMsg("粗对焦:最小值" + nfUp.ToString()  + ",步长" + nfStep.ToString() + "拍照张数" + nfTimes.ToString());
+
+
+            for (int i = 0; i < nfTimes; i++)
+            {
+                int cWd = (int)Math.Ceiling(nfUp + i * nfStep + 0.5);
+                iSEM.SetWorkingDistance((float)(cWd * 0.00000001));
+                Thread.Sleep(3000);
+
+                int swd = cWd / 100;
+                SendMsg("wd = " + swd.ToString() + "um");
+
+                String fileName = path_fine + "\\" + cWd.ToString() + ".tif";
+                if (!GetImage(ImageMode.SEM, fileName))
+                {
+                    return false;
+                }
+
+                Thread.Sleep(5000);
+            }
+
+            int fineWd;
+            ChooseBest(path_coarse, out fineWd);
+
+            SendMsg("wd fine max = " + fineWd.ToString());
+
+            a_nWd = fineWd;
+
+            SendMsg("细选工作距离wd = " + a_nWd.ToString());
+
             return true;
             return true;
 
 
         }
         }
+
+        //LoG算子计算
+        private double LoGMean(string a_strImgPath)
+        {
+            //读入Img文件
+            if (!File.Exists(a_strImgPath))
+            {
+                return 0;
+            }
+
+            Mat src, gray_src;
+            int kernel_size = 3;
+
+            src = Cv2.ImRead(a_strImgPath);
+            gray_src = new Mat();
+
+            src.CvtColor(ColorConversionCodes.BGR2GRAY);
+
+            Mat kernel = Cv2.GetStructuringElement(MorphShapes.Cross, new OpenCvSharp.Size(10, 10));
+            Cv2.MorphologyEx(src, src, MorphTypes.Close, kernel);
+
+            Cv2.GaussianBlur(src, src, new OpenCvSharp.Size(3, 3), 0, 0);
+            Cv2.Laplacian(src, src, MatType.CV_8UC3, kernel_size);
+            Cv2.ConvertScaleAbs(src, src);
+
+            //图像的平均灰度
+
+            double meanValue = 0.0;
+            meanValue = Cv2.Mean(src)[0];
+            return meanValue;
+        }
+
+        //梯度计算
+        private double Tenengrad(string a_strImgPath)
+        {
+            //读入Img文件
+            if (!File.Exists(a_strImgPath))
+            {
+                return 0;
+            }
+
+            Mat src;
+            src = Cv2.ImRead(a_strImgPath);
+
+            src.CvtColor(ColorConversionCodes.BGR2GRAY);
+
+            Mat kernel = Cv2.GetStructuringElement(MorphShapes.Cross, new OpenCvSharp.Size(10, 10));
+            Cv2.MorphologyEx(src, src, MorphTypes.Close, kernel);
+
+            Cv2.GaussianBlur(src, src, new OpenCvSharp.Size(3, 3), 0, 0);
+            Cv2.Sobel(src, src, MatType.CV_8UC1, 1, 1);
+            //图像的平均灰度
+            double meanValue = 0.0;
+            meanValue = Cv2.Mean(src)[0];
+            return meanValue;
+        }
+
+        //梯度计算
+        private double TTgrad(string a_strImgPath)
+        {
+            //读入Img文件
+            if (!File.Exists(a_strImgPath))
+            {
+                return 0;
+            }
+
+            Mat src;
+            src = Cv2.ImRead(a_strImgPath);
+
+            src.CvtColor(ColorConversionCodes.BGR2GRAY);
+
+            Mat kernel = Cv2.GetStructuringElement(MorphShapes.Cross, new OpenCvSharp.Size(10, 10));
+            Cv2.MorphologyEx(src, src, MorphTypes.Close, kernel);
+
+            Mat scalex = new Mat();
+            Mat scaley = new Mat();
+
+            Cv2.Scharr(src, src, src.Depth(), 1, 0);
+            Cv2.ConvertScaleAbs(src, scalex);
+
+            Cv2.Scharr(src, src, src.Depth(), 0, 1);
+            Cv2.ConvertScaleAbs(src, scaley);
+
+            Cv2.AddWeighted(scalex, 0.5, scaley, 0.5, 0, src);
+
+            //图像的平均灰度
+            double meanValue = 0.0;
+            meanValue = Cv2.Mean(src)[0];
+            return meanValue;
+        }
+
+        //三选二算法
+        private void ChooseBest(string a_strImgPath, out int a_nWd)
+        {
+            a_nWd = -1;
+
+            var files = Directory.GetFiles(a_strImgPath, "*.tif");
+            float[] values = new float[files.Length];
+
+
+            double smax1 = LoGMean(files[0]);
+            int wdmax1 = int.Parse(System.IO.Path.GetFileNameWithoutExtension(files[0]));
+
+            double smax2 = Tenengrad(files[0]);
+            int wdmax2 = wdmax1;
+
+            double smax3 = TTgrad(files[0]);
+            int wdmax3 = wdmax1;
+
+
+
+            int x = 0;
+            foreach (var file in files)
+            {
+
+                int wd = int.Parse(System.IO.Path.GetFileNameWithoutExtension(file));
+                double svalue1 = LoGMean(file);
+                double svalue2 = Tenengrad(file);
+                double svalue3 = TTgrad(file);
+
+
+                if (smax1 < svalue1)
+                {
+                    smax1 = svalue1;
+                    wdmax1 = wd;
+                }
+
+                if (smax2 < svalue2)
+                {
+                    smax2 = svalue2;
+                    wdmax2 = wd;
+                }
+
+                if (smax3 < svalue3)
+                {
+                    smax3 = svalue3;
+                    wdmax3 = wd;
+                }
+
+                x++;
+            }
+
+            SendMsg("LoG = " + wdmax1.ToString() + ",梯度 = " + wdmax2.ToString() + ",滤波 = " + wdmax3.ToString());
+
+
+            if (wdmax1 == wdmax2 || wdmax1 == wdmax3)
+            {
+                a_nWd = wdmax1;
+                SendMsg("焦距 = " + wdmax1.ToString());
+            }
+            else if (wdmax1 == wdmax2 || wdmax2 == wdmax3)
+            {
+                a_nWd = wdmax2;
+                SendMsg("焦距 = " + wdmax2.ToString());
+            }
+            else if (wdmax3 == wdmax2 || wdmax1 == wdmax3)
+            {
+                a_nWd = wdmax3;
+                SendMsg("焦距 = " + wdmax3.ToString());
+            }
+            else
+            {
+                SendMsg("对焦失败。");
+            }
+        }
     }
     }
 }
 }

+ 24 - 0
MeasureThread/MeasureThread.csproj

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU.props" Condition="Exists('..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU.props')" />
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
   <PropertyGroup>
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -13,6 +14,8 @@
     <FileAlignment>512</FileAlignment>
     <FileAlignment>512</FileAlignment>
     <Deterministic>true</Deterministic>
     <Deterministic>true</Deterministic>
     <TargetFrameworkProfile />
     <TargetFrameworkProfile />
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
   </PropertyGroup>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <DebugSymbols>true</DebugSymbols>
@@ -36,6 +39,18 @@
       <SpecificVersion>False</SpecificVersion>
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\bin\Debug\MeasureData.dll</HintPath>
       <HintPath>..\bin\Debug\MeasureData.dll</HintPath>
     </Reference>
     </Reference>
+    <Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
+      <HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net461\OpenCvSharp.dll</HintPath>
+    </Reference>
+    <Reference Include="OpenCvSharp.Blob, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
+      <HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net461\OpenCvSharp.Blob.dll</HintPath>
+    </Reference>
+    <Reference Include="OpenCvSharp.Extensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
+      <HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net461\OpenCvSharp.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="OpenCvSharp.UserInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
+      <HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net461\OpenCvSharp.UserInterface.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Core" />
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Windows.Forms" />
@@ -65,5 +80,14 @@
       <Name>WebManager</Name>
       <Name>WebManager</Name>
     </ProjectReference>
     </ProjectReference>
   </ItemGroup>
   </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU.props'))" />
+  </Target>
 </Project>
 </Project>

+ 4 - 0
MeasureThread/packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="OpenCvSharp3-AnyCPU" version="4.0.0.20181129" targetFramework="net461" />
+</packages>

+ 18 - 9
WebManager/WebResult.cs

@@ -135,8 +135,13 @@ namespace WebManager
         /// <param name="imagePath">图片路径</param>
         /// <param name="imagePath">图片路径</param>
         /// <param name="imageType">孔类型</param>
         /// <param name="imageType">孔类型</param>
         /// <param name="firm">厂家类型</param>
         /// <param name="firm">厂家类型</param>
+        /// <param name="offsetx1">切割点相对于原点坐标左上角x值</param>
+        /// <param name="offsetx2">切割点相对于原点坐标左上角y值</param>
+        /// <param name="offsety1">切割点相对于原点坐标右上角x值</param>
+        /// <param name="offsety2">切割点相对于原点坐标右上角y值</param>
+        /// <param name="state">返回状态</param>
         /// <returns>json字符串</returns>
         /// <returns>json字符串</returns>
-        public void Img_Cut_Position(String imagePath, int imageType, String firm, out double offsetx, out double offsety, out int state)
+        public void Img_Cut_Position(String imagePath, String imageType, String firm, out float offsetx1, out float offsety1, out float offsetx2, out float offsety2, out int state)
         {
         {
             try
             try
             {
             {
@@ -157,15 +162,19 @@ namespace WebManager
             {
             {
                 JObject jname = JObject.Parse(jret["img_name"].ToString());
                 JObject jname = JObject.Parse(jret["img_name"].ToString());
                 JArray jlocation = JArray.Parse(jname["location"].ToString());
                 JArray jlocation = JArray.Parse(jname["location"].ToString());
-                offsetx = Convert.ToDouble(jlocation[0].ToString());
-                offsety = Convert.ToDouble(jlocation[1].ToString());
+                offsetx1 = Convert.ToSingle(jlocation[0][0].ToString());
+                offsety1 = Convert.ToSingle(jlocation[0][1].ToString());
+                offsetx2 = Convert.ToSingle(jlocation[1][0].ToString());
+                offsety2 = Convert.ToSingle(jlocation[1][1].ToString());
                 state = Convert.ToInt32(jname["state"].ToString());
                 state = Convert.ToInt32(jname["state"].ToString());
             }
             }
             else
             else
             {
             {
                 state = 0;
                 state = 0;
-                offsetx = 0;
-                offsety = 0;
+                offsetx1 = 0;
+                offsety1 = 0;
+                offsetx2 = 0;
+                offsety2 = 0;
             }
             }
         }
         }
 
 
@@ -308,7 +317,7 @@ namespace WebManager
         /// </summary>
         /// </summary>
         /// <param name="imagePath">图片路径</param>
         /// <param name="imagePath">图片路径</param>
         /// <returns>json字符串</returns>
         /// <returns>json字符串</returns>
-        public void Img_Center_Position_OffsetAngle_Direction(String imagePath, int imageType, String firm, out double offsetx, out double offsety, out double degree, out int direction, out int state)
+        public void Img_Center_Position_OffsetAngle_Direction(String imagePath, String imageType, String firm, out float offsetx, out float offsety, out float degree, out int direction, out int state)
         {
         {
             try
             try
             {
             {
@@ -329,10 +338,10 @@ namespace WebManager
             {
             {
                 JObject jname = JObject.Parse(jret["img_name"].ToString());
                 JObject jname = JObject.Parse(jret["img_name"].ToString());
                 JArray jlocation = JArray.Parse(jname["center"].ToString());
                 JArray jlocation = JArray.Parse(jname["center"].ToString());
-                offsetx = Convert.ToDouble(jlocation[0].ToString());
-                offsety = Convert.ToDouble(jlocation[1].ToString());
+                offsetx = Convert.ToSingle(jlocation[0].ToString());
+                offsety = Convert.ToSingle(jlocation[1].ToString());
                 state = Convert.ToInt32(jname["state"].ToString());
                 state = Convert.ToInt32(jname["state"].ToString());
-                degree = Convert.ToDouble(jname["degree"].ToString());
+                degree = Convert.ToSingle(jname["degree"].ToString());
                 direction = Convert.ToInt32(jname["direction"].ToString());
                 direction = Convert.ToInt32(jname["direction"].ToString());
 
 
             }
             }