Example #1
0
        private void Button_Click_Clear(object sender, RoutedEventArgs e)
        {
            Tb1.Clear();
            Tb2.Clear();
            helper Clear = new helper(Tb1.Text, Tb2.Text);

            answ.Content = Clear.GetClear();
        }
Example #2
0
 private static void Cam2AutoProcess()
 {
     while (Cam2AcqThread.IsAlive || Cam2ImageQueue.Count > 0)
     {
         if (Cam2ImageQueue.Count > 0)
         {
             SortedList <string, string> rs = RunCam2Program(Cam2ImageQueue.Dequeue());
             if (Cam2ResultAvailable != null)
             {
                 Cam2ResultAvailable(null, new VisionResultAvailableEventArgs(Tb2.CreateLastRunRecord(), rs));
             }
         }
     }
 }
Example #3
0
        public static SortedList <string, string> RunCam2Program(ICogImage iCogImage)
        {
            WriteBlockInput(Tb2, "Image", iCogImage);
            Tb2.Run();
            Tb2.CreateLastRunRecord();

            SortedList <string, string> rs = new SortedList <string, string>()
            {
            };

            rs["RunStatus"] = Tb2.RunStatus.Result.ToString();
            if (rs["RunStatus"] != "Accept")
            {             //检测异常
                rs["Result"]       = "4";
                rs["ResultString"] = "检测失败";
                return(rs);
            }

            //处理结果,生成结果
            rs["Result"]       = "1";
            rs["ResultString"] = "OK";
            rs["NGKeys"]       = "";
            foreach (CogToolBlockTerminal item in Tb2.Outputs)
            {
                ConfigItem cfg   = ProductManager.GetCurProduct().Configs.Find(cfi => cfi.CamIndex == 2 && cfi.Key == item.Name);
                double     value = 0;
                double.TryParse(item.Value.ToString(), out value);
                value = Math.Round(value, 3);
                rs.Add(item.Name, value.ToString());
                if (value > cfg.Usl || value < cfg.Lsl)
                {
                    rs["Result"]       = "2";
                    rs["ResultString"] = "NG";
                    rs["NGKeys"]      += item.Name + ",";
                }
            }
            return(rs);
        }