Переглянути джерело

测试12类56类没有问题7类有时对焦不是很好

gsp 4 роки тому
батько
коміт
b320f3a53f

+ 1 - 1
DBManager/MeasureDB.cs

@@ -37,7 +37,7 @@ namespace DBManager
         public void CreateDB()
         {
             string path = Path.GetDirectoryName(m_measureFile.FileName);
-            path += "\\MeasureDB.db";
+            path = "D:\\HOZ\\test\\MeasureDB.db";
 
             if (File.Exists(path))
             {

+ 14 - 0
ExtenderControl/Extender.cs

@@ -155,6 +155,20 @@ namespace Extender
             controlThread = new Thread(this.ControlerThread);
             controlThread.Start();
         }
+        public void CloseExtender()
+        {
+            if (myExtender != null)
+            {
+            myExtender.CloseExtender();
+            controlThread.Abort();
+            }
+           
+        }
+
+          ~ExtenderWrapper()
+        {
+            this.CloseExtender();
+        }
         private void ControlerThread()
         {
             while (true)

+ 10 - 2
ExtenderControl/ExtenderInterface.cs

@@ -33,11 +33,19 @@ namespace Extender
         }
 
         //其他使用的成员变量
-        private readonly IExtenderControl m_iExtender = new ExtenderWrapper(); //成员变量
+        private  IExtenderControl m_iExtender = null; //成员变量
+        //private readonly IExtenderControl m_iExtender = new Extender(); //成员变量
 
         public IExtenderControl IExtender
         {
-            get { return m_iExtender; }
+            get {
+                if (m_iExtender == null)
+                {
+                    m_iExtender = new ExtenderWrapper();
+                }
+                return m_iExtender;
+
+            }
         } //属性,只能当前类创建         
     }
 

+ 12 - 6
HOZProject/App.config

@@ -7,7 +7,7 @@
       <!--厂商_数据源-->
       <add key="Firm" value="N-BOE,LG,SDC,O-BOE"/>
       <!--样品类型_数据源-->
-      <add key="Sample_Type" value="0,1,2"/>
+      <add key="Sample_Type" value="0,1,2,3"/>
       <!--拍照的工作电压_数据源-->
       <add key="WPZD" value="100,200,300,2500,2000"/>
       <!--拍照的放大倍数_数据源-->
@@ -151,26 +151,32 @@
       <add key="RemoteMLFPath" value="\\192.168.1.101\Carl Zeiss\SmartSEM\User\Service\"/>
 
 
-      <!--add by sun 2020-12-15 增加不同样品扫描速度参数,每类样品3种扫描速度-->
-      <!--0类样品 正常情况下默认扫描速度-->
+      <!--add by sun 2020-12-15 增加不同样品扫描速度参数,每类样品3种扫描速度-->
+      <!--0类样品 正常情况下默认扫描速度-->
       <add key="ScanSpeedNormal_0" value="CMD_SCANRATE4"/>
       <!--对焦拍照扫描速度-->
       <add key="ScanSpeedFocus_0" value="CMD_SCANRATE5"/>
       <!--高倍拍照扫描速度-->
       <add key="ScanSpeedHigh_0" value="CMD_SCANRATE7"/>
-      <!--1类样品 正常情况下默认扫描速度-->
+      <!--1类样品 正常情况下默认扫描速度-->
       <add key="ScanSpeedNormal_1" value="CMD_SCANRATE4"/>
       <!--对焦拍照扫描速度-->
       <add key="ScanSpeedFocus_1" value="CMD_SCANRATE5"/>
       <!--高倍拍照扫描速度-->
       <add key="ScanSpeedHigh_1" value="CMD_SCANRATE7"/>
-      <!--2类样品 正常情况下默认扫描速度-->
+      <!--2类样品 正常情况下默认扫描速度-->
       <add key="ScanSpeedNormal_2" value="CMD_SCANRATE4"/>
       <!--对焦拍照扫描速度-->
       <add key="ScanSpeedFocus_2" value="CMD_SCANRATE5"/>
       <!--高倍拍照扫描速度-->
       <add key="ScanSpeedHigh_2" value="CMD_SCANRATE7"/>
-      <!--add by sun 2020-12-15 增加不同样品扫描速度参数,每类样品3种扫描速度 end-->
+      <!--3大类样品 正常情况下默认扫描速度-->
+      <add key="ScanSpeedNormal_3" value="CMD_SCANRATE4"/>
+      <!--对焦拍照扫描速度-->
+      <add key="ScanSpeedFocus_3" value="CMD_SCANRATE5"/>
+      <!--高倍拍照扫描速度-->
+      <add key="ScanSpeedHigh_3" value="CMD_SCANRATE7"/>
+      <!--add by sun 2020-12-15 增加不同样品扫描速度参数,每大类样品3种扫描速度 end-->
       
     </appSettings>
 </configuration>

+ 43 - 43
HOZProject/FormHOZMain.Designer.cs

@@ -53,11 +53,11 @@
             this.pbClose = new System.Windows.Forms.PictureBox();
             this.pbImportTemplateFile = new System.Windows.Forms.PictureBox();
             this.pbLog = new System.Windows.Forms.PictureBox();
-            this.pbInit = new System.Windows.Forms.PictureBox();
             this.pbSave = new System.Windows.Forms.PictureBox();
             this.pbOpen = new System.Windows.Forms.PictureBox();
             this.pbNew = new System.Windows.Forms.PictureBox();
             this.pbStop = new System.Windows.Forms.PictureBox();
+            this.pbInit = new System.Windows.Forms.PictureBox();
             this.plMain.SuspendLayout();
             this.plFill.SuspendLayout();
             this.groupBox1.SuspendLayout();
@@ -72,11 +72,11 @@
             ((System.ComponentModel.ISupportInitialize)(this.pbClose)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.pbImportTemplateFile)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.pbLog)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.pbInit)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.pbSave)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.pbOpen)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.pbNew)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.pbStop)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.pbInit)).BeginInit();
             this.SuspendLayout();
             // 
             // plMain
@@ -90,7 +90,7 @@
             this.plMain.Controls.Add(this.plLeft);
             this.plMain.Controls.Add(this.plTop);
             this.plMain.Location = new System.Drawing.Point(16, 15);
-            this.plMain.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.plMain.Margin = new System.Windows.Forms.Padding(4);
             this.plMain.Name = "plMain";
             this.plMain.Size = new System.Drawing.Size(1401, 895);
             this.plMain.TabIndex = 1;
@@ -107,7 +107,7 @@
             this.plFill.Controls.Add(this.pbImage);
             this.plFill.Controls.Add(this.plSEM);
             this.plFill.Location = new System.Drawing.Point(203, 108);
-            this.plFill.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.plFill.Margin = new System.Windows.Forms.Padding(4);
             this.plFill.Name = "plFill";
             this.plFill.Size = new System.Drawing.Size(1192, 788);
             this.plFill.TabIndex = 5;
@@ -121,9 +121,9 @@
             this.groupBox1.Controls.Add(this.textBox2);
             this.groupBox1.ForeColor = System.Drawing.Color.White;
             this.groupBox1.Location = new System.Drawing.Point(909, 4);
-            this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.groupBox1.Margin = new System.Windows.Forms.Padding(4);
             this.groupBox1.Name = "groupBox1";
-            this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.groupBox1.Padding = new System.Windows.Forms.Padding(4);
             this.groupBox1.Size = new System.Drawing.Size(267, 125);
             this.groupBox1.TabIndex = 26;
             this.groupBox1.TabStop = false;
@@ -133,7 +133,7 @@
             // textBox1
             // 
             this.textBox1.Location = new System.Drawing.Point(8, 25);
-            this.textBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.textBox1.Margin = new System.Windows.Forms.Padding(4);
             this.textBox1.Name = "textBox1";
             this.textBox1.Size = new System.Drawing.Size(132, 25);
             this.textBox1.TabIndex = 21;
@@ -143,7 +143,7 @@
             // 
             this.button1.ForeColor = System.Drawing.Color.Black;
             this.button1.Location = new System.Drawing.Point(159, 25);
-            this.button1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.button1.Margin = new System.Windows.Forms.Padding(4);
             this.button1.Name = "button1";
             this.button1.Size = new System.Drawing.Size(100, 91);
             this.button1.TabIndex = 24;
@@ -158,7 +158,7 @@
             "True",
             "False"});
             this.comboBox1.Location = new System.Drawing.Point(8, 91);
-            this.comboBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.comboBox1.Margin = new System.Windows.Forms.Padding(4);
             this.comboBox1.Name = "comboBox1";
             this.comboBox1.Size = new System.Drawing.Size(132, 23);
             this.comboBox1.TabIndex = 25;
@@ -166,7 +166,7 @@
             // textBox2
             // 
             this.textBox2.Location = new System.Drawing.Point(8, 59);
-            this.textBox2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.textBox2.Margin = new System.Windows.Forms.Padding(4);
             this.textBox2.Name = "textBox2";
             this.textBox2.Size = new System.Drawing.Size(132, 25);
             this.textBox2.TabIndex = 22;
@@ -177,7 +177,7 @@
             this.plPrarInfo.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
             this.plPrarInfo.ForeColor = System.Drawing.Color.Transparent;
             this.plPrarInfo.Location = new System.Drawing.Point(0, 0);
