Selaa lähdekoodia

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

wb_han 5 vuotta sitten
vanhempi
commit
cc31ee39e0

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 602 - 320
HOZProject/FormUnitControl.Designer.cs


+ 115 - 2
HOZProject/FormUnitControl.cs

@@ -1477,10 +1477,11 @@ namespace HOZProject
         {
         {
             reloadconfig();
             reloadconfig();
             cbbWYP.SelectedIndex = 0;
             cbbWYP.SelectedIndex = 0;
-
             cbbWCS.SelectedIndex = 0;
             cbbWCS.SelectedIndex = 0;
-
             cbbWXZ.SelectedIndex = 0;
             cbbWXZ.SelectedIndex = 0;
+
+            this.chart1.Series[0].Points.Clear();
+            
         }
         }
 
 
         private void reloadconfig()
         private void reloadconfig()
@@ -1502,5 +1503,117 @@ namespace HOZProject
             }
             }
             
             
         }
         }
+
+
+        
+        private void btnPsFile_Click(object sender, EventArgs e)
+        {
+            OpenFileDialog sfd = new OpenFileDialog();
+            sfd.Title = "选择位置文件:";
+            //sfd.InitialDirectory = @"C:\ProgramData\Carl Zeiss\SmartSEM\User\Default";
+            sfd.Filter = "TXT文件|*.TXT";
+            if (sfd.ShowDialog() == DialogResult.OK)
+            {
+                //Console.WriteLine(sfd.FileName);
+
+                StreamReader sr = new StreamReader(sfd.FileName, Encoding.Default);
+                String line = "";
+                sr.ReadLine();
+                sr.ReadLine();
+                sr.ReadLine();
+                sr.ReadLine();
+                line = sr.ReadLine();
+                sr.Close();
+                sr.Dispose();
+                String[] lines = line.Split(',');
+                double x = Convert.ToDouble(lines[1]);
+                double y = Convert.ToDouble(lines[2]);
+                chart1.Series[0].Points.AddXY(x, y);
+                chart1.Series[0].Points[0].Label = x.ToString("0.000") + "," + y.ToString("0.000");
+            }
+        }
+
+        private void btnrect_Click(object sender, EventArgs e)
+        {
+            this.chart1.Series[0].Points.Clear();
+            List<double> xpoints = new List<double>();
+            List<double> ypoints = new List<double>();
+            //排列数
+            int rag = Convert.ToInt32(txtarray.Text);
+            //间距
+            double dist = Convert.ToDouble(txtdistance.Text);
+            //中心点x,y轴坐标
+            double cx = Convert.ToDouble(txtx.Text);
+            double cy = Convert.ToDouble(txty.Text);
+            //求样品1的水平角度
+            double angle = 0;
+
+            //xpoints.Add(Math.Pow(Math.Pow(Convert.ToDouble(txtx.Text), 2) + Math.Pow(Convert.ToDouble(txty.Text), 2), 0.5));
+            //ypoints.Add(Math.Pow(Math.Pow(Convert.ToDouble(txtx.Text), 2) + Math.Pow(Convert.ToDouble(txty.Text), 2), 0.5));
+            xpoints.Add(Convert.ToDouble(txtsample1x.Text));
+            ypoints.Add(Convert.ToDouble(txtsample1y.Text));
+
+            //计算第一个点与X轴的交角度数
+            angle = Math.Atan2(ypoints[0] - cy, cx - xpoints[0]) * 180 / Math.PI;
+            lblPs1.Text = angle.ToString("0.0");
+
+            //这里是求与第一个点横向排列的其他点的移动角度
+            //就是按45度向左向右移动的度
+            angle = 45 - angle;
+            angle = angle * Math.PI / 180;
+
+            txtsample1x.Text = xpoints[0].ToString("0.000");
+            txtsample1y.Text = ypoints[0].ToString("0.000");
+
+            chart1.Series[0].Points.AddXY(xpoints[0], ypoints[0]);
+            chart1.Series[0].Points[chart1.Series[0].Points.Count - 1].Label = xpoints[0].ToString("0.000") + "," + ypoints[0].ToString("0.000");
+
+            double tx = 0;
+            double ty = 0;
+            for (int j = 0; j < rag; j++)
+            {
+                //计算每行第一个点的坐标
+                if(j>0)
+                {
+                    tx = dist * j * Math.Sin(angle);
+                    ty = dist * j * Math.Cos(angle);
+                    xpoints.Add(tx + xpoints[0]);
+                    ypoints.Add(ypoints[0] - ty);
+                    chart1.Series[0].Points.AddXY(xpoints[xpoints.Count-1], ypoints[ypoints.Count-1]);
+                    chart1.Series[0].Points[chart1.Series[0].Points.Count - 1].Label = xpoints[xpoints.Count - 1].ToString("0.000") + "," + ypoints[ypoints.Count - 1].ToString("0.000");
+                }
+                //计算每行其他点的坐标
+                for (int i = 1; i < rag; i++)
+                {
+                    tx = dist * i * Math.Cos(angle);
+                    ty = dist * i * Math.Sin(angle);
+                    xpoints.Add(tx + xpoints[j * rag]);
+                    ypoints.Add(ty + ypoints[j * rag]);
+                    chart1.Series[0].Points.AddXY(xpoints[xpoints.Count - 1], ypoints[ypoints.Count - 1]);
+                    chart1.Series[0].Points[chart1.Series[0].Points.Count - 1].Label = xpoints[xpoints.Count - 1].ToString("0.000") + "," + ypoints[ypoints.Count - 1].ToString("0.000");
+                }
+            }
+        }
+
+        private void btn30_Click(object sender, EventArgs e)
+        {
+            txtsample1x.Text = "21.7";
+            txtsample1y.Text = "90";
+            btnrect_Click(null, null);
+        }
+
+        private void btn45_Click(object sender, EventArgs e)
+        {
+            txtsample1x.Text = "29.65";
+            txtsample1y.Text = "100.35";
+            btnrect_Click(null, null);
+        }
+
+        private void btn60_Click(object sender, EventArgs e)
+        {
+            txtsample1x.Text = "40";
+            txtsample1y.Text = "108.3";
+            btnrect_Click(null, null);
+        }
     }
     }
 }
 }

