mirror of
https://github.com/eggplantlwj/VisionEdit.git
synced 2026-03-28 11:16:34 +08:00
传输优化
This commit is contained in:
Binary file not shown.
@@ -46,6 +46,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="FindLine.cs" />
|
||||
<Compile Include="FindLineToolRun.cs" />
|
||||
<Compile Include="FormFindLine.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -68,14 +69,30 @@
|
||||
<Project>{DF3D4D4C-02DF-4F92-9FD4-0A861F64B0EF}</Project>
|
||||
<Name>DataStruct</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\HalconWindowTest\HalconWindow.csproj">
|
||||
<Project>{4ADC75AE-59C7-4D36-B675-A6CE51B6F5BA}</Project>
|
||||
<Name>HalconWindow</Name>
|
||||
<ProjectReference Include="..\FormLib\FormLib.csproj">
|
||||
<Project>{8c6fc8c6-8874-494b-8260-071f291aa33d}</Project>
|
||||
<Name>FormLib</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ImageWindow\HWindow_Tool.csproj">
|
||||
<Project>{9BAA53FD-89B5-43E2-AC59-A27B006DEBB6}</Project>
|
||||
<Name>HWindow_Tool</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ToolBase\ToolBase.csproj">
|
||||
<Project>{7CD50B44-BF56-4E8E-8FA1-05F6968C1835}</Project>
|
||||
<Name>ToolBase</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ToolLib.Log\LogForm\LogForm.csproj">
|
||||
<Project>{6b38d68f-e77b-4761-bde5-a261ea8925dd}</Project>
|
||||
<Name>LogForm</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ToolLib.Log\Logger\Logger.csproj">
|
||||
<Project>{d4e052b9-e541-4b67-a1f9-273073ef1d4b}</Project>
|
||||
<Name>Logger</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ToolLib.VisionJob\ToolLib.VisionJob.csproj">
|
||||
<Project>{16e8ff17-98a8-4452-ab9e-c433dc9c21f7}</Project>
|
||||
<Name>ToolLib.VisionJob</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
67
FindLine/FindLineToolRun.cs
Normal file
67
FindLine/FindLineToolRun.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* ==============================================================================
|
||||
*
|
||||
* Filename: FindLineToolRun
|
||||
* Description:
|
||||
*
|
||||
* Version: 1.0
|
||||
* Created: 2021/2/25 16:23:29
|
||||
*
|
||||
* Author: liu.wenjie
|
||||
*
|
||||
* ==============================================================================
|
||||
*/
|
||||
using CommonMethods;
|
||||
using CommonMethods.Interface;
|
||||
using FormLib;
|
||||
using HalconDotNet;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using ToolLib.VisionJob;
|
||||
|
||||
namespace FindLineTool
|
||||
{
|
||||
public class FindLineRun : IToolRun
|
||||
{
|
||||
public void ToolRun(string jobName, int toolIndex, int inputItemNum, TreeNode selectNode, List<IToolInfo> L_toolList)
|
||||
{
|
||||
FindLine myFindLine = (FindLine)L_toolList[toolIndex].tool;
|
||||
VisionJob myJob = VisionJobParams.pVisionProject.Project[jobName];
|
||||
for (int j = 0; j < inputItemNum; j++)
|
||||
{
|
||||
if (L_toolList[toolIndex].GetInput(L_toolList[toolIndex].toolInput[j].IOName).value == null)
|
||||
{
|
||||
selectNode.ForeColor = Color.Red;
|
||||
Logger.LoggerClass.WriteLog(L_toolList[toolIndex].toolName + " 无输入图像", Logger.MsgLevel.Exception);
|
||||
}
|
||||
else
|
||||
{
|
||||
string sourceFrom = L_toolList[toolIndex].GetInput(L_toolList[toolIndex].toolInput[j].IOName).value.ToString();
|
||||
if (L_toolList[toolIndex].toolInput[j].IOName == "InputImage")
|
||||
{
|
||||
string sourceToolName = Regex.Split(sourceFrom, " . ")[0];
|
||||
sourceToolName = sourceToolName.Substring(3, Regex.Split(sourceFrom, " . ")[0].Length - 3);
|
||||
string toolItem = Regex.Split(sourceFrom, " . ")[1];
|
||||
myFindLine.inputImage = myJob.GetToolInfoByToolName(sourceToolName).GetOutput(toolItem).value as HObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
myFindLine.Run(SoftwareRunState.Release);
|
||||
if (myFindLine.toolRunStatu == ToolRunStatu.Succeed)
|
||||
{
|
||||
myFindLine.DispMainWindow(FormImageWindow.Instance.myHWindow);
|
||||
myJob.FormLogDisp(L_toolList[toolIndex].toolName + " 运行成功", Color.Green, selectNode);
|
||||
}
|
||||
else
|
||||
{
|
||||
myJob.FormLogDisp(L_toolList[toolIndex].toolName + " 运行失败", Color.Red, selectNode, Logger.MsgLevel.Exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
50
FindLine/FormFindLine.Designer.cs
generated
50
FindLine/FormFindLine.Designer.cs
generated
@@ -70,7 +70,10 @@
|
||||
this.btn_runFindLineTool = new System.Windows.Forms.Button();
|
||||
this.btn_moveCliperRegion = new System.Windows.Forms.Button();
|
||||
this.cbx_edgeSelect = new System.Windows.Forms.ComboBox();
|
||||
this.txbLog = new System.Windows.Forms.TextBox();
|
||||
this.statusStrip = new System.Windows.Forms.StatusStrip();
|
||||
this.lb_RunStatus = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.lb_RunTime = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
@@ -78,6 +81,7 @@
|
||||
this.groupBox3.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.statusStrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitContainer1
|
||||
@@ -538,22 +542,41 @@
|
||||
this.cbx_edgeSelect.TabIndex = 317;
|
||||
this.cbx_edgeSelect.Text = "all";
|
||||
//
|
||||
// txbLog
|
||||
// statusStrip
|
||||
//
|
||||
this.txbLog.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txbLog.Location = new System.Drawing.Point(0, 487);
|
||||
this.txbLog.Name = "txbLog";
|
||||
this.txbLog.ReadOnly = true;
|
||||
this.txbLog.Size = new System.Drawing.Size(1129, 21);
|
||||
this.txbLog.TabIndex = 274;
|
||||
this.statusStrip.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.lb_RunStatus,
|
||||
this.toolStripStatusLabel2,
|
||||
this.lb_RunTime});
|
||||
this.statusStrip.Location = new System.Drawing.Point(0, 484);
|
||||
this.statusStrip.Name = "statusStrip";
|
||||
this.statusStrip.Size = new System.Drawing.Size(1127, 24);
|
||||
this.statusStrip.TabIndex = 1;
|
||||
this.statusStrip.Text = "statusStrip1";
|
||||
//
|
||||
// lb_RunStatus
|
||||
//
|
||||
this.lb_RunStatus.Name = "lb_RunStatus";
|
||||
this.lb_RunStatus.Size = new System.Drawing.Size(0, 19);
|
||||
//
|
||||
// toolStripStatusLabel2
|
||||
//
|
||||
this.toolStripStatusLabel2.Name = "toolStripStatusLabel2";
|
||||
this.toolStripStatusLabel2.Size = new System.Drawing.Size(137, 19);
|
||||
this.toolStripStatusLabel2.Text = " ";
|
||||
//
|
||||
// lb_RunTime
|
||||
//
|
||||
this.lb_RunTime.Name = "lb_RunTime";
|
||||
this.lb_RunTime.Size = new System.Drawing.Size(0, 19);
|
||||
//
|
||||
// FormFindLine
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1127, 508);
|
||||
this.Controls.Add(this.txbLog);
|
||||
this.Controls.Add(this.statusStrip);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "FormFindLine";
|
||||
@@ -571,6 +594,8 @@
|
||||
this.groupBox1.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.statusStrip.ResumeLayout(false);
|
||||
this.statusStrip.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -611,7 +636,6 @@
|
||||
public System.Windows.Forms.Button btn_runFindLineTool;
|
||||
private System.Windows.Forms.Button btn_moveCliperRegion;
|
||||
public System.Windows.Forms.ComboBox cbx_edgeSelect;
|
||||
public System.Windows.Forms.TextBox txbLog;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Label label15;
|
||||
public System.Windows.Forms.TextBox tbx_Sigma;
|
||||
@@ -620,5 +644,9 @@
|
||||
private System.Windows.Forms.CheckBox chBDispRec;
|
||||
private System.Windows.Forms.Label label16;
|
||||
public System.Windows.Forms.TextBox tbx_caliperLength2;
|
||||
public System.Windows.Forms.StatusStrip statusStrip;
|
||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2;
|
||||
public System.Windows.Forms.ToolStripStatusLabel lb_RunTime;
|
||||
public System.Windows.Forms.ToolStripStatusLabel lb_RunStatus;
|
||||
}
|
||||
}
|
||||
@@ -1,219 +1,234 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using CommonMethods;
|
||||
using HalconDotNet;
|
||||
using HalconWindow.HalconWindow;
|
||||
|
||||
namespace FindLineTool
|
||||
{
|
||||
public partial class FormFindLine : Form
|
||||
{
|
||||
public FindLine myFindLine = null;
|
||||
public IToolInfo myToolInfo = null;
|
||||
public HWindow_Final myHwindow = new HWindow_Final();
|
||||
/// <summary>
|
||||
/// 窗体对象实例
|
||||
/// </summary>
|
||||
private static FormFindLine _instance;
|
||||
public static FormFindLine Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_instance != null)
|
||||
{
|
||||
lock (_instance)
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
object line = new object();
|
||||
_instance = new FormFindLine(ref line);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
object line = new object();
|
||||
_instance = new FormFindLine(ref line);
|
||||
return _instance;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public FormFindLine(ref object findLine)
|
||||
{
|
||||
InitializeComponent();
|
||||
_instance = this;
|
||||
myToolInfo = (IToolInfo)findLine;
|
||||
myFindLine = (FindLine)myToolInfo.tool;
|
||||
//myFindLine.inputImage = ComGlobalParams.inputImageGlobal; // 暂时直接将图像传递给该工具
|
||||
myFindLine.DispImage();
|
||||
|
||||
}
|
||||
|
||||
private void FormFindLine_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.panel1.Controls.Add(myHwindow);
|
||||
myHwindow.Dock = DockStyle.Fill;
|
||||
InitTool();
|
||||
}
|
||||
|
||||
private void btn_moveCliperRegion_Click(object sender, EventArgs e)
|
||||
{
|
||||
myFindLine.UpdateImage();
|
||||
myFindLine.DrawExpectLine(myHwindow);
|
||||
}
|
||||
|
||||
|
||||
public void TextBoxMessageDisp(string mes, Color setColor)
|
||||
{
|
||||
txbLog.BackColor = setColor;
|
||||
txbLog.Text = mes;
|
||||
txbLog.Font = new Font("微软雅黑", 10, FontStyle.Bold);
|
||||
// CommonMethods.CommonMethods.Delay(2000);
|
||||
txbLog.BackColor = Color.White;
|
||||
}
|
||||
|
||||
private void btn_runFindLineTool_Click(object sender, EventArgs e)
|
||||
{
|
||||
// 更改界面中参数,实时更新类中参数
|
||||
myFindLine.expectLineStartRow = Convert.ToDouble(tbx_expectLineStartRow.Text.Trim());
|
||||
myFindLine.expectLineStartCol = Convert.ToDouble(tbx_expectLineStartCol.Text.Trim());
|
||||
myFindLine.expectLineEndRow = Convert.ToDouble(tbx_expectLineEndRow.Text.Trim());
|
||||
myFindLine.expectLineEndCol = Convert.ToDouble(tbx_expectLineEndCol.Text.Trim());
|
||||
// 运行参数
|
||||
myFindLine.minScore = Convert.ToDouble(tbx_minScore.Text.Trim());
|
||||
myFindLine.cliperNum = Convert.ToInt16(tbx_caliperNum.Text.Trim());
|
||||
myFindLine.threshold = Convert.ToInt16(tbx_threshold.Text.Trim());
|
||||
myFindLine.length = Convert.ToInt16(tbx_caliperLength.Text.Trim());
|
||||
myFindLine.weidth = Convert.ToInt16(tbx_caliperLength2.Text.Trim());
|
||||
myFindLine.polarity = cbx_polarity.SelectedItem.ToString() == "从明到暗" ? "negative":"positive";
|
||||
myFindLine.edgeSelect = cbx_edgeSelect.SelectedItem.ToString();
|
||||
myFindLine.sigma = Convert.ToDouble(tbx_Sigma.Text.Trim());
|
||||
// Run
|
||||
myFindLine.Run(SoftwareRunState.Debug);
|
||||
}
|
||||
|
||||
public void InitTool()
|
||||
{
|
||||
this.Text = myToolInfo.toolName;
|
||||
btn_runFindLineTool.Focus();
|
||||
Application.DoEvents();
|
||||
|
||||
//myFindLine.Run(); //运行一下,使卡尺显示出来
|
||||
|
||||
tbx_expectLineStartRow.Text = myFindLine.expectLineStartRow.ToString();
|
||||
tbx_expectLineStartCol.Text = myFindLine.expectLineStartCol.ToString();
|
||||
tbx_expectLineEndRow.Text = myFindLine.expectLineEndRow.ToString();
|
||||
tbx_expectLineEndCol.Text = myFindLine.expectLineEndCol.ToString();
|
||||
cbx_edgeSelect.Text = myFindLine.edgeSelect;
|
||||
tbx_minScore.Text = myFindLine.minScore.ToString();
|
||||
cbx_polarity.Text = myFindLine.polarity == "positive" ? "从暗到明" : "从明到暗";
|
||||
tbx_caliperNum.Text = myFindLine.cliperNum.ToString();
|
||||
tbx_caliperLength.Text = myFindLine.length.ToString();
|
||||
tbx_threshold.Text = myFindLine.threshold.ToString();
|
||||
tbx_Sigma.Text = myFindLine.sigma.ToString();
|
||||
tbx_caliperLength2.Text = myFindLine.weidth.ToString();
|
||||
chBDispRec.Checked = myFindLine.dispRec;
|
||||
chBDispCross.Checked = myFindLine.dispCross;
|
||||
}
|
||||
|
||||
#region 输入检查
|
||||
private void tbx_expectLineStartRow_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
myFindLine.expectLineStartRow = Convert.ToDouble(tbx_expectLineStartRow.Text.Trim());
|
||||
}
|
||||
catch
|
||||
{
|
||||
TextBoxMessageDisp("输入了非法字符,已自动替换为默认值:200", Color.Red);
|
||||
tbx_expectLineStartRow.Text = "200";
|
||||
}
|
||||
}
|
||||
|
||||
private void tbx_expectLineStartCol_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
myFindLine.expectLineStartCol = Convert.ToDouble(tbx_expectLineStartCol.Text.Trim());
|
||||
}
|
||||
catch
|
||||
{
|
||||
TextBoxMessageDisp("输入了非法字符,已自动替换为默认值:200", Color.Red);
|
||||
tbx_expectLineStartCol.Text = "200";
|
||||
}
|
||||
}
|
||||
|
||||
private void tbx_expectLineEndRow_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
myFindLine.expectLineEndRow = Convert.ToDouble(tbx_expectLineEndRow.Text.Trim());
|
||||
}
|
||||
catch
|
||||
{
|
||||
TextBoxMessageDisp("输入了非法字符,已自动替换为默认值:200", Color.Red);
|
||||
tbx_expectLineEndRow.Text = "200";
|
||||
}
|
||||
}
|
||||
|
||||
private void tbx_expectLineEndCol_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
myFindLine.expectLineEndCol = Convert.ToDouble(tbx_expectLineEndCol.Text.Trim());
|
||||
}
|
||||
catch
|
||||
{
|
||||
TextBoxMessageDisp("输入了非法字符,已自动替换为默认值:600", Color.Red);
|
||||
tbx_expectLineEndCol.Text = "600";
|
||||
}
|
||||
}
|
||||
|
||||
private void chBDispRec_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(chBDispRec.Checked)
|
||||
{
|
||||
myFindLine.dispRec = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
myFindLine.dispRec = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void chBDispCross_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(chBDispCross.Checked)
|
||||
{
|
||||
myFindLine.dispCross = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
myFindLine.dispCross = false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void FormFindLine_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
myHwindow.Dispose();
|
||||
this.Dispose();
|
||||
this.Dispose();
|
||||
GC.Collect();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using CommonMethods;
|
||||
using HalconDotNet;
|
||||
using ChoiceTech.Halcon.Control;
|
||||
|
||||
namespace FindLineTool
|
||||
{
|
||||
public partial class FormFindLine : Form
|
||||
{
|
||||
public FindLine myFindLine = null;
|
||||
public IToolInfo myToolInfo = null;
|
||||
public HWindow_Final myHwindow = new HWindow_Final();
|
||||
/// <summary>
|
||||
/// 窗体对象实例
|
||||
/// </summary>
|
||||
private static FormFindLine _instance;
|
||||
public static FormFindLine Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_instance != null)
|
||||
{
|
||||
lock (_instance)
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
object line = new object();
|
||||
_instance = new FormFindLine(ref line);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
object line = new object();
|
||||
_instance = new FormFindLine(ref line);
|
||||
return _instance;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public FormFindLine(ref object findLine)
|
||||
{
|
||||
InitializeComponent();
|
||||
_instance = this;
|
||||
if(findLine.GetType().FullName != "System.Object")
|
||||
{
|
||||
myToolInfo = (IToolInfo)findLine;
|
||||
myFindLine = (FindLine)myToolInfo.tool;
|
||||
//myFindLine.inputImage = ComGlobalParams.inputImageGlobal; // 暂时直接将图像传递给该工具
|
||||
myFindLine.DispImage();
|
||||
}
|
||||
}
|
||||
|
||||
private void FormFindLine_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.panel1.Controls.Add(myHwindow);
|
||||
myHwindow.Dock = DockStyle.Fill;
|
||||
InitTool();
|
||||
}
|
||||
|
||||
private void btn_moveCliperRegion_Click(object sender, EventArgs e)
|
||||
{
|
||||
myFindLine.UpdateImage();
|
||||
myFindLine.DrawExpectLine(myHwindow);
|
||||
}
|
||||
|
||||
private void btn_runFindLineTool_Click(object sender, EventArgs e)
|
||||
{
|
||||
// 更改界面中参数,实时更新类中参数
|
||||
myFindLine.expectLineStartRow = Convert.ToDouble(tbx_expectLineStartRow.Text.Trim());
|
||||
myFindLine.expectLineStartCol = Convert.ToDouble(tbx_expectLineStartCol.Text.Trim());
|
||||
myFindLine.expectLineEndRow = Convert.ToDouble(tbx_expectLineEndRow.Text.Trim());
|
||||
myFindLine.expectLineEndCol = Convert.ToDouble(tbx_expectLineEndCol.Text.Trim());
|
||||
// 运行参数
|
||||
myFindLine.minScore = Convert.ToDouble(tbx_minScore.Text.Trim());
|
||||
myFindLine.cliperNum = Convert.ToInt16(tbx_caliperNum.Text.Trim());
|
||||
myFindLine.threshold = Convert.ToInt16(tbx_threshold.Text.Trim());
|
||||
myFindLine.length = Convert.ToInt16(tbx_caliperLength.Text.Trim());
|
||||
myFindLine.weidth = Convert.ToInt16(tbx_caliperLength2.Text.Trim());
|
||||
myFindLine.polarity = cbx_polarity.SelectedItem.ToString() == "从明到暗" ? "negative":"positive";
|
||||
myFindLine.edgeSelect = cbx_edgeSelect.SelectedItem.ToString();
|
||||
myFindLine.sigma = Convert.ToDouble(tbx_Sigma.Text.Trim());
|
||||
// Run
|
||||
myFindLine.Run(SoftwareRunState.Debug);
|
||||
}
|
||||
|
||||
public void InitTool()
|
||||
{
|
||||
this.Text = myToolInfo.toolName;
|
||||
btn_runFindLineTool.Focus();
|
||||
Application.DoEvents();
|
||||
|
||||
//myFindLine.Run(); //运行一下,使卡尺显示出来
|
||||
|
||||
tbx_expectLineStartRow.Text = myFindLine.expectLineStartRow.ToString();
|
||||
tbx_expectLineStartCol.Text = myFindLine.expectLineStartCol.ToString();
|
||||
tbx_expectLineEndRow.Text = myFindLine.expectLineEndRow.ToString();
|
||||
tbx_expectLineEndCol.Text = myFindLine.expectLineEndCol.ToString();
|
||||
cbx_edgeSelect.Text = myFindLine.edgeSelect;
|
||||
tbx_minScore.Text = myFindLine.minScore.ToString();
|
||||
cbx_polarity.Text = myFindLine.polarity == "positive" ? "从暗到明" : "从明到暗";
|
||||
tbx_caliperNum.Text = myFindLine.cliperNum.ToString();
|
||||
tbx_caliperLength.Text = myFindLine.length.ToString();
|
||||
tbx_threshold.Text = myFindLine.threshold.ToString();
|
||||
tbx_Sigma.Text = myFindLine.sigma.ToString();
|
||||
tbx_caliperLength2.Text = myFindLine.weidth.ToString();
|
||||
chBDispRec.Checked = myFindLine.dispRec;
|
||||
chBDispCross.Checked = myFindLine.dispCross;
|
||||
}
|
||||
/// <summary>
|
||||
/// 设定工具运行状态
|
||||
/// </summary>
|
||||
/// <param name="msg">运行中的信息</param>
|
||||
/// <param name="status">运行状态</param>
|
||||
public void SetToolStatus(string msg, ToolRunStatu status)
|
||||
{
|
||||
if(myFindLine!=null)
|
||||
{
|
||||
myFindLine.runMessage = msg;
|
||||
myFindLine.toolRunStatu = status;
|
||||
lb_RunStatus.Text = myFindLine.toolRunStatu == ToolRunStatu.Succeed ? "工具运行成功!" : $"工具运行异常, 异常原因:{myFindLine.runMessage}";
|
||||
lb_RunTime.Text = myFindLine.runTime;
|
||||
if (myFindLine.toolRunStatu == ToolRunStatu.Succeed)
|
||||
{
|
||||
statusStrip.BackColor = Color.LimeGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
statusStrip.BackColor = Color.Red;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region 输入检查
|
||||
private void tbx_expectLineStartRow_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
myFindLine.expectLineStartRow = Convert.ToDouble(tbx_expectLineStartRow.Text.Trim());
|
||||
}
|
||||
catch
|
||||
{
|
||||
SetToolStatus("输入了非法字符,已自动替换为默认值:200", ToolRunStatu.Input_Value_Type_Error);
|
||||
tbx_expectLineStartRow.Text = "200";
|
||||
}
|
||||
}
|
||||
|
||||
private void tbx_expectLineStartCol_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
myFindLine.expectLineStartCol = Convert.ToDouble(tbx_expectLineStartCol.Text.Trim());
|
||||
}
|
||||
catch
|
||||
{
|
||||
SetToolStatus("输入了非法字符,已自动替换为默认值:200", ToolRunStatu.Input_Value_Type_Error);
|
||||
tbx_expectLineStartCol.Text = "200";
|
||||
}
|
||||
}
|
||||
|
||||
private void tbx_expectLineEndRow_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
myFindLine.expectLineEndRow = Convert.ToDouble(tbx_expectLineEndRow.Text.Trim());
|
||||
}
|
||||
catch
|
||||
{
|
||||
SetToolStatus("输入了非法字符,已自动替换为默认值:200", ToolRunStatu.Input_Value_Type_Error);
|
||||
tbx_expectLineEndRow.Text = "200";
|
||||
}
|
||||
}
|
||||
|
||||
private void tbx_expectLineEndCol_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
myFindLine.expectLineEndCol = Convert.ToDouble(tbx_expectLineEndCol.Text.Trim());
|
||||
}
|
||||
catch
|
||||
{
|
||||
SetToolStatus("输入了非法字符,已自动替换为默认值:600", ToolRunStatu.Input_Value_Type_Error);
|
||||
tbx_expectLineEndCol.Text = "600";
|
||||
}
|
||||
}
|
||||
|
||||
private void chBDispRec_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(chBDispRec.Checked)
|
||||
{
|
||||
myFindLine.dispRec = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
myFindLine.dispRec = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void chBDispCross_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(chBDispCross.Checked)
|
||||
{
|
||||
myFindLine.dispCross = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
myFindLine.dispCross = false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void FormFindLine_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
myHwindow.Dispose();
|
||||
this.Dispose();
|
||||
this.Dispose();
|
||||
GC.Collect();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,6 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@@ -1,34 +1,34 @@
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\FindLineTool.dll
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\FindLineTool.pdb
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\CommonMethods.dll
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\DataStruct.dll
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\halcondotnet.dll
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\HalconWindow.exe
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\ToolBase.dll
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\CommonMethods.pdb
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\DataStruct.pdb
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\HalconWindow.pdb
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\ToolBase.pdb
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\halcondotnet.xml
|
||||
F:\VSCode\VisionEditTest\FindLine\obj\Debug\FindLineTool.csprojResolveAssemblyReference.cache
|
||||
F:\VSCode\VisionEditTest\FindLine\obj\Debug\FindLineTool.FormFindLine.resources
|
||||
F:\VSCode\VisionEditTest\FindLine\obj\Debug\FindLineTool.csproj.GenerateResource.Cache
|
||||
F:\VSCode\VisionEditTest\FindLine\obj\Debug\FindLineTool.dll
|
||||
F:\VSCode\VisionEditTest\FindLine\obj\Debug\FindLineTool.pdb
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\FindLineTool.dll
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\FindLineTool.pdb
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\CommonMethods.dll
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\DataStruct.dll
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\halcondotnet.dll
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\HalconWindow.exe
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\ToolBase.dll
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\CommonMethods.pdb
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\DataStruct.pdb
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\HalconWindow.pdb
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\ToolBase.pdb
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\halcondotnet.xml
|
||||
G:\VisionEdit\VisionEdit\FindLine\obj\Debug\FindLineTool.csprojResolveAssemblyReference.cache
|
||||
G:\VisionEdit\VisionEdit\FindLine\obj\Debug\FindLineTool.FormFindLine.resources
|
||||
G:\VisionEdit\VisionEdit\FindLine\obj\Debug\FindLineTool.csproj.GenerateResource.Cache
|
||||
G:\VisionEdit\VisionEdit\FindLine\obj\Debug\FindLineTool.dll
|
||||
G:\VisionEdit\VisionEdit\FindLine\obj\Debug\FindLineTool.pdb
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\FindLineTool.dll
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\FindLineTool.pdb
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\CommonMethods.dll
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\DataStruct.dll
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\halcondotnet.dll
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\HalconWindow.exe
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\ToolBase.dll
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\CommonMethods.pdb
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\DataStruct.pdb
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\HalconWindow.pdb
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\ToolBase.pdb
|
||||
F:\VSCode\VisionEditTest\FindLine\bin\Debug\halcondotnet.xml
|
||||
F:\VSCode\VisionEditTest\FindLine\obj\Debug\FindLineTool.csprojResolveAssemblyReference.cache
|
||||
F:\VSCode\VisionEditTest\FindLine\obj\Debug\FindLineTool.FormFindLine.resources
|
||||
F:\VSCode\VisionEditTest\FindLine\obj\Debug\FindLineTool.csproj.GenerateResource.Cache
|
||||
F:\VSCode\VisionEditTest\FindLine\obj\Debug\FindLineTool.dll
|
||||
F:\VSCode\VisionEditTest\FindLine\obj\Debug\FindLineTool.pdb
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\FindLineTool.dll
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\FindLineTool.pdb
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\CommonMethods.dll
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\DataStruct.dll
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\halcondotnet.dll
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\HalconWindow.exe
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\ToolBase.dll
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\CommonMethods.pdb
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\DataStruct.pdb
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\HalconWindow.pdb
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\ToolBase.pdb
|
||||
G:\VisionEdit\VisionEdit\FindLine\bin\Debug\halcondotnet.xml
|
||||
G:\VisionEdit\VisionEdit\FindLine\obj\Debug\FindLineTool.csprojResolveAssemblyReference.cache
|
||||
G:\VisionEdit\VisionEdit\FindLine\obj\Debug\FindLineTool.FormFindLine.resources
|
||||
G:\VisionEdit\VisionEdit\FindLine\obj\Debug\FindLineTool.csproj.GenerateResource.Cache
|
||||
G:\VisionEdit\VisionEdit\FindLine\obj\Debug\FindLineTool.dll
|
||||
G:\VisionEdit\VisionEdit\FindLine\obj\Debug\FindLineTool.pdb
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user