add goto zero button after test

This commit is contained in:
CVE
2025-11-24 15:31:55 +08:00
parent 4541dc88cc
commit 5963f0d772
3 changed files with 140 additions and 20 deletions

View File

@@ -72,6 +72,11 @@
this.nud_SizeX = new System.Windows.Forms.NumericUpDown();
this.btn_Action = new System.Windows.Forms.Button();
this.btn_ToZero = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.textBox4 = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -97,6 +102,11 @@
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.label4);
this.splitContainer1.Panel2.Controls.Add(this.textBox4);
this.splitContainer1.Panel2.Controls.Add(this.label3);
this.splitContainer1.Panel2.Controls.Add(this.textBox1);
this.splitContainer1.Panel2.Controls.Add(this.button1);
this.splitContainer1.Panel2.Controls.Add(this.textBox2);
this.splitContainer1.Panel2.Controls.Add(this.label1);
this.splitContainer1.Panel2.Controls.Add(this.textBox3);
@@ -194,7 +204,7 @@
// lbl_Time
//
this.lbl_Time.AutoSize = true;
this.lbl_Time.Location = new System.Drawing.Point(655, 25);
this.lbl_Time.Location = new System.Drawing.Point(655, 8);
this.lbl_Time.Name = "lbl_Time";
this.lbl_Time.Size = new System.Drawing.Size(65, 12);
this.lbl_Time.TabIndex = 32;
@@ -202,7 +212,7 @@
//
// txt_Time
//
this.txt_Time.Location = new System.Drawing.Point(741, 22);
this.txt_Time.Location = new System.Drawing.Point(741, 5);
this.txt_Time.Name = "txt_Time";
this.txt_Time.ReadOnly = true;
this.txt_Time.Size = new System.Drawing.Size(129, 21);
@@ -222,13 +232,13 @@
this.txt_Times.Location = new System.Drawing.Point(274, 14);
this.txt_Times.Name = "txt_Times";
this.txt_Times.ReadOnly = true;
this.txt_Times.Size = new System.Drawing.Size(129, 21);
this.txt_Times.Size = new System.Drawing.Size(86, 21);
this.txt_Times.TabIndex = 29;
//
// lbl_RMS
//
this.lbl_RMS.AutoSize = true;
this.lbl_RMS.Location = new System.Drawing.Point(655, 133);
this.lbl_RMS.Location = new System.Drawing.Point(655, 98);
this.lbl_RMS.Name = "lbl_RMS";
this.lbl_RMS.Size = new System.Drawing.Size(71, 12);
this.lbl_RMS.TabIndex = 28;
@@ -236,7 +246,7 @@
//
// txt_RMS
//
this.txt_RMS.Location = new System.Drawing.Point(741, 130);
this.txt_RMS.Location = new System.Drawing.Point(741, 95);
this.txt_RMS.Name = "txt_RMS";
this.txt_RMS.ReadOnly = true;
this.txt_RMS.Size = new System.Drawing.Size(129, 21);
@@ -245,7 +255,7 @@
// lbl_RotationR
//
this.lbl_RotationR.AutoSize = true;
this.lbl_RotationR.Location = new System.Drawing.Point(655, 106);
this.lbl_RotationR.Location = new System.Drawing.Point(655, 74);
this.lbl_RotationR.Name = "lbl_RotationR";
this.lbl_RotationR.Size = new System.Drawing.Size(77, 12);
this.lbl_RotationR.TabIndex = 26;
@@ -253,7 +263,7 @@
//
// txt_RR
//
this.txt_RR.Location = new System.Drawing.Point(741, 103);
this.txt_RR.Location = new System.Drawing.Point(741, 71);
this.txt_RR.Name = "txt_RR";
this.txt_RR.ReadOnly = true;
this.txt_RR.Size = new System.Drawing.Size(129, 21);
@@ -302,7 +312,7 @@
// lbl_DR
//
this.lbl_DR.AutoSize = true;
this.lbl_DR.Location = new System.Drawing.Point(655, 214);
this.lbl_DR.Location = new System.Drawing.Point(655, 171);
this.lbl_DR.Name = "lbl_DR";
this.lbl_DR.Size = new System.Drawing.Size(65, 12);
this.lbl_DR.TabIndex = 20;
@@ -310,7 +320,7 @@
//
// txt_DR
//
this.txt_DR.Location = new System.Drawing.Point(741, 211);
this.txt_DR.Location = new System.Drawing.Point(741, 168);
this.txt_DR.Name = "txt_DR";
this.txt_DR.ReadOnly = true;
this.txt_DR.Size = new System.Drawing.Size(129, 21);
@@ -319,7 +329,7 @@
// lbl_DY
//
this.lbl_DY.AutoSize = true;
this.lbl_DY.Location = new System.Drawing.Point(655, 187);
this.lbl_DY.Location = new System.Drawing.Point(655, 146);
this.lbl_DY.Name = "lbl_DY";
this.lbl_DY.Size = new System.Drawing.Size(65, 12);
this.lbl_DY.TabIndex = 18;
@@ -327,7 +337,7 @@
//
// txt_DY
//
this.txt_DY.Location = new System.Drawing.Point(741, 184);
this.txt_DY.Location = new System.Drawing.Point(741, 143);
this.txt_DY.Name = "txt_DY";
this.txt_DY.ReadOnly = true;
this.txt_DY.Size = new System.Drawing.Size(129, 21);
@@ -336,7 +346,7 @@
// lbl_DX
//
this.lbl_DX.AutoSize = true;
this.lbl_DX.Location = new System.Drawing.Point(655, 160);
this.lbl_DX.Location = new System.Drawing.Point(655, 122);
this.lbl_DX.Name = "lbl_DX";
this.lbl_DX.Size = new System.Drawing.Size(65, 12);
this.lbl_DX.TabIndex = 16;
@@ -344,7 +354,7 @@
//
// txt_DX
//
this.txt_DX.Location = new System.Drawing.Point(741, 157);
this.txt_DX.Location = new System.Drawing.Point(741, 119);
this.txt_DX.Name = "txt_DX";
this.txt_DX.ReadOnly = true;
this.txt_DX.Size = new System.Drawing.Size(129, 21);
@@ -353,7 +363,7 @@
// lbl_RotationY
//
this.lbl_RotationY.AutoSize = true;
this.lbl_RotationY.Location = new System.Drawing.Point(655, 79);
this.lbl_RotationY.Location = new System.Drawing.Point(655, 52);
this.lbl_RotationY.Name = "lbl_RotationY";
this.lbl_RotationY.Size = new System.Drawing.Size(77, 12);
this.lbl_RotationY.TabIndex = 14;
@@ -361,7 +371,7 @@
//
// txt_RY
//
this.txt_RY.Location = new System.Drawing.Point(741, 76);
this.txt_RY.Location = new System.Drawing.Point(741, 49);
this.txt_RY.Name = "txt_RY";
this.txt_RY.ReadOnly = true;
this.txt_RY.Size = new System.Drawing.Size(129, 21);
@@ -370,7 +380,7 @@
// lbl_RotationX
//
this.lbl_RotationX.AutoSize = true;
this.lbl_RotationX.Location = new System.Drawing.Point(655, 52);
this.lbl_RotationX.Location = new System.Drawing.Point(655, 30);
this.lbl_RotationX.Name = "lbl_RotationX";
this.lbl_RotationX.Size = new System.Drawing.Size(77, 12);
this.lbl_RotationX.TabIndex = 12;
@@ -378,7 +388,7 @@
//
// txt_RX
//
this.txt_RX.Location = new System.Drawing.Point(741, 49);
this.txt_RX.Location = new System.Drawing.Point(741, 27);
this.txt_RX.Name = "txt_RX";
this.txt_RX.ReadOnly = true;
this.txt_RX.Size = new System.Drawing.Size(129, 21);
@@ -427,9 +437,9 @@
//
// btn_RunTest
//
this.btn_RunTest.Location = new System.Drawing.Point(409, 14);
this.btn_RunTest.Location = new System.Drawing.Point(366, 14);
this.btn_RunTest.Name = "btn_RunTest";
this.btn_RunTest.Size = new System.Drawing.Size(119, 23);
this.btn_RunTest.Size = new System.Drawing.Size(76, 23);
this.btn_RunTest.TabIndex = 9;
this.btn_RunTest.Text = "启动检测";
this.btn_RunTest.UseVisualStyleBackColor = true;
@@ -543,6 +553,50 @@
this.btn_ToZero.UseVisualStyleBackColor = true;
this.btn_ToZero.Click += new System.EventHandler(this.btn_ToZero_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(450, 14);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(76, 23);
this.button1.TabIndex = 37;
this.button1.Text = "去零角度";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(655, 195);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(59, 12);
this.label3.TabIndex = 39;
this.label3.Text = "去零角度X";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(741, 192);
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(129, 21);
this.textBox1.TabIndex = 38;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(655, 219);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(59, 12);
this.label4.TabIndex = 41;
this.label4.Text = "去零角度Y";
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(741, 216);
this.textBox4.Name = "textBox4";
this.textBox4.ReadOnly = true;
this.textBox4.Size = new System.Drawing.Size(129, 21);
this.textBox4.TabIndex = 40;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -611,6 +665,11 @@
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBox1;
}
}

