浏览代码

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

wb_han 5 年之前
父节点
当前提交
b9ffd21ced

+ 11 - 0
FileManager/LogManager.cs

@@ -50,6 +50,17 @@ namespace FileManager
         {
             CreateFile(xmlFilePath);
         }
+
+        /// <summary>
+        /// 初始化记录硬件操作日志文件,默认创建日志文件
+        /// </summary>
+        public static void InitManulLog()
+        {
+            //硬件日志名称
+            logName = DateTime.Now.ToString("yyyyMMddHHmmss") + "ManulLog.txt";
+            CreateHardwareFile(logName);
+        }
+
         /// <summary>
         /// 初始化记录硬件操作日志文件,默认创建日志文件
         /// </summary>

+ 7 - 0
HOZ.sln

@@ -25,6 +25,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MeasureData", "MeasureData\
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebManager", "WebManager\WebManager.csproj", "{00319B6F-FAD0-46B5-B76B-7164DC5CA0D5}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ManulDo", "ManulDo\ManulDo.csproj", "{513BBFDA-D2A1-4D4F-ADD0-01A19485533A}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -63,6 +65,10 @@ Global
 		{00319B6F-FAD0-46B5-B76B-7164DC5CA0D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{00319B6F-FAD0-46B5-B76B-7164DC5CA0D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{00319B6F-FAD0-46B5-B76B-7164DC5CA0D5}.Release|Any CPU.Build.0 = Release|Any CPU
+		{513BBFDA-D2A1-4D4F-ADD0-01A19485533A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{513BBFDA-D2A1-4D4F-ADD0-01A19485533A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{513BBFDA-D2A1-4D4F-ADD0-01A19485533A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{513BBFDA-D2A1-4D4F-ADD0-01A19485533A}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -76,6 +82,7 @@ Global
 		{5674DD32-3A9F-4D74-B177-A693A75A0255} = {371F2331-83C6-41DB-8D59-9232ECB09801}
 		{12617585-8D9A-4AD4-B6C4-6894A48CEE9E} = {371F2331-83C6-41DB-8D59-9232ECB09801}
 		{00319B6F-FAD0-46B5-B76B-7164DC5CA0D5} = {371F2331-83C6-41DB-8D59-9232ECB09801}
+		{513BBFDA-D2A1-4D4F-ADD0-01A19485533A} = {682CF60F-46F7-451A-9887-91C2DCB80B10}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {F291AB01-6941-478D-BA98-1C371698FFAD}

文件差异内容过多而无法显示
+ 507 - 409
HOZProject/FormUnitControl.Designer.cs


+ 87 - 116
HOZProject/FormUnitControl.cs

@@ -33,11 +33,11 @@ namespace HOZProject
 
         public XmlManager xmg = new XmlManager();
 
-
+        
         private String path = Directory.GetCurrentDirectory();
         private int st_flag = 0;
 
-        WebResult wr = new WebResult("127.0.0.1", "18080", "Huawei/WebServerTest");
+        WebResult wr = new WebResult("127.0.0.1", "18080");
         #endregion
 
         #region 构造函数
@@ -47,19 +47,19 @@ namespace HOZProject
 
             Control.CheckForIllegalCrossThreadCalls = false;
 
-            if (iSEM.ConnectStatus())
+            if(iSEM.ConnectStatus())
             {
                 float ret = iSEM.GetFIBIMAGING();
-                if (ret == 0)
+                if(ret==0)
                 {
                     btnSEM.BackColor = Color.Lime;
                 }
-                else if (ret == 1)
+                else if(ret==1)
                 {
                     btnFIB.BackColor = Color.Lime;
                     panelFIB.Visible = true;
                 }
-                else if (ret == 2)
+                else if(ret==2)
                 {
                     btnMILL.BackColor = Color.Lime;
                 }
@@ -71,7 +71,7 @@ namespace HOZProject
 
         }
         #endregion
-
+        
         #region 缩放Get
         private void btnenlargeGet_Click(object sender, EventArgs e)
         {
@@ -143,7 +143,7 @@ namespace HOZProject
                 btnBrightnessSet.Enabled = false;
             }
             else
-            {
+            { 
                 txtBrightnessSet.Text = ret.ToString();
                 btnBrightnessSet.Enabled = true;
             }
@@ -273,6 +273,7 @@ namespace HOZProject
             float set = 0;
             if (float.TryParse(txtTiltAngleSet.Text, out set))
             {
+                //iSEM.SetTiltAngleOn();
                 iSEM.SetTiltAngle(set);
             }
         }
@@ -317,7 +318,7 @@ namespace HOZProject
             float set = 0;
             if (float.TryParse(txtScanRotationSet.Text, out set))
             {
-
+                //iSEM.SetScanRotationOn();
                 iSEM.SetScanRotation(set);
             }
         }
@@ -414,7 +415,7 @@ namespace HOZProject
             }
             else
             {
-                if (ret == 0)
+                if(ret==0)
                 {
                     btnTiltCorr.BackColor = Color.Blue;
                     iSEM.SetTiltCorrectionOn();
@@ -600,7 +601,7 @@ namespace HOZProject
         #region 窗体关闭
         private void FormUnitControl_FormClosing(object sender, FormClosingEventArgs e)
         {
-            if (iSEM != null)
+            if(iSEM!=null)
             {
                 iSEM.Dispose();
             }
@@ -700,20 +701,20 @@ namespace HOZProject
         #region SEM模式
         private void btnSEM_Click(object sender, EventArgs e)
         {
-            if (iSEM.CmdFIBModeSEM())
+            if(iSEM.CmdFIBModeSEM())
             {
                 btnFIB.BackColor = SystemColors.Control;
                 btnSEM.BackColor = Color.Lime;
                 btnMILL.BackColor = SystemColors.Control;
                 panelFIB.Visible = false;
-            }
+            } 
         }
         #endregion
 
         #region FIB模式
         private void btnFIB_Click(object sender, EventArgs e)
         {
-            if (iSEM.CmdFIBModeFIB())
+            if(iSEM.CmdFIBModeFIB())
             {
                 btnFIB.BackColor = Color.Lime;
                 btnSEM.BackColor = SystemColors.Control;
@@ -726,7 +727,7 @@ namespace HOZProject
         #region MILL模式
         private void btnMILL_Click(object sender, EventArgs e)
         {
-            if (iSEM.CmdFIBModeMILL())
+            if(iSEM.CmdFIBModeMILL())
             {
                 btnFIB.BackColor = SystemColors.Control;
                 btnSEM.BackColor = SystemColors.Control;
@@ -762,11 +763,11 @@ namespace HOZProject
         {
             float ret = 111;
             Boolean state = false;
-            while (true)
+            while(true)
             {
                 Thread.Sleep(1000);
                 ret = iSEM.GetAutoFunction();
-                if (ret == 0)
+                if(ret==0)
                 {
                     if (st_flag == 1 && state == true)
                     {
@@ -783,7 +784,7 @@ namespace HOZProject
                         }
                         break;
                     }
-                    else if (st_flag == 2 && state)
+                    else if(st_flag==2 && state)
                     {
                         btnAutoFocus2.BackColor = Color.Lime;
                         Thread.Sleep(1000);
@@ -886,9 +887,9 @@ namespace HOZProject
                     //    fileStream.Dispose();
                     //}
 
-
+                    
                 }
-                else if (ret > 0 && ret < 12)
+                else if(ret>0 && ret<12)
                 {
                     state = true;
                 }
@@ -951,7 +952,7 @@ namespace HOZProject
                 fileStream.Dispose();
             }
             Thread.Sleep(1000);
-            iSEM.SetAutoVideoBrightness();
+            iSEM.SetAutoVideoContrast();
             btnAutoContrast.BackColor = Color.Red;
             st_flag = 4;
             Thread.Sleep(1000);
@@ -971,7 +972,7 @@ namespace HOZProject
                 fileStream.Dispose();
             }
             Thread.Sleep(1000);
-            iSEM.SetAutoVideoBrightness();
+            iSEM.SetAutoVideoBrightnessAndContrast();
             btnAutoBrightness.BackColor = Color.Red;
             btnAutoContrast.BackColor = Color.Red;
             btnAutoBC.BackColor = Color.Red;
@@ -1133,9 +1134,8 @@ namespace HOZProject
             sfd.Filter = "MLF文件|*.MLF";
             if (sfd.ShowDialog() == DialogResult.OK)
             {
-                string fn = Path.GetFileNameWithoutExtension(sfd.FileName).ToUpper();
-                iSEM.CMDMCFFilename(fn);
-
+                //string fn = Path.GetFileNameWithoutExtension(sfd.FileName).ToUpper();
+                iSEM.CMDMCFFilename(sfd.FileName);
             }
         }
         #endregion
@@ -1201,7 +1201,7 @@ namespace HOZProject
             {
                 return;
             }
-            if (!float.TryParse(txtStageY.Text, out sety))
+            if(!float.TryParse(txtStageY.Text,out sety))
             {
                 return;
             }
@@ -1215,10 +1215,10 @@ namespace HOZProject
         private void MoveStagexy()
         {
             float ret = 111;
-            while (true)
+            while(true)
             {
                 ret = iSEM.GetStageIs();
-                if (ret == 0)
+                if(ret==0)
                 {
                     btnMoveXY.BackColor = Color.Lime;
                     break;
@@ -1265,25 +1265,26 @@ namespace HOZProject
 
         private void btnExeEly_Click(object sender, EventArgs e)
         {
-            iSEM.CmdFIBLoadELY(@"E:\HOZ\MillStep2.ely");
+            OpenFileDialog sfd = new OpenFileDialog();
+            sfd.Title = "选择ELY文件:";
+            //sfd.InitialDirectory = @"C:\ProgramData\Carl Zeiss\SmartSEM\User\Default";
+            sfd.Filter = "ELY文件|*.ELY";
+            if (sfd.ShowDialog() == DialogResult.OK)
+            {
+                iSEM.CmdFIBLoadELY(sfd.FileName);
+            } 
         }
 
         private void btnExeEly2_Click(object sender, EventArgs e)
         {
-            iSEM.CmdFIBLoadELY(@"E:\HOZ\MillStep4.ely");
+            iSEM.CmdFIBEXPOSUREELY();
         }
 
         private void btnFIBStatus_Click(object sender, EventArgs e)
         {
-            btnFIBStatus.Text = iSEM.GetFIBApiStatus().ToString();
+            btnFIBStatus.Text = iSEM.GetFIBMode().ToString();
         }
 
-        //测量线程测试
-        private void button1_Click(object sender, EventArgs e)
-        {
-            //FormMeasureTest Measure = new FormMeasureTest();
-            //Measure.Show();
-        }
 
         private void btnPost1_Click(object sender, EventArgs e)
         {
@@ -1365,84 +1366,54 @@ namespace HOZProject
             lblstate6.Text = state.ToString();
         }
 
-        //private void btnPost1_Click(object sender, EventArgs e)
-        //{
-        //    double degree = 0;
-        //    int direction = 0;
-        //    int state = 0;
-        //    wr.Img_OffsetAngle_Direction("D:/aaaa.jpg", out degree, out direction, out state);
-        //    lbldegree1.Text = degree.ToString("0.0");
-        //    lbldirection1.Text = direction.ToString();
-        //    lblstate1.Text = state.ToString();
-        //}
-
-        //private void btnPost2_Click(object sender, EventArgs e)
-        //{
-        //    double offsetx = 0;
-        //    double offsety = 0;
-        //    int state = 0;
-        //    wr.Img_Cut_Position("D:/aaaa.jpg", out offsetx, out offsety, out state);
-        //    lbllocationx.Text = offsetx.ToString("0.0");
-        //    lbllocationy.Text = offsety.ToString("0.0");
-        //    lblstate2.Text = state.ToString();
-        //}
-
-        //private void btnPost3_Click(object sender, EventArgs e)
-        //{
-        //    int state = 0;
-        //    wr.Img_Cut_Success("D:/aaaa.jpg", "D:/bbbb.jpg", out state);
-        //    lblstate3.Text = state.ToString();
-        //}
-
-        //private void btnPost4_Click(object sender, EventArgs e)
-        //{
-        //    double offsetx = 0;
-        //    double offsety = 0;
-        //    int state = 0;
-        //    wr.Img_Trapezoid_Top_Center_Position("D:/aaaa.jpg", out offsetx, out offsety, out state);
-        //    lbltopcx.Text = offsetx.ToString("0.0");
-        //    lbltopcy.Text = offsety.ToString("0.0");
-        //    lblstate4.Text = state.ToString();
-        //}
-
-        //private void btnPost5_Click(object sender, EventArgs e)
-        //{
-        //    List<string> filenames = new List<string>();
-        //    filenames.Add("1111111");
-        //    filenames.Add("2222222");
-        //    filenames.Add("3333333");
-        //    lblfocuspath.Text = wr.Img_Auto_Focus(filenames);
-        //}
-
-        //private void btnPost6_Click(object sender, EventArgs e)
-        //{
-        //    List<string> filenames = new List<string>();
-        //    filenames.Add("1111111");
-        //    filenames.Add("2222222");
-        //    filenames.Add("3333333");
-        //    lblstigpath.Text = wr.Img_Auto_Focus(filenames);
-        //}
-
-        //private void btnPost7_Click(object sender, EventArgs e)
-        //{
-        //    double offsetx = 0;
-        //    double offsety = 0;
-        //    double degree = 0;
-        //    int direction = 0;
-        //    int state = 0;
-        //    wr.Img_Center_Position_OffsetAngle_Direction("D:/aaaa.jpg", out offsetx, out offsety, out degree, out direction, out state);
-        //    lblcenterx.Text = offsetx.ToString("0.0");
-        //    lblcentery.Text = offsety.ToString("0.0");
-        //    lbldegree2.Text = degree.ToString();
-        //    lbldirection2.Text = direction.ToString();
-        //    lblstate5.Text = state.ToString();
-        //}
-
-        //private void btnPost8_Click(object sender, EventArgs e)
-        //{
-        //    int state = 0;
-        //    wr.Img_Measure_Size("D:/aaaa.jpg", "1000", "0.005", out state);
-        //    lblstate6.Text = state.ToString();
-        //}
+        private void btnScanRotationSetLock_Click(object sender, EventArgs e)
+        {
+            iSEM.SetScanRotationOff();
+        }
+
+        private void button1_Click_1(object sender, EventArgs e)
+        {
+            iSEM.SetTiltAngleOff();
+        }
+
+        private void btnTiltAngleSetOn_Click(object sender, EventArgs e)
+        {
+            iSEM.SetTiltAngleOn();
+        }
+
+        private void btnScanRotationSetOn_Click(object sender, EventArgs e)
+        {
+            iSEM.SetScanRotationOn();
+        }
+
+        private void btnExeEly3_Click(object sender, EventArgs e)
+        {
+            iSEM.CmdFIBSTARTELY();
+        }
+
+        private void btnCreateConfig_Click(object sender, EventArgs e)
+        {
+            ConfigManager cfm = new ConfigManager();
+            cfm.PT_Depostion = chkpt0.Checked;
+            cfm.Template_File = txtTemplateFile.Text;
+            cfm.Sample_Name = txtSampleName.Text;
+            cfm.M_Config_Param.Voltage = Convert.ToDouble(txtvoltage.Text);
+            cfm.M_Config_Param.Magnification = Convert.ToDouble(txtMag.Text);
+            cfm.M_Config_Param.Pixel_Size = Convert.ToDouble(txtpixel.Text);
+            cfm.CreateXml(@"E:\test.cfg");
+            cfm.Save(@"E:\test.cfg");
+        }
+
+        private void btnReadConfig_Click(object sender, EventArgs e)
+        {
+            ConfigManager cfm = new ConfigManager();
+            cfm.Read(@"E:\test.cfg");
+            this.ckbPT.Checked = cfm.PT_Depostion;
+            this.lblTemplateFile.Text = cfm.Template_File;
+            this.lblSampleName.Text = cfm.Sample_Name;
+            this.lblvoltage.Text = cfm.M_Config_Param.Voltage.ToString();
+            this.lblmag.Text = cfm.M_Config_Param.Magnification.ToString();
+            this.lblpixel.Text = cfm.M_Config_Param.Pixel_Size.ToString();
+        }
     }
 }

+ 2 - 1
HOZProject/Program.cs

@@ -17,8 +17,9 @@ namespace HOZProject
             Application.EnableVisualStyles();
             Application.SetCompatibleTextRenderingDefault(false);
             //Application.Run(new FormUCMain());
-            Application.Run(new FormHOZMain());
+            //Application.Run(new FormHOZMain());
             //Application.Run(new FormMeasureTest());
+            Application.Run(new FormUnitControl());
         }
     }
 }

+ 0 - 0
WindowsFormsApp1/App.config → ManulDo/App.config


+ 86 - 62
WindowsFormsApp1/MainForm.Designer.cs → ManulDo/MainForm.Designer.cs

@@ -28,7 +28,7 @@
         /// </summary>
         private void InitializeComponent()
         {
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
             this.groupBox1 = new System.Windows.Forms.GroupBox();
             this.btnOpenFile = new System.Windows.Forms.Button();
             this.btnSaveFile = new System.Windows.Forms.Button();
@@ -50,7 +50,6 @@
             this.tBSampleName = new System.Windows.Forms.TextBox();
             this.cBIsManul = new System.Windows.Forms.CheckBox();
             this.cBIsPT = new System.Windows.Forms.CheckBox();
-            this.LogText = new System.Windows.Forms.TextBox();
             this.CutHoleGridView = new System.Windows.Forms.DataGridView();
             this.Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.X = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -59,6 +58,7 @@
             this.M = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.R = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.T = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.listmsg = new System.Windows.Forms.ListBox();
             this.groupBox1.SuspendLayout();
             this.groupBox2.SuspendLayout();
             this.groupBox3.SuspendLayout();
@@ -70,18 +70,21 @@
             this.groupBox1.Controls.Add(this.btnOpenFile);
             this.groupBox1.Controls.Add(this.btnSaveFile);
             this.groupBox1.Controls.Add(this.btnNewFile);
-            this.groupBox1.Location = new System.Drawing.Point(12, 12);
+            this.groupBox1.Location = new System.Drawing.Point(11, 10);
+            this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.groupBox1.Name = "groupBox1";
-            this.groupBox1.Size = new System.Drawing.Size(455, 81);
+            this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.groupBox1.Size = new System.Drawing.Size(404, 67);
             this.groupBox1.TabIndex = 1;
             this.groupBox1.TabStop = false;
             this.groupBox1.Text = "测量文件操作";
             // 
             // btnOpenFile
             // 
-            this.btnOpenFile.Location = new System.Drawing.Point(235, 28);
+            this.btnOpenFile.Location = new System.Drawing.Point(209, 23);
+            this.btnOpenFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btnOpenFile.Name = "btnOpenFile";
-            this.btnOpenFile.Size = new System.Drawing.Size(102, 37);
+            this.btnOpenFile.Size = new System.Drawing.Size(91, 31);
             this.btnOpenFile.TabIndex = 2;
             this.btnOpenFile.Text = "打开";
             this.btnOpenFile.UseVisualStyleBackColor = true;
@@ -89,9 +92,10 @@
             // 
             // btnSaveFile
             // 
-            this.btnSaveFile.Location = new System.Drawing.Point(127, 28);
+            this.btnSaveFile.Location = new System.Drawing.Point(113, 23);
+            this.btnSaveFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btnSaveFile.Name = "btnSaveFile";
-            this.btnSaveFile.Size = new System.Drawing.Size(102, 37);
+            this.btnSaveFile.Size = new System.Drawing.Size(91, 31);
             this.btnSaveFile.TabIndex = 1;
             this.btnSaveFile.Text = "保存";
             this.btnSaveFile.UseVisualStyleBackColor = true;
@@ -99,9 +103,10 @@
             // 
             // btnNewFile
             // 
-            this.btnNewFile.Location = new System.Drawing.Point(19, 28);
+            this.btnNewFile.Location = new System.Drawing.Point(17, 23);
+            this.btnNewFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btnNewFile.Name = "btnNewFile";
-            this.btnNewFile.Size = new System.Drawing.Size(102, 37);
+            this.btnNewFile.Size = new System.Drawing.Size(91, 31);
             this.btnNewFile.TabIndex = 0;
             this.btnNewFile.Text = "新建";
             this.btnNewFile.UseVisualStyleBackColor = true;
@@ -116,18 +121,21 @@
             this.groupBox2.Controls.Add(this.button4);
             this.groupBox2.Controls.Add(this.button3);
             this.groupBox2.Controls.Add(this.btnLoadCutHoles);
-            this.groupBox2.Location = new System.Drawing.Point(12, 99);
+            this.groupBox2.Location = new System.Drawing.Point(11, 82);
+            this.groupBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.groupBox2.Name = "groupBox2";
-            this.groupBox2.Size = new System.Drawing.Size(455, 130);
+            this.groupBox2.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.groupBox2.Size = new System.Drawing.Size(404, 108);
             this.groupBox2.TabIndex = 2;
             this.groupBox2.TabStop = false;
             this.groupBox2.Text = "测量流程";
             // 
             // button1
             // 
-            this.button1.Location = new System.Drawing.Point(343, 81);
+            this.button1.Location = new System.Drawing.Point(305, 67);
+            this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.button1.Name = "button1";
-            this.button1.Size = new System.Drawing.Size(102, 37);
+            this.button1.Size = new System.Drawing.Size(91, 31);
             this.button1.TabIndex = 6;
             this.button1.Text = "截面";
             this.button1.UseVisualStyleBackColor = true;
@@ -135,9 +143,10 @@
             // 
             // button7
             // 
-            this.button7.Location = new System.Drawing.Point(235, 81);
+            this.button7.Location = new System.Drawing.Point(209, 67);
+            this.button7.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.button7.Name = "button7";
-            this.button7.Size = new System.Drawing.Size(102, 37);
+            this.button7.Size = new System.Drawing.Size(91, 31);
             this.button7.TabIndex = 5;
             this.button7.Text = "分析位置";
             this.button7.UseVisualStyleBackColor = true;
@@ -145,9 +154,10 @@
             // 
             // button6
             // 
-            this.button6.Location = new System.Drawing.Point(127, 81);
+            this.button6.Location = new System.Drawing.Point(113, 67);
+            this.button6.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.button6.Name = "button6";
-            this.button6.Size = new System.Drawing.Size(102, 37);
+            this.button6.Size = new System.Drawing.Size(91, 31);
             this.button6.TabIndex = 4;
             this.button6.Text = "切割";
             this.button6.UseVisualStyleBackColor = true;
@@ -155,9 +165,10 @@
             // 
             // button5
             // 
-            this.button5.Location = new System.Drawing.Point(19, 81);
+            this.button5.Location = new System.Drawing.Point(17, 67);
+            this.button5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.button5.Name = "button5";
-            this.button5.Size = new System.Drawing.Size(102, 37);
+            this.button5.Size = new System.Drawing.Size(91, 31);
             this.button5.TabIndex = 3;
             this.button5.Text = "定位";
             this.button5.UseVisualStyleBackColor = true;
@@ -165,9 +176,10 @@
             // 
             // button4
             // 
-            this.button4.Location = new System.Drawing.Point(235, 38);
+            this.button4.Location = new System.Drawing.Point(209, 32);
+            this.button4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.button4.Name = "button4";
-            this.button4.Size = new System.Drawing.Size(102, 37);
+            this.button4.Size = new System.Drawing.Size(91, 31);
             this.button4.TabIndex = 2;
             this.button4.Text = "停止";
             this.button4.UseVisualStyleBackColor = true;
@@ -175,9 +187,10 @@
             // 
             // button3
             // 
-            this.button3.Location = new System.Drawing.Point(127, 38);
+            this.button3.Location = new System.Drawing.Point(113, 32);
+            this.button3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.button3.Name = "button3";
-            this.button3.Size = new System.Drawing.Size(102, 37);
+            this.button3.Size = new System.Drawing.Size(91, 31);
             this.button3.TabIndex = 1;
             this.button3.Text = "启动";
             this.button3.UseVisualStyleBackColor = true;
@@ -185,9 +198,10 @@
             // 
             // btnLoadCutHoles
             // 
-            this.btnLoadCutHoles.Location = new System.Drawing.Point(19, 38);
+            this.btnLoadCutHoles.Location = new System.Drawing.Point(17, 32);
+            this.btnLoadCutHoles.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btnLoadCutHoles.Name = "btnLoadCutHoles";
-            this.btnLoadCutHoles.Size = new System.Drawing.Size(102, 37);
+            this.btnLoadCutHoles.Size = new System.Drawing.Size(91, 31);
             this.btnLoadCutHoles.TabIndex = 0;
             this.btnLoadCutHoles.Text = "导入切孔";
             this.btnLoadCutHoles.UseVisualStyleBackColor = true;
@@ -203,18 +217,21 @@
             this.groupBox3.Controls.Add(this.tBSampleName);
             this.groupBox3.Controls.Add(this.cBIsManul);
             this.groupBox3.Controls.Add(this.cBIsPT);
-            this.groupBox3.Location = new System.Drawing.Point(13, 235);
+            this.groupBox3.Location = new System.Drawing.Point(12, 196);
+            this.groupBox3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.groupBox3.Name = "groupBox3";
-            this.groupBox3.Size = new System.Drawing.Size(454, 109);
+            this.groupBox3.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.groupBox3.Size = new System.Drawing.Size(404, 91);
             this.groupBox3.TabIndex = 3;
             this.groupBox3.TabStop = false;
             this.groupBox3.Text = "测量参数";
             // 
             // btParamOK
             // 
-            this.btParamOK.Location = new System.Drawing.Point(342, 67);
+            this.btParamOK.Location = new System.Drawing.Point(304, 56);
+            this.btParamOK.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btParamOK.Name = "btParamOK";
-            this.btParamOK.Size = new System.Drawing.Size(102, 37);
+            this.btParamOK.Size = new System.Drawing.Size(91, 31);
             this.btParamOK.TabIndex = 7;
             this.btParamOK.Text = "确定";
             this.btParamOK.UseVisualStyleBackColor = true;
@@ -222,9 +239,10 @@
             // 
             // btFIB
             // 
-            this.btFIB.Location = new System.Drawing.Point(185, 60);
+            this.btFIB.Location = new System.Drawing.Point(164, 50);
+            this.btFIB.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btFIB.Name = "btFIB";
-            this.btFIB.Size = new System.Drawing.Size(43, 27);
+            this.btFIB.Size = new System.Drawing.Size(38, 22);
             this.btFIB.TabIndex = 6;
             this.btFIB.Text = "...";
             this.btFIB.UseVisualStyleBackColor = true;
@@ -232,43 +250,46 @@
             // 
             // tBFIBTemp
             // 
-            this.tBFIBTemp.Location = new System.Drawing.Point(85, 59);
+            this.tBFIBTemp.Location = new System.Drawing.Point(76, 49);
+            this.tBFIBTemp.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.tBFIBTemp.Name = "tBFIBTemp";
             this.tBFIBTemp.ReadOnly = true;
-            this.tBFIBTemp.Size = new System.Drawing.Size(100, 28);
+            this.tBFIBTemp.Size = new System.Drawing.Size(89, 25);
             this.tBFIBTemp.TabIndex = 5;
             // 
             // label2
             // 
             this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(17, 69);
+            this.label2.Location = new System.Drawing.Point(15, 57);
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(71, 18);
+            this.label2.Size = new System.Drawing.Size(61, 15);
             this.label2.TabIndex = 4;
             this.label2.Text = "FIB模板";
             // 
             // label1
             // 
             this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(206, 31);
+            this.label1.Location = new System.Drawing.Point(183, 26);
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(80, 18);
+            this.label1.Size = new System.Drawing.Size(67, 15);
             this.label1.TabIndex = 3;
             this.label1.Text = "样品名称";
             // 
             // tBSampleName
             // 
-            this.tBSampleName.Location = new System.Drawing.Point(288, 28);
+            this.tBSampleName.Location = new System.Drawing.Point(256, 23);
+            this.tBSampleName.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.tBSampleName.Name = "tBSampleName";
-            this.tBSampleName.Size = new System.Drawing.Size(100, 28);
+            this.tBSampleName.Size = new System.Drawing.Size(89, 25);
             this.tBSampleName.TabIndex = 2;
             // 
             // cBIsManul
             // 
             this.cBIsManul.AutoSize = true;
-            this.cBIsManul.Location = new System.Drawing.Point(94, 28);
+            this.cBIsManul.Location = new System.Drawing.Point(84, 23);
+            this.cBIsManul.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.cBIsManul.Name = "cBIsManul";
-            this.cBIsManul.Size = new System.Drawing.Size(106, 22);
+            this.cBIsManul.Size = new System.Drawing.Size(89, 19);
             this.cBIsManul.TabIndex = 1;
             this.cBIsManul.Text = "手动对焦";
             this.cBIsManul.UseVisualStyleBackColor = true;
@@ -276,26 +297,19 @@
             // cBIsPT
             // 
             this.cBIsPT.AutoSize = true;
-            this.cBIsPT.Location = new System.Drawing.Point(18, 28);
+            this.cBIsPT.Location = new System.Drawing.Point(16, 23);
+            this.cBIsPT.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.cBIsPT.Name = "cBIsPT";
-            this.cBIsPT.Size = new System.Drawing.Size(70, 22);
+            this.cBIsPT.Size = new System.Drawing.Size(60, 19);
             this.cBIsPT.TabIndex = 0;
             this.cBIsPT.Text = "有PT";
             this.cBIsPT.UseVisualStyleBackColor = true;
             // 
-            // LogText
-            // 
-            this.LogText.Location = new System.Drawing.Point(473, 12);
-            this.LogText.Multiline = true;
-            this.LogText.Name = "LogText";
-            this.LogText.Size = new System.Drawing.Size(315, 332);
-            this.LogText.TabIndex = 15;
-            // 
             // CutHoleGridView
             // 
-            dataGridViewCellStyle4.BackColor = System.Drawing.Color.Beige;
-            dataGridViewCellStyle4.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Bold);
-            this.CutHoleGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4;
+            dataGridViewCellStyle2.BackColor = System.Drawing.Color.Beige;
+            dataGridViewCellStyle2.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Bold);
+            this.CutHoleGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
             this.CutHoleGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.CutHoleGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.Name,
@@ -305,11 +319,12 @@
             this.M,
             this.R,
             this.T});
-            this.CutHoleGridView.Location = new System.Drawing.Point(12, 350);
+            this.CutHoleGridView.Location = new System.Drawing.Point(11, 292);
+            this.CutHoleGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.CutHoleGridView.Name = "CutHoleGridView";
             this.CutHoleGridView.ReadOnly = true;
             this.CutHoleGridView.RowTemplate.Height = 30;
-            this.CutHoleGridView.Size = new System.Drawing.Size(776, 263);
+            this.CutHoleGridView.Size = new System.Drawing.Size(690, 219);
             this.CutHoleGridView.TabIndex = 16;
             // 
             // Name
@@ -347,16 +362,26 @@
             this.T.Name = "T";
             this.T.ReadOnly = true;
             // 
+            // listmsg
+            // 
+            this.listmsg.FormattingEnabled = true;
+            this.listmsg.ItemHeight = 15;
+            this.listmsg.Location = new System.Drawing.Point(713, 10);
+            this.listmsg.Name = "listmsg";
+            this.listmsg.Size = new System.Drawing.Size(697, 604);
+            this.listmsg.TabIndex = 17;
+            // 
             // MainForm
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(800, 622);
+            this.ClientSize = new System.Drawing.Size(1422, 628);
+            this.Controls.Add(this.listmsg);
             this.Controls.Add(this.CutHoleGridView);
-            this.Controls.Add(this.LogText);
             this.Controls.Add(this.groupBox3);
             this.Controls.Add(this.groupBox2);
             this.Controls.Add(this.groupBox1);
+            this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             //this.Name = "MainForm";
             this.Text = "测量流程测试";
             this.groupBox1.ResumeLayout(false);
@@ -365,7 +390,6 @@
             this.groupBox3.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.CutHoleGridView)).EndInit();
             this.ResumeLayout(false);
-            this.PerformLayout();
 
         }
 
@@ -399,7 +423,7 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn M;
         private System.Windows.Forms.DataGridViewTextBoxColumn R;
         private System.Windows.Forms.DataGridViewTextBoxColumn T;
-        private System.Windows.Forms.TextBox LogText;
+        private System.Windows.Forms.ListBox listmsg;
     }
 }
 

+ 8 - 2
WindowsFormsApp1/MainForm.cs → ManulDo/MainForm.cs

@@ -10,6 +10,7 @@ using System.Windows.Forms;
 
 using MeasureData;
 using MeasureThread;
+using FileManager;
 
 namespace WindowsFormsApp1
 {
@@ -37,6 +38,10 @@ namespace WindowsFormsApp1
             m_BackgroundWorker.DoWork += new DoWorkEventHandler(DoWork);
             m_BackgroundWorker.ProgressChanged += new ProgressChangedEventHandler(UpdateProgress);
             m_BackgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(CompletedWork);
+
+            LogManager.InitManulLog();
+           
+
         }
         #endregion
         #region 测量线程
@@ -60,7 +65,7 @@ namespace WindowsFormsApp1
             //主界面显示内容
             this.BeginInvoke((Action)delegate
             {
-                this.LogText.Text += e.Time.ToString() + e.State + "\n";
+                this.listmsg.Items.Add(e.Time.ToString() + e.State);
             });
         }
 
