当前位置: 首页 > news >正文

使用Visual Studio调试VisionPro脚本

使用Visual Studio调试VisionPro脚本

  • 方法一 : 修改项目文件 csproj
    • 步骤:
  • 方法二 : Visual Studio附加功能
    • 步骤:

方法一 : 修改项目文件 csproj

步骤:

  1. 开启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 name="message">Sets the Message in the tool's RunStatus.</param>/// <param name="result">Sets the Result in the tool's RunStatus</param>/// <returns>True if the tool should run normally,///          False if GroupRun customizes run behavior</returns>public 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 name="host">The host tool</param>public override void Initialize(Cognex.VisionPro.ToolGroup.CogToolGroup host){// DO NOT REMOVE - Call the base class implementation first - DO NOT REMOVEbase.Initialize(host);}#endregion}
  1. 创建Visual Studio启动项目
  • 创建一个C#控制台应用程序。
  1. 修改项目文件 csproj
  • 此文件可以使用记事本打开,注意插入的位置以及当前VisionPro的安装位置。
    <WarningLevel>4</WarningLevel><StartAction>Program</StartAction><StartProgram>C:\Program Files\Cognex\VisionPro\bin\Cognex.VisionPro.QuickBuild.exe</StartProgram></PropertyGroup>
  1. 启动调试
  • 打开控制台程序,直接运行,VisionPro会自动启动,在VisionPro上点击运行,开始进入调试状态。

方法二 : Visual Studio附加功能

步骤:

  1. 开启VisionPro脚本调试功能(见方法一)
  2. 打开Visual Studio软件,选择附加
  • VS不需要创建任何工程
  • 注意点击附加时,VisionPro软件必须是打开的,否则找不到需要托管的内容
    在这里插入图片描述
  1. 再附加的进程上选择VisionPro脚本的进程
  2. 在VisionPro中运行脚本
  3. 启动调试
    在这里插入图片描述
http://www.lryc.cn/news/270186.html

相关文章:

  • Ubuntu安装K8S的dashboard(管理页面)
  • zookeeper之集群搭建
  • 从0开始界面设计师 Qt Designer
  • Html / CSS刷题笔记
  • 关于“Python”的核心知识点整理大全51
  • Termius for Mac/Win:一站式终端模拟器、SSH 和 SFTP 客户端软件的卓越选择
  • vr体验馆用什么软件计时计费,如遇到停电软件程序如何恢复时间
  • HTML---JavaScript基础
  • 2023年03月17日_微软和谷歌办公AI的感慨
  • 2023年新一代开发者工具 Vue ,正式开源!
  • springboot(ssm校园组团平台 高校组团系统 Java系统
  • QT 利用开源7z 实现解压各种压缩包,包括进度条和文件名的显示(zip,7z,rar,iso等50多种格式)
  • androidStudio 没有新建flutter工程的入口?
  • 微信小程序开发系列-03全局配置中的“window”和“tabBar”
  • 基于CNN神经网络的手写字符识别实验报告
  • Ubuntu 系统中安装和配置 clash
  • DragonEnglish:COCA20000+单词+释义
  • 『亚马逊云科技产品测评』活动征文|云服务器如何快速搭建个人博客(图文详解)
  • QT上位机开发(乘法计算小软件)
  • 【Matlab】BP 神经网络时序预测算法
  • GPT在企业自动化方面的应用
  • STM32——通用计时器
  • 【HarmonyOS】鸿蒙开发简介与项目基础配置演示
  • [MySQL] MySQL数据库创建存储过程
  • mysql哪些情况下不走索引?
  • 蓝桥杯python比赛历届真题99道经典练习题 (13-20)
  • 初识javaWeb
  • day5--java基础编程:异常,内部类
  • 2023.12.28 关于 Redis 数据类型 List 内部编码、应用场景
  • uni-app page新建以及page外观配置