public void Read()
        {
            string strVisionConfigPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "VisionMgr" + ".xml";

            if (VisionMgr.GetInstance().CurrentVisionProcessDir == null &&
                ParamSetMgr.GetInstance().CurrentProductFile == null &&
                ParamSetMgr.GetInstance().CurrentProductFile == "" &&
                !Directory.Exists(VisionMgr.GetInstance().CurrentVisionProcessDir))
            {
                Directory.CreateDirectory(VisionMgr.GetInstance().CurrentVisionProcessDir);
            }
            dicVisionType.Clear();
            dicVisionType = (SerialDictionary <string, StepVisionInfo>)AccessXmlSerializer.XmlToObject(strVisionConfigPath, dicVisionType.GetType());

            dicVision.Clear();
            if (dicVisionType == null)
            {
                dicVisionType = new SerialDictionary <string, StepVisionInfo>();
            }
            foreach (var temp in dicVisionType)
            {
                Type     type = AssemblyOperate.GetTypeFromAssembly(temp.Value.VisionType);
                object[] args = new object[]
                {
                    temp.Key
                };
                Add(temp.Key, Activator.CreateInstance(type, args) as VisionSetpBase);
                dicVision[temp.Key].Read();
                dicVision[temp.Key].m_camparam = temp.Value.CamParam;
            }
        }