-            this.plPrarInfo.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.plPrarInfo.Margin = new System.Windows.Forms.Padding(4);
             this.plPrarInfo.Name = "plPrarInfo";
             this.plPrarInfo.Size = new System.Drawing.Size(291, 125);
             this.plPrarInfo.TabIndex = 2;
@@ -201,7 +201,7 @@
             this.pbImage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
             this.pbImage.Dock = System.Windows.Forms.DockStyle.Fill;
             this.pbImage.Location = new System.Drawing.Point(0, 0);
-            this.pbImage.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbImage.Margin = new System.Windows.Forms.Padding(4);
             this.pbImage.Name = "pbImage";
             this.pbImage.Size = new System.Drawing.Size(1192, 717);
             this.pbImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
@@ -216,7 +216,7 @@
             this.plSEM.Controls.Add(this.lblFlowContent);
             this.plSEM.Dock = System.Windows.Forms.DockStyle.Bottom;
             this.plSEM.Location = new System.Drawing.Point(0, 717);
-            this.plSEM.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.plSEM.Margin = new System.Windows.Forms.Padding(4);
             this.plSEM.Name = "plSEM";
             this.plSEM.Size = new System.Drawing.Size(1192, 71);
             this.plSEM.TabIndex = 19;
@@ -254,7 +254,7 @@
             this.plLeft.Controls.Add(this.plLeftContent);
             this.plLeft.Dock = System.Windows.Forms.DockStyle.Left;
             this.plLeft.Location = new System.Drawing.Point(0, 100);
-            this.plLeft.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.plLeft.Margin = new System.Windows.Forms.Padding(4);
             this.plLeft.Name = "plLeft";
             this.plLeft.Size = new System.Drawing.Size(194, 795);
             this.plLeft.TabIndex = 4;
@@ -281,7 +281,7 @@
             this.plLeftContent.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
             this.plLeftContent.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
             this.plLeftContent.Location = new System.Drawing.Point(7, 26);
-            this.plLeftContent.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.plLeftContent.Margin = new System.Windows.Forms.Padding(4);
             this.plLeftContent.Name = "plLeftContent";
             this.plLeftContent.Size = new System.Drawing.Size(178, 765);
             this.plLeftContent.TabIndex = 0;
@@ -304,7 +304,7 @@
             this.plTop.Controls.Add(this.pbInit);
             this.plTop.Dock = System.Windows.Forms.DockStyle.Top;
             this.plTop.Location = new System.Drawing.Point(0, 0);
-            this.plTop.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.plTop.Margin = new System.Windows.Forms.Padding(4);
             this.plTop.Name = "plTop";
             this.plTop.Size = new System.Drawing.Size(1401, 100);
             this.plTop.TabIndex = 3;
@@ -315,7 +315,7 @@
             this.pbPause.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbPause.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbPause.Location = new System.Drawing.Point(633, 6);
-            this.pbPause.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbPause.Margin = new System.Windows.Forms.Padding(4);
             this.pbPause.Name = "pbPause";
             this.pbPause.Size = new System.Drawing.Size(91, 89);
             this.pbPause.TabIndex = 8;
@@ -329,7 +329,7 @@
             this.pbStart.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbStart.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbStart.Location = new System.Drawing.Point(495, 5);
-            this.pbStart.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbStart.Margin = new System.Windows.Forms.Padding(4);
             this.pbStart.Name = "pbStart";
             this.pbStart.Size = new System.Drawing.Size(91, 89);
             this.pbStart.TabIndex = 8;
@@ -346,7 +346,7 @@
             this.pbMax.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbMax.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbMax.Location = new System.Drawing.Point(1309, 5);
-            this.pbMax.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbMax.Margin = new System.Windows.Forms.Padding(4);
             this.pbMax.Name = "pbMax";
             this.pbMax.Size = new System.Drawing.Size(37, 39);
             this.pbMax.TabIndex = 7;
@@ -363,7 +363,7 @@
             this.pbMin.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbMin.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbMin.Location = new System.Drawing.Point(1264, 5);
-            this.pbMin.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbMin.Margin = new System.Windows.Forms.Padding(4);
             this.pbMin.Name = "pbMin";
             this.pbMin.Size = new System.Drawing.Size(37, 39);
             this.pbMin.TabIndex = 7;
@@ -380,7 +380,7 @@
             this.pbClose.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbClose.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbClose.Location = new System.Drawing.Point(1355, 5);
-            this.pbClose.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbClose.Margin = new System.Windows.Forms.Padding(4);
             this.pbClose.Name = "pbClose";
             this.pbClose.Size = new System.Drawing.Size(37, 39);
             this.pbClose.TabIndex = 7;
@@ -396,7 +396,7 @@
             this.pbImportTemplateFile.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbImportTemplateFile.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbImportTemplateFile.Location = new System.Drawing.Point(299, 5);
-            this.pbImportTemplateFile.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbImportTemplateFile.Margin = new System.Windows.Forms.Padding(4);
             this.pbImportTemplateFile.Name = "pbImportTemplateFile";
             this.pbImportTemplateFile.Size = new System.Drawing.Size(91, 89);
             this.pbImportTemplateFile.TabIndex = 6;
@@ -410,27 +410,13 @@
             this.pbLog.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbLog.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbLog.Location = new System.Drawing.Point(396, 5);
-            this.pbLog.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbLog.Margin = new System.Windows.Forms.Padding(4);
             this.pbLog.Name = "pbLog";
             this.pbLog.Size = new System.Drawing.Size(91, 89);
             this.pbLog.TabIndex = 6;
             this.pbLog.TabStop = false;
             this.pbLog.Click += new System.EventHandler(this.pbLog_Click);
             // 
-            // pbInit
-            // 
-            this.pbInit.BackColor = System.Drawing.Color.Transparent;
-            this.pbInit.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pbInit.BackgroundImage")));
-            this.pbInit.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
-            this.pbInit.Cursor = System.Windows.Forms.Cursors.Hand;
-            this.pbInit.Location = new System.Drawing.Point(104, 5);
-            this.pbInit.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
-            this.pbInit.Name = "pbInit";
-            this.pbInit.Size = new System.Drawing.Size(91, 89);
-            this.pbInit.TabIndex = 5;
-            this.pbInit.TabStop = false;
-            this.pbInit.Click += new System.EventHandler(this.pbInit_Click);
-            // 
             // pbSave
             // 
             this.pbSave.BackColor = System.Drawing.Color.Transparent;
@@ -438,7 +424,7 @@
             this.pbSave.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbSave.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbSave.Location = new System.Drawing.Point(203, 5);
-            this.pbSave.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbSave.Margin = new System.Windows.Forms.Padding(4);
             this.pbSave.Name = "pbSave";
             this.pbSave.Size = new System.Drawing.Size(91, 89);
             this.pbSave.TabIndex = 4;
@@ -452,7 +438,7 @@
             this.pbOpen.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbOpen.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbOpen.Location = new System.Drawing.Point(7, 5);
-            this.pbOpen.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbOpen.Margin = new System.Windows.Forms.Padding(4);
             this.pbOpen.Name = "pbOpen";
             this.pbOpen.Size = new System.Drawing.Size(91, 89);
             this.pbOpen.TabIndex = 3;
@@ -465,7 +451,7 @@
             this.pbNew.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbNew.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbNew.Location = new System.Drawing.Point(7, 5);
-            this.pbNew.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbNew.Margin = new System.Windows.Forms.Padding(4);
             this.pbNew.Name = "pbNew";
             this.pbNew.Size = new System.Drawing.Size(91, 89);
             this.pbNew.TabIndex = 3;
@@ -481,7 +467,7 @@
             this.pbStop.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbStop.Enabled = false;
             this.pbStop.Location = new System.Drawing.Point(495, 4);
-            this.pbStop.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.pbStop.Margin = new System.Windows.Forms.Padding(4);
             this.pbStop.Name = "pbStop";
             this.pbStop.Size = new System.Drawing.Size(91, 89);
             this.pbStop.TabIndex = 8;
@@ -491,6 +477,20 @@
             this.pbStop.MouseEnter += new System.EventHandler(this.pbStop_MouseEnter);
             this.pbStop.MouseLeave += new System.EventHandler(this.pbStop_MouseLeave);
             // 
+            // pbInit
+            // 
+            this.pbInit.BackColor = System.Drawing.Color.Transparent;
+            this.pbInit.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pbInit.BackgroundImage")));
+            this.pbInit.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
+            this.pbInit.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.pbInit.Location = new System.Drawing.Point(104, 5);
+            this.pbInit.Margin = new System.Windows.Forms.Padding(4);
+            this.pbInit.Name = "pbInit";
+            this.pbInit.Size = new System.Drawing.Size(91, 89);
+            this.pbInit.TabIndex = 5;
+            this.pbInit.TabStop = false;
+            this.pbInit.Click += new System.EventHandler(this.pbInit_Click);
+            // 
             // FormHOZMain
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
@@ -500,7 +500,7 @@
             this.ControlBox = false;
             this.Controls.Add(this.plMain);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
-            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.Margin = new System.Windows.Forms.Padding(4);
             this.MinimumSize = new System.Drawing.Size(1365, 849);
             this.Name = "FormHOZMain";
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
@@ -525,11 +525,11 @@
             ((System.ComponentModel.ISupportInitialize)(this.pbClose)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.pbImportTemplateFile)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.pbLog)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.pbInit)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.pbSave)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.pbOpen)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.pbNew)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.pbStop)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.pbInit)).EndInit();
             this.ResumeLayout(false);
 
         }