@@ -178,6 +183,7 @@ namespace WindowsFormsApp1
             if (m_MeasureFile == null)
             {
                 MessageBox.Show("请新建一个测量文件");
+                listmsg.Items.Clear();
             }
             else
             {
@@ -221,7 +227,7 @@ namespace WindowsFormsApp1
             if (m_MeasureFile == null)
             {
                 MessageBox.Show("请新建一个测量文件");
-                this.LogText.Text += "请新建一个测量文件";
+                this.listmsg.Items.Add("请新建一个测量文件");
             }
             else
             {

+ 0 - 0
WindowsFormsApp1/MainForm.resx → ManulDo/MainForm.resx


+ 1 - 1
WindowsFormsApp1/ManulDo.csproj → ManulDo/ManulDo.csproj

@@ -18,7 +18,7 @@
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
+    <OutputPath>..\bin\Debug\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>

+ 0 - 0
WindowsFormsApp1/Program.cs → ManulDo/Program.cs


+ 0 - 0
WindowsFormsApp1/Properties/AssemblyInfo.cs → ManulDo/Properties/AssemblyInfo.cs


+ 0 - 0
WindowsFormsApp1/Properties/Resources.Designer.cs → ManulDo/Properties/Resources.Designer.cs


+ 0 - 0
WindowsFormsApp1/Properties/Resources.resx → ManulDo/Properties/Resources.resx


+ 0 - 0
WindowsFormsApp1/Properties/Settings.Designer.cs → ManulDo/Properties/Settings.Designer.cs


+ 0 - 0
WindowsFormsApp1/Properties/Settings.settings → ManulDo/Properties/Settings.settings


+ 157 - 0
MeasureData/ConfigManager.cs

@@ -0,0 +1,157 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using System.Xml;
+using System.IO;
+using FileManager;
+
+namespace MeasureData
+{
+    public class ConfigManager : ISlo
+    {
+        #region 内容
+        //是否PT沉积
+        private Boolean pt_Depostion;
+        public Boolean PT_Depostion
+        {
+            get { return this.pt_Depostion; }
+            set { this.pt_Depostion = value; }
+        }
+
+        //模板文件
+        private String template_File;
+        public String Template_File
+        {
+            get { return this.template_File; }
+            set { this.template_File = value; }
+        }
+
+        //样品名称
+        private String sample_Name;
+        public String Sample_Name
+        {
+            get { return this.sample_Name; }
+            set { this.sample_Name = value; }
+        }
+
+        //样品配置参数
+        private MeasureConfigParam m_Config_Param;
+        public MeasureConfigParam M_Config_Param
+        {
+            get { return this.m_Config_Param; }
+            set { this.m_Config_Param = value; }
+        }
+        #endregion
+
+        public ConfigManager()
+        {
+            this.m_Config_Param = new MeasureConfigParam();
+        }
+
+
+        /// <summary>
+        /// 创建XML文件
+        /// </summary>
+        /// <param name="filename">创建XML文件的全路径</param>
+        /// <returns>0:失败;1:成功;2:文件已存在</returns>
+        public int CreateXml(String filename)
+        {
+            if (!File.Exists(filename))
+            {
+                if (XmlManager.CreateXmlFile(filename))
+                {
+                    return 1;
+                }
+                else
+                {
+                    return 0;
+                }
+            }
+            else
+            {
+                XmlManager.CreateXmlFile(filename);
+                return 2;
+            }
+        }
+
+        //保存
+        public bool Save(String filename)
+        {
+            XmlDocument doc = new XmlDocument();
+            if (File.Exists(filename))
+            {
+                doc.Load(filename);//载入xml文件               
+            }
+            else
+            {
+                return false; //当前路径不存在               
+            }
+
+            XmlNode root = doc.SelectSingleNode("XMLData");
+            Serialize(true, doc, root);
+            doc.Save(filename);
+
+            return true;
+        }
+
+        //读取
+        public bool Read(String filename)
+        {
+            XmlDocument doc = new XmlDocument();
+            if (File.Exists(filename))
+            {
+                doc.Load(filename);//载入xml文件               
+            }
+            else
+            {
+                return false; //当前路径不存在               
+            }
+
+            XmlNode root = doc.SelectSingleNode("XMLData");
+            Serialize(false, doc, root);
+            //doc.Save(filename);
+
+            return true;
+        }
+
+        //XML文件保存
+        //样品孔存储xml文档
+        public override void Serialize(bool isStoring, XmlDocument xml, XmlNode rootNode)
+        {
+            Slo sFile = new Slo();
+            Slo sParam = new Slo();
+
+
+            xBool pt_depostion = new xBool();
+            xString template_file = new xString();
+            xString sample_name = new xString();
+
+            
+            
+            pt_depostion.AssignValue(this.pt_Depostion);
+            template_file.AssignValue(this.template_File);
+            sample_name.AssignValue(this.sample_Name);
+            sFile.Register("PT_Depostion", pt_depostion);
+            sFile.Register("Template_File", template_file);
+            sFile.Register("Sample_Name", sample_name);
+            sFile.Register("MeasureConfigParam", m_Config_Param);
+
+
+            if (isStoring)
+            {
+                sFile.Serialize(true, xml, rootNode);
+            }
+            else
+            {
+                sFile.Serialize(false, xml, rootNode);
+
+                this.pt_Depostion = pt_depostion.value();
+                this.template_File = template_file.value();
+                this.sample_Name = sample_name.value();
+            }
+        }
+    }
+}

+ 71 - 0
MeasureData/MeasureConfigParam.cs

@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using FileManager;
+using System.Xml;
+
+namespace MeasureData
+{
+    public class MeasureConfigParam :ISlo
+    {
+        #region 内容
+        //测量电压
+        private double voltage;
+        public double Voltage
+        {
+            get { return this.voltage; }
+            set { this.voltage = value; }
+        }
+
+        //放大位数
+        private double magnification;
+        public double Magnification
+        {
+            get { return this.magnification; }
+            set { this.magnification = value; }
+        }
+
+        //像素
+        private double pixel_Size;
+        public double Pixel_Size
+        {
+            get { return this.pixel_Size; }
+            set { this.pixel_Size = value; }
+        }
+        #endregion
+
+        public override void Serialize(bool isStoring, XmlDocument xml, XmlNode rootNode)
+        {
+            Slo sFile = new Slo();
+            Slo sParam = new Slo();
+
+
+            xDouble _voltage = new xDouble();
+            xDouble _magnification = new xDouble();
+            xDouble _pixelsize = new xDouble();
+
+            _voltage.AssignValue(this.voltage);
+            _magnification.AssignValue(this.magnification);
+            _pixelsize.AssignValue(this.pixel_Size);
+            sFile.Register("Voltage", _voltage);
+            sFile.Register("Magnification", _magnification);
+            sFile.Register("PixelSize", _pixelsize);
+
+
+            if (isStoring)
+            {
+                sFile.Serialize(true, xml, rootNode);
+            }
+            else
+            {
+                sFile.Serialize(false, xml, rootNode);
+
+                this.voltage = _voltage.value();
+                this.magnification = _magnification.value();
+                this.pixel_Size = _pixelsize.value();
+            }
+        }
+    }
+}

+ 2 - 0
MeasureData/MeasureData.csproj

@@ -47,7 +47,9 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="ConfigManager.cs" />
     <Compile Include="CutHole.cs" />
+    <Compile Include="MeasureConfigParam.cs" />
     <Compile Include="MeasureFile.cs" />
     <Compile Include="MeasureParam.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />

+ 18 - 6
MeasureData/MeasureFile.cs

@@ -259,6 +259,7 @@ namespace MeasureData
             //按行取出txt文件
             string[] lines = File.ReadAllLines(a_FilePathName, System.Text.Encoding.Default);
 
+            LogManager.AddHardwareLog("read " + lines.Count().ToString() + "lines",true);
             //按现有的文件格式生成
             string posMode = lines[1];
             if (posMode.CompareTo(@"Absolute") != 0)
@@ -291,6 +292,9 @@ namespace MeasureData
             {
                 int currentLine = i + 4;
                 string currentString = lines[currentLine];
+
+                LogManager.AddHardwareLog(currentString, true);
+
                 string[] CurrentPos = currentString.Split(',');
                 int nCurrentPosNum = CurrentPos.Length;
 
@@ -305,18 +309,26 @@ namespace MeasureData
                 CHole.HoleName = CurrentPos[nLabelPos];
                 //切孔位置
                 SemPosition holePos = new SemPosition();                
-                holePos.X = (float)Convert.ToDouble(CurrentPos[nXPos]);
-                holePos.Y = (float)Convert.ToDouble(CurrentPos[nYPos]);
-                holePos.Z = (float)Convert.ToDouble(CurrentPos[nZPos]);
-                holePos.M = (float)Convert.ToDouble(CurrentPos[nMPos]);
-                holePos.T = (float)Convert.ToDouble(CurrentPos[nTPos]);
-                holePos.R = (float)Convert.ToDouble(CurrentPos[nRPos]);
+                holePos.X = Convert.ToSingle(CurrentPos[nXPos]);
+                holePos.Y = Convert.ToSingle(CurrentPos[nYPos]);
+                holePos.Z = Convert.ToSingle(CurrentPos[nZPos]);
+                holePos.M = Convert.ToSingle(CurrentPos[nMPos]);
+                holePos.T = Convert.ToSingle(CurrentPos[nTPos]);
+                holePos.R = Convert.ToSingle(CurrentPos[nRPos]);
                 CHole.Position = holePos;
                 //默认切割点均参与测试
                 CHole.SWITCH = true;
 
                 //更新切孔链表
                 this.ListCutHole.Add(CHole);
+                LogManager.AddHardwareLog("X =" + CurrentPos[nXPos]
+                    + "Y =" + CurrentPos[nYPos]
+                    + "Z =" + CurrentPos[nZPos]
+                    + "M =" + CurrentPos[nTPos]
+                    + "T =" + CurrentPos[nRPos]
+                    + "R =" + CurrentPos[nMPos]
+                    , true);
+
             }
 
             return true;            

文件差异内容过多而无法显示
+ 642 - 172
MeasureThread/Measure.cs


+ 10 - 1
SmartSEMControl/HardwareInterface.cs

@@ -96,6 +96,8 @@ namespace SmartSEMControl
 
         //角度补偿
         float GetTiltAngle();
+        Boolean SetTiltAngleOn();
+        Boolean SetTiltAngleOff();
         Boolean SetTiltAngle(float set);
 
         //抓图
@@ -130,6 +132,8 @@ namespace SmartSEMControl
 
         //Scan Rotate角度接口
         float GetScanRotation();
+        Boolean SetScanRotationOn();
+        Boolean SetScanRotationOff();
         Boolean SetScanRotation(float set);
 
         //像素读取PixelSize
@@ -173,7 +177,7 @@ namespace SmartSEMControl
         Boolean DetectorType(float set);
 
         //执行宏文件
-        Boolean CMDMCFFilename(String filename);
+        Boolean CMDMCFFilename(String _MLFFullFileName);
 
         //样品台状态
         float GetStageIs();
@@ -189,6 +193,11 @@ namespace SmartSEMControl
 
         //加载执行.ely文件
         Boolean CmdFIBLoadELY(String _ELYFullFileName);
+        //FIB确认.ely文件
+        Boolean CmdFIBEXPOSUREELY();
+        //FIB执行.ely文件
+        Boolean CmdFIBSTARTELY();
+
 
         //清除控件
         Boolean Dispose();

+ 119 - 14
SmartSEMControl/SmartSEM.cs

@@ -107,8 +107,11 @@ namespace SmartSEMControl
         #endregion
 
         #region 固定参数
+        //判断这个文件夹是否存在20200826
         private readonly String ELYPATH = @"C:\ProgramData\Carl Zeiss\SmartFIB\API\Drop\";
         private readonly String ELYFILENAME = "ApiLayout.ely";
+        private readonly String MLFPATH = @"C:\ProgramData\Carl Zeiss\SmartSEM\User\Service\";
+        private readonly String MLFFILENAME = "Opton.MLF";
         #endregion
 
         #region 模拟参数
@@ -203,6 +206,9 @@ namespace SmartSEMControl
 
         //FIB状态
         private readonly String DP_SMARTFIB_API_STATUS = "DP_SMARTFIB_API_STATUS";
+
+        //FIB,ELY文件确认前,需要将该变量置为2->FIB
+        private readonly String DP_PATTERNING_MODE = "DP_PATTERNING_MODE";
         #endregion
 
         #region 命令
@@ -233,6 +239,10 @@ namespace SmartSEMControl
 
         //FIB加载.ely文件命令
         private readonly String CMD_SMARTFIB_LOAD_ELY = "CMD_SMARTFIB_LOAD_ELY";
+        //FIB确认.ely文件命令
+        private readonly String CMD_SMARTFIB_PREPARE_EXPOSURE = "CMD_SMARTFIB_PREPARE_EXPOSURE";
+        //FIB开始.ley文件命令
+        private readonly String CMD_FIB_START_MILLING = "CMD_FIB_START_MILLING";
         #endregion
 
         #region 宏文件命令
@@ -249,6 +259,16 @@ namespace SmartSEMControl
         {
             LogManager.InitHardwareLog();
             Init();
+            //判断ELY默认文件夹是否存在
+            if(!Directory.Exists(ELYPATH))
+            {
+                Directory.CreateDirectory(ELYPATH);
+            }
+
+            if (!Directory.Exists(MLFPATH))
+            {
+                Directory.CreateDirectory(MLFPATH);
+            }
         }
         #endregion
 
@@ -782,6 +802,27 @@ namespace SmartSEMControl
                 return float.NaN;
             }
         }
