Prechádzať zdrojové kódy

增加钉盘导入程序

@wang_qi0307 5 rokov pred
rodič
commit
e81ab52099

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 602 - 320
HOZProject/FormUnitControl.Designer.cs


+ 120 - 2
HOZProject/FormUnitControl.cs

@@ -43,6 +43,11 @@ namespace HOZProject
         String[] sT;
         String[] firms;
         Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
+
+        int pw = 0;
+        int ph = 0;
+        int lw = 0;
+        int lh = 0;
         #endregion
 
         #region 构造函数
@@ -1477,10 +1482,11 @@ namespace HOZProject
         {
             reloadconfig();
             cbbWYP.SelectedIndex = 0;
-
             cbbWCS.SelectedIndex = 0;
-
             cbbWXZ.SelectedIndex = 0;
+
+            this.chart1.Series[0].Points.Clear();
+            
         }
 
         private void reloadconfig()
@@ -1502,5 +1508,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.Configuration" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Windows.Forms.DataVisualization" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov