修复了一些bug,降低插件之间耦合度

This commit is contained in:
liu.wenjie
2019-09-27 18:26:27 +08:00
parent f2306a43f8
commit cea92806ea
197 changed files with 143156 additions and 184 deletions

71
ToolListRun/CaliperRun.cs Normal file
View File

@@ -0,0 +1,71 @@
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 CaliperTool;
using CommonMethods;
using HalconDotNet;
using VisionEdit;
using VisionEdit.FormLib;
namespace ToolListRun
{
public class CaliperRun
{
public void ToolRun(int toolIndex, int inputItemNum, TreeNode selectNode, FormLog myFormLog, FormImageWindow myFormWindow, List<IToolInfo> L_toolList, VisionJob myVisionJob)
{
Caliper myCaliper = (Caliper)L_toolList[toolIndex].tool;
for (int j = 0; j < inputItemNum; j++)
{
if (L_toolList[toolIndex].toolInput[j].IOName == "InputImage" && L_toolList[toolIndex].GetInput(L_toolList[toolIndex].toolInput[j].IOName).value == null)
{
selectNode.ForeColor = Color.Red;
myFormLog.ShowLog(L_toolList[toolIndex].toolName + " 无输入图像");
break;
}
else
{
if (L_toolList[toolIndex].GetInput(L_toolList[toolIndex].toolInput[j].IOName).value != null)
{
string sourceFrom = L_toolList[toolIndex].GetInput(L_toolList[toolIndex].toolInput[j].IOName).value.ToString();
string sourceToolName = Regex.Split(sourceFrom, " . ")[0];
sourceToolName = sourceToolName.Substring(3, Regex.Split(sourceFrom, " . ")[0].Length - 3);
string toolItem = Regex.Split(sourceFrom, " . ")[1];
if (L_toolList[toolIndex].toolInput[j].IOName == "InputImage")
{
myCaliper.inputImage = myVisionJob.GetToolInfoByToolName(myVisionJob.JobName, sourceToolName).GetOutput(toolItem).value as HObject;
}
if (L_toolList[toolIndex].toolInput[j].IOName == "inputCenterRow")
{
myCaliper.expectRecStartRow = myVisionJob.GetToolInfoByToolName(myVisionJob.JobName, sourceToolName).GetOutput(toolItem).value as HTuple;
}
if (L_toolList[toolIndex].toolInput[j].IOName == "inputCenterCol")
{
myCaliper.expectRecStartColumn = myVisionJob.GetToolInfoByToolName(myVisionJob.JobName, sourceToolName).GetOutput(toolItem).value as HTuple;
}
if (L_toolList[toolIndex].toolInput[j].IOName == "inputPhi")
{
myCaliper.expectAngle = myVisionJob.GetToolInfoByToolName(myVisionJob.JobName, sourceToolName).GetOutput(toolItem).value as HTuple;
}
}
}
}
myCaliper.Run(SoftwareRunState.Release);
if (myCaliper.toolRunStatu == ToolRunStatu.Succeed)
{
myCaliper.DispMainWindow(myFormWindow.myHWindow);
myVisionJob.FormLogDisp(L_toolList[toolIndex].toolName + " 运行成功", Color.Green, selectNode);
}
else
{
myVisionJob.FormLogDisp(L_toolList[toolIndex].toolName + " 运行失败", Color.Red, selectNode);
}
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ToolListRun")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ToolListRun")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//将 ComVisible 设置为 false 将使此程序集中的类型
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("cdb92f0e-2065-4116-874d-3142fa19c2e6")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CDB92F0E-2065-4116-874D-3142FA19C2E6}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ToolListRun</RootNamespace>
<AssemblyName>ToolListRun</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="halcondotnet">
<HintPath>C:\Program Files\MVTec\HALCON-19.05-Progress\bin\dotnet20\halcondotnet.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="WeifenLuo.WinFormsUI.Docking">
<HintPath>E:\VisionAndMotionPro V0.0.0.3\VisionAndMotionPro V0.0.0.3\VisionAndMotion\bin\Debug\WeifenLuo.WinFormsUI.Docking.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CaliperRun.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CaliperTool\CaliperTool.csproj">
<Project>{AABF8D49-FA00-4E25-9410-4A573D48DAB1}</Project>
<Name>CaliperTool</Name>
</ProjectReference>
<ProjectReference Include="..\CommonMethods\CommonHelper.csproj">
<Project>{1C8D0DDC-2086-48A9-9586-F2B643E2FC54}</Project>
<Name>CommonHelper</Name>
</ProjectReference>
<ProjectReference Include="..\HalconWindowTest\HalconWindow.csproj">
<Project>{4ADC75AE-59C7-4D36-B675-A6CE51B6F5BA}</Project>
<Name>HalconWindow</Name>
</ProjectReference>
<ProjectReference Include="..\VisionEdit\VisionEdit.csproj">
<Project>{2CD1B0C2-D64A-4DA4-8A9E-64D5AB35DE25}</Project>
<Name>VisionEdit</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.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

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.

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.

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.