wubiaoti123

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Cognex.VisionPro;
using Cognex.VisionPro.ToolBlock;
using Cognex.VisionPro.QuickBuild;
using Cognex.VisionPro.ToolGroup;
using System.IO;
using System.Windows;
using Cognex.VisionPro.PMAlign;

namespace WpfApp2
{
    public class ReadVpp
    {

        public static CogToolBlock toolBlock_Locate, toolBlock_Result;
        public static CogToolGroup toolGroup;
        public static CogPMAlignTool cogPMAlignTool;
        public static string Result, Result1, Result2, Result3, Result4, Result5, Result6, Result7, Result8, Result9, Result10, Result11, Result12;


        public static void Vpp()
        {
            int i = 0;
            string name;
            toolGroup = CommonVar.Vpp.jobManager.Job(0).VisionTool as CogToolGroup;
            toolBlock_Locate = toolGroup.Tools["Locate"] as CogToolBlock;
            toolBlock_Result = toolGroup.Tools["CogToolBlockResult"] as CogToolBlock;
            CommonVar.Vpp.PMACount = int.Parse(toolBlock_Locate.Outputs["PMACount"].Value.ToString());
            toolBlock_Result.Outputs.LongCount();
            CommonVar.num = Convert.ToString(toolBlock_Result.Outputs.ToArray());
            //CommonVar.Vpp.Result = toolBlock_Result.Outputs[1].Value.ToString();
            #region  数据拉取
            while (i < Convert.ToInt32(toolBlock_Result.Outputs.LongCount()))
            {
                if (i == 0)
                {
                    name = "Result";
                }
                else
                {
                    name = toolBlock_Result.Outputs[i].Name;
                }
                i++;
                if (name == "Result")
                {
                    Result = toolBlock_Result.Outputs[0].Value.ToString();
                    List list = new List(Result.Split(','));
                    CommonVar.Vpp.text11 = list[0];
                    int l = list.Count;
                    CommonVar.Vpp.text12 = list[l-1];
                    if (CommonVar.Vpp.text11==CommonVar.Vpp.text12)
                    {
                        CommonVar.Vpp.text12 = "";
                    }
                }
                else if (name == "Result1")
                {
                    Result1 = toolBlock_Result.Outputs[1].Value.ToString();
                }
                else if (name == "Result2")
                {
                    Result2 = toolBlock_Result.Outputs[2].Value.ToString();
                }
                else if (name == "Result3")
                {
                    Result3 = toolBlock_Result.Outputs[3].Value.ToString();
                }
                else if (name == "Result4")
                {
                    Result4 = toolBlock_Result.Outputs[4].Value.ToString();
                }
                else if (name == "Result5")
                {
                    Result5 = toolBlock_Result.Outputs[5].Value.ToString();
                }
                else if (name == "Result6")
                {
                    Result6 = toolBlock_Result.Outputs[6].Value.ToString();
                }
                else if (name == "Result7")
                {
                    Result7 = toolBlock_Result.Outputs[7].Value.ToString();
                }
                else if (name == "Result8")
                {
                    Result8 = toolBlock_Result.Outputs[8].Value.ToString();
                }
                else if (name == "Result9")
                {
                    Result9 = toolBlock_Result.Outputs[9].Value.ToString();
                }
                else if (name == "Result10")
                {
                    Result10 = toolBlock_Result.Outputs[10].Value.ToString();
                }
                else if (name == "Result11")
                {
                    Result11 = toolBlock_Result.Outputs[11].Value.ToString();
                }
                else if (name == "Result12")
                {
                    Result12 = toolBlock_Result.Outputs[12].Value.ToString();
                }
            }
          #endregion
        }
    }
}

    
        
            
            
            
        
        
            
        
            
                
                
            
            
                
                    
                    
                    
                
                
                
            
                
                    
                    
                
                
                    
                        
                        
                    
                    
                        
                            
                                
                                    
                                
                            
                        
                    
                    
                        
                    
                
                
                    
                        
                
            
        
        
            
                
                    
                    
                
                
                    
                
        
    

你可能感兴趣的:(c#,java,开发语言)