VisionPro中使用Script脚本

使用脚本可以:

  • 根据运行的结果有条件的执行其它工具
  • 对结果执行额外的计算
  • 创建用户自己可重复使用的工具

有三个地方可用使用脚本

  • ToolGroup scripts lets you control the behavior of a tool group.

  • Job scripts gives you access to the acquisition process for a QuickBuild Job.

  • CogToolBlock scripts allow you customize and extend the capabilities of any of the vision tools the CogToolBlock contains, or to add additional logic to the results generated by the vision tools.

  • ToolGroup脚本可用控制一个tool group的behavior

  • Job脚本使你可用接触到一个QuickBuild Job的采集过程

  • CogToolBlock允许你定制和扩展视觉工具包含的能力,或者对结果增加额外的逻辑

Tool Group脚本

在ToolGroup中定义输入输出端口

在Initialize方法中调用DefineScriptTerminal

public override void Initialize(CogToolGroup host)
{
  // DO NOT REMOVE - Call the base class implementation first - DO NOT REMOVE
  base.Initialize(host);

  Int32 res = 0;

  this.toolGroup.DefineScriptTerminal(res,"Result",false);
  this.toolGroup.DefineScriptTerminal(res,"Input1",true);
  this.toolGroup.DefineScriptTerminal(res,"Input2",true);

}

在GroupRun中调用GetScriptTerminalData获取输入,调用SetScriptTerminalData设置输出

// Multiply the values of the two input terminals and place the result on the output terminal

Int32 m1 = (Int32) this.toolGroup.GetScriptTerminalData("Input1");
Int32 m2 = (Int32) this.toolGroup.GetScriptTerminalData("Input2");
this.toolGroup.SetScriptTerminalData("Result",m1*m2);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值