招标信息网哪个比较好,seo营销型网站,办公软件培训,德化住房和城乡建设网站使用Visual Studio调试VisionPro脚本 方法一 #xff1a; 修改项目文件 csproj步骤#xff1a; 方法二 #xff1a; Visual Studio附加功能步骤#xff1a; 方法一 #xff1a; 修改项目文件 csproj
步骤#xff1a;
开启VisionPro脚本调试功能
创建一个VisionPro程序… 使用Visual Studio调试VisionPro脚本 方法一 修改项目文件 csproj步骤 方法二 Visual Studio附加功能步骤 方法一 修改项目文件 csproj
步骤
开启VisionPro脚本调试功能
创建一个VisionPro程序写个简单脚本
public class CogToolBlockSimpleScript : CogToolBlockAdvancedScript
{/// summary/// Called when the parent tool is run./// Add code here to customize or replace the normal run behavior./// /summary/// param namemessageSets the Message in the tools RunStatus./param/// param nameresultSets the Result in the tools RunStatus/param/// returnsTrue if the tool should run normally,/// False if GroupRun customizes run behavior/returnspublic override bool GroupRun(ref string message, ref CogToolResultConstants result){// To let the execution stop in this script when a debugger is attached, uncomment the following lines.//以下这三句要解开注释#if DEBUG if (System.Diagnostics.Debugger.IsAttached) System.Diagnostics.Debugger.Break();#endif// Run each tool using the RunTool functionforeach(ICogTool tool in Tools)RunTool(tool, ref message, ref result);if (Tools.CogBlobTool1.Results.GetBlobs().Count 2){Outputs.res OK;} else{Outputs.res NG;}return false;}#region When the Script is Initialized/// summary/// Perform any initialization required by your script here/// /summary/// param namehostThe host tool/parampublic override void Initialize(Cognex.VisionPro.ToolGroup.CogToolGroup host){// DO NOT REMOVE - Call the base class implementation first - DO NOT REMOVEbase.Initialize(host);}#endregion}创建Visual Studio启动项目
创建一个C#控制台应用程序。
修改项目文件 csproj
此文件可以使用记事本打开注意插入的位置以及当前VisionPro的安装位置。 WarningLevel4/WarningLevelStartActionProgram/StartActionStartProgramC:\Program Files\Cognex\VisionPro\bin\Cognex.VisionPro.QuickBuild.exe/StartProgram/PropertyGroup启动调试
打开控制台程序直接运行VisionPro会自动启动在VisionPro上点击运行开始进入调试状态。
方法二 Visual Studio附加功能
步骤
开启VisionPro脚本调试功能见方法一打开Visual Studio软件选择附加
VS不需要创建任何工程注意点击附加时VisionPro软件必须是打开的否则找不到需要托管的内容
再附加的进程上选择VisionPro脚本的进程在VisionPro中运行脚本启动调试