+        /// <summary>
+        /// 角度补偿解锁
+        /// </summary>
+        /// <returns></returns>
+        public Boolean SetTiltAngleOn()
+        {
+            Boolean ret = WriteDataParams(DP_TILT_CORRECTION, 1);
+            LogManager.AddHardwareLog("Set DP_TILT_CORRECTION = 1.", ret);
+            return ret;
+        }
+
+        /// <summary>
+        /// 角度补偿锁定
+        /// </summary>
+        /// <returns></returns>
+        public Boolean SetTiltAngleOff()
+        {
+            Boolean ret = WriteDataParams(DP_TILT_CORRECTION, 0);
+            LogManager.AddHardwareLog("Set DP_TILT_CORRECTION = 0.", ret);
+            return ret;
+        }
 
         /// <summary>
         /// 设置角度补偿
@@ -791,12 +832,12 @@ namespace SmartSEMControl
         public Boolean SetTiltAngle(float set)
         {
             Boolean ret = false;
-            ret = WriteDataParams(DP_TILT_CORRECTION, 1);
-            LogManager.AddHardwareLog("Set DP_TILT_CORRECTION = 1.", ret);
+            //ret = WriteDataParams(DP_TILT_CORRECTION, 1);
+            //LogManager.AddHardwareLog("Set DP_TILT_CORRECTION = 1.", ret);
             ret = WriteParams(AP_TILT_ANGLE, set);
             LogManager.AddHardwareLog("SetTiltAngle = " + set.ToString(), ret);
-            ret = WriteDataParams(DP_TILT_CORRECTION, 0);
-            LogManager.AddHardwareLog("Set DP_TILT_CORRECTION = 0.", ret);
+            //ret = WriteDataParams(DP_TILT_CORRECTION, 0);
+            //LogManager.AddHardwareLog("Set DP_TILT_CORRECTION = 0.", ret);
             return ret;
         }
         #endregion