View File

@@ -374,6 +374,8 @@ namespace WaferAlignment
Task.Run(() =>
{
splitContainer1.Invoke(new Action(() => splitContainer1.Panel2.Enabled = false));
m_roateX = 0;
m_roateY = 0;
string str = "";
str = ToZero();
MessageBox.Show(str);
@@ -676,7 +678,8 @@ namespace WaferAlignment
txt_DX.Text = dX.ToString();
txt_DY.Text = dY.ToString();
txt_DR.Text = dR.ToString();
textBox1.Text = "";
textBox4.Text = "";
}
private void ClearDisplay()
{
@@ -770,5 +773,51 @@ namespace WaferAlignment
{
m_roateY = Convert.ToDouble(nud_SizeY.Value);
}
private void button1_Click(object sender, EventArgs e)
{
if (angle > 0)
{
double exr = 360 - angle;
var cir = Rotation2D.RotatePointDegrees(Convert.ToDouble(TCP_X), Convert.ToDouble(TCP_Y), m_roateX, m_roateY, exr, true, false);
CogGraphicCollection graphics = new CogGraphicCollection();
AddPointMarker(graphics, cir.x, cir.y, CogColorConstants.Purple);
cogRecordDisplay1.StaticGraphics.AddList(graphics, "");
textBox1.Text = cir.x.ToString("F4");
textBox4.Text = cir.y.ToString("F4"); ;
if (_s7 != null)
{
_s7.SetValue(arMode, (ushort)0);
//_s7.SetValue(arSizeX, Convert.ToSingle(nud_SizeX.Value));
//_s7.SetValue(arSizeY, Convert.ToSingle(nud_SizeY.Value));
_s7.SetValue(arSizeR, Convert.ToSingle(exr));
_s7.SetValue(arAction, true);
Thread.Sleep(20);
while (true)
{
bool value = false;
if (_s7.GetValue(arOver, out value))
{
if (value)
{
_s7.SetValue(arAction, false);
break;
}
else
{
Thread.Sleep(20);
continue;
}
}
else
{
Thread.Sleep(20);
continue;
}
}
}
}
}
}
}

View File

@@ -140,4 +140,16 @@
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>