+ 2 - 1
HOZProject/FormHOZMain.cs

@@ -210,9 +210,10 @@ namespace HOZProject
                 m_MeasureFile.MParam.ZDistance= Convert.ToSingle(ConfigurationManager.AppSettings["ZDistance"]);
 
                 //add by sun 2020-12-15 增加不同样品扫描速度参数
-                m_MeasureFile.MParam.ScanSpeedNormal = Convert.ToString(ConfigurationManager.AppSettings["ScanSpeedNormal_"+ m_MeasureFile.MParam.SampleName]);
+                m_MeasureFile.MParam.ScanSpeedNormal = Convert.ToString(ConfigurationManager.AppSettings["ScanSpeedNormal_" + m_MeasureFile.MParam.SampleName]);
                 m_MeasureFile.MParam.ScanSpeedFocus = Convert.ToString(ConfigurationManager.AppSettings["ScanSpeedFocus_" + m_MeasureFile.MParam.SampleName]);
                 m_MeasureFile.MParam.ScanSpeedHigh = Convert.ToString(ConfigurationManager.AppSettings["ScanSpeedHigh_" + m_MeasureFile.MParam.SampleName]);
+                LogManager.AddHardwareLog("==============="+ ConfigurationManager.AppSettings["ScanSpeedNormal_3"] + "========="+ m_MeasureFile.MParam.SampleName, true);
                 //add by sun 2020-12-15 增加不同样品扫描速度参数 end
 
                 m_Ms.InitMeas(m_MeasureFile);

+ 158 - 115
HOZProject/FormUnitControl.Designer.cs

@@ -354,21 +354,24 @@
             this.txtDeltaR = new System.Windows.Forms.TextBox();
             this.label85 = new System.Windows.Forms.Label();
             this.tabPage6 = new System.Windows.Forms.TabPage();
+            this.label101 = new System.Windows.Forms.Label();
+            this.lblEDSH = new System.Windows.Forms.Label();
+            this.label99 = new System.Windows.Forms.Label();
+            this.lblEDSW = new System.Windows.Forms.Label();
+            this.label97 = new System.Windows.Forms.Label();
+            this.lblEDSY = new System.Windows.Forms.Label();
+            this.label96 = new System.Windows.Forms.Label();
+            this.lblEDSX = new System.Windows.Forms.Label();
+            this.button14 = new System.Windows.Forms.Button();
+            this.ltLines = new System.Windows.Forms.ListBox();
+            this.button13 = new System.Windows.Forms.Button();
             this.label94 = new System.Windows.Forms.Label();
             this.txtPicPath = new System.Windows.Forms.TextBox();
             this.ltPoints = new System.Windows.Forms.ListBox();
             this.button12 = new System.Windows.Forms.Button();
-            this.button13 = new System.Windows.Forms.Button();
-            this.ltLines = new System.Windows.Forms.ListBox();
-            this.button14 = new System.Windows.Forms.Button();
-            this.lblEDSX = new System.Windows.Forms.Label();
-            this.label96 = new System.Windows.Forms.Label();
-            this.label97 = new System.Windows.Forms.Label();
-            this.lblEDSY = new System.Windows.Forms.Label();
-            this.label99 = new System.Windows.Forms.Label();
-            this.lblEDSW = new System.Windows.Forms.Label();
-            this.label101 = new System.Windows.Forms.Label();
-            this.lblEDSH = new System.Windows.Forms.Label();
+            this.button15 = new System.Windows.Forms.Button();
+            this.textBox3 = new System.Windows.Forms.TextBox();
+            this.textBox4 = new System.Windows.Forms.TextBox();
             this.panelControl.SuspendLayout();
             this.panelSEM.SuspendLayout();
             this.panelFIB.SuspendLayout();
@@ -3809,6 +3812,9 @@
             // 
             // tabPage5
             // 
+            this.tabPage5.Controls.Add(this.textBox4);
+            this.tabPage5.Controls.Add(this.textBox3);
+            this.tabPage5.Controls.Add(this.button15);
             this.tabPage5.Controls.Add(this.label93);
             this.tabPage5.Controls.Add(this.txtFocus);
             this.tabPage5.Controls.Add(this.button11);
@@ -4089,6 +4095,111 @@
             this.tabPage6.Text = "POST_EDS";
             this.tabPage6.UseVisualStyleBackColor = true;
             // 
+            // label101
+            // 
+            this.label101.AutoSize = true;
+            this.label101.Location = new System.Drawing.Point(558, 276);
+            this.label101.Name = "label101";
+            this.label101.Size = new System.Drawing.Size(23, 15);
+            this.label101.TabIndex = 66;
+            this.label101.Text = "H:";
+            // 
+            // lblEDSH
+            // 
+            this.lblEDSH.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+            this.lblEDSH.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.lblEDSH.Location = new System.Drawing.Point(605, 267);
+            this.lblEDSH.Name = "lblEDSH";
+            this.lblEDSH.Size = new System.Drawing.Size(112, 27);
+            this.lblEDSH.TabIndex = 65;
+            // 
+            // label99
+            // 
+            this.label99.AutoSize = true;
+            this.label99.Location = new System.Drawing.Point(558, 233);
+            this.label99.Name = "label99";
+            this.label99.Size = new System.Drawing.Size(23, 15);
+            this.label99.TabIndex = 64;
+            this.label99.Text = "W:";
+            // 
+            // lblEDSW
+            // 
+            this.lblEDSW.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+            this.lblEDSW.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.lblEDSW.Location = new System.Drawing.Point(605, 224);
+            this.lblEDSW.Name = "lblEDSW";
+            this.lblEDSW.Size = new System.Drawing.Size(112, 27);
+            this.lblEDSW.TabIndex = 63;
+            // 
+            // label97
+            // 
+            this.label97.AutoSize = true;
+            this.label97.Location = new System.Drawing.Point(558, 190);
+            this.label97.Name = "label97";
+            this.label97.Size = new System.Drawing.Size(23, 15);
+            this.label97.TabIndex = 62;
+            this.label97.Text = "Y:";
+            // 
+            // lblEDSY
+            // 
+            this.lblEDSY.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+            this.lblEDSY.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.lblEDSY.Location = new System.Drawing.Point(605, 181);
+            this.lblEDSY.Name = "lblEDSY";
+            this.lblEDSY.Size = new System.Drawing.Size(112, 27);
+            this.lblEDSY.TabIndex = 61;
+            // 
+            // label96
+            // 
+            this.label96.AutoSize = true;
+            this.label96.Location = new System.Drawing.Point(558, 147);
+            this.label96.Name = "label96";
+            this.label96.Size = new System.Drawing.Size(23, 15);
+            this.label96.TabIndex = 60;
+            this.label96.Text = "X:";
+            // 
+            // lblEDSX
+            // 
+            this.lblEDSX.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+            this.lblEDSX.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.lblEDSX.Location = new System.Drawing.Point(605, 138);
+            this.lblEDSX.Name = "lblEDSX";
+            this.lblEDSX.Size = new System.Drawing.Size(112, 27);
+            this.lblEDSX.TabIndex = 59;
+            // 
+            // button14
+            // 
+            this.button14.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.button14.Location = new System.Drawing.Point(549, 62);
+            this.button14.Margin = new System.Windows.Forms.Padding(3, 1, 3, 1);
+            this.button14.Name = "button14";
+            this.button14.Size = new System.Drawing.Size(223, 50);
+            this.button14.TabIndex = 58;
+            this.button14.Text = "获取EDS面数据";
+            this.button14.UseVisualStyleBackColor = true;
+            this.button14.Click += new System.EventHandler(this.button14_Click);
+            // 
+            // ltLines
+            // 
+            this.ltLines.FormattingEnabled = true;
+            this.ltLines.ItemHeight = 15;
+            this.ltLines.Location = new System.Drawing.Point(285, 147);
+            this.ltLines.Name = "ltLines";
+            this.ltLines.Size = new System.Drawing.Size(223, 379);
+            this.ltLines.TabIndex = 57;
+            // 
+            // button13
+            // 
+            this.button13.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.button13.Location = new System.Drawing.Point(285, 62);
+            this.button13.Margin = new System.Windows.Forms.Padding(3, 1, 3, 1);
+            this.button13.Name = "button13";
+            this.button13.Size = new System.Drawing.Size(223, 50);
+            this.button13.TabIndex = 56;
+            this.button13.Text = "获取EDS线数据";
+            this.button13.UseVisualStyleBackColor = true;
+            this.button13.Click += new System.EventHandler(this.button13_Click);
+            // 
             // label94
             // 
             this.label94.AutoSize = true;
@@ -4127,110 +4238,39 @@
             this.button12.UseVisualStyleBackColor = true;
             this.button12.Click += new System.EventHandler(this.button12_Click);
             // 