Exemple #2
0
        public object ReadParam()
        {
            object obj = null;

            try
            {
                obj = AccessXmlSerializer.XmlToObject(AppDomain.CurrentDomain.BaseDirectory + @"\config\ElecCmp.xml", serialPortParam.GetType());
                if (obj != null)
                {
                    serialPortParam = (SerialPortParam)obj;
                }
                else
                {
                    Save();
                }
            }
            catch
            {
                obj = null;
            }
            if (obj == null)
            {
                MessageBox.Show("电抓  串口 数据读取出错", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(obj);
        }
Exemple #3
0
        public object ReadParam2()
        {
            object obj2 = null;

            try
            {
                obj2 = AccessXmlSerializer.XmlToObject(AppDomain.CurrentDomain.BaseDirectory + @"\config\LightVal_" + LightName + ".xml", itemlightdic.GetType());
                if (obj2 != null)
                {
                    itemlightdic = (SerialDictionary <string, LightSet>)obj2;
                    if (itemlightdic.Count == 0)
                    {
                        MessageBox.Show("lingt control  数据读取出错", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        logger.Error("lingt control  数据读取出错");
                    }
                }
                else
                {
                    SaveItems();
                }
            }
            catch
            {
                obj2 = null;
            }
            if (obj2 == null)
            {
                MessageBox.Show("lingt control  数据读取出错", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(obj2);
        }
Exemple #4
0
        public object ReadParam()
        {
            object obj  = null;
            object obj2 = null;

            try
            {
                obj = AccessXmlSerializer.XmlToObject(AppDomain.CurrentDomain.BaseDirectory + @"config\COM_KEYENCE_Scanner" + ".xml", serialPortParam.GetType());
                if (obj != null)
                {
                    serialPortParam = (SerialPortParam)obj;
                }
                else
                {
                    Save();
                }
            }
            catch
            {
                obj = null;
            }
            if (obj == null)
            {
                MessageBox.Show("lingt control 串口 数据读取出错", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(obj);
        }
Exemple #5
0
        public override Object Read(string strPath)
        {
            Code1dParam tempvision1dCodeParam = (Code1dParam)AccessXmlSerializer.XmlToObject(strPath, vision1dCodeParam.GetType());

            if (tempvision1dCodeParam == null)
            {
                _logger.Warn(m_strStepName + ": 视觉处理项目加载失败,请检查");
                MessageBox.Show(m_strStepName + ": 视觉处理项目加载失败,请检查", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }
            vision1dCodeParam = tempvision1dCodeParam;
            string Mode1dcodePath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + "_bar_code_model.bcm";;

            if (Mode1dcodePath != null && File.Exists(Mode1dcodePath))
            {
                if (Mode1dCode != null)
                {
                    HOperatorSet.ClearBarCodeModel(Mode1dCode);
                }
                HOperatorSet.ReadBarCodeModel(Mode1dcodePath, out Mode1dCode);
            }
            if (File.Exists(vision1dCodeParam.Mode1dcodeSearchPath))
            {
                if (Mode1dCodeSearch != null && Mode1dCodeSearch.IsInitialized())
                {
                    Mode1dCodeSearch.Dispose();
                }
                HOperatorSet.ReadRegion(out Mode1dCodeSearch, vision1dCodeParam.Mode1dcodeSearchPath);
            }
            GC.Collect();

            return(vision1dCodeParam);
        }
Exemple #6
0
        public virtual Object Read()
        {
            string strPath = "";

            strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".json";
            AccessJosnSerializer.ObjectToJson(strPath, this);
            strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".xml";
            return(AccessXmlSerializer.XmlToObject(strPath, this.GetType()));
        }
Exemple #7
0
        public override Object Read(string strPath)
        {
            // string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".xml";
            blobParam = (BlobParam)AccessXmlSerializer.XmlToObject(strPath, blobParam.GetType());

            GC.Collect();

            return(blobParam);
        }
 public static bool Read(int index, string path)
 {
     UserTest.DispCalibrationAB[index] = (List <DispCalibration>)AccessXmlSerializer.XmlToObject(path, typeof(List <DispCalibration>));
     if (UserTest.DispCalibrationAB[index] == null)
     {
         UserTest.DispCalibrationAB[index] = new List <DispCalibration>();
         return(false);
     }
     return(true);
 }
Exemple #9
0
        public override Object Read(string strPath)
        {
            // string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".xml";
            VisionCode2dParam tempvision2dCodeParam = (VisionCode2dParam)AccessXmlSerializer.XmlToObject(strPath, vision2dCodeParam.GetType());

            if (tempvision2dCodeParam == null)
            {
                _logger.Warn(m_strStepName + ": 视觉处理项目加载失败,请检查");
                MessageBox.Show(m_strStepName + ": 视觉处理项目加载失败,请检查", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }
            vision2dCodeParam = tempvision2dCodeParam;
            string Mode2dcodePath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + "_data_code_model.dcm";;

            if (vision2dCodeParam != null && Mode2dcodePath != null && File.Exists(Mode2dcodePath))
            {
                if (Mode2dCode != null)
                {
                    HOperatorSet.ClearDataCode2dModel(Mode2dCode);
                }
                Mode2dCode = null;
                HOperatorSet.ReadDataCode2dModel(Mode2dcodePath, out Mode2dCode);
                if (Mode2dCode == null || Mode2dCode.Length <= 0)
                {
                    _logger.Warn(m_strStepName + ": 2维码模板读取失败,请检查");
                    MessageBox.Show(m_strStepName + ": 2维码模板读取失败,请检查", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                // MessageBox.Show(m_strStepName + ": 2维码模板读取失败,请检查", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            if (vision2dCodeParam != null && File.Exists(vision2dCodeParam.Mode2dcodeSearchPath))
            {
                if (Mode2dCodeSearch != null && Mode2dCodeSearch.IsInitialized())
                {
                    Mode2dCodeSearch.Dispose();
                }
                HOperatorSet.ReadRegion(out Mode2dCodeSearch, vision2dCodeParam.Mode2dcodeSearchPath);
                if (Mode2dCodeSearch == null || Mode2dCodeSearch.IsInitialized())
                {
                    _logger.Warn(m_strStepName + ": 2维码搜索区域读取失败,请检查");
                }
                //  MessageBox.Show(m_strStepName + ": 2维码搜索区域读取失败,请检查", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                _logger.Warn(m_strStepName + ": 2维码搜索区域读取失败,请检查");
                //  MessageBox.Show(m_strStepName + ": 2维码搜索区域读取失败,请检查", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            GC.Collect();

            return(vision2dCodeParam);
        }
        private void Form_ParamSet_Load(object sender, EventArgs e)
        {
            sys.g_eventRightChanged += ChangedUserRight;
            ParamSetMgr.GetInstance().m_eventLoadProductFile += LoadProductFile;
            userRight = UserRight.User_None;
            int width = 0;

            for (int i = 0; i < dataGridView_Param.Columns.Count; i++)
            {
                width += dataGridView_Param.Columns[i].Width;
            }
            dataGridView_Param.Width = width + 35;
            sys.g_User             = sys.g_User;
            label_CurrentFile.Text = "当前产品:" + ParamSetMgr.GetInstance().CurrentProductFile;

            treeView_ProdutFile.Nodes.Add("当前产品");
            treeView_ProdutFile.Nodes.Add("产品选择");
            if (ParamSetMgr.GetInstance().CurrentProductFile != null && ParamSetMgr.GetInstance().CurrentProductFile != "")
            {
                treeView_ProdutFile.Nodes[0].Nodes.Add(ParamSetMgr.GetInstance().CurrentProductFile);
                treeView_ProdutFile.Nodes[0].ImageIndex = 0;
            }



            DirectoryInfo[] dirInfo = ParamSetMgr.GetInstance().EnumProductFile();

            int pos;

            for (int i = 0; dirInfo != null && i < dirInfo.Length; i++)
            {
                pos = dirInfo[i].FullName.LastIndexOf("\\");
                string str = dirInfo[i].FullName.Substring(pos + 1, dirInfo[i].FullName.Length - pos - 1);
                if (str != ParamSetMgr.GetInstance().CurrentProductFile)
                {
                    treeView_ProdutFile.Nodes[1].Nodes.Add(str);
                }
            }
            treeView_ProdutFile.Nodes[0].Expand();
            if (treeView_ProdutFile.Nodes[0].FirstNode != null && treeView_ProdutFile.Nodes[0].FirstNode.Name != null && treeView_ProdutFile.Nodes[0].FirstNode.Text != "")
            {
                List <string> classList = ParamSetMgr.GetInstance().GetParamClassList();
                foreach (var temp in classList)
                {
                    treeView_ProdutFile.Nodes[0].Nodes[0].Nodes.Add(temp);
                }
            }
            treeView_ProdutFile.Nodes[0].ExpandAll();
            treeView_ProdutFile.Nodes[1].Expand();
            // m_path = ParamSetMgr.GetInstance().CurrentWorkFile;
            //加载描述文件
            string path = $"{ParamSetMgr.GetInstance().CurrentWorkDir}\\{ParamSetMgr.GetInstance().CurrentProductFile}\\Description.xml";

            DescriptionClass.paramValue = AccessXmlSerializer.XmlToObject <List <ParamValue> >(path);
        }
 public static bool ReadCT(string path)
 {
     UserTest.ProductCount = (ProductInfo)AccessXmlSerializer.XmlToObject(path, typeof(ProductInfo));
     if (UserTest.ProductCount == null)
     {
         UserTest.ProductCount = new ProductInfo();
         SaveCT(path);
         return(false);
     }
     return(true);
 }
Exemple #12
0
        public object Read()
        {
            string strPath = AppDomain.CurrentDomain.BaseDirectory + @"\config\traydata.xml";
            Object obj     = AccessXmlSerializer.XmlToObject(strPath, this.GetType());

            if (obj != null)
            {
                trayMgr = (TrayMgr)obj;
            }
            return(trayMgr);
            // return  trayDataLoad.Read();
        }
        public void Read()
        {
            string strPath = AppDomain.CurrentDomain.BaseDirectory + "calcNum.xml";

            if (File.Exists(strPath))
            {
                calcNum = (CalcNum)AccessXmlSerializer.XmlToObject(strPath, typeof(CalcNum));
            }
            else
            {
                Save();
            }
        }
        private object LoadTechingPara()
        {
            object obj = null;

            try
            {
                obj = AccessXmlSerializer.XmlToObject(AppDomain.CurrentDomain.BaseDirectory + @"\Config\GppSetting.xml", typeof(SerialPortParamCommon));
            }
            catch
            {
                obj = null;
            }
            return(obj);
        }
Exemple #15
0
        public void Read()
        {
            string currentNozzleFile = ParamSetMgr.GetInstance().CurrentWorkDir + ("\\") + ParamSetMgr.GetInstance().CurrentProductFile + ("\\") + "nozzleArr" + (".xml");

            if (!File.Exists(currentNozzleFile))
            {
                Save();
            }
            Object obs = AccessXmlSerializer.XmlToObject(currentNozzleFile, typeof(Nozzle[]));

            if (obs != null)
            {
                nozzleArr = (Nozzle[])obs;
            }
        }
Exemple #16
0
        public object LoadTechingPara()
        {
            object obj = null;

            try
            {
                obj = AccessXmlSerializer.XmlToObject(AppDomain.CurrentDomain.BaseDirectory + @"\config\Teaching.xml", typeof(List <GripperTeachingPara>));
            }
            catch
            {
                obj = null;
            }
            if (obj == null)
            {
                MessageBox.Show("电抓  串口 数据读取出错", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(obj);
        }
        private object ReadParam()
        {
            object obj = null;

            try
            {
                obj         = AccessXmlSerializer.XmlToObject(AppDomain.CurrentDomain.BaseDirectory + @"\config\Anicet.xml", anicetParam.GetType());
                anicetParam = (AnicetSerialPortParam)obj;
            }
            catch
            {
                obj = null;
            }
            if (obj == null)
            {
                MessageBox.Show("Anicet IO 串口 数据读取出错", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(obj);
        }
Exemple #18
0
        public TolNum Read()
        {
            TolNum tol1 = (TolNum)AccessXmlSerializer.XmlToObject("d:\\Sum.xml", typeof(TolNum));

            if (tol1 == null)
            {
                tol.Save();
            }
            else
            {
                tol = tol1;
            }
            ParamSetMgr.GetInstance().SetDoubleParam("产品计数", tol.nSumProduct);
            ParamSetMgr.GetInstance().SetDoubleParam("左废纸数", tol.nLeftProduct);
            ParamSetMgr.GetInstance().SetDoubleParam("右废纸数", tol.nRightProduct);

            ParamSetMgr.GetInstance().SetDoubleParam("上料吸嘴数", tol.nLoadNozzleWorkNum);
            ParamSetMgr.GetInstance().SetDoubleParam("下料吸嘴数", tol.nUnLoadNozzleWorkNum);
            ParamSetMgr.GetInstance().SetDoubleParam("左贴装吸嘴数", tol.nLeftNozzleWorkNum);
            ParamSetMgr.GetInstance().SetDoubleParam("右贴装吸嘴数", tol.nRightNozzleWorkNum);
            return(tol);
        }
        private void Form_ParamSet_Load(object sender, EventArgs e)
        {
            sys.g_eventRightChanged += ChangedUserRight;
            ParamSetMgr.GetInstance().m_eventLoadProductFile += LoadProductFile;
            userRight = UserRight.User_None;
            int width = 0;

            for (int i = 0; i < dataGridView_Param.Columns.Count; i++)
            {
                width += dataGridView_Param.Columns[i].Width;
            }
            dataGridView_Param.Width = width + 35;
            richTextBox1.Location    = new Point(dataGridView_Param.Location.X + dataGridView_Param.Width, dataGridView_Param.Location.Y);
            sys.g_User             = sys.g_User;
            label_CurrentFile.Text = "当前产品:" + ParamSetMgr.GetInstance().CurrentProductFile;
            UpdateProductList();

            // m_path = ParamSetMgr.GetInstance().CurrentWorkFile;
            string path = $"{ParamSetMgr.GetInstance().CurrentWorkDir}\\{ParamSetMgr.GetInstance().CurrentProductFile}\\Description.xml";

            DescriptionClass.paramValue = AccessXmlSerializer.XmlToObject <List <ParamValue> >(path);
        }
Exemple #20
0
 public void Read()
 {
     dBottomHigh = (LaserRelativedData)AccessXmlSerializer.XmlToObject(@"E:\VCMPlaneBottomHigh.xml", dBottomHigh.GetType());
 }
 public override object Read(string strPath)
 {
     try
     {
         //  string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".xml";
         VisionFitCircleParam tempvisionFitCircleParam = (VisionFitCircleParam)AccessXmlSerializer.XmlToObject(strPath, visionFitCircleParam.GetType());
         if (tempvisionFitCircleParam != null)
         {
             visionFitCircleParam = tempvisionFitCircleParam;
         }
         else
         {
             _logger.Warn(m_strStepName + ": 视觉处理项目加载失败,请检查");
             MessageBox.Show(m_strStepName + ": 视觉处理项目加载失败,请检查", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(null);
         }
         return(visionFitCircleParam);
     }
     catch (Exception e)
     {
         _logger.Warn(m_strStepName + "读取失败:" + e.Message);
     }
     return(null);
 }
Exemple #22
0
        public override Object Read(string strPath)
        {
            string strSaveRegions = strPath;

            try
            {
                strPath = strPath + "\\" + m_strStepName + ".xml";
                //string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".xml";
                VisionShapParam tempvisionShapParam = (VisionShapParam)AccessXmlSerializer.XmlToObject(strPath, visionShapParam.GetType());
                if (tempvisionShapParam == null)
                {
                    MessageBox.Show(m_strStepName + ": 视觉处理项目加载失败,请检查", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    _logger.Warn(m_strStepName + ": 视觉处理项目加载失败,请检查");
                    return(null);
                }
                visionShapParam = tempvisionShapParam;

                if (visionShapParam != null && File.Exists(visionShapParam.ModeShmPath))
                {
                    if (ModeID != null)
                    {
                        HOperatorSet.ClearShapeModel(ModeID);
                    }
                    ModeID = null;
                    HOperatorSet.ReadShapeModel(visionShapParam.ModeShmPath, out ModeID);
                    if (ModeID == null || ModeID.Length <= 0)
                    {
                        MessageBox.Show(m_strStepName + "读取项目:" + "模板读取失败", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        _logger.Warn(m_strStepName + "读取项目:" + "模板读取失败");
                    }
                }
                else
                {
                    _logger.Warn(m_strStepName + "读取项目:" + "模板读取失败");
                    MessageBox.Show(m_strStepName + "读取项目:" + "模板读取失败", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                if (visionShapParam != null && File.Exists(visionShapParam.SeachRectRegionPath))
                {
                    if (RegionSearch != null && RegionSearch.IsInitialized())
                    {
                        RegionSearch.Dispose();
                    }
                    HOperatorSet.ReadRegion(out RegionSearch, visionShapParam.SeachRectRegionPath);
                    if (RegionSearch == null || RegionSearch.IsInitialized())
                    {
                        _logger.Warn(m_strStepName + "读取项目:" + "搜索区域读取失败");
                    }
                    //     MessageBox.Show(m_strStepName + "读取项目:" + "搜索区域读取失败", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    _logger.Warn(m_strStepName + "读取项目:" + "搜索区域读取失败");
                    // MessageBox.Show(m_strStepName + "读取项目:" + "搜索区域读取失败", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                if (visionShapParam != null && File.Exists(visionShapParam.RoiRegionPath))
                {
                    if (RegionRoi != null && RegionRoi.IsInitialized())
                    {
                        RegionRoi.Dispose();
                    }
                    HOperatorSet.ReadRegion(out RegionRoi, visionShapParam.RoiRegionPath);
                    if (RegionRoi == null || RegionRoi.IsInitialized())
                    {
                        _logger.Warn(m_strStepName + "读取项目:" + "roi读取失败");
                    }
                    //     MessageBox.Show(m_strStepName + "读取项目:" + "roi读取失败", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    _logger.Warn(m_strStepName + "读取项目:" + "roi读取失败");
                    // MessageBox.Show(m_strStepName + "读取项目:" + "roi读取失败", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception e1)
            {
                _logger.Warn(m_strStepName + "读取项目:" + e1.Message);
                MessageBox.Show(m_strStepName + "读取项目:" + e1.Message, "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch
            {
                _logger.Warn(m_strStepName + "读取项目失败");
                MessageBox.Show(m_strStepName + "读取项目失败", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            GC.Collect();
            //  ReadRegions(strSaveRegions);
            return(visionShapParam);
        }
Exemple #23
0
 public virtual Object Read(string strPath)
 {
     //string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".xml";
     return(AccessXmlSerializer.XmlToObject(strPath, this.GetType()));
 }