+ 1 - 0
HOZProject/UnitControl.csproj

@@ -37,6 +37,7 @@
     <Reference Include="System" />
     <Reference Include="System" />
     <Reference Include="System.Configuration" />
     <Reference Include="System.Configuration" />
     <Reference Include="System.Core" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Windows.Forms.DataVisualization" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />
     <Reference Include="Microsoft.CSharp" />

+ 272 - 0
MeasureThread/Measure.cs

@@ -43,11 +43,283 @@ namespace MeasureThread
         }
         }
         private DateTime m_time;
         private DateTime m_time;
 
 
+        public int Step_Code
+        {
+            get { return step_Code; }
+            set { step_Code = value; }
+        }
+        private int step_Code;
+
+        //图片信息
+        public class PictureInformation
+        {
+            public Boolean Is_Picture
+            {
+                get { return is_Picture; }
+                set { is_Picture = value; }
+            }
+            private Boolean is_Picture;
+
+            public String Picture_FullPath
+            {
+                get { return picture_FullPath; }
+                set { picture_FullPath = value; }
+            }
+            private String picture_FullPath;
+
+            public double Work_Voltage
+            {
+                get { return work_Voltage; }
+                set { work_Voltage = value; }
+            }
+            private double work_Voltage;
+
+            public double Magnification
+            {
+                get { return magnification; }
+                set { magnification = value; }
+            }
+            private double magnification;
+
+            public double Work_Distance
+            {
+                get { return work_Distance; }
+                set { work_Distance = value; }
+            }
+            private double work_Distance;
+
+            public String Work_Status
+            {
+                get { return work_Status; }
+                set { work_Status = value; }
+            }
+            private String work_Status;
+        }
+        //图片信息实例类
+        public PictureInformation Picture_Information
+        {
+            get { return picture_Information; }
+            set { picture_Information = value; }
+        }
+        private PictureInformation picture_Information;
+
+        //图像信息
+        public class ImageInformation
+        {
+            public int Method_Name
+            {
+                get { return method_Name; }
+                set { method_Name = value; }
+            }
+            private int method_Name;
+
+            public Source_Img_Degree_Direction SIDD;
+            public Cut_Position CP;
+            public Cut_Success CS;
+            public Trapezoid_Top_Center_Position TTCP;
+            public Auto_Foucs AF;
+            public Auto_Stigmatic AS;
+            public Center_Position_OffsetAngle_Direction CPOD;
+            public Measure_Size MS;
+
+            public ImageInformation()
+            {
+                SIDD = new Source_Img_Degree_Direction();
+                CP = new Cut_Position();
+                CS = new Cut_Success();
+                TTCP = new Trapezoid_Top_Center_Position();
+                AF = new Auto_Foucs();
+                AS = new Auto_Stigmatic();
+                CPOD = new Center_Position_OffsetAngle_Direction();
+                MS = new Measure_Size();
+            }
+
+            //1-计算原始图像偏移角度及方向
+            public class Source_Img_Degree_Direction
+            {
+                public Boolean Is_Image = false;
+
+                public double Degree
+                {
+                    get { return degree; }
+                    set { degree = value; }
+                }
+                private double degree;
+
+                public int Direction
+                {
+                    get { return direction; }
+                    set { direction = value; }
+                }
+                private int direction;
+
+                public int State
+                {
+                    get { return state; }
+                    set { state = value; }
+                }
+                private int state;
+            }
+
+            //2-计算切割点位置
+            public class Cut_Position
+            {
+                public Boolean Is_Image = false;
+
+                public double Offsetx
+                {
+                    get { return offsetx; }
+                    set { offsetx = value; }
+                }
+                private double offsetx;
+
+                public double Offsety
+                {
+                    get { return offsety; }
+                    set { offsety = value; }
+                }
+                private double offsety;
+
+                public int State
+                {
+                    get { return state; }
+                    set { state = value; }
+                }
+                private int state;
+            }
+
+            //3-是否切割成功
+            public class Cut_Success
+            {
+                public Boolean Is_Image = false;
+
+                public int State
+                {
+                    get { return state; }
+                    set { state = value; }
+                }
+                private int state;
+
+            }
+
+            //4-计算切割后图像梯形区域上边中心点坐标
+            public class Trapezoid_Top_Center_Position
+            {
+                public Boolean Is_Image = false;
+
+                public double TopCenterX
+                {
+                    get { return topCenterX; }
+                    set { topCenterX = value; }
+                }
+                private double topCenterX;
+
+                public double TopCenterY
+                {
+                    get { return topCenterY; }
+                    set { topCenterY = value; }
+                }
+                private double topCenterY;
+
+                public int State
+                {
+                    get { return state; }
+                    set { state = value; }
+                }
+                private int state;
+            }
+
+            //5-自动对焦
+            public class Auto_Foucs
+            {
+                public Boolean Is_Image = true;
+
+                public String Img_Path
+                {
+                    get { return img_Path; }
+                    set { img_Path = value; }
+                }
+                private String img_Path;
+            }
+
+            //6-自动像闪
+            public class Auto_Stigmatic
+            {
+                public Boolean Is_Image = true;
+
+                public String Img_Path
+                {
+                    get { return img_Path; }
+                    set { img_Path = value; }
+                }
+                private String img_Path;
+            }
+
+            //7-计算切割面区域中心坐标,以及偏移角度及方向
+            public class Center_Position_OffsetAngle_Direction
+            {
+                public Boolean Is_Image = false; 
+
+                public double CenterX
+                {
+                    get { return centerX; }
+                    set { centerX = value; }
+                }
+                private double centerX;
+
+                public double CenterY
+                {
+                    get { return centerY; }
+                    set { centerY = value; }
+                }
+                private double centerY;
+
+                public double Degree
+                {
+                    get { return degree; }
+                    set { degree = value; }
+                }
+                private double degree;
+
+                public int Direction
+                {
+                    get { return direction; }
+                    set { direction = value; }
+                }
+                private int direction;
+
+                public int State
+                {
+                    get { return state; }
+                    set { state = value; }
+                }
+                private int state;
+            }
+
+            //8-测量尺寸
+            public class Measure_Size
+            {
+                public Boolean Is_Image = false;
+
+                public int State
+                {
+                    get { return state; }
+                    set { state = value; }
+                }
+                private int state;
+            }
+        }
+
         public ThreadStatusEventArgs(string a_State)
         public ThreadStatusEventArgs(string a_State)
         {
         {
             this.m_state = a_State;
             this.m_state = a_State;
+            picture_Information = new PictureInformation();
         }
         }
     }
     }