-            // button13
-            // 
-            this.button13.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button13.Location = new System.Drawing.Point(285, 62);
-            this.button13.Margin = new System.Windows.Forms.Padding(3, 1, 3, 1);
-            this.button13.Name = "button13";
-            this.button13.Size = new System.Drawing.Size(223, 50);
-            this.button13.TabIndex = 56;
-            this.button13.Text = "获取EDS线数据";
-            this.button13.UseVisualStyleBackColor = true;
-            this.button13.Click += new System.EventHandler(this.button13_Click);
-            // 
-            // ltLines
-            // 
-            this.ltLines.FormattingEnabled = true;
-            this.ltLines.ItemHeight = 15;
-            this.ltLines.Location = new System.Drawing.Point(285, 147);
-            this.ltLines.Name = "ltLines";
-            this.ltLines.Size = new System.Drawing.Size(223, 379);
-            this.ltLines.TabIndex = 57;
-            // 
-            // button14
-            // 
-            this.button14.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button14.Location = new System.Drawing.Point(549, 62);
-            this.button14.Margin = new System.Windows.Forms.Padding(3, 1, 3, 1);
-            this.button14.Name = "button14";
-            this.button14.Size = new System.Drawing.Size(223, 50);
-            this.button14.TabIndex = 58;
-            this.button14.Text = "获取EDS面数据";
-            this.button14.UseVisualStyleBackColor = true;
-            this.button14.Click += new System.EventHandler(this.button14_Click);
-            // 
-            // lblEDSX
-            // 
-            this.lblEDSX.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
-            this.lblEDSX.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.lblEDSX.Location = new System.Drawing.Point(605, 138);
-            this.lblEDSX.Name = "lblEDSX";
-            this.lblEDSX.Size = new System.Drawing.Size(112, 27);
-            this.lblEDSX.TabIndex = 59;
-            // 
-            // label96
-            // 
-            this.label96.AutoSize = true;
-            this.label96.Location = new System.Drawing.Point(558, 147);
-            this.label96.Name = "label96";
-            this.label96.Size = new System.Drawing.Size(23, 15);
-            this.label96.TabIndex = 60;
-            this.label96.Text = "X:";
-            // 
-            // label97
-            // 
-            this.label97.AutoSize = true;
-            this.label97.Location = new System.Drawing.Point(558, 190);
-            this.label97.Name = "label97";
-            this.label97.Size = new System.Drawing.Size(23, 15);
-            this.label97.TabIndex = 62;
-            this.label97.Text = "Y:";
-            // 
-            // lblEDSY
-            // 
-            this.lblEDSY.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
-            this.lblEDSY.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.lblEDSY.Location = new System.Drawing.Point(605, 181);
-            this.lblEDSY.Name = "lblEDSY";
-            this.lblEDSY.Size = new System.Drawing.Size(112, 27);
-            this.lblEDSY.TabIndex = 61;
-            // 
-            // label99
-            // 
-            this.label99.AutoSize = true;
-            this.label99.Location = new System.Drawing.Point(558, 233);
-            this.label99.Name = "label99";
-            this.label99.Size = new System.Drawing.Size(23, 15);
-            this.label99.TabIndex = 64;
-            this.label99.Text = "W:";
-            // 
-            // lblEDSW
-            // 
-            this.lblEDSW.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
-            this.lblEDSW.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.lblEDSW.Location = new System.Drawing.Point(605, 224);
-            this.lblEDSW.Name = "lblEDSW";
-            this.lblEDSW.Size = new System.Drawing.Size(112, 27);
-            this.lblEDSW.TabIndex = 63;
-            // 
-            // label101
-            // 
-            this.label101.AutoSize = true;
-            this.label101.Location = new System.Drawing.Point(558, 276);
-            this.label101.Name = "label101";
-            this.label101.Size = new System.Drawing.Size(23, 15);
-            this.label101.TabIndex = 66;
-            this.label101.Text = "H:";
-            // 
-            // lblEDSH
-            // 
-            this.lblEDSH.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
-            this.lblEDSH.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.lblEDSH.Location = new System.Drawing.Point(605, 267);
-            this.lblEDSH.Name = "lblEDSH";
-            this.lblEDSH.Size = new System.Drawing.Size(112, 27);
-            this.lblEDSH.TabIndex = 65;
+            // button15
+            // 
+            this.button15.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.button15.Location = new System.Drawing.Point(772, 315);
+            this.button15.Margin = new System.Windows.Forms.Padding(3, 1, 3, 1);
+            this.button15.Name = "button15";
+            this.button15.Size = new System.Drawing.Size(144, 41);
+            this.button15.TabIndex = 115;
+            this.button15.Text = "矩形框";
+            this.button15.UseVisualStyleBackColor = true;
+            this.button15.Click += new System.EventHandler(this.button15_Click);
+            // 
+            // textBox3
+            // 
+            this.textBox3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F);
+            this.textBox3.Location = new System.Drawing.Point(947, 319);
+            this.textBox3.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
+            this.textBox3.Name = "textBox3";
+            this.textBox3.Size = new System.Drawing.Size(100, 30);
+            this.textBox3.TabIndex = 116;
+            this.textBox3.Text = "500";
+            this.textBox3.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+            // 
+            // textBox4
+            // 
+            this.textBox4.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F);
+            this.textBox4.Location = new System.Drawing.Point(1102, 319);
+            this.textBox4.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
+            this.textBox4.Name = "textBox4";
+            this.textBox4.Size = new System.Drawing.Size(100, 30);
+            this.textBox4.TabIndex = 117;
+            this.textBox4.Text = "200";
+            this.textBox4.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
             // 
             // FormUnitControl
             // 
@@ -4605,6 +4645,9 @@
         private System.Windows.Forms.Label label96;
         private System.Windows.Forms.Label lblEDSX;
         private System.Windows.Forms.Button button14;
+        private System.Windows.Forms.TextBox textBox4;
+        private System.Windows.Forms.TextBox textBox3;
+        private System.Windows.Forms.Button button15;
     }
 }
 

+ 5 - 0
HOZProject/FormUnitControl.cs

@@ -2363,5 +2363,10 @@ namespace HOZProject
             lblEDSW.Text = w.ToString();
             lblEDSH.Text = h.ToString();
         }
+
+        private void button15_Click(object sender, EventArgs e)
+        {
+            iSEM.SetReduced(256, 192, Convert.ToInt32(textBox3.Text), Convert.ToInt32(textBox4.Text));
+        }
     }
 }

+ 6 - 1
HOZProject/UserControls/UControl_Init.cs

@@ -1137,7 +1137,12 @@ namespace HOZProject
 
             float.TryParse(config.AppSettings.Settings["ZDistance"].Value, out fResult);
             cfm.ZDistance = fResult;
-
+            //add by sun 2020-12-15 增加不同样品扫描速度参数,每大类样品3种扫描速度
+            //cfm.ScanSpeedNormal = ConfigurationManager.AppSettings["ScanSpeedNormal_"+cfm.SampleName].ToString();
+            //cfm.ScanSpeedFocus = ConfigurationManager.AppSettings["ScanSpeedFocus_" + cfm.SampleName].ToString();
+            //cfm.ScanSpeedHigh = ConfigurationManager.AppSettings["ScanSpeedHigh_" + cfm.SampleName].ToString();
+            LogManager.AddHardwareLog("==========参数测试==" + cfm.SampleName+"======="+ config.AppSettings.Settings["ScanSpeedNormal_0"].Value, true);
+            //add by sun 2020-12-15 增加不同样品扫描速度参数,每大类样品3种扫描速度 end
             return cfm;
         }
         #endregion

+ 272 - 66
MeasureThread/Measure.cs

@@ -584,7 +584,7 @@ namespace MeasureThread
 
             //设置扫描周期
             LogManager.AddHardwareLog("测量线程:设置图像扫描周期为对焦周期", true);
-            iSEM.CmdFocusRate(4);
+            iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedNormal);//CmdFocusRate(4);
             Thread.Sleep(200);
             cycle_time = iSEM.GetCycleTime();
             if (cycle_time == 0)
@@ -1141,13 +1141,30 @@ namespace MeasureThread
                 {
                     if(m_measureFile.MParam.FIBAutoBC)
                     {
-                        iSEM.SetAutoVideoBrightnessAndContrast();
-                        //20201128陈工建议增加
-                        Thread.Sleep(200);
-                        iSEM.SetAutoBright(100);
-                        Thread.Sleep(200);
-                        iSEM.SetAutoContrast(100);
-                        Thread.Sleep(5000);
+                        //add by sun 2020-12-17 解决3大类样品FIB下亮度过白导致无法识别问题
+                        float m_TempBrightness = 50.0f;
+                        float m_TempContrast = 30.0f;
+                        if (m_measureFile.MParam.SampleName == "3")
+                        {
+                            m_TempBrightness = 50.0f;
+                            m_TempContrast = 30.0f;
+                            iSEM.SetAutoVideoOff();
+                            Thread.Sleep(200);
+                            iSEM.SetBrightness(m_TempBrightness); //50.0f
+                            Thread.Sleep(200);
+                            iSEM.SetContrast(m_TempContrast); //30.0f
+                            Thread.Sleep(200);
+                        }
+                        else //add by sun 2020-12-17 解决3大类样品FIB下亮度过白导致无法识别问题  end
+                        {
+                            iSEM.SetAutoVideoBrightnessAndContrast();
+                            //20201128陈工建议增加
+                            Thread.Sleep(200);
+                            iSEM.SetAutoBright(100);
+                            Thread.Sleep(200);
+                            iSEM.SetAutoContrast(100);
+                            Thread.Sleep(5000);
+                        }      
                     }
                     else
                     {
@@ -1165,8 +1182,9 @@ namespace MeasureThread
                 //拍照前改变速度,延时
                 iSEM.CloseReduced();
                 Thread.Sleep(200);
-
-                iSEM.CmdSaveRate();
+                //add by sun 2020-12-15 增加不同样品扫描速度参数,每大类样品3种扫描速度
+                iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedHigh);//iSEM.CmdSaveRate();
+                //add by sun 2020 - 12 - 15 增加不同样品扫描速度参数,每大类样品3种扫描速度 end
                 Thread.Sleep(200);
                 cycle_time = iSEM.GetCycleTime();
                 Thread.Sleep(Convert.ToInt32(cycle_time) +100);
@@ -1182,7 +1200,7 @@ namespace MeasureThread
                 arg.Picture_Information.Picture_FullPath = fileName2;
                 arg.Message = "FIB拍照成功";
                 SendMsg("1-11");
-                iSEM.CmdFocusRate(4);
+                iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedNormal);//CmdFocusRate(4);
                 Thread.Sleep(200);
                 cycle_time = iSEM.GetCycleTime();
                 Thread.Sleep(Convert.ToInt32(cycle_time) +100);