@@ -901,7 +942,11 @@ namespace SmartSEMControl
                 {
                     LogManager.AddHardwareLog("GrabImage Filename=" + filename + ",x,y,w,h,type=" + xoff.ToString() + "," + 
                         yoff.ToString() + "," + width.ToString() + "," + height.ToString() + "," + type.ToString(), true);
-                    ImageLive();
+                    float sta = GetImageFrozen();
+                    if (sta == 1)
+                    {
+                        ImageLive();
+                    }
                     return true;
                 }
             }
@@ -1337,6 +1382,28 @@ namespace SmartSEMControl
             }
         }
 
+        /// <summary>
+        /// ScanRotation解锁
+        /// </summary>
+        /// <returns></returns>
+        public Boolean SetScanRotationOn()
+        {
+            Boolean ret = WriteDataParams(DP_SCAN_ROT, 1);
+            LogManager.AddHardwareLog("SetScanRotation DP_SCAN_ROT = 1", ret);
+            return ret;
+        }
+
+        /// <summary>
+        /// ScanRotation锁定
+        /// </summary>
+        /// <returns></returns>
+        public Boolean SetScanRotationOff()
+        {
+            Boolean ret = WriteDataParams(DP_SCAN_ROT, 0);
+            LogManager.AddHardwareLog("SetScanRotation DP_SCAN_ROT = 0", ret);
+            return ret;
+        }
+
         /// <summary>
         /// 设置Scan Rotate角度接口
         /// </summary>
