publicclassCogToolBlockSimpleScript: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>publicoverrideboolGroupRun(refstring message,refCogToolResultConstants 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";}returnfalse;}#region When the Script is Initialized/// <summary>/// Perform any initialization required by your script here/// </summary>/// <param name="host">The host tool</param>publicoverridevoidInitialize(Cognex.VisionPro.ToolGroup.CogToolGroup host){// DO NOT REMOVE - Call the base class implementation first - DO NOT REMOVEbase.Initialize(host);}#endregion}