@@ -1637,17 +1655,30 @@ namespace MeasureThread
             Thread.Sleep(200);
 
             //iSEM.SetAutoVideoBrightnessAndContrast();
+            //add by sun 2020-12-17 解决3大类样品FIB下亮度过白导致无法识别问题
+            float m_TempBrightness = 50.0f;
+            float m_TempContrast = 30.0f;
+            if (m_measureFile.MParam.SampleName == "3")
+            {
+                m_TempBrightness = 48.0f;
+                m_TempContrast = 29.0f;
+            }
+            //add by sun 2020-12-17 解决3大类样品FIB下亮度过白导致无法识别问题            
             iSEM.SetAutoVideoOff();
             Thread.Sleep(200);
-            iSEM.SetBrightness(50.0f);
+            iSEM.SetBrightness(m_TempBrightness); //50.0f
             Thread.Sleep(200);
-            iSEM.SetContrast(30.0f);
+            iSEM.SetContrast(m_TempContrast); //30.0f
+            Thread.Sleep(2000);
 
-            Thread.Sleep(5000);
             float mag = m_measureFile.MParam.Location_Magnification / 3;
             if (mag < 200)
             {
-                mag = 200;
+                //add by sun 2020-12-17 设置找梯形照片的放大倍数为400,原来设置成200容易识别错乱
+                if (m_measureFile.MParam.SampleName == "3")
+                    mag = 400;
+                else //add by sun 2020-12-17 设置找梯形照片的放大倍数为400,原来设置成200容易识别错乱
+                    mag = 200;
             }
             if (!iSEM.SetMagnification(mag))
             {
@@ -1690,7 +1721,9 @@ namespace MeasureThread
             Thread.Sleep(200);
 
             //拍照前改变速度,延时
-            iSEM.CmdSaveRate();
+            //add by sun 2020-12-15 增加不同样品扫描速度参数,每大类样品3种扫描速度
+            iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedHigh);//iSEM.CmdSaveRate();
+            //add by sun 2020 - 12 - 15 增加不同样品扫描速度参数,每大类样品3种扫描速度 end
             Thread.Sleep(200);
             cycle_time = iSEM.GetCycleTime();
             Thread.Sleep(Convert.ToInt32(cycle_time) +100);
@@ -1707,7 +1740,7 @@ namespace MeasureThread
             arg.State = true;
             arg.Message = "SEM拍照成功";
             SendMsg("1-25");
-            iSEM.CmdFocusRate(4);
+            iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedNormal);//CmdFocusRate(4);
             Thread.Sleep(200);
             cycle_time = iSEM.GetCycleTime();
             Thread.Sleep(Convert.ToInt32(cycle_time) +100);
@@ -1752,7 +1785,9 @@ namespace MeasureThread
                 //高倍到低倍不进行对焦
 
                 //拍照前改变速度,延时
-                iSEM.CmdSaveRate();
+                //add by sun 2020-12-15 增加不同样品扫描速度参数,每大类样品3种扫描速度
+                iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedHigh);//iSEM.CmdSaveRate();
+                //add by sun 2020 - 12 - 15 增加不同样品扫描速度参数,每大类样品3种扫描速度 end
                 Thread.Sleep(200);
                 cycle_time = iSEM.GetCycleTime();
                 Thread.Sleep(Convert.ToInt32(cycle_time) +100);
@@ -1767,8 +1802,8 @@ namespace MeasureThread
                     //return false;
                     LogManager.AddHardwareLog("测量线程报错:找到已切割的位置拍照失败", true);
                 }
-                
-                iSEM.CmdFocusRate(4);
+
+                iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedNormal);//CmdFocusRate(4);
                 Thread.Sleep(200);
                 cycle_time = iSEM.GetCycleTime();
                 Thread.Sleep(Convert.ToInt32(cycle_time) +100);
@@ -1825,6 +1860,7 @@ namespace MeasureThread
                 LogManager.AddHardwareLog("测量线程报错:" + arg.Message, false);
                 return false;
             }
+            //add
 #endregion
             Thread.Sleep(200);
 #region 设置拍照的放大倍数
@@ -1858,9 +1894,9 @@ namespace MeasureThread
                 LogManager.AddHardwareLog("停止键按下", true);
                 return false;
             }
-#endregion
+            #endregion
 
-#region 拍摄矩形的切割孔,使用拍照的放大倍数
+            #region 拍摄矩形的切割孔,使用拍照的放大倍数
             //if(!iSEM.SetAutoVideoBrightnessAndContrast())
             //{
             //    LogManager.AddHardwareLog("测量线程报错:自动开启亮度对比度失败", false);
@@ -1869,10 +1905,14 @@ namespace MeasureThread
             //Thread.Sleep(5000);
 
             //2.控制SEM自动对焦、亮度、对比度-接口
-            iSEM.SetReduced(402, 128, 340, 256);
+            //add by sun 2020-12-16 解决第5/6类样品 2000倍对焦不好问题
+            if ((m_measureFile.MParam.SampleName == "2")||(m_measureFile.MParam.SampleName == "3"))
+                iSEM.SetReduced(402, 128, 500, 500);
+            else  //add by sun 2020-12-16 解决第5/6类样品 2000倍对焦不好问题 end
+                iSEM.SetReduced(402, 128, 340, 256);
             Thread.Sleep(200);
             //add by sun 2020 - 12 - 15 拍截面图调用蔡司接口时,要保证扫描速度5以上,自动亮度对比度功能关闭
-            iSEM.CmdFocusRate(5);
+            iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedFocus);//CmdFocusRate(5);
             //add by sun 2020 - 12 - 15 拍截面图调用蔡司接口时,要保证扫描速度5以上,自动亮度对比度功能关闭 end
             Thread.Sleep(200);
             cycle_time = iSEM.GetCycleTime();
@@ -1913,11 +1953,25 @@ namespace MeasureThread
                 return false;
             }
 
+            //add by sun 2020-12-17 解决3大类样品FIB下亮度过白导致无法识别问题
+            float m_TempBrightness = 50.0f;
+            float m_TempContrast = 30.0f;
+            if (m_measureFile.MParam.SampleName == "3")
+            {
+                m_TempBrightness = 50f;
+                m_TempContrast = 29f;
+                iSEM.SetBrightness(m_TempBrightness); //50.0f
+                Thread.Sleep(200);
+                iSEM.SetContrast(m_TempContrast); //30.0f
+                Thread.Sleep(200);
+            }
+            //add by sun 2020-12-17 解决3大类样品FIB下亮度过白导致无法识别问题 end
+
             if (!iSEM.SetAutoVideoBrightnessAndContrast())
             {
                 LogManager.AddHardwareLog("测量线程报错:自动开启亮度对比度失败", false);
                 return false;
-            }
+            }            
             Thread.Sleep(5000);
 
             //3、设置SEM补偿角度
@@ -1955,7 +2009,9 @@ namespace MeasureThread
             arg.Picture_Information.Work_Distance = iSEM.GetWorkingDistance();
             Thread.Sleep(200);
             //拍照前改变速度,延时
-            iSEM.CmdSaveRate();
+            //add by sun 2020-12-15 增加不同样品扫描速度参数,每大类样品3种扫描速度
+            iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedHigh);//iSEM.CmdSaveRate();
+            //add by sun 2020 - 12 - 15 增加不同样品扫描速度参数,每大类样品3种扫描速度 end
             Thread.Sleep(200);
             cycle_time = iSEM.GetCycleTime();
             Thread.Sleep(Convert.ToInt32(cycle_time)*2);
@@ -1971,7 +2027,7 @@ namespace MeasureThread
             arg.State = true;
             arg.Message = "SEM拍照成功";
             SendMsg("1-30");
-            iSEM.CmdFocusRate(4);
+            iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedNormal);//CmdFocusRate(4);
             Thread.Sleep(200);
             cycle_time = iSEM.GetCycleTime();
             Thread.Sleep(Convert.ToInt32(cycle_time) +100);
@@ -2051,7 +2107,9 @@ namespace MeasureThread
                 arg.Picture_Information.Work_Distance = iSEM.GetWorkingDistance();
                 Thread.Sleep(200);
                 //拍照前改变速度,延时
-                iSEM.CmdSaveRate();
+                //add by sun 2020-12-15 增加不同样品扫描速度参数,每大类样品3种扫描速度
+                iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedHigh);//iSEM.CmdSaveRate();
+                //add by sun 2020 - 12 - 15 增加不同样品扫描速度参数,每大类样品3种扫描速度 end
                 Thread.Sleep(200);
                 cycle_time = iSEM.GetCycleTime();
                 Thread.Sleep(Convert.ToInt32(cycle_time) +100);
