1、变量定义
#region Private Member Variables
private Cognex.VisionPro.ToolBlock.CogToolBlock mToolBlock;
//绘制图形
Cognex.VisionPro.CogGraphicCollection graphics = new CogGraphicCollection();
#endregion
2、绘制图形(注释内容为绘制图形相关内容)
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
//清空图形**************************
graphics.Clear();
//计算点到线的平均距离
int nNum = 0;
double dDistanceSum = 0;
double dDistanceAvg = 0;
StringBuilder sb = new StringBuilder();
Cognex.VisionPro.