@@ -1345,12 +1412,12 @@ namespace SmartSEMControl
         public Boolean SetScanRotation(float set)
         {
             Boolean ret = false;
-            ret = WriteDataParams(DP_SCAN_ROT, 1);
-            LogManager.AddHardwareLog("SetScanRotation DP_SCAN_ROT = 1", ret);
+            //ret = WriteDataParams(DP_SCAN_ROT, 1);
+            //LogManager.AddHardwareLog("SetScanRotation DP_SCAN_ROT = 1", ret);
             ret = WriteParams(AP_SCANROTATION, set);
             LogManager.AddHardwareLog("SetScanRotation = " + set.ToString(), ret);
-            ret = WriteDataParams(DP_SCAN_ROT, 0);
-            LogManager.AddHardwareLog("SetScanRotation DP_SCAN_ROT = 0", ret);
+            //ret = WriteDataParams(DP_SCAN_ROT, 0);
+            //LogManager.AddHardwareLog("SetScanRotation DP_SCAN_ROT = 0", ret);
             return ret;
         }
         #endregion
@@ -1461,12 +1528,30 @@ namespace SmartSEMControl
         #endregion
 
         #region 调用宏文件命令
-        public Boolean CMDMCFFilename(String filename)
+        public Boolean CMDMCFFilename(String _MLFFullFileName)
         {
-            String CMDMCF = MCF_FILENAME + filename;
-            Boolean ret = ExecuteCmd(CMDMCF);
-            LogManager.AddHardwareLog("CMDMCFFilename = " + filename, ret);
-            return ret;
+            //String CMDMCF = MCF_FILENAME + filename;
+            //Boolean ret = ExecuteCmd(CMDMCF);
+            //LogManager.AddHardwareLog("CMDMCFFilename = " + filename, ret);
+            //return ret;
+
+            if (File.Exists(_MLFFullFileName) && Directory.Exists(MLFPATH))
+            {
+                //移动文件
+                if (_MLFFullFileName != (MLFPATH + MLFFILENAME))
+                {
+                    File.Copy(_MLFFullFileName, MLFPATH + MLFFILENAME, true);
+                    LogManager.AddHardwareLog("CmdFIBLoadMLF Copy FileName:" + _MLFFullFileName + " To " + MLFPATH + MLFFILENAME, true);
+                }
+                Boolean ret = ExecuteCmd(MCF_FILENAME + MLFFILENAME.Substring(0,MLFFILENAME.Length-4));
+                LogManager.AddHardwareLog("CmdFIBLoadMLF Success Execute " + _MLFFullFileName, true);
+                return ret;
+            }
+            else
+            {
+                LogManager.AddHardwareLog("CmdFIBLoadMLF Faild:" + _MLFFullFileName + " Is Not Exists!", false);
+                return false;
+            }
         }
         #endregion
 