@@ -2067,7 +2125,7 @@ namespace MeasureThread
                 arg.State = true;
                 arg.Message = "SEM拍照成功";
                 SendMsg("1-33");
-                iSEM.CmdFocusRate(4);
+                iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedNormal);//CmdFocusRate(4);
                 Thread.Sleep(200);
                 cycle_time = iSEM.GetCycleTime();
                 Thread.Sleep(Convert.ToInt32(cycle_time) +100);
@@ -2092,11 +2150,11 @@ namespace MeasureThread
                     ",计算两个放大区域坐标,输入图像" + fileName6.ToString() +
                     "输入样品" + Convert.ToInt32(m_measureFile.MParam.SampleName) +
                     "输入产品" + m_measureFile.MParam.Firm.ToString()
-                    + "输出中心点1(x,y)为(" + ct[0].X.ToString() + "," + ct[0].Y.ToString() + ")"
-                    + "输出放大倍数1" + mag[0]
-                    + "输出中心点2(x,y)为(" + ct[1].X.ToString() + "," + ct[1].Y.ToString() + ")"
-                    + "输出放大倍数2" + mag[0]
-                    + "输出中心点3(x,y)为(" + ct0.X.ToString() + "," + ct0.Y.ToString() + ")", true);
+                    + "输出中心点1为(" + ct[0].X.ToString() + "," + ct[0].Y.ToString() + ")"
+                    + "输出放大倍数1==" + mag[0]
+                    + "倍,输出中心点2为(" + ct[1].X.ToString() + "," + ct[1].Y.ToString() + ")"
+                    + "输出放大倍数2==" + mag[0]
+                    + "倍,输出中心点3为(" + ct0.X.ToString() + "," + ct0.Y.ToString() + ")", true);
                 #endregion
                 if (state == 1 && ct.Count != 0 && mag.Count != 0)
                 {
@@ -2139,18 +2197,38 @@ namespace MeasureThread
                     //关闭自动亮度对比度
                     iSEM.SetAutoVideoOff();
                     Thread.Sleep(2000);
-
-                    iSEM.SetReduced(402, 128, 340, 256);
+                    //add by sun 2020-12-17 解决3大类样品FIB下亮度过白导致无法识别问题
+                   
+                    if (m_measureFile.MParam.SampleName == "3")
+                    {
+                        m_TempBrightness = 50f;
+                        m_TempContrast = 29f;
+                        iSEM.SetBrightness(m_TempBrightness); //50.0f
+                        Thread.Sleep(200);
+                        iSEM.SetContrast(m_TempContrast); //30.0f
+                        Thread.Sleep(200);
+                    }
+                    //add by sun 2020-12-17 解决3大类样品FIB下亮度过白导致无法识别问题 end
+                    //add by sun 2020-12-16 解决第5/6类样品 6000倍对焦不好问题
+                    if ( m_measureFile.MParam.SampleName == "3")
+                    {
+                        iSEM.SetReduced(402, 128, 500, 500);
+                    }else
+                    {
+                        iSEM.SetReduced(402, 128, 340, 256);
+                    }
+                        
+                        
                     Thread.Sleep(200);
                     //add by sun 2020-12-15 拍截面图调用蔡司接口时,要保证扫描速度5以上,自动亮度对比度功能关闭
-                    iSEM.CmdFocusRate(5);
+                    iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedFocus);//CmdFocusRate(5);
                     //add by sun 2020-12-15 拍截面图调用蔡司接口时,要保证扫描速度5以上,自动亮度对比度功能关闭 end
                     Thread.Sleep(200);
                     cycle_time = iSEM.GetCycleTime();
                     Thread.Sleep(100 + Convert.ToInt32(cycle_time));
 
 
-                    //放大到10000倍
+                    //放大到6000倍
                     iSEM.SetMagnification(magMax / 2);
                     Thread.Sleep(100 + Convert.ToInt32(cycle_time));
 
@@ -2224,7 +2302,7 @@ namespace MeasureThread
                     //{
                     //    return false;
                     //}                   
-
+                   
                     iSEM.CloseReduced();
                     Thread.Sleep(200);
                     cycle_time = iSEM.GetCycleTime();
@@ -2380,6 +2458,13 @@ namespace MeasureThread
                         }
                         #endregion
 
+                        //add by sun 2020-12-17 根据客户要求,3大类样品需要在5000倍下在拍摄一张图片,不需要分析
+                        if((m_measureFile.MParam.SampleName=="3")&&(n==0))
+                        { 
+                            if (!GetImageFromSEM(mag[n]/2))
+                                LogManager.AddHardwareLog("测量线程报错:第一个区域放大一半倍数" + (mag[n]/2).ToString() + "控制失败", true);
+                        }
+                        //add by sun 2020-12-17 根据客户要求,3大类样品需要在5000倍下在拍摄一张图片,不需要分析 end
                         #region 拍照
                         if (!iSEM.SetMagnification(mag[n]))
                         {
@@ -2436,7 +2521,7 @@ namespace MeasureThread
                         arg.State = true;
                         arg.Message = "移动到第一个点位置拍照成功";
                         SendMsg("1-35");
-                        iSEM.CmdFocusRate(4);
+                        iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedNormal);//CmdFocusRate(4);
                         Thread.Sleep(200);
                         cycle_time = iSEM.GetCycleTime();
                         Thread.Sleep(Convert.ToInt32(cycle_time) + 100);
@@ -2503,6 +2588,15 @@ namespace MeasureThread
         //第一个孔的测试过程
         public bool FirstHole()
         {
+            //add by sun 2020-12-17 不同样品电压、电流不一致,应设置灵活。123456类电压2000V电流200pA,7类5000V 500pA,能谱 7000V 500pA 
+            LogManager.AddHardwareLog("测量线程:第一孔=====设置拍照电压 123456类电压2000V电流200pA,7类5000V 500pA,能谱 7000V 500pA  目前是第 " + m_measureFile.MParam.SampleName + " 类!", true);
+            if (!SetVoltageAndIPROBE())
+            {
+                LogManager.AddHardwareLog("测量线程:第一孔=====设置电压电流失败!目前是第 " + m_measureFile.MParam.SampleName + " 类!", true);
+                return false;
+            }
+            //add by sun 2020-12-17 不同样品电压、电流不一致,应设置灵活。123456类电压2000V电流200pA,7类5000V 500pA,能谱 7000V 500pA end
+
             //设置拉直的放大倍数
             LogManager.AddHardwareLog("测量线程:第一个孔的测试过程-设置SEM放大倍数为拉直放大倍数,放大倍数为" + m_measureFile.MParam.Stretch_Magnification.ToString(), true);
 
@@ -2550,7 +2644,7 @@ namespace MeasureThread
                 }
             }
 
-            // by sun:2是5/6类样品,不需要拉直
+            // 2是5/6类样品,不需要拉直
             if (m_measureFile.MParam.SampleName != "2")
             {
                 LogManager.AddHardwareLog("测量线程:第一个孔的测试过程-拉直操作开始!", true);
@@ -2609,7 +2703,7 @@ namespace MeasureThread
             //        return false;
             //    }
             //    LogManager.AddHardwareLog("测量线程:第一个孔的测试过程-14.自动控制FIB切割结束!", true);
-            //}            
+            //}
             //del by sun 2020-12-15 temp end
             //判断是否停止进程
             if (key_stop)
@@ -2689,6 +2783,14 @@ namespace MeasureThread
         //非第一个孔的测试过程
         public bool OtherHole()
         {
+            //add by sun 2020-12-17 不同样品电压、电流不一致,应设置灵活。123456类电压2000V电流200pA,7类5000V 500pA,能谱 7000V 500pA 
+            LogManager.AddHardwareLog("测量线程:非第一孔==设置拍照电压 123456类电压2000V电流200pA,7类5000V 500pA,能谱 7000V 500pA  目前是第 " + m_measureFile.MParam.SampleName + " 类!", true);
+            if (!SetVoltageAndIPROBE())
+            {
+                LogManager.AddHardwareLog("测量线程:非第一孔==设置电压电流失败!目前是第 " + m_measureFile.MParam.SampleName + " 类!", true);
+                return false;
+            }
+            //add by sun 2020-12-17 不同样品电压、电流不一致,应设置灵活。123456类电压2000V电流200pA,7类5000V 500pA,能谱 7000V 500pA end
             //设置拉直的放大倍数
             if (!iSEM.SetMagnification(m_measureFile.MParam.Stretch_Magnification))
             {
@@ -3045,17 +3147,26 @@ namespace MeasureThread
             iSEM.SetReduced(402, 128, 340, 256);
             Thread.Sleep(200);
             //add by sun 2020-12-15
-            iSEM.CmdFocusRate(5);
+            iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedFocus);//CmdFocusRate(5);
             //add by sun 2020-12-15 end
             Thread.Sleep(200);
             cycle_time = iSEM.GetCycleTime();
             Thread.Sleep(100 + Convert.ToInt32(cycle_time));
 
+            //add by sun 2020-12-17 解决3大类样品FIB下亮度过白导致无法识别问题
+            float m_TempBrightness = 50.0f;
+            float m_TempContrast = 30.0f;
+            if (m_measureFile.MParam.SampleName == "3")
+            {
+                m_TempBrightness = 48.0f;
+                m_TempContrast = 29.0f;
+            }
+            //add by sun 2020-12-17 解决3大类样品FIB下亮度过白导致无法识别问题    
             iSEM.SetAutoVideoOff();
             Thread.Sleep(200);
-            iSEM.SetBrightness(50.0f);
+            iSEM.SetBrightness(m_TempBrightness);//50.0f
             Thread.Sleep(200);
-            iSEM.SetContrast(30.0f);
+            iSEM.SetContrast(m_TempContrast);//30.0f
             Thread.Sleep(200);
 
             if (!ImageFocus1(false))
@@ -3091,7 +3202,9 @@ namespace MeasureThread
             String fileName0 = data_path + "\\" + m_cutHoles[m_nWorkHoleNo].HoleName + "_" + m_measureFile.MParam.Stretch_Magnification.ToString("0") + "_" + ImageName0;
             LogManager.AddHardwareLog("测量线程:设置保存图像的是扫描速度保存图像" + fileName0, true);
             //拍照前改变速度,延时
-            iSEM.CmdSaveRate();
+            //add by sun 2020-12-15 增加不同样品扫描速度参数,每大类样品3种扫描速度
+            iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedHigh);//iSEM.CmdSaveRate();//
+            //add by sun 2020 - 12 - 15 增加不同样品扫描速度参数,每大类样品3种扫描速度 end
             Thread.Sleep(200);
             cycle_time = iSEM.GetCycleTime();
             Thread.Sleep(Convert.ToInt32(cycle_time) +100);
@@ -3107,7 +3220,7 @@ namespace MeasureThread
             arg.Picture_Information.Picture_FullPath = fileName0;
             arg.State = true;
             SendMsg("1-4");
-            iSEM.CmdFocusRate(4);
+            iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedNormal);//CmdFocusRate(4);
             Thread.Sleep(200);
             cycle_time = iSEM.GetCycleTime();
             Thread.Sleep(Convert.ToInt32(cycle_time) +100);
