示例#1
0
        public override object Read()
        {
            try
            {
                VisionFitCircleParam tempvisionFitCircleParam = null;
                string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".xml";
                //tempvisionFitCircleParam = (VisionFitCircleParam)AccessXmlSerializer.XmlToObject(strPath, visionFitCircleParam.GetType());
                strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".json";
                VisionFitCircircle fitCircircle = (VisionFitCircircle)AccessJosnSerializer.JsonToObject(strPath, this.GetType());
                if (fitCircircle != null && fitCircircle.visionFitCircleParam != null)
                {
                    visionFitCircleParam = tempvisionFitCircleParam = fitCircircle.visionFitCircleParam;
                }
                else
                {
                    _logger.Warn(m_strStepName + ": 视觉处理项目加载失败,请检查");
                    MessageBox.Show(m_strStepName + ": 视觉处理项目加载失败,请检查", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(null);
                }
                return(visionFitCircleParam);

                //object obj = new object();
                //string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".json";
                //AccessJosnSerializer.ObjectToJson(strPath,obj);
            }
            catch (Exception e)
            {
                _logger.Warn(m_strStepName + "读取失败:" + e.Message);
            }
            return(null);
        }
示例#2
0
        public override VisionSetpBase Clone()
        {
            VisionFitCircircle visionFitCircircle = new VisionFitCircircle(m_strStepName);

            visionFitCircircle.Read();
            return(visionFitCircircle);
        }