@@ -1854,6 +1939,26 @@ namespace SmartSEMControl
         }
         #endregion
 
+        #region FIB确认.ely文件
+        public Boolean CmdFIBEXPOSUREELY()
+        {
+            Boolean ret = WriteDataParams(DP_PATTERNING_MODE, 2);
+            LogManager.AddHardwareLog("DP_PATTERNING_MODE = 2", ret);
+            ret = ExecuteCmd(CMD_SMARTFIB_PREPARE_EXPOSURE);
+            LogManager.AddHardwareLog("CMD_SMARTFIB_PREPARE_EXPOSURE", ret);
+            return ret;
+        }
+        #endregion
+
+        #region FIB执行.ely文件
+        public Boolean CmdFIBSTARTELY()
+        {
+            Boolean ret = ExecuteCmd(CMD_FIB_START_MILLING);
+            LogManager.AddHardwareLog("CMD_FIB_START_MILLING", ret);
+            return ret;
+        }
+        #endregion
+
         #region 错误代码转义
         private String ErrorToString(long lError)
         {

+ 18 - 22
WebManager/WebResult.cs

@@ -28,12 +28,10 @@ namespace WebManager
         /// </summary>
         /// <param name="ws_ip">WebServer的IP地址</param>
         /// <param name="ws_port">WebServer的端口号</param>
-        /// <param name="ws_path">WebServer的项目名</param>
-        public WebResult(String ws_ip,String ws_port,String ws_path)
+        public WebResult(String ws_ip,String ws_port)
         {
             this.webServer_IP = ws_ip;
             this.webServer_Port = ws_port;
-            this.webServer_Path = ws_path;
             //更新Web网址
             Update_Url();
         }
@@ -43,10 +41,7 @@ namespace WebManager
         /// </summary>
         private void Update_Url()
         {
-            if (this.webServer_Path.Substring(0, 1) != "/")
-            {
-                this.webServer_Path = "/" + this.webServer_Path;
-            }
+            this.webServer_Path = "/" + this.webServer_Path;
             this.Url = "http://" + this.webServer_IP + ":" + this.webServer_Port + this.webServer_Path;
         }
 
@@ -59,7 +54,6 @@ namespace WebManager
             set
             {
                 this.webServer_IP = value;
-                Update_Url();
             }
         }
 