@@ -3238,6 +3351,7 @@ namespace MeasureThread
         //拍图
         public bool GetImage(String a_fileName)
         {
+            LogManager.AddHardwareLog("获取分辨率开始!", true);
             //3. 获取分辨率
             int[] ImageSize = iSEM.GetImageStore();
             if (ImageSize[0] == 0 || ImageSize[1] == 0)
@@ -3246,10 +3360,11 @@ namespace MeasureThread
             }
             short width = (short)ImageSize[0];
             short height = (short)ImageSize[1];
-
+            LogManager.AddHardwareLog("获取分辨率结束!"+ a_fileName +"===="+ width+ "*"+height, true);
             //4. 抓图
             if (!iSEM.GrabImage(a_fileName, 0, 0, width, height, 0))
             {
+                LogManager.AddHardwareLog("抓图失败!", true);
                 return false;
             }
 
@@ -3415,6 +3530,7 @@ namespace MeasureThread
                     string focusstig = XmlRpcClient.autofocusstig(10, 3, 3, 3, 0.7, snumstr);
                     if (focusstig != "success")
                     {
+                        LogManager.AddHardwareLog("对焦失败" + focusstig , true);
                         return false;
                     }
                 }
@@ -5758,12 +5874,22 @@ namespace MeasureThread
             float x2 = 0, y2 = 0;
             int state = 0;
 
+            //add by sun 2020-12-17 解决3大类样品FIB下亮度过白导致无法识别问题
+            float m_TempBrightness = 50.0f;
+            float m_TempContrast = 30.0f;
+            if (m_measureFile.MParam.SampleName == "3")
+            {
+                m_TempBrightness = 48.0f;
+                m_TempContrast = 29.0f;
+            }
+            //add by sun 2020-12-17 解决3大类样品FIB下亮度过白导致无法识别问题    
             iSEM.SetAutoVideoOff();
             Thread.Sleep(200);
-            iSEM.SetBrightness(50.0f);
+            iSEM.SetBrightness(m_TempBrightness);//50.0f
             Thread.Sleep(200);
-            iSEM.SetContrast(30.0f);
-
+            iSEM.SetContrast(m_TempContrast);//30.0f
+            Thread.Sleep(200);
+            
             //1.控制SEM放大到300倍
             float mag = m_measureFile.MParam.Photograph_Magnification / 3;
             if (mag < 200)
@@ -5808,7 +5934,9 @@ namespace MeasureThread
             Thread.Sleep(200);
 
             //拍照前改变速度,延时
-            iSEM.CmdSaveRate();
+            //add by sun 2020-12-15 增加不同样品扫描速度参数,每大类样品3种扫描速度
+            iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedHigh);//iSEM.CmdSaveRate();
+            //add by sun 2020 - 12 - 15 增加不同样品扫描速度参数,每大类样品3种扫描速度 end
             Thread.Sleep(200);
             cycle_time = iSEM.GetCycleTime();
             Thread.Sleep(Convert.ToInt32(cycle_time) + 100);
@@ -5825,7 +5953,7 @@ namespace MeasureThread
             //arg.State = true;
             //arg.Message = "SEM拍照成功";
             //SendMsg("1-25");
-            iSEM.CmdFocusRate(4);
+            iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedNormal);//CmdFocusRate(4);
             Thread.Sleep(200);
             cycle_time = iSEM.GetCycleTime();
             Thread.Sleep(Convert.ToInt32(cycle_time) + 100);
@@ -5869,7 +5997,9 @@ namespace MeasureThread
                 //高倍到低倍不进行对焦
 
                 //拍照前改变速度,延时
-                iSEM.CmdSaveRate();
+                //add by sun 2020-12-15 增加不同样品扫描速度参数,每大类样品3种扫描速度
+                iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedHigh);//iSEM.CmdSaveRate();
+                //add by sun 2020 - 12 - 15 增加不同样品扫描速度参数,每大类样品3种扫描速度 end
                 Thread.Sleep(200);
                 cycle_time = iSEM.GetCycleTime();
                 Thread.Sleep(Convert.ToInt32(cycle_time) + 100);
@@ -5954,7 +6084,7 @@ namespace MeasureThread
             iSEM.SetReduced(402, 128, 340, 256);
             Thread.Sleep(200);
             //add by sun 2020-12-15
-            iSEM.CmdFocusRate(5);
+            iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedFocus);//iSEM.CmdFocusRate(5);//
             //add by sun 2020-12-15 end
             Thread.Sleep(200);
             cycle_time = iSEM.GetCycleTime();
@@ -6035,7 +6165,9 @@ namespace MeasureThread
             arg.Picture_Information.Work_Distance = iSEM.GetWorkingDistance();
             Thread.Sleep(200);
             //拍照前改变速度,延时
-            iSEM.CmdSaveRate();
+            //add by sun 2020-12-15 增加不同样品扫描速度参数,每大类样品3种扫描速度
+            iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedHigh);//iSEM.CmdSaveRate();
+            //add by sun 2020 - 12 - 15 增加不同样品扫描速度参数,每大类样品3种扫描速度 end
             Thread.Sleep(200);
             cycle_time = iSEM.GetCycleTime();
             Thread.Sleep(Convert.ToInt32(cycle_time) * 2);
@@ -6050,7 +6182,7 @@ namespace MeasureThread
             //arg.State = true;
             //arg.Message = "SEM拍照成功";
             //SendMsg("1-30");
-            iSEM.CmdFocusRate(4);
+            iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedNormal);//CmdFocusRate(4);
             Thread.Sleep(200);
             cycle_time = iSEM.GetCycleTime();
             Thread.Sleep(Convert.ToInt32(cycle_time) + 100);
@@ -6130,7 +6262,9 @@ namespace MeasureThread
                 arg.Picture_Information.Work_Distance = iSEM.GetWorkingDistance();
                 Thread.Sleep(200);
                 //拍照前改变速度,延时
-                iSEM.CmdSaveRate();
+                //add by sun 2020-12-15 增加不同样品扫描速度参数,每大类样品3种扫描速度
+                iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedHigh);//iSEM.CmdSaveRate();
+                //add by sun 2020 - 12 - 15 增加不同样品扫描速度参数,每大类样品3种扫描速度 end
                 Thread.Sleep(200);
                 cycle_time = iSEM.GetCycleTime();
                 Thread.Sleep(Convert.ToInt32(cycle_time) + 100);
@@ -6146,7 +6280,7 @@ namespace MeasureThread
                 //arg.State = true;
                 //arg.Message = "SEM拍照成功";
                 //SendMsg("1-33");
-                iSEM.CmdFocusRate(4);
+                iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedNormal);//CmdFocusRate(4);
                 Thread.Sleep(200);
                 cycle_time = iSEM.GetCycleTime();
                 Thread.Sleep(Convert.ToInt32(cycle_time) + 100);
@@ -6222,7 +6356,7 @@ namespace MeasureThread
                     iSEM.SetReduced(402, 128, 340, 256);
                     Thread.Sleep(200);
                     //add by sun 2020-12-15
-                    iSEM.CmdFocusRate(5);
+                    iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedFocus);//CmdFocusRate(5);
                     //add by sun 2020-12-15 end
                     Thread.Sleep(200);
                     cycle_time = iSEM.GetCycleTime();
@@ -6474,11 +6608,15 @@ namespace MeasureThread
                 LogManager.AddHardwareLog("Z轴位置设置超出范围.", true);
             }
             LogManager.AddHardwareLog("将Z轴位置指定到:" + m_measureFile.MParam.EDSZ.ToString(), true);
