Beispiel #1
0
        /// <summary>
        /// 通过单元格索引基准值类
        /// </summary>
        /// <param name="cell"></param>
        /// <returns></returns>
        public BaseParStd GetParStdByCell(string cell)
        {
            try
            {
                BaseParImageProcess baseParImageProcess = GetCellParImageProcess(cell);

                BaseParStd baseParStd = baseParImageProcess.g_ParStd;
                return(baseParStd);
            }
            catch (Exception ex)
            {
                Log.L_I.WriteError(NameClass, ex);
                return(null);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 通过名称索引基准值类
        /// </summary>
        /// <param name="name">算法名称</param>
        /// <param name="pos">拍照位置</param>
        /// <returns></returns>
        public BaseParStd GetParStdByName(string name, int pos)
        {
            try
            {
                BaseParImageProcess baseParImageProcess = GetCellParImageProcessByType(name, pos);

                BaseParStd baseParStd = baseParImageProcess.g_ParStd;
                return(baseParStd);
            }
            catch (Exception ex)
            {
                Log.L_I.WriteError(NameClass, ex);
                return(null);
            }
        }
        /// <summary>
        /// 初始化参数
        /// </summary>
        public override string Init(BaseParImageProcess par, BaseUCDisplayCamera baseUCCamera, List <CellReference> cellExe_L, List <CellHObjectReference> cellHObject_L, List <CellReference> cellData_L, Hashtable htResult, Hashtable htCellRef_Mult, Hashtable htResult_MultC)
        {
            string nameWin = "";

            try
            {
                #region 窗体名称
                if (g_ParAlgorithm != null)
                {
                    nameWin = g_ParAlgorithm.NoCamera.ToString() + g_ParAlgorithm.NameCell;
                }
                #endregion 窗体名称

                #region 赋值
                NameClass = "WinLinesDotsPosNegInspect" + par.NameCell;

                //参数赋值
                g_ParAlgorithm = par;
                g_ParLinesDotsPosNegInspect = (ParLinesDotsPosNegInspect)par;
                g_ParAlgorithm_Old          = (ParLinesDotsPosNegInspect)par.Clone();
                //权限设置
                g_AuthorityCtr_L = par.g_AuthorityCtr_L;

                g_HtResult      = htResult;      //结果
                g_CellData_L    = cellData_L;    //数据单元
                g_CellExecute_L = cellExe_L;     //可执行单元
                g_CellHObject_L = cellHObject_L; //可执行图像单元
                #endregion 赋值

                //参数初始化
                uCLinesDotsPosNegInspect.Init((ParLinesDotsPosNegInspect)par, cellExe_L, cellHObject_L, htCellRef_Mult, htResult_MultC);

                //相机控制类
                g_BaseUCDisplayCamera = baseUCCamera;

                //图像预处理
                uCPreProcess.Init(baseUCCamera, ((ParLinesDotsPosNegInspect)par).g_ParPreprocess, cellExe_L, par.IndexCell);

                //设定ROI
                uCSetROI.Init(baseUCCamera, (ParLinesDotsPosNegInspect)par, cellHObject_L, cellData_L, htResult);

                //设置输入输出
                uCSetInput.Init(par.g_ParInput, cellHObject_L);
                //uCOutputImageProcess.Init(par.g_ParOutput, par.g_BaseResult, cellExe_L, cellData_L, htResult);

                //基准值和结果
                baseUCStandard.Init((ParStdStraightLine)((ParLinesDotsPosNegInspect)par).g_ParStd, ResultToStd, ShowStdImage);

                //设置其他
                //uCSetOthers.Init(par, cellHObject_L);

                //测试运行
                uCTestRun.Init(baseUCCamera, par, cellExe_L, cellHObject_L, htResult, uCResult);

                //显示参数
                ShowPar_Invoke();
            }
            catch (Exception ex)
            {
                Log.L_I.WriteError(NameClass, ex);
            }
            return(nameWin);
        }
        public void RecordVersion()
        {
            try
            {
                string path     = new DirectoryInfo("../").FullName;
                string pathRoot = new DirectoryInfo("../").Parent.Parent.FullName + "\\Dll\\";

                if (!Directory.Exists(pathRoot))
                {
                    Directory.CreateDirectory(pathRoot);
                }
                //if (Directory.Exists(pathRoot))
                //{
                //    FileInfo[] fileInfos = (new DirectoryInfo(pathRoot)).GetFiles();
                //    foreach (FileInfo item in fileInfos)
                //    {
                //        if (item.FullName.Contains(".dll"))
                //        {
                //            File.Delete(item.FullName);
                //        }
                //    }
                //}

                if (!path.Contains("bin"))
                {
                    return;
                }
                string pathSave    = path + "机器视觉控制处理软件\\Version.ini";
                string pathSaveXml = path + "机器视觉控制处理软件\\";

                IniFile inst = new IniFile();

                BasicClass.VerInfo v = BaseClass.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "1", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "1Path", v.PathDll + "\n", pathSave);

                v = BaseComprehensive.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "2", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "2Path", v.PathDll + "\n", pathSave);


                v = BaseUCDisplay.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "3", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "3Path", v.PathDll + "\n", pathSave);

                v = CameraBase.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "4", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "4Path", v.PathDll + "\n", pathSave);

                v = ComFunction.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "5", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "5Path", v.PathDll + "\n", pathSave);


                v = BaseParAlgorithm.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "6", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "6Path", v.PathDll + "\n", pathSave);


                v = BaseFunCalibrate.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "7", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "7Path", v.PathDll + "\n", pathSave);


                v = BaseParComInterface.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "8", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "8Path", v.PathDll + "\n", pathSave);

                v = BaseParCommunication.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "9", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "9Path", v.PathDll + "\n", pathSave);

                v = BaseParConfigFile.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "10", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "10Path", v.PathDll + "\n", pathSave);


                v = BaseParDisplay.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "11", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "11Path", v.PathDll + "\n", pathSave);

                v = DrawDisplay.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "12", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "12Path", v.PathDll + "\n", pathSave);


                v = BaseParGeometry.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "13", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "13Path", v.PathDll + "\n", pathSave);


                v = BaseParGrabImage.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "14", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "14Path", v.PathDll + "\n", pathSave);

                v = BaseParHelp.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "15", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "15Path", v.PathDll + "\n", pathSave);


                v = BaseParImageProcess.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "16", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "16Path", v.PathDll, pathSave);


                v = BaseParInOutput.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "17", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "17Path", v.PathDll + "\n", pathSave);

                v = BaseParLog.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "18", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "18Path", v.PathDll + "\n", pathSave);

                v = BaseParMath.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "19", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "19Path", v.PathDll + "\n", pathSave);

                v = BaseParResult.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "20", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "20Path", v.PathDll + "\n", pathSave);

                v = BaseParTool.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "21", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "21Path", v.PathDll + "\n", pathSave);

                v = BaseParWorkFlow.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "22", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "22Path", v.PathDll + "\n", pathSave);

                v = BaseParCell.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "23", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "23Path", v.PathDll + "\n", pathSave);


                v = BaseUCSetComprehensive.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "24", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "24Path", v.PathDll + "\n", pathSave);


                v = BaseParSetPar.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "25", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "25Path", v.PathDll + "\n", pathSave);


                v = BaseDealComprehensive.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "26", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "26Path", v.PathDll + "\n", pathSave);


                Assembly assembly = Assembly.GetExecutingAssembly();
                inst.WriteIni("VerInfo", "Main27Path", assembly.Location, pathSave);

                v = BaseDealComprehensive.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "28", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "28Path", v.PathDll + "\n", pathSave);

                v = BaseFile.GetVersion();
                inst.WriteIni("VerInfo", v.Name + "29", v.Version, pathSave);
                inst.WriteIni("VerInfo", v.Name + "29Path", v.PathDll + "\n", pathSave);

                ControlLib.VerInfo v1 = BaseControlLib.GetVersion();
                inst.WriteIni("VerInfo", v1.Name + "30", v1.Version, pathSave);
                inst.WriteIni("VerInfo", v1.Name + "30Path", v1.PathDll + "\n", pathSave);
            }
            catch (Exception ex)
            {
                Log.L_I.WriteError(NameClass, ex);
            }
        }