@@ -72,20 +66,6 @@ namespace WebManager
             set
             {
                 this.webServer_Port = value;
-                Update_Url();
-            }
-        }
-
-        /// <summary>
-        /// WebServer的项目名
-        /// </summary>
-        public String WebServer_Path
-        {
-            //get { return this.webServer_IP; }
-            set
-            {
-                this.webServer_Path = value;
-                Update_Url();
             }
         }
 
@@ -114,6 +94,8 @@ namespace WebManager
         /// <returns>json字符串</returns>
         public void Img_OffsetAngle_Direction(String imagePath, out double degree, out int direction, out int state)
         {
+            this.webServer_Path = "test1";
+            Update_Url();
             JObject json = new JObject();
             json.Add("img_path", imagePath);
             String res = RequestString(JsonConvert.SerializeObject(json));
@@ -142,6 +124,8 @@ namespace WebManager
         /// <returns>json字符串</returns>
         public void Img_Cut_Position(String imagePath, out double offsetx, out double offsety, out int state)
         {
+            this.webServer_Path = "test2";
+            Update_Url();
             JObject json = new JObject();
             json.Add("img_path", imagePath);
             String res = RequestString(JsonConvert.SerializeObject(json));
@@ -170,6 +154,8 @@ namespace WebManager
         /// <returns>json字符串</returns>
         public void Img_Cut_Success(String imageBefore, String imageAfter, out int state)
         {
+            this.webServer_Path = "test3";
+            Update_Url();
             JObject json = new JObject();
             json.Add("img_before_path", imageBefore);
             json.Add("img_after_path", imageAfter);
@@ -192,6 +178,8 @@ namespace WebManager
         /// <returns>json字符串</returns>
         public void Img_Trapezoid_Top_Center_Position(String imagePath, out double offsetx, out double offsety, out int state)
         {
+            this.webServer_Path = "test4";
+            Update_Url();
             JObject json = new JObject();
             json.Add("img_path", imagePath);
             String res = RequestString(JsonConvert.SerializeObject(json));
@@ -219,6 +207,8 @@ namespace WebManager
         /// <returns>json字符串</returns>
         public String Img_Auto_Focus(List<String> imagePath)
         {
+            this.webServer_Path = "test5";
+            Update_Url();
             JObject json = new JObject();
             for(int i=0;i<imagePath.Count;i++)
             {
@@ -243,6 +233,8 @@ namespace WebManager
         /// <returns>json字符串</returns>
         public String Img_Auto_Stigmatic(List<String> imagePath)
         {
+            this.webServer_Path = "test6";
+            Update_Url();
             JObject json = new JObject();
             for (int i = 0; i < imagePath.Count; i++)
             {
@@ -267,6 +259,8 @@ namespace WebManager
         /// <returns>json字符串</returns>
         public void Img_Center_Position_OffsetAngle_Direction(String imagePath, out double offsetx, out double offsety, out double degree, out int direction, out int state)
         {
+            this.webServer_Path = "test7";
+            Update_Url();
             JObject json = new JObject();
             json.Add("img_path", imagePath);
             String res = RequestString(JsonConvert.SerializeObject(json));
@@ -301,6 +295,8 @@ namespace WebManager
         /// <returns>json字符串</returns>
         public void Img_Measure_Size(String imagePath, String ratio, String size, out int state)
         {
+            this.webServer_Path = "test8";
+            Update_Url();
             JObject json = new JObject();
             json.Add("img_path", imagePath);
             json.Add("ratio", ratio);

部分文件因为文件数量过多而无法显示