-            if (!iSEM.SetStageGotoZ(m_measureFile.MParam.EDSZ))
-            {
-                LogManager.AddHardwareLog("测量线程报错:样品台Z回到安全位置失败", false);
-                return false;
-            }
+            //if (!iSEM.SetStageGotoZ(m_measureFile.MParam.EDSZ))
+            //{
+            //    LogManager.AddHardwareLog("测量线程报错:样品台Z回到安全位置失败", false);
+            //    return false;
+            //}
+            //设置WD  add by sun 2020-12-16 能谱设置工作距离为10mm
+            iSEM.SetWorkingDistance(m_measureFile.MParam.EDSZ);
+            Thread.Sleep(1000);
+
             while (true)
             {
                 Thread.Sleep(4000);
@@ -6520,7 +6658,7 @@ namespace MeasureThread
             iSEM.SetReduced(256, 192, 512, 512);
             Thread.Sleep(200);
             //add by sun 2020-12-15
-            iSEM.CmdFocusRate(5);
+            iSEM.CmdFocusScanSpeed(m_measureFile.MParam.ScanSpeedFocus);//CmdFocusRate(5);
             //add by sun 2020-12-15 end
             Thread.Sleep(200);
             cycle_time = iSEM.GetCycleTime();
@@ -6564,6 +6702,74 @@ namespace MeasureThread
             iSEM.SetBeamShiftY(0);
             Thread.Sleep(200);
         }
+
+
+        //add by sun 2020-12-17 不同样品电压、电流不一致,应设置灵活。123456类电压2000V电流200pA,7类5000V 500pA,能谱 7000V 500pA
+        #region 设置电压电流
+        public bool SetVoltageAndIPROBE()
+        {            
+            LogManager.AddHardwareLog("测量线程:设置电压电流 123456类电压2000V电流200pA,7类5000V 500pA,能谱 7000V 500pA  目前是第 " + m_measureFile.MParam.SampleName + " 类!", true);
+            //这块应该做成参数!!! 暂时写死。类型3 则为 5000V 500pA
+            bool mRet_VoltageFlag = false;
+            bool mRet_ElecFlag = false;
+            if (m_measureFile.MParam.SampleName != "3")
+            {
+                mRet_VoltageFlag = iSEM.SetSEMVoltage(2000);
+                Thread.Sleep(500);
+                mRet_ElecFlag = iSEM.SetSEMIPROBE(0.2F / 1000000000);
+                Thread.Sleep(500);
+            }
+            else
+            {
+                mRet_VoltageFlag = iSEM.SetSEMVoltage(5000);
+                Thread.Sleep(500);
+                mRet_ElecFlag = iSEM.SetSEMIPROBE(0.5F / 1000000000);
+                Thread.Sleep(500);
+            }
+            if (!mRet_VoltageFlag) return false;
+            if (!mRet_ElecFlag) return false;
+            LogManager.AddHardwareLog("测量线程:设置电压电流完成!" , true);
+            return true;
+        }
+        #endregion
+        //add by sun 2020-12-17 不同样品电压、电流不一致,应设置灵活。123456类电压2000V电流200pA,7类5000V 500pA,能谱 7000V 500pA end
+
+        //add by sun 2020-12-17 根据客户要求,3大类样品需要在5000倍下在拍摄一张图片,不需要分析
+        #region 拍照
+        public bool GetImageFromSEM(float m_Mag) { 
+        
+            if (!iSEM.SetMagnification(m_Mag))
+            {
+                LogManager.AddHardwareLog("测量线程报错:第一个区域放大倍数" + m_Mag.ToString() + "失败", false);
+                return false;
+            }
+            LogManager.AddHardwareLog("========测量线程:移动到第一个点位置拍照完成(一半倍数)!", true);
+            Thread.Sleep(100 + Convert.ToInt32(cycle_time));
+
+            String m_FileName = data_path + "\\" + m_cutHoles[m_nWorkHoleNo].HoleName + "_" + m_Mag.ToString() + "_0_" + ImageNameTwo_1;
+            //arg.Picture_Information.Picture_FullPath = m_FileName;
+            //arg.Picture_Information.Work_Status = "SEM";
+            //arg.Picture_Information.Work_Voltage = iSEM.GetSEMVoltage();
+            //Thread.Sleep(200);
+            //arg.Picture_Information.Magnification = iSEM.GetMagnification();
+            //Thread.Sleep(200);
+            //arg.Picture_Information.Work_Distance = iSEM.GetWorkingDistance();
+            //Thread.Sleep(200);
+            //拍照前改变速度,延时
+            iSEM.CmdLineScan();
+            Thread.Sleep(200);
+            cycle_time = iSEM.GetCycleTime();
+            Thread.Sleep(Convert.ToInt32(cycle_time) + 100);
+            if (!GetImage(m_FileName))
+            {
+                LogManager.AddHardwareLog("测量线程报错:========" + arg.Message, false);
+                return false;
+            }
+            LogManager.AddHardwareLog("========测量线程:移动到第一个点位置完成!", true);
+            return true;
+        }
+        #endregion
+        //add by sun 2020-12-17 根据客户要求,3大类样品需要在5000倍下在拍摄一张图片,不需要分析 end
         #endregion
     }
 }

+ 13 - 0
OxfordTest/Form1.Designer.cs

@@ -155,6 +155,7 @@
             this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
             this.button26 = new System.Windows.Forms.Button();
             this.button25 = new System.Windows.Forms.Button();
+            this.button27 = new System.Windows.Forms.Button();
             this.groupBox1.SuspendLayout();
             this.拍图.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pBImage)).BeginInit();
@@ -878,6 +879,7 @@
             // 
             // groupBox1
             // 
+            this.groupBox1.Controls.Add(this.button27);
             this.groupBox1.Controls.Add(this.btnCreateDB);
             this.groupBox1.Controls.Add(this.button2);
             this.groupBox1.Controls.Add(this.button23);
@@ -1472,6 +1474,16 @@
             this.button25.UseVisualStyleBackColor = true;
             this.button25.Click += new System.EventHandler(this.button25_Click);
             // 
+            // button27
+            // 
+            this.button27.Location = new System.Drawing.Point(143, -1);
+            this.button27.Name = "button27";
+            this.button27.Size = new System.Drawing.Size(137, 24);
+            this.button27.TabIndex = 79;
+            this.button27.Text = "连接能谱";
+            this.button27.UseVisualStyleBackColor = true;
+            this.button27.Click += new System.EventHandler(this.button27_Click);
+            // 
             // Form1
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
@@ -1622,6 +1634,7 @@
         private System.Windows.Forms.TextBox txtpy1;
         private System.Windows.Forms.TextBox txtpx1;
         private System.Windows.Forms.Label label32;
+        private System.Windows.Forms.Button button27;
     }
 }
 

+ 20 - 2
OxfordTest/Form1.cs

@@ -20,11 +20,12 @@ namespace OxfordTest
 
         //全局只有一个fatorySEM
         static ExtenderInterface factoryExtender = ExtenderInterface.Instance;
-        IExtenderControl iExtender = factoryExtender.IExtender;
-
+        //IExtenderControl iExtender = factoryExtender.IExtender;
+        IExtenderControl iExtender ;
         public Form1()
         {
             InitializeComponent();
+           
         }
 
         //获取电压
@@ -550,6 +551,23 @@ namespace OxfordTest
             pname.Add("aaaa");
             pname.Add("bbbb");
             pname.Add("cccc");
+
+           
+        }
+
+        private void button27_Click(object sender, EventArgs e)
+        {
+            try
+            {
+                IExtenderControl iExtender = factoryExtender.IExtender;
+                MessageBox.Show("连接能谱成功");
+            }
+            catch (Exception x)
+            {
+                MessageBox.Show("oxford 初始化失败" + x.Message);
+                
+            }
+           
         }
     }
 }

+ 1 - 0
SmartSEMControl/HardwareInterface.cs

@@ -220,6 +220,7 @@ namespace SmartSEMControl
         Boolean CmdFIBSTARTELY();
         //add by sun 2020-12-15 拍截面图调用蔡司接口时,要保证扫描速度5以上,自动亮度对比度功能关闭
         Boolean CmdFocusRate(int mFocusSpeed);
+        Boolean CmdFocusScanSpeed(String mFocusSpeed);
         //add by sun 2020-12-15 拍截面图调用蔡司接口时,要保证扫描速度5以上,自动亮度对比度功能关闭 end
         Boolean CmdSaveRate();
         Boolean CmdSaveBestRate();

+ 7 - 0
SmartSEMControl/SmartSEM.cs

@@ -2372,6 +2372,13 @@ namespace SmartSEMControl
             LogManager.AddHardwareLog("调整扫描速度为====="+ mTempSpeed + "===是否成功"+ ret, true);  //CMD_SCANRATE4!
             return ret;
         }
+
+        public Boolean CmdFocusScanSpeed(String mFocusSpeed)  
+        {
+            Boolean ret = ExecuteCmd(mFocusSpeed);
+            LogManager.AddHardwareLog("调整扫描速度为CmdFocusScanSpeed=====" + mFocusSpeed + "===是否成功?" + ret, true);
+            return ret;
+        }
         #endregion add by sun 2020-12-15 拍截面图调用蔡司接口时,要保证扫描速度5以上,自动亮度对比度功能关闭 end