开启左侧

VisionPro 代码怎么实现偏移坐标后显示

[复制链接]
ly160371 发表于 2018-11-5 22:13:19 | 显示全部楼层 |阅读模式
VisionPro中ToolBlock工具下怎么实现偏移显示(代码如下):


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

    double Offset = (double)mToolBlock.Inputs["offset"].Value;(这里的Offset是ToolBlock输入端写的偏移量)
    // Run each tool using the RunTool function
    foreach(ICogTool tool in mToolBlock.Tools)
      mToolBlock.RunTool(tool, ref message, ref result);
    CogCreateLineBisectPointsTool lineAVG = mToolBlock.Tools["CogCreateLineBisectPointsTool1"] as CogCreateLineBisectPointsTool;
    CogFindCircleTool c1 = mToolBlock.Tools["CogFindCircleTool1"] as CogFindCircleTool;
    CogFindCircleTool c2 = mToolBlock.Tools["CogFindCircleTool2"] as CogFindCircleTool;
    lineAVG.GetOutputLine().X=( (c1.Results.GetCircle().CenterX + c2.Results.GetCircle().CenterX) / 2)+Offset;
    lineAVG.GetOutputLine().Y= (c1.Results.GetCircle().CenterY + c2.Results.GetCircle().CenterY) / 2;
    lineAVG.GetOutputLine().Visible = true;
    lineAVG.OutputColor = CogColorConstants.Red;
    lineAVG.OutputLineStyle = CogGraphicLineStyleConstants.DashDotDot;

    return false;
  }
lxd 发表于 2018-12-12 14:15:38 | 显示全部楼层
问一下,脚本编程语言,怎么着手学习呢?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表