+
+
+
+
     public class CutHolesStatusEventArgs
     public class CutHolesStatusEventArgs
     {
     {
         public string State
         public string State

+ 10 - 2
WebManager/WebResult.cs

@@ -91,6 +91,8 @@ namespace WebManager
         /// 计算原始图像偏移角度及方向
         /// 计算原始图像偏移角度及方向
         /// </summary>
         /// </summary>
         /// <param name="imagePath">图片路径</param>
         /// <param name="imagePath">图片路径</param>
+        /// <param name="imageType">孔类型</param>
+        /// <param name="firm">厂家类型</param>
         /// <returns>json字符串</returns>
         /// <returns>json字符串</returns>
         public void Img_OffsetAngle_Direction(String imagePath, int imageType, String firm, out double degree, out int direction, out int state)
         public void Img_OffsetAngle_Direction(String imagePath, int imageType, String firm, out double degree, out int direction, out int state)
         {
         {
@@ -122,13 +124,17 @@ namespace WebManager
         /// 计算切割点位置
         /// 计算切割点位置
         /// </summary>
         /// </summary>
         /// <param name="imagePath">图片路径</param>
         /// <param name="imagePath">图片路径</param>
+        /// <param name="imageType">孔类型</param>
+        /// <param name="firm">厂家类型</param>
         /// <returns>json字符串</returns>
         /// <returns>json字符串</returns>
-        public void Img_Cut_Position(String imagePath, out double offsetx, out double offsety, out int state)
+        public void Img_Cut_Position(String imagePath, int imageType, String firm, out double offsetx, out double offsety, out int state)
         {
         {
             this.webServer_Path = "test2";
             this.webServer_Path = "test2";
             Update_Url();
             Update_Url();
             JObject json = new JObject();
             JObject json = new JObject();
             json.Add("img_path", imagePath);
             json.Add("img_path", imagePath);
+            json.Add("img_type", imageType);
+            json.Add("firm", firm);
             String res = RequestString(JsonConvert.SerializeObject(json));
             String res = RequestString(JsonConvert.SerializeObject(json));
             JObject jret = (JObject)JsonConvert.DeserializeObject(res);
             JObject jret = (JObject)JsonConvert.DeserializeObject(res);
             if (jret != null && jret.Property("img_name") != null && jret.Property("img_name").ToString() != "")
             if (jret != null && jret.Property("img_name") != null && jret.Property("img_name").ToString() != "")
@@ -258,12 +264,14 @@ namespace WebManager
         /// </summary>
         /// </summary>
         /// <param name="imagePath">图片路径</param>
         /// <param name="imagePath">图片路径</param>
         /// <returns>json字符串</returns>
         /// <returns>json字符串</returns>
-        public void Img_Center_Position_OffsetAngle_Direction(String imagePath, out double offsetx, out double offsety, out double degree, out int direction, out int state)
+        public void Img_Center_Position_OffsetAngle_Direction(String imagePath, int imageType, String firm, out double offsetx, out double offsety, out double degree, out int direction, out int state)
         {
         {
             this.webServer_Path = "test7";
             this.webServer_Path = "test7";
             Update_Url();
             Update_Url();
             JObject json = new JObject();
             JObject json = new JObject();
             json.Add("img_path", imagePath);
             json.Add("img_path", imagePath);
+            json.Add("img_type", imageType);
+            json.Add("firm", firm);
             String res = RequestString(JsonConvert.SerializeObject(json));
             String res = RequestString(JsonConvert.SerializeObject(json));
             JObject jret = (JObject)JsonConvert.DeserializeObject(res);
             JObject jret = (JObject)JsonConvert.DeserializeObject(res);
             if (jret != null && jret.Property("img_name") != null && jret.Property("img_name").ToString() != "")
             if (jret != null && jret.Property("img_name") != null && jret.Property("img_name").ToString() != "")

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä